From 2a8483bce5654c19b42e890bff956a5728fe48a5 Mon Sep 17 00:00:00 2001 From: Dmitry Savintsev Date: Wed, 26 Jun 2024 20:29:27 +0200 Subject: [PATCH 01/31] IX: save/restore global var in test (#3638) Signed-off-by: Dmitry S --- adapters/ix/ix.go | 20 ++++++++++++++------ adapters/ix/ix_test.go | 32 +++++++++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index 23f60d4b905..86f71f58c76 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -95,7 +95,7 @@ func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters setPublisherId(&requestCopy, uniqueSiteIDs, ixDiag) - err := setIxDiagIntoExtRequest(&requestCopy, ixDiag) + err := setIxDiagIntoExtRequest(&requestCopy, ixDiag, version.Ver) if err != nil { errs = append(errs, err) } @@ -392,7 +392,17 @@ func marshalJsonWithoutUnicode(v interface{}) (string, error) { return strings.TrimSuffix(sb.String(), "\n"), nil } -func setIxDiagIntoExtRequest(request *openrtb2.BidRequest, ixDiag *IxDiag) error { +// extractVersionWithoutCommitHash takes a version string like '0.23.1-g4ee257d8' and returns +// the prefix without the commit hash: '0.23.1' - +// the substring preceding the first hyphen. +func extractVersionWithoutCommitHash(ver string) string { + if strings.Contains(ver, "-") { + return ver[:strings.Index(ver, "-")] + } + return ver // if no hyphen, return the original string +} + +func setIxDiagIntoExtRequest(request *openrtb2.BidRequest, ixDiag *IxDiag, ver string) error { extRequest := &ExtRequest{} if request.Ext != nil { if err := json.Unmarshal(request.Ext, &extRequest); err != nil { @@ -404,10 +414,8 @@ func setIxDiagIntoExtRequest(request *openrtb2.BidRequest, ixDiag *IxDiag) error ixDiag.PbjsV = extRequest.Prebid.Channel.Version } // Slice commit hash out of version - if strings.Contains(version.Ver, "-") { - ixDiag.PbsV = version.Ver[:strings.Index(version.Ver, "-")] - } else if version.Ver != "" { - ixDiag.PbsV = version.Ver + if ver != "" { + ixDiag.PbsV = extractVersionWithoutCommitHash(ver) } // Only set request.ext if ixDiag is not empty diff --git a/adapters/ix/ix_test.go b/adapters/ix/ix_test.go index 2b48327605a..88848db81e3 100644 --- a/adapters/ix/ix_test.go +++ b/adapters/ix/ix_test.go @@ -9,7 +9,6 @@ import ( "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" "github.com/prebid/prebid-server/v2/util/ptrutil" - "github.com/prebid/prebid-server/v2/version" "github.com/stretchr/testify/assert" "github.com/prebid/openrtb/v20/adcom1" @@ -152,6 +151,34 @@ func TestIxMakeRequestWithGppString(t *testing.T) { assert.Equal(t, req.Regs.GPP, testGppString) } +func TestExtractVersionWithoutCommitHash(t *testing.T) { + tests := []struct { + name string + version string + expected string + }{ + { + name: "empty version", + version: "", + expected: "", + }, + { + name: "version with commit hash", + version: "1.880-abcdef", + expected: "1.880", + }, + { + name: "version without commit hash", + version: "1.23.4", + expected: "1.23.4", + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + assert.Equal(t, test.expected, extractVersionWithoutCommitHash(test.version)) + }) + } +} func TestBuildIxDiag(t *testing.T) { testCases := []struct { description string @@ -253,9 +280,8 @@ func TestBuildIxDiag(t *testing.T) { for _, test := range testCases { t.Run(test.description, func(t *testing.T) { - version.Ver = test.pbsVersion ixDiag := &IxDiag{} - err := setIxDiagIntoExtRequest(test.request, ixDiag) + err := setIxDiagIntoExtRequest(test.request, ixDiag, test.pbsVersion) if test.expectError { assert.NotNil(t, err) } else { From 07f3ee24245daac300565a38d62550663ac3d6ea Mon Sep 17 00:00:00 2001 From: redaguermas Date: Thu, 27 Jun 2024 06:45:38 -0700 Subject: [PATCH 02/31] Nobid: Add iframe sync support (#3732) Co-authored-by: Reda Guermas --- static/bidder-info/nobid.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/static/bidder-info/nobid.yaml b/static/bidder-info/nobid.yaml index 7c33998bf20..6e742a18e49 100644 --- a/static/bidder-info/nobid.yaml +++ b/static/bidder-info/nobid.yaml @@ -15,3 +15,6 @@ userSync: redirect: url: "https://ads.servenobid.com/getsync?tek=pbs&ver=1&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}}" userMacro: "$UID" + iframe: + url: "https://public.servenobid.com/sync.html?tek=pbs&ver=1&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}}" + userMacro: $UID From 057e25d6ab740d636dd27a2f1d6d3ae90c349427 Mon Sep 17 00:00:00 2001 From: sergeykcointraffic <158448507+sergeykcointraffic@users.noreply.github.com> Date: Sat, 29 Jun 2024 01:01:56 +0800 Subject: [PATCH 03/31] =?UTF-8?q?New=20Adapter:=20=D0=A1ointraffic=20(#364?= =?UTF-8?q?7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Aleksandr Štšepelin --- adapters/cointraffic/cointraffic.go | 77 +++++++++ adapters/cointraffic/cointraffic_test.go | 51 ++++++ .../exemplary/simple-banner.json | 158 ++++++++++++++++++ .../supplemental/bad-request.json | 70 ++++++++ .../cointraffictest/supplemental/no-bid.json | 65 +++++++ .../supplemental/server-error.json | 70 ++++++++ adapters/cointraffic/params_test.go | 51 ++++++ exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_cointraffic.go | 5 + static/bidder-info/cointraffic.yaml | 10 ++ static/bidder-params/cointraffic.json | 16 ++ 12 files changed, 577 insertions(+) create mode 100644 adapters/cointraffic/cointraffic.go create mode 100644 adapters/cointraffic/cointraffic_test.go create mode 100644 adapters/cointraffic/cointraffictest/exemplary/simple-banner.json create mode 100644 adapters/cointraffic/cointraffictest/supplemental/bad-request.json create mode 100644 adapters/cointraffic/cointraffictest/supplemental/no-bid.json create mode 100644 adapters/cointraffic/cointraffictest/supplemental/server-error.json create mode 100644 adapters/cointraffic/params_test.go create mode 100644 openrtb_ext/imp_cointraffic.go create mode 100644 static/bidder-info/cointraffic.yaml create mode 100644 static/bidder-params/cointraffic.json diff --git a/adapters/cointraffic/cointraffic.go b/adapters/cointraffic/cointraffic.go new file mode 100644 index 00000000000..e5c6b9156ce --- /dev/null +++ b/adapters/cointraffic/cointraffic.go @@ -0,0 +1,77 @@ +package cointraffic + +import ( + "encoding/json" + "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/openrtb_ext" + "net/http" +) + +type adapter struct { + endpoint string +} + +// Builder builds a new instance of the Cointraffic adapter for the given bidder with the given config. +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { + bidder := &adapter{ + endpoint: config.Endpoint, + } + return bidder, nil +} + +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + requestJSON, err := json.Marshal(request) + if err != nil { + return nil, []error{err} + } + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + headers.Add("x-openrtb-version", "2.5") + + requestData := &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint, + Body: requestJSON, + Headers: headers, + ImpIDs: openrtb_ext.GetImpIDs(request.Imp), + } + + return []*adapters.RequestData{requestData}, nil +} + +func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *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 response openrtb2.BidResponse + if err := json.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(response.SeatBid[0].Bid)) + if response.Cur != "" { + bidResponse.Currency = response.Cur + } + + var errs []error + + for _, seatBid := range response.SeatBid { + for i := range seatBid.Bid { + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &seatBid.Bid[i], + BidType: openrtb_ext.BidTypeBanner, + }) + } + } + + return bidResponse, errs +} diff --git a/adapters/cointraffic/cointraffic_test.go b/adapters/cointraffic/cointraffic_test.go new file mode 100644 index 00000000000..2e82efa3317 --- /dev/null +++ b/adapters/cointraffic/cointraffic_test.go @@ -0,0 +1,51 @@ +package cointraffic + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/prebid/prebid-server/v2/adapters/adapterstest" + "github.com/prebid/prebid-server/v2/config" + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +const testsDir = "cointraffictest" +const testsBidderEndpoint = "http://test-request.com/prebid" + +func TestJsonSamples(t *testing.T) { + ac := config.Adapter{ + Endpoint: testsBidderEndpoint, + ExtraAdapterInfo: "", + } + + sc := config.Server{ + ExternalUrl: "http://hosturl.com", + GvlID: 1, + DataCenter: "2", + } + + bidder, buildErr := Builder(openrtb_ext.BidderCointraffic, ac, sc) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, testsDir, bidder) +} + +func TestEndpointTemplateMalformed(t *testing.T) { + ac := config.Adapter{ + Endpoint: "{{Malformed}}", + } + + sc := config.Server{ + ExternalUrl: "http://hosturl.com", + GvlID: 1, + DataCenter: "2", + } + + _, buildErr := Builder(openrtb_ext.BidderCointraffic, ac, sc) + + assert.Nil(t, buildErr) +} diff --git a/adapters/cointraffic/cointraffictest/exemplary/simple-banner.json b/adapters/cointraffic/cointraffictest/exemplary/simple-banner.json new file mode 100644 index 00000000000..1ca486eedb3 --- /dev/null +++ b/adapters/cointraffic/cointraffictest/exemplary/simple-banner.json @@ -0,0 +1,158 @@ +{ + "mockBidRequest": { + "id": "testRequestIdSingle", + "site": { + "page": "https://publisher-website.com/web" + }, + "imp": [ + { + "id": "testImpressionId1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placementId": "testPlacementId" + } + } + }, + { + "id": "testImpressionId2", + "banner": { + "format": [ + { + "w": 320, + "h": 100 + } + ] + }, + "ext": { + "bidder": { + "placementId": "testPlacementId" + } + } + } + ], + "device": { + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36", + "ip": "111.111.111.111" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "uri": "http://test-request.com/prebid", + "body": { + "id": "testRequestIdSingle", + "site": { + "page": "https://publisher-website.com/web" + }, + "imp": [ + { + "id": "testImpressionId1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placementId": "testPlacementId" + } + } + }, + { + "id": "testImpressionId2", + "banner": { + "format": [ + { + "w": 320, + "h": 100 + } + ] + }, + "ext": { + "bidder": { + "placementId": "testPlacementId" + } + } + } + ], + "device": { + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36", + "ip": "111.111.111.111" + } + }, + "impIDs": [ + "testImpressionId1", + "testImpressionId2" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "testRequestIdSingle", + "seatbid": [ + { + "seat": "cointraffic", + "bid": [ + { + "id": "uniqueId", + "impid": "testImpressionId1", + "price": 1.50, + "adid": "advertiserUniqueId", + "adm": "iframe-content", + "crid": "creativeUniqueId", + "w": 300, + "h": 250, + "nurl": "http://test-request.com/prebid/confirm" + } + ] + } + ], + "cur": "EUR" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "EUR", + "bids": [ + { + "bid": { + "id": "uniqueId", + "impid": "testImpressionId1", + "price": 1.50, + "adm": "iframe-content", + "adid": "advertiserUniqueId", + "crid": "creativeUniqueId", + "w": 300, + "h": 250, + "nurl": "http://test-request.com/prebid/confirm" + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/cointraffic/cointraffictest/supplemental/bad-request.json b/adapters/cointraffic/cointraffictest/supplemental/bad-request.json new file mode 100644 index 00000000000..7afab031a22 --- /dev/null +++ b/adapters/cointraffic/cointraffictest/supplemental/bad-request.json @@ -0,0 +1,70 @@ +{ + "mockBidRequest": { + "id": "testRequestIssues", + "site": { + "page": "https://publisher-website.com/web" + }, + "imp": [ + { + "id": "testImpressionId", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placementId": "testPlacementId" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://test-request.com/prebid", + "body": { + "id": "testRequestIssues", + "site": { + "page": "https://publisher-website.com/web" + }, + "imp": [ + { + "id": "testImpressionId", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placementId": "testPlacementId" + } + } + } + ] + }, + "impIDs": [ + "testImpressionId" + ] + }, + "mockResponse": { + "status": 400, + "body": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/cointraffic/cointraffictest/supplemental/no-bid.json b/adapters/cointraffic/cointraffictest/supplemental/no-bid.json new file mode 100644 index 00000000000..b88d8e83b55 --- /dev/null +++ b/adapters/cointraffic/cointraffictest/supplemental/no-bid.json @@ -0,0 +1,65 @@ +{ + "mockBidRequest": { + "id": "testRequestNoBid", + "site": { + "page": "https://publisher-website.com/web" + }, + "imp": [ + { + "id": "testImpressionId", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placementId": "testPlacementId" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://test-request.com/prebid", + "body": { + "id": "testRequestNoBid", + "site": { + "page": "https://publisher-website.com/web" + }, + "imp": [ + { + "id": "testImpressionId", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placementId": "testPlacementId" + } + } + } + ] + }, + "impIDs": [ + "testImpressionId" + ] + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/cointraffic/cointraffictest/supplemental/server-error.json b/adapters/cointraffic/cointraffictest/supplemental/server-error.json new file mode 100644 index 00000000000..8f439682584 --- /dev/null +++ b/adapters/cointraffic/cointraffictest/supplemental/server-error.json @@ -0,0 +1,70 @@ +{ + "mockBidRequest": { + "id": "testRequestIssues", + "site": { + "page": "https://publisher-website.com/web" + }, + "imp": [ + { + "id": "testImpressionId", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placementId": "testPlacementId" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://test-request.com/prebid", + "body": { + "id": "testRequestIssues", + "site": { + "page": "https://publisher-website.com/web" + }, + "imp": [ + { + "id": "testImpressionId", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placementId": "testPlacementId" + } + } + } + ] + }, + "impIDs": [ + "testImpressionId" + ] + }, + "mockResponse": { + "status": 500, + "body": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 500. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/cointraffic/params_test.go b/adapters/cointraffic/params_test.go new file mode 100644 index 00000000000..0bd0421aed0 --- /dev/null +++ b/adapters/cointraffic/params_test.go @@ -0,0 +1,51 @@ +package cointraffic + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +// This file actually intends to test static/bidder-params/cointraffic.json +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderCointraffic, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected params: %s", validParam) + } + } +} + +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, invalidParam := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderCointraffic, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"placementId": "123"}`, +} + +var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{}`, + `{"placementId": 42}`, + `{"placementId": ""}`, +} diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 80c5910b1dc..3cd4e257e31 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -63,6 +63,7 @@ import ( "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/cointraffic" "github.com/prebid/prebid-server/v2/adapters/coinzilla" "github.com/prebid/prebid-server/v2/adapters/colossus" "github.com/prebid/prebid-server/v2/adapters/compass" @@ -276,6 +277,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderBWX: bwx.Builder, openrtb_ext.BidderCadentApertureMX: cadentaperturemx.Builder, openrtb_ext.BidderCcx: ccx.Builder, + openrtb_ext.BidderCointraffic: cointraffic.Builder, openrtb_ext.BidderCoinzilla: coinzilla.Builder, openrtb_ext.BidderColossus: colossus.Builder, openrtb_ext.BidderCompass: compass.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index a70a0964602..70ab0160f00 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -79,6 +79,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderBWX, BidderCadentApertureMX, BidderCcx, + BidderCointraffic, BidderCoinzilla, BidderColossus, BidderCompass, @@ -392,6 +393,7 @@ const ( BidderBWX BidderName = "bwx" BidderCadentApertureMX BidderName = "cadent_aperture_mx" BidderCcx BidderName = "ccx" + BidderCointraffic BidderName = "cointraffic" BidderCoinzilla BidderName = "coinzilla" BidderColossus BidderName = "colossus" BidderCompass BidderName = "compass" diff --git a/openrtb_ext/imp_cointraffic.go b/openrtb_ext/imp_cointraffic.go new file mode 100644 index 00000000000..da5ea69b1b5 --- /dev/null +++ b/openrtb_ext/imp_cointraffic.go @@ -0,0 +1,5 @@ +package openrtb_ext + +type ExtImpCointraffic struct { + PlacementId string `json:"placementId"` +} diff --git a/static/bidder-info/cointraffic.yaml b/static/bidder-info/cointraffic.yaml new file mode 100644 index 00000000000..d1139ee517d --- /dev/null +++ b/static/bidder-info/cointraffic.yaml @@ -0,0 +1,10 @@ +endpoint: "https://apps.adsgravity.io/pbs/v1/request" +maintainer: + email: tech@cointraffic.io +capabilities: + app: + mediaTypes: + - banner + site: + mediaTypes: + - banner diff --git a/static/bidder-params/cointraffic.json b/static/bidder-params/cointraffic.json new file mode 100644 index 00000000000..8a749fdfac3 --- /dev/null +++ b/static/bidder-params/cointraffic.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Cointraffic Adapter Params", + "description": "A schema which validates params accepted by the Cointraffic adapter", + "type": "object", + "properties": { + "placementId": { + "type": "string", + "minLength": 1, + "description": "Ad placement identifier" + } + }, + "required": [ + "placementId" + ] +} From 09a3dd4c3d9005babe88868c1fdc029f630cf857 Mon Sep 17 00:00:00 2001 From: Saar Amrani Date: Mon, 1 Jul 2024 10:54:47 +0300 Subject: [PATCH 04/31] New Adapter: Vidazoo (#3698) --- adapters/vidazoo/params_test.go | 41 +++ adapters/vidazoo/vidazoo.go | 133 +++++++++ adapters/vidazoo/vidazoo_test.go | 24 ++ .../vidazoo/vidazootest/exemplary/banner.json | 127 +++++++++ .../vidazootest/exemplary/multi-imp.json | 265 ++++++++++++++++++ .../vidazoo/vidazootest/exemplary/video.json | 154 ++++++++++ .../vidazootest/supplemental/bad-request.json | 65 +++++ .../supplemental/internal-error.json | 65 +++++ .../vidazootest/supplemental/no-content.json | 60 ++++ .../supplemental/unknown-bid-type.json | 109 +++++++ exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_vidazoo.go | 6 + static/bidder-info/vidazoo.yaml | 18 ++ static/bidder-params/vidazoo.json | 16 ++ 15 files changed, 1087 insertions(+) create mode 100644 adapters/vidazoo/params_test.go create mode 100644 adapters/vidazoo/vidazoo.go create mode 100644 adapters/vidazoo/vidazoo_test.go create mode 100644 adapters/vidazoo/vidazootest/exemplary/banner.json create mode 100644 adapters/vidazoo/vidazootest/exemplary/multi-imp.json create mode 100644 adapters/vidazoo/vidazootest/exemplary/video.json create mode 100644 adapters/vidazoo/vidazootest/supplemental/bad-request.json create mode 100644 adapters/vidazoo/vidazootest/supplemental/internal-error.json create mode 100644 adapters/vidazoo/vidazootest/supplemental/no-content.json create mode 100644 adapters/vidazoo/vidazootest/supplemental/unknown-bid-type.json create mode 100644 openrtb_ext/imp_vidazoo.go create mode 100644 static/bidder-info/vidazoo.yaml create mode 100644 static/bidder-params/vidazoo.json diff --git a/adapters/vidazoo/params_test.go b/adapters/vidazoo/params_test.go new file mode 100644 index 00000000000..5c80469c73d --- /dev/null +++ b/adapters/vidazoo/params_test.go @@ -0,0 +1,41 @@ +package vidazoo + +import ( + "encoding/json" + "github.com/prebid/prebid-server/v2/openrtb_ext" + "testing" +) + +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 _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderVidazoo, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected valid params: %s", validParam) + } + } +} + +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.BidderVidazoo, json.RawMessage(p)); err == nil { + t.Errorf("Schema allowed invalid params: %s", p) + } + } +} + +var validParams = []string{ + `{"cId": "provided_cid_123"}`, +} + +var invalidParams = []string{ + `{"cId": 3898334}`, +} diff --git a/adapters/vidazoo/vidazoo.go b/adapters/vidazoo/vidazoo.go new file mode 100644 index 00000000000..e2fc9959486 --- /dev/null +++ b/adapters/vidazoo/vidazoo.go @@ -0,0 +1,133 @@ +package vidazoo + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/prebid-server/v2/adapters" + "github.com/prebid/prebid-server/v2/config" + "github.com/prebid/prebid-server/v2/errortypes" + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +type adapter struct { + endpoint string +} + +// Builder builds a new instance of the Vidazoo for the given bidder with the given config. +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { + bidder := &adapter{ + endpoint: config.Endpoint, + } + return bidder, nil +} + +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var requests []*adapters.RequestData + var errors []error + + requestCopy := *request + + for _, imp := range request.Imp { + requestCopy.Imp = []openrtb2.Imp{imp} + + requestJSON, err := json.Marshal(&requestCopy) + if err != nil { + errors = append(errors, fmt.Errorf("marshal bidRequest: %w", err)) + continue + } + + cId, err := extractCid(&imp) + if err != nil { + errors = append(errors, fmt.Errorf("extract cId: %w", err)) + continue + } + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + + requestData := &adapters.RequestData{ + Method: "POST", + Uri: fmt.Sprintf("%s%s", a.endpoint, url.QueryEscape(cId)), + Body: requestJSON, + Headers: headers, + ImpIDs: []string{imp.ID}, + } + + requests = append(requests, requestData) + } + + return requests, errors +} + +func getMediaTypeForBid(bid openrtb2.Bid) (openrtb_ext.BidType, error) { + switch bid.MType { + case openrtb2.MarkupBanner: + return openrtb_ext.BidTypeBanner, nil + case openrtb2.MarkupVideo: + return openrtb_ext.BidTypeVideo, nil + } + return "", &errortypes.BadInput{ + Message: fmt.Sprintf("Could not define bid type for imp: %s", bid.ImpID), + } +} + +func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + var errs []error + + if adapters.IsResponseStatusCodeNoContent(responseData) { + return nil, nil + } + + if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil { + return nil, []error{&errortypes.BadInput{ + Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", responseData.StatusCode), + }} + } + + var response openrtb2.BidResponse + if err := json.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{&errortypes.BadServerResponse{ + Message: fmt.Sprintf("bad server response: %d. ", err), + }} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(response.SeatBid)) + + if response.Cur != "" { + bidResponse.Currency = response.Cur + } + + for _, seatBid := range response.SeatBid { + for i, bid := range seatBid.Bid { + bidType, err := getMediaTypeForBid(bid) + if err != nil { + errs = append(errs, err) + continue + } + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &seatBid.Bid[i], + BidType: bidType, + }) + } + } + + return bidResponse, errs +} + +func extractCid(imp *openrtb2.Imp) (string, error) { + var bidderExt adapters.ExtImpBidder + if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { + return "", fmt.Errorf("unmarshal bidderExt: %w", err) + } + + var impExt openrtb_ext.ImpExtVidazoo + if err := json.Unmarshal(bidderExt.Bidder, &impExt); err != nil { + return "", fmt.Errorf("unmarshal ImpExtVidazoo: %w", err) + } + return strings.TrimSpace(impExt.ConnectionId), nil +} diff --git a/adapters/vidazoo/vidazoo_test.go b/adapters/vidazoo/vidazoo_test.go new file mode 100644 index 00000000000..892aae77ed6 --- /dev/null +++ b/adapters/vidazoo/vidazoo_test.go @@ -0,0 +1,24 @@ +package vidazoo + +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" +) + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderVidazoo, config.Adapter{ + Endpoint: "http://prebid-server.cootlogix.com/openrtb/", + }, + config.Server{ + ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2", + }) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "vidazootest", bidder) +} diff --git a/adapters/vidazoo/vidazootest/exemplary/banner.json b/adapters/vidazoo/vidazootest/exemplary/banner.json new file mode 100644 index 00000000000..98b145181f4 --- /dev/null +++ b/adapters/vidazoo/vidazootest/exemplary/banner.json @@ -0,0 +1,127 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 240, + "h": 400 + }, + "ext": { + "bidder": { + "cId": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://prebid-server.cootlogix.com/openrtb/test_cid_123", + "body": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 240, + "h": 400 + }, + "ext": { + "bidder": { + "cId": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some-request-id", + "cur": "", + "bidid": "some-bid-id", + "seatbid": [ + { + "bid": [ + { + "exp": 60, + "adm": "
Some creative
", + "burl": "", + "iurl": "http://prebid-server.cootlogix.com/creative.jpg", + "lurl": "", + "nurl": "", + "id": "some-bid-id", + "impid": "some-impression-id", + "h": 400, + "w": 240, + "price": 1, + "dealid": "deal123", + "adomain": [ + "test.com" + ], + "adid": "some-ad-id", + "cid": "test", + "attr": [], + "cat": [], + "crid": "some-creative-id", + "ext": {}, + "hratio": 0, + "language": "", + "protocol": 0, + "qagmediarating": 0, + "tactic": "", + "wratio": 0, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "some-bid-id", + "impid": "some-impression-id", + "price": 1, + "adm": "
Some creative
", + "adid": "some-ad-id", + "cid": "test", + "iurl": "http://prebid-server.cootlogix.com/creative.jpg", + "crid": "some-creative-id", + "adomain": [ + "test.com" + ], + "dealid": "deal123", + "w": 240, + "h": 400, + "exp": 60, + "ext": {}, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ], + "expectedMakeBidsErrors": [] +} \ No newline at end of file diff --git a/adapters/vidazoo/vidazootest/exemplary/multi-imp.json b/adapters/vidazoo/vidazootest/exemplary/multi-imp.json new file mode 100644 index 00000000000..7c0f288f3c8 --- /dev/null +++ b/adapters/vidazoo/vidazootest/exemplary/multi-imp.json @@ -0,0 +1,265 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 1, + "maxduration": 2, + "protocols": [ + 1, + 2, + 5 + ], + "w": 300, + "h": 250, + "startdelay": 1, + "placement": 1, + "playbackmethod": [ + 2 + ], + "api": [ + 1, + 2, + 3, + 4 + ] + }, + "ext": { + "bidder": { + "cId": "test_cid_123" + } + } + }, + { + "id": "some-impression-id", + "banner": { + "w": 240, + "h": 400 + }, + "ext": { + "bidder": { + "cId": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://prebid-server.cootlogix.com/openrtb/test_cid_123", + "body": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 1, + "maxduration": 2, + "protocols": [ + 1, + 2, + 5 + ], + "w": 300, + "h": 250, + "startdelay": 1, + "placement": 1, + "playbackmethod": [ + 2 + ], + "api": [ + 1, + 2, + 3, + 4 + ] + }, + "ext": { + "bidder": { + "cId": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some-request-id", + "cur": "", + "bidid": "some-bid-id", + "seatbid": [ + { + "bid": [ + { + "exp": 60, + "adm": "Some Ad SystemSome Ad Title00:00:02", + "id": "some-bid-id", + "impid": "some-impression-id", + "h": 250, + "w": 300, + "price": 1, + "dealid": "deal123", + "adomain": [ + "test.com" + ], + "adid": "some-ad-id", + "cid": "test", + "crid": "some-creative-id", + "mtype": 2 + } + ] + } + ] + } + } + }, + { + "expectedRequest": { + "uri": "http://prebid-server.cootlogix.com/openrtb/test_cid_123", + "body": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 240, + "h": 400 + }, + "ext": { + "bidder": { + "cId": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some-request-id", + "cur": "", + "bidid": "some-bid-id", + "seatbid": [ + { + "bid": [ + { + "exp": 60, + "adm": "
Some creative
", + "burl": "", + "iurl": "http://prebid-server.cootlogix.com/creative.jpg", + "lurl": "", + "nurl": "", + "id": "some-bid-id", + "impid": "some-impression-id", + "h": 400, + "w": 240, + "price": 1, + "dealid": "deal123", + "adomain": [ + "test.com" + ], + "adid": "some-ad-id", + "cid": "test", + "attr": [], + "cat": [], + "crid": "some-creative-id", + "ext": {}, + "hratio": 0, + "language": "", + "protocol": 0, + "qagmediarating": 0, + "tactic": "", + "wratio": 0, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "exp": 60, + "adm": "Some Ad SystemSome Ad Title00:00:02", + "id": "some-bid-id", + "impid": "some-impression-id", + "h": 250, + "w": 300, + "price": 1, + "dealid": "deal123", + "adomain": [ + "test.com" + ], + "adid": "some-ad-id", + "cid": "test", + "crid": "some-creative-id", + "mtype": 2 + }, + "type": "video" + } + ] + }, + { + "bids": [ + { + "bid": { + "id": "some-bid-id", + "impid": "some-impression-id", + "price": 1, + "adm": "
Some creative
", + "adid": "some-ad-id", + "cid": "test", + "iurl": "http://prebid-server.cootlogix.com/creative.jpg", + "crid": "some-creative-id", + "adomain": [ + "test.com" + ], + "dealid": "deal123", + "w": 240, + "h": 400, + "exp": 60, + "ext": {}, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ], + "expectedMakeBidsErrors": [] +} \ No newline at end of file diff --git a/adapters/vidazoo/vidazootest/exemplary/video.json b/adapters/vidazoo/vidazootest/exemplary/video.json new file mode 100644 index 00000000000..2a414476382 --- /dev/null +++ b/adapters/vidazoo/vidazootest/exemplary/video.json @@ -0,0 +1,154 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 1, + "maxduration": 2, + "protocols": [ + 1, + 2, + 5 + ], + "w": 300, + "h": 250, + "startdelay": 1, + "placement": 1, + "playbackmethod": [ + 2 + ], + "api": [ + 1, + 2, + 3, + 4 + ] + }, + "ext": { + "bidder": { + "cId": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://prebid-server.cootlogix.com/openrtb/test_cid_123", + "body": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 1, + "maxduration": 2, + "protocols": [ + 1, + 2, + 5 + ], + "w": 300, + "h": 250, + "startdelay": 1, + "placement": 1, + "playbackmethod": [ + 2 + ], + "api": [ + 1, + 2, + 3, + 4 + ] + }, + "ext": { + "bidder": { + "cId": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some-request-id", + "cur": "", + "bidid": "some-bid-id", + "seatbid": [ + { + "bid": [ + { + "exp": 60, + "adm": "Some Ad SystemSome Ad Title00:00:02", + "id": "some-bid-id", + "impid": "some-impression-id", + "h": 250, + "w": 300, + "price": 1, + "dealid": "deal123", + "adomain": [ + "test.com" + ], + "adid": "some-ad-id", + "cid": "test", + "crid": "some-creative-id", + "mtype": 2 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "exp": 60, + "adm": "Some Ad SystemSome Ad Title00:00:02", + "id": "some-bid-id", + "impid": "some-impression-id", + "h": 250, + "w": 300, + "price": 1, + "dealid": "deal123", + "adomain": [ + "test.com" + ], + "adid": "some-ad-id", + "cid": "test", + "crid": "some-creative-id", + "mtype": 2 + }, + "type": "video" + } + ] + } + ], + "expectedMakeBidsErrors": [] +} \ No newline at end of file diff --git a/adapters/vidazoo/vidazootest/supplemental/bad-request.json b/adapters/vidazoo/vidazootest/supplemental/bad-request.json new file mode 100644 index 00000000000..864fe64c619 --- /dev/null +++ b/adapters/vidazoo/vidazootest/supplemental/bad-request.json @@ -0,0 +1,65 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 240, + "h": 400 + }, + "ext": { + "bidder": { + "cid": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://prebid-server.cootlogix.com/openrtb/test_cid_123", + "body": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 240, + "h": 400 + }, + "ext": { + "bidder": { + "cid": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 400, + "body": {} + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/vidazoo/vidazootest/supplemental/internal-error.json b/adapters/vidazoo/vidazootest/supplemental/internal-error.json new file mode 100644 index 00000000000..92dc89f08c0 --- /dev/null +++ b/adapters/vidazoo/vidazootest/supplemental/internal-error.json @@ -0,0 +1,65 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 240, + "h": 400 + }, + "ext": { + "bidder": { + "cid": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://prebid-server.cootlogix.com/openrtb/test_cid_123", + "body": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 240, + "h": 400 + }, + "ext": { + "bidder": { + "cid": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 500, + "body": {} + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 500. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/vidazoo/vidazootest/supplemental/no-content.json b/adapters/vidazoo/vidazootest/supplemental/no-content.json new file mode 100644 index 00000000000..6d8e7e9bec1 --- /dev/null +++ b/adapters/vidazoo/vidazootest/supplemental/no-content.json @@ -0,0 +1,60 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 240, + "h": 400 + }, + "ext": { + "bidder": { + "cid": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://prebid-server.cootlogix.com/openrtb/test_cid_123", + "body": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 240, + "h": 400 + }, + "ext": { + "bidder": { + "cid": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [] +} \ No newline at end of file diff --git a/adapters/vidazoo/vidazootest/supplemental/unknown-bid-type.json b/adapters/vidazoo/vidazootest/supplemental/unknown-bid-type.json new file mode 100644 index 00000000000..5f3ec80799e --- /dev/null +++ b/adapters/vidazoo/vidazootest/supplemental/unknown-bid-type.json @@ -0,0 +1,109 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 240, + "h": 400 + }, + "ext": { + "bidder": { + "cId": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://prebid-server.cootlogix.com/openrtb/test_cid_123", + "body": { + "id": "some-request-id", + "site": { + "page": "prebid.org" + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 240, + "h": 400 + }, + "ext": { + "bidder": { + "cId": "test_cid_123" + } + } + } + ], + "tmax": 5000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some-request-id", + "cur": "", + "bidid": "some-bid-id", + "seatbid": [ + { + "bid": [ + { + "exp": 60, + "adm": "
Some creative
", + "burl": "", + "iurl": "http://prebid-server.cootlogix.com/creative.jpg", + "lurl": "", + "nurl": "", + "id": "some-bid-id", + "impid": "some-impression-id", + "h": 400, + "w": 240, + "price": 1, + "dealid": "deal123", + "adomain": [ + "test.com" + ], + "adid": "some-ad-id", + "cid": "test", + "attr": [], + "cat": [], + "crid": "some-creative-id", + "ext": {}, + "hratio": 0, + "language": "", + "protocol": 0, + "qagmediarating": 0, + "tactic": "", + "wratio": 0, + "mtype": 8 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [] + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Could not define bid type for imp: some-impression-id", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 3cd4e257e31..cf2892cc371 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -190,6 +190,7 @@ import ( "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/vidazoo" "github.com/prebid/prebid-server/v2/adapters/videobyte" "github.com/prebid/prebid-server/v2/adapters/videoheroes" "github.com/prebid/prebid-server/v2/adapters/vidoomy" @@ -407,6 +408,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderUndertone: undertone.Builder, openrtb_ext.BidderUnicorn: unicorn.Builder, openrtb_ext.BidderUnruly: unruly.Builder, + openrtb_ext.BidderVidazoo: vidazoo.Builder, openrtb_ext.BidderVideoByte: videobyte.Builder, openrtb_ext.BidderVideoHeroes: videoheroes.Builder, openrtb_ext.BidderVidoomy: vidoomy.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 70ab0160f00..7f0c63bd767 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -208,6 +208,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderUndertone, BidderUnicorn, BidderUnruly, + BidderVidazoo, BidderVideoByte, BidderVideoHeroes, BidderVidoomy, @@ -522,6 +523,7 @@ const ( BidderUndertone BidderName = "undertone" BidderUnicorn BidderName = "unicorn" BidderUnruly BidderName = "unruly" + BidderVidazoo BidderName = "vidazoo" BidderVideoByte BidderName = "videobyte" BidderVideoHeroes BidderName = "videoheroes" BidderVidoomy BidderName = "vidoomy" diff --git a/openrtb_ext/imp_vidazoo.go b/openrtb_ext/imp_vidazoo.go new file mode 100644 index 00000000000..c2589d3f1ae --- /dev/null +++ b/openrtb_ext/imp_vidazoo.go @@ -0,0 +1,6 @@ +package openrtb_ext + +// ImpExtVidazoo defines the contract for bidrequest.imp[i].ext.prebid.bidder.vidazoo +type ImpExtVidazoo struct { + ConnectionId string `json:"cId"` +} diff --git a/static/bidder-info/vidazoo.yaml b/static/bidder-info/vidazoo.yaml new file mode 100644 index 00000000000..7abef2e3518 --- /dev/null +++ b/static/bidder-info/vidazoo.yaml @@ -0,0 +1,18 @@ +endpoint: "https://prebidsrvr.cootlogix.com/openrtb/" +maintainer: + email: "dev@vidazoo.com" +gvlVendorID: 744 +endpointCompression: gzip +capabilities: + app: + mediaTypes: + - banner + - video + site: + mediaTypes: + - banner + - video +userSync: + iframe: + url: https://sync.cootlogix.com/api/user/html/pbs_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}} + userMacro: ${userId} \ No newline at end of file diff --git a/static/bidder-params/vidazoo.json b/static/bidder-params/vidazoo.json new file mode 100644 index 00000000000..95683d73d3c --- /dev/null +++ b/static/bidder-params/vidazoo.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Vidazoo Adapter Params", + "description": "A schema which validates params accepted by the Vidazoo adapter", + "type": "object", + "properties": { + "cId": { + "type": "string", + "description": "The connection id.", + "minLength": 1 + } + }, + "required": [ + "cId" + ] +} \ No newline at end of file From 8784615f24129f751c2e83b738180a089ac015dc Mon Sep 17 00:00:00 2001 From: SiddhantAgrawal Date: Mon, 1 Jul 2024 13:45:13 +0530 Subject: [PATCH 05/31] InMobi: include iframe & native for M-Web (#3682) Co-authored-by: Siddhant Kumar Agrawal Co-authored-by: Siddhant Kumar Agrawal --- .../exemplary/simple-web-native.json | 104 ++++++++++++++++++ static/bidder-info/inmobi.yaml | 5 +- 2 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 adapters/inmobi/inmobitest/exemplary/simple-web-native.json diff --git a/adapters/inmobi/inmobitest/exemplary/simple-web-native.json b/adapters/inmobi/inmobitest/exemplary/simple-web-native.json new file mode 100644 index 00000000000..2d5a2a8c07c --- /dev/null +++ b/adapters/inmobi/inmobitest/exemplary/simple-web-native.json @@ -0,0 +1,104 @@ +{ + "mockBidRequest": { + "site": { + "page": "https://www.inmobi.com" + }, + "id": "req-id", + "device": { + "ip": "1.1.1.1", + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36" + }, + "imp": [ + { + "ext": { + "bidder": { + "plc": "1716021069867" + } + }, + "native": { + "request": "{\"ver\":\"1.2\",\"context\":2,\"contextsubtype\":20,\"plcmttype\":11,\"plcmtcnt\":1,\"aurlsupport\":1,\"durlsupport\":1,\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"len\":140}},{\"id\":128,\"required\":0,\"img\":{\"wmin\":836,\"hmin\":627,\"type\":3}}]}" + }, + "id": "imp-id" + } + ] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "https://api.w.inmobi.com/showad/openrtb/bidder/prebid", + "body": { + "site": { + "page": "https://www.inmobi.com" + }, + "id": "req-id", + "device": { + "ip": "1.1.1.1", + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36" + }, + "imp": [ + { + "ext": { + "bidder": { + "plc": "1716021069867" + } + }, + "native": { + "request": "{\"ver\":\"1.2\",\"context\":2,\"contextsubtype\":20,\"plcmttype\":11,\"plcmtcnt\":1,\"aurlsupport\":1,\"durlsupport\":1,\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"len\":140}},{\"id\":128,\"required\":0,\"img\":{\"wmin\":836,\"hmin\":627,\"type\":3}}]}" + }, + "id": "imp-id" + } + ] + }, + "impIDs":["imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "req-id", + "seatbid": [ + { + "bid": [ + { + "ext": { + "prebid": { + "meta": { + "networkName": "inmobi" + } + } + }, + "nurl": "https://some.event.url/params", + "crid": "123456789", + "adomain": [], + "price": 2.0, + "id": "1234", + "adm": "native-json", + "impid": "imp-id" + } + ] + } + ] + } + } + }], + + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "bid": { + "id": "1234", + "impid": "imp-id", + "price": 2.0, + "adm": "native-json", + "crid": "123456789", + "nurl": "https://some.event.url/params", + "ext": { + "prebid": { + "meta": { + "networkName": "inmobi" + } + } + } + }, + "type": "native" + }] + }] +} diff --git a/static/bidder-info/inmobi.yaml b/static/bidder-info/inmobi.yaml index 72bdd21d974..3f0c9b9b480 100644 --- a/static/bidder-info/inmobi.yaml +++ b/static/bidder-info/inmobi.yaml @@ -12,8 +12,9 @@ capabilities: mediaTypes: - banner - video + - native userSync: - redirect: - url: "https://sync.inmobi.com/prebid?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}}" + iframe: + url: "https://sync.inmobi.com/prebid?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&redirect={{.RedirectURL}}" userMacro: "{ID5UID}" From 80a90dd32635f087563d5e9e51593a7313a3913b Mon Sep 17 00:00:00 2001 From: IgorKulemzin <65122039+IgorKulemzin@users.noreply.github.com> Date: Mon, 1 Jul 2024 11:45:41 +0300 Subject: [PATCH 06/31] OpenWeb: Adapter Refactor + New Endpoint (#3670) Co-authored-by: Zdravko Kosanovic Co-authored-by: Dedi Sidi --- adapters/openweb/openweb.go | 202 +++++++----------- adapters/openweb/openweb_test.go | 2 +- .../exemplary/multiple-imps-same-aid.json | 175 --------------- .../openwebtest/exemplary/simple-banner.json | 137 +++++------- .../openwebtest/exemplary/simple-video.json | 23 +- ...ession-mapping.json => missing-mtype.json} | 40 ++-- ...lid-imps.json => missing-org-and-aid.json} | 6 +- .../supplemental/missing-placement-id.json | 29 +++ .../openwebtest/supplemental/status-204.json | 56 ----- .../openwebtest/supplemental/status-400.json | 66 ------ .../openwebtest/supplemental/status-500.json | 66 ------ adapters/openweb/params_test.go | 14 +- openrtb_ext/imp_openweb.go | 7 +- static/bidder-info/openweb.yaml | 10 +- static/bidder-params/openweb.json | 33 +-- 15 files changed, 232 insertions(+), 634 deletions(-) delete mode 100644 adapters/openweb/openwebtest/exemplary/multiple-imps-same-aid.json rename adapters/openweb/openwebtest/supplemental/{wrong-impression-mapping.json => missing-mtype.json} (59%) rename adapters/openweb/openwebtest/supplemental/{no-valid-imps.json => missing-org-and-aid.json} (78%) create mode 100644 adapters/openweb/openwebtest/supplemental/missing-placement-id.json delete mode 100644 adapters/openweb/openwebtest/supplemental/status-204.json delete mode 100644 adapters/openweb/openwebtest/supplemental/status-400.json delete mode 100644 adapters/openweb/openwebtest/supplemental/status-500.json diff --git a/adapters/openweb/openweb.go b/adapters/openweb/openweb.go index b74e97dfc3f..a1996d056b2 100644 --- a/adapters/openweb/openweb.go +++ b/adapters/openweb/openweb.go @@ -2,10 +2,14 @@ package openweb import ( "encoding/json" + "errors" "fmt" "net/http" + "strconv" + "strings" "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" @@ -16,175 +20,115 @@ type adapter struct { endpoint string } -type openwebImpExt struct { - OpenWeb openrtb_ext.ExtImpOpenWeb `json:"openweb"` -} - -func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - totalImps := len(request.Imp) - errors := make([]error, 0, totalImps) - sourceIdToImpIds := make(map[int][]int) - var sourceIds []int - - for i := 0; i < totalImps; i++ { - - sourceId, err := validateImpression(&request.Imp[i]) - - if err != nil { - errors = append(errors, err) - continue - } - - if _, ok := sourceIdToImpIds[sourceId]; !ok { - sourceIdToImpIds[sourceId] = make([]int, 0, totalImps-i) - sourceIds = append(sourceIds, sourceId) - } - - sourceIdToImpIds[sourceId] = append(sourceIdToImpIds[sourceId], i) - +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) (requestsToBidder []*adapters.RequestData, errs []error) { + org, err := checkExtAndExtractOrg(request) + if err != nil { + errs = append(errs, fmt.Errorf("checkExtAndExtractOrg: %w", err)) + return nil, errs } - totalReqs := len(sourceIdToImpIds) - if totalReqs == 0 { - return nil, errors + requestJSON, err := json.Marshal(request) + if err != nil { + errs = append(errs, fmt.Errorf("marshal bidRequest: %w", err)) + return nil, errs } headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") - headers.Add("Accept", "application/json") - reqs := make([]*adapters.RequestData, 0, totalReqs) + return append(requestsToBidder, &adapters.RequestData{ + Method: http.MethodPost, + Uri: a.endpoint + "?publisher_id=" + org, + Body: requestJSON, + Headers: headers, + ImpIDs: openrtb_ext.GetImpIDs(request.Imp), + }), nil +} - imps := request.Imp - reqCopy := *request - reqCopy.Imp = make([]openrtb2.Imp, totalImps) - for _, sourceId := range sourceIds { - impIds := sourceIdToImpIds[sourceId] - reqCopy.Imp = reqCopy.Imp[:0] +// checkExtAndExtractOrg checks the presence of required parameters and extracts the Org ID string. +func checkExtAndExtractOrg(request *openrtb2.BidRequest) (string, error) { + var err error + for _, imp := range request.Imp { + var bidderExt adapters.ExtImpBidder + if err = json.Unmarshal(imp.Ext, &bidderExt); err != nil { + return "", fmt.Errorf("unmarshal bidderExt: %w", err) + } - for i := 0; i < len(impIds); i++ { - reqCopy.Imp = append(reqCopy.Imp, imps[impIds[i]]) + var impExt openrtb_ext.ExtImpOpenWeb + if err = json.Unmarshal(bidderExt.Bidder, &impExt); err != nil { + return "", fmt.Errorf("unmarshal ExtImpOpenWeb: %w", err) } - body, err := json.Marshal(reqCopy) - if err != nil { - errors = append(errors, fmt.Errorf("error while encoding bidRequest, err: %s", err)) - return nil, errors + if impExt.PlacementID == "" { + return "", errors.New("no placement id supplied") } - reqs = append(reqs, &adapters.RequestData{ - Method: "POST", - Uri: a.endpoint + fmt.Sprintf("?aid=%d", sourceId), - Body: body, - Headers: headers, - ImpIDs: openrtb_ext.GetImpIDs(reqCopy.Imp), - }) - } + if impExt.Org != "" { + return strings.TrimSpace(impExt.Org), nil + } - return reqs, errors + if impExt.Aid != 0 { + return strconv.Itoa(impExt.Aid), nil + } + } + return "", errors.New("no org or aid supplied") } -func (a *adapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { - - if httpRes.StatusCode == http.StatusNoContent { +func (a *adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if adapters.IsResponseStatusCodeNoContent(responseData) { return nil, nil } - if httpRes.StatusCode != http.StatusOK { - return nil, []error{&errortypes.BadServerResponse{ - Message: fmt.Sprintf("Remote server error: %s", httpRes.Body), - }} - } - var bidResp openrtb2.BidResponse - if err := json.Unmarshal(httpRes.Body, &bidResp); err != nil { - return nil, []error{&errortypes.BadServerResponse{ - Message: fmt.Sprintf("error while decoding response, err: %s", err), - }} + if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil { + return nil, []error{err} } - bidResponse := adapters.NewBidderResponse() - var errors []error + var response openrtb2.BidResponse + if err := json.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} + } - for _, sb := range bidResp.SeatBid { - for i := 0; i < len(sb.Bid); i++ { + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + if response.Cur != "" { + bidResponse.Currency = response.Cur + } - bid := sb.Bid[i] + var errs []error - mediaType, impOK := getBidType(bidReq.Imp, bid.ImpID) - if !impOK { - errors = append(errors, &errortypes.BadServerResponse{ - Message: fmt.Sprintf("ignoring bid id=%s, request doesn't contain any impression with id=%s", bid.ID, bid.ImpID), - }) + for _, seatBid := range response.SeatBid { + for i, bid := range seatBid.Bid { + bidType, err := getMediaTypeForBid(bid) + if err != nil { + errs = append(errs, err) continue } bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ - Bid: &bid, - BidType: mediaType, + Bid: &seatBid.Bid[i], + BidType: bidType, }) } } - return bidResponse, errors + return bidResponse, errs } -func getBidType(imps []openrtb2.Imp, impId string) (mediaType openrtb_ext.BidType, ok bool) { - mediaType = openrtb_ext.BidTypeBanner - for _, imp := range imps { - if imp.ID == impId { - ok = true - - if imp.Video != nil { - mediaType = openrtb_ext.BidTypeVideo - } - - break - } - } - - return -} - -func validateImpression(imp *openrtb2.Imp) (int, error) { - var bidderExt adapters.ExtImpBidder - - if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { - return 0, &errortypes.BadInput{ - Message: fmt.Sprintf("ignoring imp id=%s, error while decoding extImpBidder, err: %s", imp.ID, err), - } - } - - impExt := openrtb_ext.ExtImpOpenWeb{} - err := json.Unmarshal(bidderExt.Bidder, &impExt) - if err != nil { - return 0, &errortypes.BadInput{ - Message: fmt.Sprintf("ignoring imp id=%s, error while decoding impExt, err: %s", imp.ID, err), +func getMediaTypeForBid(bid openrtb2.Bid) (openrtb_ext.BidType, error) { + switch bid.MType { + case openrtb2.MarkupBanner: + return openrtb_ext.BidTypeBanner, nil + case openrtb2.MarkupVideo: + return openrtb_ext.BidTypeVideo, nil + default: + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("unsupported MType %d", bid.MType), } } - - var impExtBuffer []byte - - impExtBuffer, err = json.Marshal(&openwebImpExt{ - OpenWeb: impExt, - }) - if err != nil { - return 0, &errortypes.BadInput{ - Message: fmt.Sprintf("ignoring imp id=%s, error while encoding impExt, err: %s", imp.ID, err), - } - } - - if impExt.BidFloor > 0 { - imp.BidFloor = impExt.BidFloor - } - - imp.Ext = impExtBuffer - - return impExt.SourceID, nil } // Builder builds a new instance of the OpenWeb adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { +func Builder(_ openrtb_ext.BidderName, config config.Adapter, _ config.Server) (adapters.Bidder, error) { bidder := &adapter{ endpoint: config.Endpoint, } diff --git a/adapters/openweb/openweb_test.go b/adapters/openweb/openweb_test.go index a63dafd06c2..2a135acb1f0 100644 --- a/adapters/openweb/openweb_test.go +++ b/adapters/openweb/openweb_test.go @@ -10,7 +10,7 @@ import ( func TestJsonSamples(t *testing.T) { bidder, buildErr := Builder(openrtb_ext.BidderOpenWeb, config.Adapter{ - Endpoint: "http://ghb.spotim.market/pbs/ortb"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + Endpoint: "https://pbs.openwebmp.com/pbs"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) diff --git a/adapters/openweb/openwebtest/exemplary/multiple-imps-same-aid.json b/adapters/openweb/openwebtest/exemplary/multiple-imps-same-aid.json deleted file mode 100644 index 2fd7c195b3e..00000000000 --- a/adapters/openweb/openwebtest/exemplary/multiple-imps-same-aid.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "bidfloor": 30, - "ext": { - "bidder": { - "aid": 1000, - "siteId": 1234, - "bidFloor": 20 - } - } - }, - { - "id": "test-imp-id-2", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "bidfloor": 30, - "ext": { - "bidder": { - "aid": 1000, - "siteId": 4321, - "bidFloor": 20 - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "bidfloor": 20, - "ext": { - "openweb": { - "aid": 1000, - "siteId": 1234, - "bidFloor": 20 - } - } - }, - { - "id": "test-imp-id-2", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "bidfloor": 20, - "ext": { - "openweb": { - "aid": 1000, - "siteId": 4321, - "bidFloor": 20 - } - } - } - ] - }, - "impIDs":["test-imp-id","test-imp-id-2"] - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "test-seat", - "bid": [ - { - "id": "test-bid-id", - "impid": "test-imp-id", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "h": 250, - "w": 300 - }, - { - "id": "test-bid-id-2", - "impid": "test-imp-id-2", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "h": 250, - "w": 300 - } - ] - } - ], - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "test-bid-id", - "impid": "test-imp-id", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "w": 300, - "h": 250 - }, - "type": "banner" - }, - { - "bid": { - "id": "test-bid-id-2", - "impid": "test-imp-id-2", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "w": 300, - "h": 250 - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/openweb/openwebtest/exemplary/simple-banner.json b/adapters/openweb/openwebtest/exemplary/simple-banner.json index b742fa50eb9..e6c1abd7cc6 100644 --- a/adapters/openweb/openwebtest/exemplary/simple-banner.json +++ b/adapters/openweb/openwebtest/exemplary/simple-banner.json @@ -16,12 +16,10 @@ } ] }, - "bidfloor": 30, "ext": { "bidder": { - "aid": 1000, - "siteId": 1234, - "bidFloor": 20 + "org": "777", + "placementId": "1" } } }, @@ -39,94 +37,70 @@ } ] }, - "bidfloor": 30, "ext": { "bidder": { - "aid": 2000, - "siteId": 4321, - "bidFloor": 20 + "org": "777", + "placementId": "1" } } } ] }, - "httpCalls": [ { "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", + "uri": "https://pbs.openwebmp.com/pbs?publisher_id=777", "body": { "id": "test-request-id", "imp": [ { - "id":"test-imp-id", + "id": "test-imp-id", "banner": { "format": [ - {"w":300,"h":250}, - {"w":300,"h":600} + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } ] }, - "bidfloor": 20, "ext": { - "openweb": { - "aid": 1000, - "siteId": 1234, - "bidFloor": 20 + "bidder": { + "org": "777", + "placementId": "1" } } - } - ] - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "test-seat", - "bid": [{ - "id": "test-bid-id", - "impid": "test-imp-id", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "h": 250, - "w": 300 - }] - } - ], - "cur": "USD" - } - } - }, - { - "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=2000", - "body": { - "id": "test-request-id", - "imp": [ + }, { - "id":"test-imp-id-2", + "id": "test-imp-id-2", "banner": { "format": [ - {"w":300,"h":250}, - {"w":300,"h":600} + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } ] }, - "bidfloor": 20, "ext": { - "openweb": { - "aid": 2000, - "siteId": 4321, - "bidFloor": 20 + "bidder": { + "org": "777", + "placementId": "1" } } } ] }, - "impIDs":["test-imp-id-2"] + "impIDs": [ + "test-imp-id", + "test-imp-id-2" + ] }, "mockResponse": { "status": 200, @@ -134,16 +108,19 @@ "id": "test-request-id", "seatbid": [ { - "seat": "test-seat-2", - "bid": [{ - "id": "test-bid-id-2", - "impid": "test-imp-id-2", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "h": 250, - "w": 300 - }] + "seat": "test-seat", + "bid": [ + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 30, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 250, + "w": 300, + "mtype": 1 + } + ] } ], "cur": "USD" @@ -163,24 +140,8 @@ "adm": "some-test-ad", "crid": "crid_10", "w": 300, - "h": 250 - }, - "type": "banner" - } - ] - }, - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "test-bid-id-2", - "impid": "test-imp-id-2", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "w": 300, - "h": 250 + "h": 250, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/openweb/openwebtest/exemplary/simple-video.json b/adapters/openweb/openwebtest/exemplary/simple-video.json index e8052e7ebf2..199607cbe32 100644 --- a/adapters/openweb/openwebtest/exemplary/simple-video.json +++ b/adapters/openweb/openwebtest/exemplary/simple-video.json @@ -14,22 +14,22 @@ }, "ext": { "bidder": { - "aid": 1000 + "aid": 777, + "placementId": "1" } } } ] }, - "httpCalls": [ { "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", + "uri": "https://pbs.openwebmp.com/pbs?publisher_id=777", "body": { "id": "test-request-id", "imp": [ { - "id":"test-imp-id", + "id": "test-imp-id", "video": { "w": 900, "h": 250, @@ -39,14 +39,17 @@ ] }, "ext": { - "openweb": { - "aid": 1000 + "bidder": { + "aid": 777, + "placementId": "1" } } } ] }, - "impIDs":["test-imp-id"] + "impIDs": [ + "test-imp-id" + ] }, "mockResponse": { "status": 200, @@ -60,7 +63,8 @@ "impid": "test-imp-id", "price": 3.5, "w": 900, - "h": 250 + "h": 250, + "mtype": 2 } ] } @@ -79,7 +83,8 @@ "impid": "test-imp-id", "price": 3.5, "w": 900, - "h": 250 + "h": 250, + "mtype": 2 }, "type": "video" } diff --git a/adapters/openweb/openwebtest/supplemental/wrong-impression-mapping.json b/adapters/openweb/openwebtest/supplemental/missing-mtype.json similarity index 59% rename from adapters/openweb/openwebtest/supplemental/wrong-impression-mapping.json rename to adapters/openweb/openwebtest/supplemental/missing-mtype.json index f83ec46da6f..68b487216c0 100644 --- a/adapters/openweb/openwebtest/supplemental/wrong-impression-mapping.json +++ b/adapters/openweb/openwebtest/supplemental/missing-mtype.json @@ -14,22 +14,22 @@ }, "ext": { "bidder": { - "aid": 1000 + "org": "777", + "placementId": "1" } } } ] }, - "httpCalls": [ { "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", + "uri": "https://pbs.openwebmp.com/pbs?publisher_id=777", "body": { "id": "test-request-id", "imp": [ { - "id":"test-imp-id", + "id": "test-imp-id", "video": { "w": 900, "h": 250, @@ -39,28 +39,37 @@ ] }, "ext": { - "openweb": { - "aid": 1000 + "bidder": { + "org": "777", + "placementId": "1" } } } ] }, - "impIDs":["test-imp-id"] + "impIDs": [ + "test-imp-id" + ] }, "mockResponse": { "status": 200, "body": { "id": "test-request-id", + "cur": "USD", "seatbid": [ { + "seat": "958", "bid": [ { - "id": "test-bid-id", - "impid": "SOME-WRONG-IMP-ID", - "price": 3.5, + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, "w": 900, - "h": 250 + "h": 250, + "mimes": [ + "video/x-flv", + "video/mp4" + ] } ] } @@ -69,11 +78,16 @@ } } ], - "expectedBidResponses": [{"currency":"USD","bids":[]}], "expectedMakeBidsErrors": [ { - "value": "ignoring bid id=test-bid-id, request doesn't contain any impression with id=SOME-WRONG-IMP-ID", + "value": "unsupported MType 0", "comparison": "literal" } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [] + } ] } diff --git a/adapters/openweb/openwebtest/supplemental/no-valid-imps.json b/adapters/openweb/openwebtest/supplemental/missing-org-and-aid.json similarity index 78% rename from adapters/openweb/openwebtest/supplemental/no-valid-imps.json rename to adapters/openweb/openwebtest/supplemental/missing-org-and-aid.json index 3335639d59f..6d156985029 100644 --- a/adapters/openweb/openwebtest/supplemental/no-valid-imps.json +++ b/adapters/openweb/openwebtest/supplemental/missing-org-and-aid.json @@ -14,16 +14,16 @@ }, "ext": { "bidder": { - "aid": "not valid value" + "org": "", + "placementId": "1" } } } ] }, - "expectedMakeRequestsErrors": [ { - "value": "^ignoring imp id=test-imp-id, error while decoding impExt", + "value": "no org or aid supplied", "comparison": "regex" } ] diff --git a/adapters/openweb/openwebtest/supplemental/missing-placement-id.json b/adapters/openweb/openwebtest/supplemental/missing-placement-id.json new file mode 100644 index 00000000000..d7159e2f638 --- /dev/null +++ b/adapters/openweb/openwebtest/supplemental/missing-placement-id.json @@ -0,0 +1,29 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "w": 900, + "h": 250, + "mimes": [ + "video/x-flv", + "video/mp4" + ] + }, + "ext": { + "bidder": { + "org": "777" + } + } + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "no placement id supplied", + "comparison": "regex" + } + ] +} diff --git a/adapters/openweb/openwebtest/supplemental/status-204.json b/adapters/openweb/openwebtest/supplemental/status-204.json deleted file mode 100644 index 637c2113fc5..00000000000 --- a/adapters/openweb/openwebtest/supplemental/status-204.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "w": 900, - "h": 250, - "mimes": [ - "video/x-flv", - "video/mp4" - ] - }, - "ext": { - "bidder": { - "aid": 1000 - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", - "body": { - "id": "test-request-id", - "imp": [ - { - "id":"test-imp-id", - "video": { - "w": 900, - "h": 250, - "mimes": [ - "video/x-flv", - "video/mp4" - ] - }, - "ext": { - "openweb": { - "aid": 1000 - } - } - } - ] - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 204 - } - } - ] -} diff --git a/adapters/openweb/openwebtest/supplemental/status-400.json b/adapters/openweb/openwebtest/supplemental/status-400.json deleted file mode 100644 index 20500de2b4a..00000000000 --- a/adapters/openweb/openwebtest/supplemental/status-400.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "w": 900, - "h": 250, - "mimes": [ - "video/x-flv", - "video/mp4" - ] - }, - "ext": { - "bidder": { - "aid": 1000 - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", - "body": { - "id": "test-request-id", - "imp": [ - { - "id":"test-imp-id", - "video": { - "w": 900, - "h": 250, - "mimes": [ - "video/x-flv", - "video/mp4" - ] - }, - "ext": { - "openweb": { - "aid": 1000 - } - } - } - ] - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 400, - "body": "Bad request" - } - } - ], - - "expectedMakeBidsErrors": [ - { - "value": "Remote server error: \"Bad request\"", - "comparison": "literal" - } - ], - - "expectedBidResponses": [] -} diff --git a/adapters/openweb/openwebtest/supplemental/status-500.json b/adapters/openweb/openwebtest/supplemental/status-500.json deleted file mode 100644 index 48cfab3b7fa..00000000000 --- a/adapters/openweb/openwebtest/supplemental/status-500.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "w": 900, - "h": 250, - "mimes": [ - "video/x-flv", - "video/mp4" - ] - }, - "ext": { - "bidder": { - "aid": 1000 - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", - "body": { - "id": "test-request-id", - "imp": [ - { - "id":"test-imp-id", - "video": { - "w": 900, - "h": 250, - "mimes": [ - "video/x-flv", - "video/mp4" - ] - }, - "ext": { - "openweb": { - "aid": 1000 - } - } - } - ] - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 500, - "body": "Internal error" - } - } - ], - - "expectedMakeBidsErrors": [ - { - "value": "Remote server error: \"Internal error\"", - "comparison": "literal" - } - ], - - "expectedBidResponses": [] -} diff --git a/adapters/openweb/params_test.go b/adapters/openweb/params_test.go index 7a53124fa30..82e2f9e5ed5 100644 --- a/adapters/openweb/params_test.go +++ b/adapters/openweb/params_test.go @@ -39,10 +39,8 @@ func TestInvalidParams(t *testing.T) { } var validParams = []string{ - `{"aid":123}`, - `{"aid":123,"placementId":1234}`, - `{"aid":123,"siteId":4321}`, - `{"aid":123,"siteId":0,"bidFloor":0}`, + `{"aid":123,"placementId":"1234"}`, + `{"org":"123","placementId":"1234"}`, } var invalidParams = []string{ @@ -53,8 +51,10 @@ var invalidParams = []string{ `4.2`, `[]`, `{}`, - `{"aid":"some string instead of int"}`, - `{"aid":"0"}`, + `{"org":123}`, + `{"org":0}`, + `{"org":"123","placementId":123}`, + `{"org":123, "placementId":"123"}`, + `{"aid":123}`, `{"aid":"123","placementId":"123"}`, - `{"aid":123, "placementId":"123", "siteId":"321"}`, } diff --git a/openrtb_ext/imp_openweb.go b/openrtb_ext/imp_openweb.go index fc3cbdacdd0..5df8e7d18e5 100644 --- a/openrtb_ext/imp_openweb.go +++ b/openrtb_ext/imp_openweb.go @@ -2,8 +2,7 @@ package openrtb_ext // ExtImpOpenWeb defines the contract for bidrequest.imp[i].ext.prebid.bidder.openweb type ExtImpOpenWeb struct { - SourceID int `json:"aid"` - PlacementID int `json:"placementId,omitempty"` - SiteID int `json:"siteId,omitempty"` - BidFloor float64 `json:"bidFloor,omitempty"` + Aid int `json:"aid,omitempty"` + Org string `json:"org,omitempty"` + PlacementID string `json:"placementId"` } diff --git a/static/bidder-info/openweb.yaml b/static/bidder-info/openweb.yaml index 9272719cf19..cde54acfb25 100644 --- a/static/bidder-info/openweb.yaml +++ b/static/bidder-info/openweb.yaml @@ -1,7 +1,8 @@ -endpoint: "http://ghb.spotim.market/pbs/ortb" +endpoint: "https://pbs.openwebmp.com/pbs" maintainer: email: "monetization@openweb.com" gvlVendorID: 280 +modifyingVastXmlAllowed: true capabilities: app: mediaTypes: @@ -12,7 +13,6 @@ capabilities: - banner - video userSync: - # openweb supports user syncing, but requires configuration by the host. contact this - # bidder directly at the email address in this file to ask about enabling user sync. - supports: - - redirect + iframe: + url: https://pbs-cs.openwebmp.com/pbs-iframe?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&redirect={{.RedirectURL}} + userMacro: "[PBS_UID]" diff --git a/static/bidder-params/openweb.json b/static/bidder-params/openweb.json index ec5766ad663..62a4853ed65 100644 --- a/static/bidder-params/openweb.json +++ b/static/bidder-params/openweb.json @@ -2,25 +2,34 @@ "$schema": "http://json-schema.org/draft-04/schema#", "title": "OpenWeb Adapter Params", "description": "A schema which validates params accepted by the OpenWeb adapter", - "type": "object", "properties": { "placementId": { - "type": "integer", - "description": "An ID which identifies this placement of the impression" - }, - "siteId": { - "type": "integer", - "description": "An ID which identifies the site selling the impression" + "type": "string", + "description": "An ID which identifies this placement of the impression", + "minLength": 1 }, "aid": { "type": "integer", - "description": "An ID which identifies the channel" + "description": "Deprecated: An ID which identifies the channel" }, - "bidFloor": { - "type": "number", - "description": "BidFloor, US Dollars" + "org": { + "type": "string", + "description": "The organization ID.", + "minLength": 1 } }, - "required": ["aid"] + "required": [ "placementId" ], + "oneOf": [ + { + "required": [ + "aid" + ] + }, + { + "required": [ + "org" + ] + } + ] } From a907ecb1f13a0de23f44d8f6d5d26c0a3d5b28fc Mon Sep 17 00:00:00 2001 From: Anand Venkatraman Date: Mon, 1 Jul 2024 14:53:33 +0530 Subject: [PATCH 07/31] PulsePoint: Marking cp/ct params to be either String or Int (#3677) --- adapters/pulsepoint/params_test.go | 7 +- adapters/pulsepoint/pulsepoint.go | 31 +++++- .../banner-string-bidder-params.json | 102 ++++++++++++++++++ .../bad-prebid-params-missing-param.json | 31 ++++++ .../supplemental/bad-prebid-params.json | 4 +- openrtb_ext/imp_pulsepoint.go | 8 +- static/bidder-params/pulsepoint.json | 10 +- 7 files changed, 180 insertions(+), 13 deletions(-) create mode 100644 adapters/pulsepoint/pulsepointtest/exemplary/banner-string-bidder-params.json create mode 100644 adapters/pulsepoint/pulsepointtest/supplemental/bad-prebid-params-missing-param.json diff --git a/adapters/pulsepoint/params_test.go b/adapters/pulsepoint/params_test.go index 4b3c6c017db..c97cec03230 100644 --- a/adapters/pulsepoint/params_test.go +++ b/adapters/pulsepoint/params_test.go @@ -37,6 +37,9 @@ func TestInvalidParams(t *testing.T) { var validParams = []string{ `{"cp":1000, "ct": 2000}`, `{"cp":1001, "ct": 2001}`, + `{"cp":"1000", "ct": "2000"}`, + `{"cp":"1000", "ct": 2000}`, + `{"cp":1000, "ct": "2000"}`, `{"cp":1001, "ct": 2001, "cf": "1x1"}`, } @@ -52,8 +55,4 @@ var invalidParams = []string{ `{"ct":"1000"}`, `{"cp":1000}`, `{"ct":1000}`, - `{"cp":1000, "ct":"1000"}`, - `{"cp":1000, "ct": "abcd"}`, - `{"cp":"abcd", "ct": 1000}`, - `{"cp":"1000.2", "ct": "1000.1"}`, } diff --git a/adapters/pulsepoint/pulsepoint.go b/adapters/pulsepoint/pulsepoint.go index c351bb7d051..dffe2754110 100644 --- a/adapters/pulsepoint/pulsepoint.go +++ b/adapters/pulsepoint/pulsepoint.go @@ -2,6 +2,7 @@ package pulsepoint import ( "encoding/json" + "errors" "fmt" "net/http" "strconv" @@ -10,6 +11,7 @@ import ( "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v2/util/jsonutil" "github.com/prebid/openrtb/v20/openrtb2" ) @@ -49,11 +51,25 @@ func (a *PulsePointAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo * continue } // parse pubid and keep it for reference - if pubID == "" && pulsepointExt.PubID > 0 { - pubID = strconv.Itoa(pulsepointExt.PubID) + if pubID == "" { + pubID, err = parseParam("pubID", pulsepointExt.PubID) + if err != nil { + errs = append(errs, &errortypes.BadInput{ + Message: err.Error(), + }) + continue + } } // tag id to be sent - imp.TagID = strconv.Itoa(pulsepointExt.TagID) + var tagID string + tagID, err = parseParam("tagID", pulsepointExt.TagID) + if err != nil { + errs = append(errs, &errortypes.BadInput{ + Message: err.Error(), + }) + continue + } + imp.TagID = tagID imps = append(imps, imp) } @@ -163,3 +179,12 @@ func getBidType(imp openrtb2.Imp) openrtb_ext.BidType { } return "" } + +func parseParam(paramName string, paramValue jsonutil.StringInt) (string, error) { + value := int(paramValue) + // verify we got a non-zero value + if value == 0 { + return "", errors.New("param not found - " + paramName) + } + return strconv.Itoa(value), nil +} diff --git a/adapters/pulsepoint/pulsepointtest/exemplary/banner-string-bidder-params.json b/adapters/pulsepoint/pulsepointtest/exemplary/banner-string-bidder-params.json new file mode 100644 index 00000000000..2a13f4d5b96 --- /dev/null +++ b/adapters/pulsepoint/pulsepointtest/exemplary/banner-string-bidder-params.json @@ -0,0 +1,102 @@ +{ + "mockBidRequest": { + "id": "request-id", + "site": { + "page": "http://publisher.com/index.html", + "publisher": { + "id": "123456789", + "name": "publisher.com" + } + }, + "imp": [{ + "id": "banner-1", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "cp": "1234", + "ct": "1001" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://bidder.pulsepoint.com", + "body": { + "id": "request-id", + "site": { + "page": "http://publisher.com/index.html", + "publisher": { + "id": "1234", + "name": "publisher.com" + } + }, + "imp": [{ + "id": "banner-1", + "tagid": "1001", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "cp": "1234", + "ct": "1001" + } + } + }] + }, + "impIDs":["banner-1"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "response-id", + "seatbid": [{ + "bid": [{ + "id": "banner-1-bid", + "impid": "banner-1", + "price": 3.5, + "adm": "
Creative
", + "adomain": [ + "advertiser.com" + ], + "crid": "20", + "w": 300, + "h": 250 + }], + "seat": "pulsepoint-seat" + }], + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "id": "banner-1-bid", + "impid": "banner-1", + "price": 3.5, + "adm": "
Creative
", + "adomain": [ + "advertiser.com" + ], + "crid": "20", + "w": 300, + "h": 250 + }, + "type": "banner" + }] + }] +} \ No newline at end of file diff --git a/adapters/pulsepoint/pulsepointtest/supplemental/bad-prebid-params-missing-param.json b/adapters/pulsepoint/pulsepointtest/supplemental/bad-prebid-params-missing-param.json new file mode 100644 index 00000000000..1b90f37d1eb --- /dev/null +++ b/adapters/pulsepoint/pulsepointtest/supplemental/bad-prebid-params-missing-param.json @@ -0,0 +1,31 @@ +{ + "mockBidRequest": { + "id": "request-id", + "site": { + "page": "http://publisher.com/index.html", + "publisher": { + "id": "123456789", + "name": "publisher.com" + } + }, + "imp": [{ + "id": "banner-1", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "cp": "1234" + } + } + }] + }, + "httpCalls": [], + "expectedMakeRequestsErrors": [{ + "value": "param not found - tagID", + "comparison": "literal" + }], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [] +} \ No newline at end of file diff --git a/adapters/pulsepoint/pulsepointtest/supplemental/bad-prebid-params.json b/adapters/pulsepoint/pulsepointtest/supplemental/bad-prebid-params.json index 2d0c74d39d7..060ffb1ad88 100644 --- a/adapters/pulsepoint/pulsepointtest/supplemental/bad-prebid-params.json +++ b/adapters/pulsepoint/pulsepointtest/supplemental/bad-prebid-params.json @@ -17,14 +17,14 @@ "ext": { "bidder": { "cp": "1234", - "ct": "1001" + "ct": "ab1001" } } }] }, "httpCalls": [], "expectedMakeRequestsErrors": [{ - "value": "json: cannot unmarshal string into Go struct field ExtImpPulsePoint.cp of type int", + "value": "Value looks like Number/Boolean/None, but can't find its end: ',' or '}' symbol", "comparison": "literal" }], "expectedBidResponses": [], diff --git a/openrtb_ext/imp_pulsepoint.go b/openrtb_ext/imp_pulsepoint.go index a901592c45b..c2ed36256e1 100644 --- a/openrtb_ext/imp_pulsepoint.go +++ b/openrtb_ext/imp_pulsepoint.go @@ -1,9 +1,13 @@ package openrtb_ext +import ( + "github.com/prebid/prebid-server/v2/util/jsonutil" +) + // ExtImpPulsePoint defines the json spec for bidrequest.imp[i].ext.prebid.bidder.pulsepoint // PubId/TagId are mandatory params type ExtImpPulsePoint struct { - PubID int `json:"cp"` - TagID int `json:"ct"` + PubID jsonutil.StringInt `json:"cp"` + TagID jsonutil.StringInt `json:"ct"` } diff --git a/static/bidder-params/pulsepoint.json b/static/bidder-params/pulsepoint.json index 673fd2efd6f..05d1e159a43 100644 --- a/static/bidder-params/pulsepoint.json +++ b/static/bidder-params/pulsepoint.json @@ -5,11 +5,17 @@ "type": "object", "properties": { "cp": { - "type": "integer", + "type": [ + "integer", + "string" + ], "description": "An ID which identifies the publisher selling the impression" }, "ct": { - "type": "integer", + "type": [ + "integer", + "string" + ], "description": "An ID which identifies the ad slot being sold" } }, From 670e1d4d0d30fa22c46a9059c68fddbde95d701c Mon Sep 17 00:00:00 2001 From: BizzClick <73241175+BizzClick@users.noreply.github.com> Date: Mon, 1 Jul 2024 12:24:29 +0300 Subject: [PATCH 08/31] Bizzclick: rename bizzclick to blasto (#3688) --- .../bizzclick.go => blasto/blasto.go} | 25 ++++------- .../blasto_test.go} | 10 ++--- .../blastotest}/exemplary/banner-app.json | 11 ++--- .../blastotest}/exemplary/banner-web.json | 15 +++---- .../exemplary/default-host-param.json | 10 +++-- .../blastotest}/exemplary/native-app.json | 11 ++--- .../blastotest}/exemplary/native-web.json | 11 ++--- .../blastotest}/exemplary/video-app.json | 11 ++--- .../blastotest}/exemplary/video-web.json | 11 ++--- .../supplemental/empty-seatbid-array.json | 9 ++-- .../invalid-blasto-ext-object.json} | 0 .../supplemental/invalid-response.json | 9 ++-- .../supplemental/status-code-bad-request.json | 9 ++-- .../supplemental/status-code-no-content.json | 9 ++-- .../supplemental/status-code-other-error.json | 9 ++-- .../status-code-service-unavailable.json | 9 ++-- adapters/{bizzclick => blasto}/params_test.go | 10 ++--- exchange/adapter_builders.go | 4 +- exchange/adapter_util.go | 1 + openrtb_ext/bidders.go | 4 +- .../{imp_bizzclick.go => imp_blasto.go} | 2 +- static/bidder-info/bizzclick.yaml | 22 ---------- static/bidder-info/blasto.yaml | 23 ++++++++++ static/bidder-params/bizzclick.json | 42 ------------------- static/bidder-params/blasto.json | 22 ++++++++++ 25 files changed, 144 insertions(+), 155 deletions(-) rename adapters/{bizzclick/bizzclick.go => blasto/blasto.go} (89%) rename adapters/{bizzclick/bizzclick_test.go => blasto/blasto_test.go} (57%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/exemplary/banner-app.json (93%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/exemplary/banner-web.json (92%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/exemplary/default-host-param.json (93%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/exemplary/native-app.json (94%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/exemplary/native-web.json (94%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/exemplary/video-app.json (93%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/exemplary/video-web.json (93%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/supplemental/empty-seatbid-array.json (93%) rename adapters/{bizzclick/bizzclicktest/supplemental/invalid-bizzclick-ext-object.json => blasto/blastotest/supplemental/invalid-blasto-ext-object.json} (100%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/supplemental/invalid-response.json (92%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/supplemental/status-code-bad-request.json (90%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/supplemental/status-code-no-content.json (88%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/supplemental/status-code-other-error.json (89%) rename adapters/{bizzclick/bizzclicktest => blasto/blastotest}/supplemental/status-code-service-unavailable.json (89%) rename adapters/{bizzclick => blasto}/params_test.go (71%) rename openrtb_ext/{imp_bizzclick.go => imp_blasto.go} (86%) delete mode 100644 static/bidder-info/bizzclick.yaml create mode 100644 static/bidder-info/blasto.yaml delete mode 100644 static/bidder-params/bizzclick.json create mode 100644 static/bidder-params/blasto.json diff --git a/adapters/bizzclick/bizzclick.go b/adapters/blasto/blasto.go similarity index 89% rename from adapters/bizzclick/bizzclick.go rename to adapters/blasto/blasto.go index 40805da0cb0..628ba0e9cf4 100644 --- a/adapters/bizzclick/bizzclick.go +++ b/adapters/blasto/blasto.go @@ -1,4 +1,4 @@ -package bizzclick +package blasto import ( "encoding/json" @@ -60,7 +60,7 @@ func (a *adapter) MakeRequests( requestsToBidder []*adapters.RequestData, errs []error, ) { - bizzclickExt, err := a.getImpressionExt(&openRTBRequest.Imp[0]) + blastoExt, err := a.getImpressionExt(&openRTBRequest.Imp[0]) if err != nil { return nil, []error{err} } @@ -68,7 +68,7 @@ func (a *adapter) MakeRequests( for idx := range openRTBRequest.Imp { openRTBRequest.Imp[idx].Ext = nil } - url, err := a.buildEndpointURL(bizzclickExt) + url, err := a.buildEndpointURL(blastoExt) if err != nil { return nil, []error{err} } @@ -87,33 +87,26 @@ func (a *adapter) MakeRequests( }}, nil } -func (a *adapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtBizzclick, error) { +func (a *adapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtBlasto, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ Message: "ext.bidder not provided", } } - var bizzclickExt openrtb_ext.ExtBizzclick - if err := json.Unmarshal(bidderExt.Bidder, &bizzclickExt); err != nil { + var blastoExt openrtb_ext.ExtBlasto + if err := json.Unmarshal(bidderExt.Bidder, &blastoExt); err != nil { return nil, &errortypes.BadInput{ Message: "ext.bidder not provided", } } - return &bizzclickExt, nil + return &blastoExt, nil } -func (a *adapter) buildEndpointURL(params *openrtb_ext.ExtBizzclick) (string, error) { - host := "us-e-node1" - if params.Host != "" { - host = params.Host - } +func (a *adapter) buildEndpointURL(params *openrtb_ext.ExtBlasto) (string, error) { sourceId := params.SourceID - if params.SourceID == "" { - sourceId = params.PlacementID - } - endpointParams := macros.EndpointTemplateParams{AccountID: params.AccountID, SourceId: sourceId, Host: host} + endpointParams := macros.EndpointTemplateParams{AccountID: params.AccountID, SourceId: sourceId} return macros.ResolveMacros(a.endpoint, endpointParams) } diff --git a/adapters/bizzclick/bizzclick_test.go b/adapters/blasto/blasto_test.go similarity index 57% rename from adapters/bizzclick/bizzclick_test.go rename to adapters/blasto/blasto_test.go index 5933ee551a6..f63cc58871c 100644 --- a/adapters/bizzclick/bizzclick_test.go +++ b/adapters/blasto/blasto_test.go @@ -1,4 +1,4 @@ -package bizzclick +package blasto import ( "testing" @@ -10,18 +10,18 @@ import ( ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderBizzclick, config.Adapter{ - Endpoint: "http://{{.Host}}.bizzclick.com/bid?rtb_seat_id={{.SourceId}}&secret_key={{.AccountID}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + bidder, buildErr := Builder(openrtb_ext.BidderBlasto, config.Adapter{ + Endpoint: "http://t-us.blasto.ai/bid?rtb_seat_id={{.SourceId}}&secret_key={{.AccountID}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) } - adapterstest.RunJSONBidderTest(t, "bizzclicktest", bidder) + adapterstest.RunJSONBidderTest(t, "blastotest", bidder) } func TestEndpointTemplateMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderBizzclick, config.Adapter{ + _, buildErr := Builder(openrtb_ext.BidderBlasto, config.Adapter{ Endpoint: "{{Malformed}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) assert.Error(t, buildErr) diff --git a/adapters/bizzclick/bizzclicktest/exemplary/banner-app.json b/adapters/blasto/blastotest/exemplary/banner-app.json similarity index 93% rename from adapters/bizzclick/bizzclicktest/exemplary/banner-app.json rename to adapters/blasto/blastotest/exemplary/banner-app.json index 840ed212623..81b8e21fc3b 100644 --- a/adapters/bizzclick/bizzclicktest/exemplary/banner-app.json +++ b/adapters/blasto/blastotest/exemplary/banner-app.json @@ -34,8 +34,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } } @@ -61,7 +60,7 @@ "123.123.123.123" ] }, - "uri": "http://host.bizzclick.com/bid?rtb_seat_id=sourceId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "device": { @@ -97,7 +96,9 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id"] + "impIDs": [ + "some-impression-id" + ] }, "mockResponse": { "status": 200, @@ -120,7 +121,7 @@ } ], "type": "banner", - "seat": "bizzclick" + "seat": "blasto" } ], "cur": "USD" diff --git a/adapters/bizzclick/bizzclicktest/exemplary/banner-web.json b/adapters/blasto/blastotest/exemplary/banner-web.json similarity index 92% rename from adapters/bizzclick/bizzclicktest/exemplary/banner-web.json rename to adapters/blasto/blastotest/exemplary/banner-web.json index 21dad82fd12..d971bfa605f 100644 --- a/adapters/bizzclick/bizzclicktest/exemplary/banner-web.json +++ b/adapters/blasto/blastotest/exemplary/banner-web.json @@ -28,8 +28,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } }, @@ -43,8 +42,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } } @@ -70,7 +68,7 @@ "123.123.123.123" ] }, - "uri": "http://host.bizzclick.com/bid?rtb_seat_id=sourceId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "device": { @@ -108,7 +106,10 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id1","some-impression-id2"] + "impIDs": [ + "some-impression-id1", + "some-impression-id2" + ] }, "mockResponse": { "status": 200, @@ -143,7 +144,7 @@ } ], "type": "banner", - "seat": "bizzclick" + "seat": "blasto" } ], "cur": "USD" diff --git a/adapters/bizzclick/bizzclicktest/exemplary/default-host-param.json b/adapters/blasto/blastotest/exemplary/default-host-param.json similarity index 93% rename from adapters/bizzclick/bizzclicktest/exemplary/default-host-param.json rename to adapters/blasto/blastotest/exemplary/default-host-param.json index a99099092d7..81b8e21fc3b 100644 --- a/adapters/bizzclick/bizzclicktest/exemplary/default-host-param.json +++ b/adapters/blasto/blastotest/exemplary/default-host-param.json @@ -34,7 +34,7 @@ "ext": { "bidder": { "accountId": "accountId", - "placementId": "placementId" + "sourceId": "sourceId" } } } @@ -60,7 +60,7 @@ "123.123.123.123" ] }, - "uri": "http://us-e-node1.bizzclick.com/bid?rtb_seat_id=placementId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "device": { @@ -96,7 +96,9 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id"] + "impIDs": [ + "some-impression-id" + ] }, "mockResponse": { "status": 200, @@ -119,7 +121,7 @@ } ], "type": "banner", - "seat": "bizzclick" + "seat": "blasto" } ], "cur": "USD" diff --git a/adapters/bizzclick/bizzclicktest/exemplary/native-app.json b/adapters/blasto/blastotest/exemplary/native-app.json similarity index 94% rename from adapters/bizzclick/bizzclicktest/exemplary/native-app.json rename to adapters/blasto/blastotest/exemplary/native-app.json index 65fe85085ad..946fa9e0300 100644 --- a/adapters/bizzclick/bizzclicktest/exemplary/native-app.json +++ b/adapters/blasto/blastotest/exemplary/native-app.json @@ -34,8 +34,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } } @@ -61,7 +60,7 @@ "123.123.123.123" ] }, - "uri": "http://host.bizzclick.com/bid?rtb_seat_id=sourceId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "device": { @@ -97,7 +96,9 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id"] + "impIDs": [ + "some-impression-id" + ] }, "mockResponse": { "status": 200, @@ -118,7 +119,7 @@ } ], "type": "native", - "seat": "bizzclick" + "seat": "blasto" } ], "cur": "USD" diff --git a/adapters/bizzclick/bizzclicktest/exemplary/native-web.json b/adapters/blasto/blastotest/exemplary/native-web.json similarity index 94% rename from adapters/bizzclick/bizzclicktest/exemplary/native-web.json rename to adapters/blasto/blastotest/exemplary/native-web.json index 0e36975194c..f55da66081e 100644 --- a/adapters/bizzclick/bizzclicktest/exemplary/native-web.json +++ b/adapters/blasto/blastotest/exemplary/native-web.json @@ -28,8 +28,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } } @@ -55,7 +54,7 @@ "2607:fb90:f27:4512:d800:cb23:a603:e245" ] }, - "uri": "http://host.bizzclick.com/bid?rtb_seat_id=sourceId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "device": { @@ -85,7 +84,9 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id"] + "impIDs": [ + "some-impression-id" + ] }, "mockResponse": { "status": 200, @@ -105,7 +106,7 @@ "crid": "20" } ], - "seat": "bizzclick" + "seat": "blasto" } ], "cur": "USD" diff --git a/adapters/bizzclick/bizzclicktest/exemplary/video-app.json b/adapters/blasto/blastotest/exemplary/video-app.json similarity index 93% rename from adapters/bizzclick/bizzclicktest/exemplary/video-app.json rename to adapters/blasto/blastotest/exemplary/video-app.json index 9c16795230a..64606f73b0d 100644 --- a/adapters/bizzclick/bizzclicktest/exemplary/video-app.json +++ b/adapters/blasto/blastotest/exemplary/video-app.json @@ -39,8 +39,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } } @@ -66,7 +65,7 @@ "123.123.123.123" ] }, - "uri": "http://host.bizzclick.com/bid?rtb_seat_id=sourceId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "device": { @@ -107,7 +106,9 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id"] + "impIDs": [ + "some-impression-id" + ] }, "mockResponse": { "status": 200, @@ -129,7 +130,7 @@ "h": 720 } ], - "seat": "bizzclick" + "seat": "blasto" } ], "cur": "USD" diff --git a/adapters/bizzclick/bizzclicktest/exemplary/video-web.json b/adapters/blasto/blastotest/exemplary/video-web.json similarity index 93% rename from adapters/bizzclick/bizzclicktest/exemplary/video-web.json rename to adapters/blasto/blastotest/exemplary/video-web.json index 9410fdb78df..2904880889c 100644 --- a/adapters/bizzclick/bizzclicktest/exemplary/video-web.json +++ b/adapters/blasto/blastotest/exemplary/video-web.json @@ -33,8 +33,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } } @@ -60,7 +59,7 @@ "123.123.123.123" ] }, - "uri": "http://host.bizzclick.com/bid?rtb_seat_id=sourceId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "device": { @@ -95,7 +94,9 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id"] + "impIDs": [ + "some-impression-id" + ] }, "mockResponse": { "status": 200, @@ -122,7 +123,7 @@ } } ], - "seat": "bizzclick" + "seat": "blasto" } ], "cur": "USD" diff --git a/adapters/bizzclick/bizzclicktest/supplemental/empty-seatbid-array.json b/adapters/blasto/blastotest/supplemental/empty-seatbid-array.json similarity index 93% rename from adapters/bizzclick/bizzclicktest/supplemental/empty-seatbid-array.json rename to adapters/blasto/blastotest/supplemental/empty-seatbid-array.json index 40aa5374504..9bb5ebda566 100644 --- a/adapters/bizzclick/bizzclicktest/supplemental/empty-seatbid-array.json +++ b/adapters/blasto/blastotest/supplemental/empty-seatbid-array.json @@ -39,8 +39,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } } @@ -66,7 +65,7 @@ "123.123.123.123" ] }, - "uri": "http://host.bizzclick.com/bid?rtb_seat_id=sourceId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "device": { @@ -107,7 +106,9 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id"] + "impIDs": [ + "some-impression-id" + ] }, "mockResponse": { "status": 200, diff --git a/adapters/bizzclick/bizzclicktest/supplemental/invalid-bizzclick-ext-object.json b/adapters/blasto/blastotest/supplemental/invalid-blasto-ext-object.json similarity index 100% rename from adapters/bizzclick/bizzclicktest/supplemental/invalid-bizzclick-ext-object.json rename to adapters/blasto/blastotest/supplemental/invalid-blasto-ext-object.json diff --git a/adapters/bizzclick/bizzclicktest/supplemental/invalid-response.json b/adapters/blasto/blastotest/supplemental/invalid-response.json similarity index 92% rename from adapters/bizzclick/bizzclicktest/supplemental/invalid-response.json rename to adapters/blasto/blastotest/supplemental/invalid-response.json index 4808f4823ee..620e95148a8 100644 --- a/adapters/bizzclick/bizzclicktest/supplemental/invalid-response.json +++ b/adapters/blasto/blastotest/supplemental/invalid-response.json @@ -34,8 +34,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } } @@ -61,7 +60,7 @@ "123.123.123.123" ] }, - "uri": "http://host.bizzclick.com/bid?rtb_seat_id=sourceId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "device": { @@ -97,7 +96,9 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id"] + "impIDs": [ + "some-impression-id" + ] }, "mockResponse": { "status": 200, diff --git a/adapters/bizzclick/bizzclicktest/supplemental/status-code-bad-request.json b/adapters/blasto/blastotest/supplemental/status-code-bad-request.json similarity index 90% rename from adapters/bizzclick/bizzclicktest/supplemental/status-code-bad-request.json rename to adapters/blasto/blastotest/supplemental/status-code-bad-request.json index b274c758856..df55900b99d 100644 --- a/adapters/bizzclick/bizzclicktest/supplemental/status-code-bad-request.json +++ b/adapters/blasto/blastotest/supplemental/status-code-bad-request.json @@ -33,8 +33,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } } @@ -43,7 +42,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://host.bizzclick.com/bid?rtb_seat_id=sourceId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "imp": [ @@ -78,7 +77,9 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id"] + "impIDs": [ + "some-impression-id" + ] }, "mockResponse": { "status": 400 diff --git a/adapters/bizzclick/bizzclicktest/supplemental/status-code-no-content.json b/adapters/blasto/blastotest/supplemental/status-code-no-content.json similarity index 88% rename from adapters/bizzclick/bizzclicktest/supplemental/status-code-no-content.json rename to adapters/blasto/blastotest/supplemental/status-code-no-content.json index 6163a4af0dd..f59c785b218 100644 --- a/adapters/bizzclick/bizzclicktest/supplemental/status-code-no-content.json +++ b/adapters/blasto/blastotest/supplemental/status-code-no-content.json @@ -27,8 +27,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } } @@ -37,7 +36,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://host.bizzclick.com/bid?rtb_seat_id=sourceId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "imp": [ @@ -66,7 +65,9 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id"] + "impIDs": [ + "some-impression-id" + ] }, "mockResponse": { "status": 204 diff --git a/adapters/bizzclick/bizzclicktest/supplemental/status-code-other-error.json b/adapters/blasto/blastotest/supplemental/status-code-other-error.json similarity index 89% rename from adapters/bizzclick/bizzclicktest/supplemental/status-code-other-error.json rename to adapters/blasto/blastotest/supplemental/status-code-other-error.json index af2a91110d2..c58e935a3e6 100644 --- a/adapters/bizzclick/bizzclicktest/supplemental/status-code-other-error.json +++ b/adapters/blasto/blastotest/supplemental/status-code-other-error.json @@ -27,8 +27,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } } @@ -37,7 +36,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://host.bizzclick.com/bid?rtb_seat_id=sourceId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "imp": [ @@ -66,7 +65,9 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id"] + "impIDs": [ + "some-impression-id" + ] }, "mockResponse": { "status": 306 diff --git a/adapters/bizzclick/bizzclicktest/supplemental/status-code-service-unavailable.json b/adapters/blasto/blastotest/supplemental/status-code-service-unavailable.json similarity index 89% rename from adapters/bizzclick/bizzclicktest/supplemental/status-code-service-unavailable.json rename to adapters/blasto/blastotest/supplemental/status-code-service-unavailable.json index d4c0fa392c8..d1bbba75afb 100644 --- a/adapters/bizzclick/bizzclicktest/supplemental/status-code-service-unavailable.json +++ b/adapters/blasto/blastotest/supplemental/status-code-service-unavailable.json @@ -27,8 +27,7 @@ "ext": { "bidder": { "accountId": "accountId", - "sourceId": "sourceId", - "host": "host" + "sourceId": "sourceId" } } } @@ -37,7 +36,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://host.bizzclick.com/bid?rtb_seat_id=sourceId&secret_key=accountId", + "uri": "http://t-us.blasto.ai/bid?rtb_seat_id=sourceId&secret_key=accountId", "body": { "id": "some-request-id", "imp": [ @@ -66,7 +65,9 @@ }, "tmax": 1000 }, - "impIDs":["some-impression-id"] + "impIDs": [ + "some-impression-id" + ] }, "mockResponse": { "status": 503 diff --git a/adapters/bizzclick/params_test.go b/adapters/blasto/params_test.go similarity index 71% rename from adapters/bizzclick/params_test.go rename to adapters/blasto/params_test.go index fe72e41f16b..a3c572ac3f8 100644 --- a/adapters/bizzclick/params_test.go +++ b/adapters/blasto/params_test.go @@ -1,4 +1,4 @@ -package bizzclick +package blasto import ( "encoding/json" @@ -8,7 +8,7 @@ import ( ) var validParams = []string{ - `{ "host": "ep1", "sourceId": "partner", "accountId": "hash" }`, + `{ "sourceId": "partner", "accountId": "hash" }`, } func TestValidParams(t *testing.T) { @@ -18,8 +18,8 @@ func TestValidParams(t *testing.T) { } for _, validParam := range validParams { - if err := validator.Validate(openrtb_ext.BidderBizzclick, json.RawMessage(validParam)); err != nil { - t.Errorf("Schema rejected Bizzclick params: %s", validParam) + if err := validator.Validate(openrtb_ext.BidderBlasto, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected Blasto params: %s", validParam) } } } @@ -43,7 +43,7 @@ func TestInvalidParams(t *testing.T) { } for _, invalidParam := range invalidParams { - if err := validator.Validate(openrtb_ext.BidderBizzclick, json.RawMessage(invalidParam)); err == nil { + if err := validator.Validate(openrtb_ext.BidderBlasto, json.RawMessage(invalidParam)); err == nil { t.Errorf("Schema allowed unexpected params: %s", invalidParam) } } diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index cf2892cc371..abb8cefcea5 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -53,7 +53,7 @@ import ( "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/blasto" "github.com/prebid/prebid-server/v2/adapters/bliink" "github.com/prebid/prebid-server/v2/adapters/blue" "github.com/prebid/prebid-server/v2/adapters/bluesea" @@ -268,7 +268,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderBidmyadz: bidmyadz.Builder, openrtb_ext.BidderBidsCube: bidscube.Builder, openrtb_ext.BidderBidstack: bidstack.Builder, - openrtb_ext.BidderBizzclick: bizzclick.Builder, + openrtb_ext.BidderBlasto: blasto.Builder, openrtb_ext.BidderBliink: bliink.Builder, openrtb_ext.BidderBlue: blue.Builder, openrtb_ext.BidderBluesea: bluesea.Builder, diff --git a/exchange/adapter_util.go b/exchange/adapter_util.go index 0d277d15723..73f17e609c2 100644 --- a/exchange/adapter_util.go +++ b/exchange/adapter_util.go @@ -120,6 +120,7 @@ func GetDisabledBidderWarningMessages(infos config.BidderInfos) map[string]strin "applogy": `Bidder "applogy" is no longer available in Prebid Server. Please update your configuration.`, "rhythmone": `Bidder "rhythmone" is no longer available in Prebid Server. Please update your configuration.`, "nanointeractive": `Bidder "nanointeractive" is no longer available in Prebid Server. Please update your configuration.`, + "bizzclick": `Bidder "bizzclick" is no longer available in Prebid Server. Please update your configuration. "bizzclick" has been renamed to "blasto".`, "liftoff": `Bidder "liftoff" is no longer available in Prebid Server. If you're looking to use the Vungle Exchange adapter, please rename it to "vungle" in your configuration.`, } diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 7f0c63bd767..bc3679267a9 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -69,7 +69,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderBidmyadz, BidderBidsCube, BidderBidstack, - BidderBizzclick, + BidderBlasto, BidderBliink, BidderBlue, BidderBluesea, @@ -384,7 +384,7 @@ const ( BidderBidmyadz BidderName = "bidmyadz" BidderBidsCube BidderName = "bidscube" BidderBidstack BidderName = "bidstack" - BidderBizzclick BidderName = "bizzclick" + BidderBlasto BidderName = "blasto" BidderBliink BidderName = "bliink" BidderBlue BidderName = "blue" BidderBluesea BidderName = "bluesea" diff --git a/openrtb_ext/imp_bizzclick.go b/openrtb_ext/imp_blasto.go similarity index 86% rename from openrtb_ext/imp_bizzclick.go rename to openrtb_ext/imp_blasto.go index 15a8c2d0d46..b49544895a9 100644 --- a/openrtb_ext/imp_bizzclick.go +++ b/openrtb_ext/imp_blasto.go @@ -1,6 +1,6 @@ package openrtb_ext -type ExtBizzclick struct { +type ExtBlasto struct { AccountID string `json:"accountId"` SourceID string `json:"sourceId"` Host string `json:"host"` diff --git a/static/bidder-info/bizzclick.yaml b/static/bidder-info/bizzclick.yaml deleted file mode 100644 index 9d0103bcd81..00000000000 --- a/static/bidder-info/bizzclick.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Contact support@bizzclick.com to connect with Bizzclick exchange. -# We have the following regional endpoint sub-domains: US East - us-e-node1, EU: n1, APAC: n3 -# Use Host macro to resolve the endpoint based on the datacenter. -# By default, we will use the US East sub-domain. -# Please deploy this config in each of your datacenters with the appropriate regional subdomain -endpoint: 'http://{{.Host}}.bizzclick.com/bid?rtb_seat_id={{.SourceId}}&secret_key={{.AccountID}}' -maintainer: - email: 'support@bizzclick.com' -geoscope: - - global -endpointCompression: "GZIP" -capabilities: - app: - mediaTypes: - - banner - - video - - native - site: - mediaTypes: - - banner - - video - - native diff --git a/static/bidder-info/blasto.yaml b/static/bidder-info/blasto.yaml new file mode 100644 index 00000000000..c9ba51fd1d2 --- /dev/null +++ b/static/bidder-info/blasto.yaml @@ -0,0 +1,23 @@ +# Contact support@blasto.ai to connect with Blasto exchange. +# We have the following regional endpoint sub-domains: +# US East: t-us +# EU: t-eu +# APAC: t-apac +# Please deploy this config in each of your datacenters with the appropriate regional subdomain +endpoint: 'http://t-us.blasto.ai/bid?rtb_seat_id={{.SourceId}}&secret_key={{.AccountID}}' +maintainer: + email: 'support@blasto.ai' +geoscope: + - global +endpointCompression: 'GZIP' +capabilities: + app: + mediaTypes: + - banner + - video + - native + site: + mediaTypes: + - banner + - video + - native diff --git a/static/bidder-params/bizzclick.json b/static/bidder-params/bizzclick.json deleted file mode 100644 index 3f16e990be1..00000000000 --- a/static/bidder-params/bizzclick.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Bizzclick Adapter Params", - "description": "A schema which validates params accepted by the Bizzclick adapter", - "type": "object", - "properties": { - "accountId": { - "type": "string", - "description": "Account id", - "minLength": 1 - }, - "sourceId": { - "type": "string", - "description": "Source id", - "minLength": 1 - }, - "host": { - "type": "string", - "description": "Server region", - "minLength": 1 - }, - "placementId": { - "type": "string", - "description": "Deprecated, use sourceId instead", - "minLength": 1 - } - }, - "oneOf": [ - { - "required": [ - "accountId", - "placementId" - ] - }, - { - "required": [ - "accountId", - "sourceId" - ] - } - ] -} \ No newline at end of file diff --git a/static/bidder-params/blasto.json b/static/bidder-params/blasto.json new file mode 100644 index 00000000000..a6490ab9871 --- /dev/null +++ b/static/bidder-params/blasto.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Blasto Adapter Params", + "description": "A schema which validates params accepted by the Blasto adapter", + "type": "object", + "properties": { + "accountId": { + "type": "string", + "description": "Account id", + "minLength": 1 + }, + "sourceId": { + "type": "string", + "description": "Source id", + "minLength": 1 + } + }, + "required": [ + "accountId", + "sourceId" + ] +} \ No newline at end of file From 99431ad83fa7546d8e8d60acc3feae77c815f37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdulbaki=20=C3=87am?= <71071893+bakicam@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:38:17 +0300 Subject: [PATCH 09/31] New Adapter: Admatic (#3654) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Faruk Çam --- adapters/admatic/admatic.go | 138 +++++++++++++ adapters/admatic/admatic_test.go | 29 +++ .../admatic/admatictest/exemplary/banner.json | 96 ++++++++++ .../admatictest/exemplary/multiple-imps.json | 181 ++++++++++++++++++ .../admatic/admatictest/exemplary/native.json | 86 +++++++++ .../exemplary/optional-params.json | 100 ++++++++++ .../admatic/admatictest/exemplary/video.json | 94 +++++++++ .../admatictest/supplemental/bad-request.json | 66 +++++++ .../multiple-imps-with-error.json | 119 ++++++++++++ .../response-200-without-body.json | 64 +++++++ .../supplemental/response-204.json | 59 ++++++ .../supplemental/server-error.json | 65 +++++++ adapters/admatic/params_test.go | 56 ++++++ exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_admatic.go | 6 + static/bidder-info/admatic.yaml | 20 ++ static/bidder-params/admatic.json | 20 ++ 18 files changed, 1203 insertions(+) create mode 100644 adapters/admatic/admatic.go create mode 100644 adapters/admatic/admatic_test.go create mode 100644 adapters/admatic/admatictest/exemplary/banner.json create mode 100644 adapters/admatic/admatictest/exemplary/multiple-imps.json create mode 100644 adapters/admatic/admatictest/exemplary/native.json create mode 100644 adapters/admatic/admatictest/exemplary/optional-params.json create mode 100644 adapters/admatic/admatictest/exemplary/video.json create mode 100644 adapters/admatic/admatictest/supplemental/bad-request.json create mode 100644 adapters/admatic/admatictest/supplemental/multiple-imps-with-error.json create mode 100644 adapters/admatic/admatictest/supplemental/response-200-without-body.json create mode 100644 adapters/admatic/admatictest/supplemental/response-204.json create mode 100644 adapters/admatic/admatictest/supplemental/server-error.json create mode 100644 adapters/admatic/params_test.go create mode 100644 openrtb_ext/imp_admatic.go create mode 100644 static/bidder-info/admatic.yaml create mode 100644 static/bidder-params/admatic.json diff --git a/adapters/admatic/admatic.go b/adapters/admatic/admatic.go new file mode 100644 index 00000000000..94d966dbfbe --- /dev/null +++ b/adapters/admatic/admatic.go @@ -0,0 +1,138 @@ +package admatic + +import ( + "encoding/json" + "fmt" + "net/http" + "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" +) + +type adapter struct { + endpoint *template.Template +} + +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { + endpointTemplate, err := template.New("endpointTemplate").Parse(config.Endpoint) + if err != nil { + return nil, fmt.Errorf("unable to parse endpoint template: %v", err) + } + + bidder := &adapter{ + endpoint: endpointTemplate, + } + return bidder, nil +} + +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var requests []*adapters.RequestData + var errs []error + + requestCopy := *request + for _, imp := range request.Imp { + requestCopy.Imp = []openrtb2.Imp{imp} + + endpoint, err := a.buildEndpointFromRequest(&imp) + if err != nil { + errs = append(errs, err) + continue + } + + requestJSON, err := json.Marshal(requestCopy) + if err != nil { + errs = append(errs, err) + continue + } + + request := &adapters.RequestData{ + Method: http.MethodPost, + Body: requestJSON, + Uri: endpoint, + ImpIDs: openrtb_ext.GetImpIDs(requestCopy.Imp), + } + + requests = append(requests, request) + } + + return requests, errs +} + +func (a *adapter) buildEndpointFromRequest(imp *openrtb2.Imp) (string, error) { + var impExt adapters.ExtImpBidder + if err := json.Unmarshal(imp.Ext, &impExt); err != nil { + return "", &errortypes.BadInput{ + Message: fmt.Sprintf("Failed to deserialize bidder impression extension: %v", err), + } + } + + var admaticExt openrtb_ext.ImpExtAdmatic + if err := json.Unmarshal(impExt.Bidder, &admaticExt); err != nil { + return "", &errortypes.BadInput{ + Message: fmt.Sprintf("Failed to deserialize AdMatic extension: %v", err), + } + } + + endpointParams := macros.EndpointTemplateParams{ + Host: admaticExt.Host, + } + + return macros.ResolveMacros(a.endpoint, endpointParams) +} + +func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if adapters.IsResponseStatusCodeNoContent(responseData) { + return nil, nil + } + + err := adapters.CheckResponseStatusCodeForErrors(responseData) + if err != nil { + return nil, []error{err} + } + var response openrtb2.BidResponse + if err := json.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + if len(response.Cur) != 0 { + bidResponse.Currency = response.Cur + } + + for _, seatBid := range response.SeatBid { + for i := range seatBid.Bid { + + bidMediaType, err := getMediaTypeForBid(seatBid.Bid[i].ImpID, request.Imp) + if err != nil { + return nil, []error{err} + } + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &seatBid.Bid[i], + BidType: bidMediaType, + }) + } + } + return bidResponse, nil +} + +func getMediaTypeForBid(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { + for _, imp := range imps { + if imp.ID == impID { + if imp.Banner != nil { + return openrtb_ext.BidTypeBanner, nil + } else if imp.Video != nil { + return openrtb_ext.BidTypeVideo, nil + } else if imp.Native != nil { + return openrtb_ext.BidTypeNative, nil + } + } + } + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("The impression with ID %s is not present into the request", impID), + } +} diff --git a/adapters/admatic/admatic_test.go b/adapters/admatic/admatic_test.go new file mode 100644 index 00000000000..d9e34c1eec7 --- /dev/null +++ b/adapters/admatic/admatic_test.go @@ -0,0 +1,29 @@ +package admatic + +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.BidderAdmatic, config.Adapter{ + Endpoint: "http://pbs.admatic.com.tr?host={{.Host}}"}, + config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1281, DataCenter: "2"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "admatictest", bidder) +} + +func TestEndpointTemplateMalformed(t *testing.T) { + _, buildErr := Builder(openrtb_ext.BidderAdmatic, config.Adapter{ + Endpoint: "host={{Host}}"}, config.Server{ExternalUrl: "http://hosturl.com"}) + + assert.Error(t, buildErr) +} diff --git a/adapters/admatic/admatictest/exemplary/banner.json b/adapters/admatic/admatictest/exemplary/banner.json new file mode 100644 index 00000000000..5950034a61e --- /dev/null +++ b/adapters/admatic/admatictest/exemplary/banner.json @@ -0,0 +1,96 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://pbs.admatic.com.tr?host=layer.serve.admatic.com.tr", + "body": { + "id": "test-request-id-banner", + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + "impIDs": ["test-imp-id-banner"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "admatic", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/admatic/admatictest/exemplary/multiple-imps.json b/adapters/admatic/admatictest/exemplary/multiple-imps.json new file mode 100644 index 00000000000..8738fbb7f95 --- /dev/null +++ b/adapters/admatic/admatictest/exemplary/multiple-imps.json @@ -0,0 +1,181 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + }, + { + "id": "test-imp-id-banner2", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer2.serve.admatic.com.tr", + "networkId": 123456 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://pbs.admatic.com.tr?host=layer.serve.admatic.com.tr", + "body": { + "id": "test-request-id-banner", + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + "impIDs": ["test-imp-id-banner"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "admatic", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + }, + { + "expectedRequest": { + "uri": "http://pbs.admatic.com.tr?host=layer2.serve.admatic.com.tr", + "body": { + "id": "test-request-id-banner", + "imp": [ + { + "id": "test-imp-id-banner2", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer2.serve.admatic.com.tr", + "networkId": 123456 + } + } + } + ] + }, + "impIDs": ["test-imp-id-banner2"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "admatic", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e801", + "impid": "test-imp-id-banner2", + "price": 0.5, + "adm": "some-test-ad-banner2", + "crid": "crid_11", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + }, + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e801", + "impid": "test-imp-id-banner2", + "price": 0.5, + "adm": "some-test-ad-banner2", + "crid": "crid_11", + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/admatic/admatictest/exemplary/native.json b/adapters/admatic/admatictest/exemplary/native.json new file mode 100644 index 00000000000..455406d05c2 --- /dev/null +++ b/adapters/admatic/admatictest/exemplary/native.json @@ -0,0 +1,86 @@ +{ + "mockBidRequest": { + "id": "test-request-id-native", + "imp": [ + { + "id": "test-imp-id-native", + "native": { + "request": "" + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://pbs.admatic.com.tr?host=layer.serve.admatic.com.tr", + "body": { + "id": "test-request-id-native", + "imp": [ + { + "id": "test-imp-id-native", + "native": { + "request": "" + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + "impIDs": ["test-imp-id-native"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-native", + "seatbid": [ + { + "seat": "admatic", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-native", + "price": 0.5, + "adm": "some-test-ad-native", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-native", + "price": 0.5, + "adm": "some-test-ad-native", + "crid": "crid_10", + "w": 728, + "h": 90 + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/admatic/admatictest/exemplary/optional-params.json b/adapters/admatic/admatictest/exemplary/optional-params.json new file mode 100644 index 00000000000..e1652c30899 --- /dev/null +++ b/adapters/admatic/admatictest/exemplary/optional-params.json @@ -0,0 +1,100 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345, + "bidFloor": 0.1, + "isTest": false + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://pbs.admatic.com.tr?host=layer.serve.admatic.com.tr", + "body": { + "id": "test-request-id-banner", + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345, + "bidFloor": 0.1, + "isTest": false + } + } + } + ] + }, + "impIDs": ["test-imp-id-banner"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "admatic", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/admatic/admatictest/exemplary/video.json b/adapters/admatic/admatictest/exemplary/video.json new file mode 100644 index 00000000000..58f5e89810b --- /dev/null +++ b/adapters/admatic/admatictest/exemplary/video.json @@ -0,0 +1,94 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-video-id", + "video": { + "mimes": ["video/mp4"], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://pbs.admatic.com.tr?host=layer.serve.admatic.com.tr", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-video-id", + "video": { + "mimes": ["video/mp4"], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + "impIDs": ["test-video-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-test-video-id", + "seatbid": [ + { + "seat": "test-seat", + "bid": [ + { + "id": "5dce6055-a93c-1fd0-8c29-14afc3e510fd", + "impid": "test-video-id", + "price": 0.1529, + "nurl": "test-win", + "adm": "test-video", + "adid": "92-288", + "adomain": ["advertiserdomain.com"], + "crid": "288", + "w": 300, + "h": 250 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "5dce6055-a93c-1fd0-8c29-14afc3e510fd", + "impid": "test-video-id", + "price": 0.1529, + "nurl": "test-win", + "adm": "test-video", + "adid": "92-288", + "adomain": ["advertiserdomain.com"], + "crid": "288", + "w": 300, + "h": 250 + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/admatic/admatictest/supplemental/bad-request.json b/adapters/admatic/admatictest/supplemental/bad-request.json new file mode 100644 index 00000000000..90f6ebd6c9d --- /dev/null +++ b/adapters/admatic/admatictest/supplemental/bad-request.json @@ -0,0 +1,66 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://pbs.admatic.com.tr?host=layer.serve.admatic.com.tr", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 400, + "headers": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] + } + \ No newline at end of file diff --git a/adapters/admatic/admatictest/supplemental/multiple-imps-with-error.json b/adapters/admatic/admatictest/supplemental/multiple-imps-with-error.json new file mode 100644 index 00000000000..c080e57c7e5 --- /dev/null +++ b/adapters/admatic/admatictest/supplemental/multiple-imps-with-error.json @@ -0,0 +1,119 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + }, + { + "id": "test-imp-id-banner2", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": {}, + "networkId": 12345 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://pbs.admatic.com.tr?host=layer.serve.admatic.com.tr", + "body": { + "id": "test-request-id-banner", + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + "impIDs": ["test-imp-id-banner"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "admatic", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedMakeRequestsErrors": [ + { + "value": "Failed to deserialize AdMatic extension: json: cannot unmarshal object into Go struct field ImpExtAdmatic.host of type string", + "comparison": "literal" + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/admatic/admatictest/supplemental/response-200-without-body.json b/adapters/admatic/admatictest/supplemental/response-200-without-body.json new file mode 100644 index 00000000000..8db31ad713f --- /dev/null +++ b/adapters/admatic/admatictest/supplemental/response-200-without-body.json @@ -0,0 +1,64 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://pbs.admatic.com.tr?host=layer.serve.admatic.com.tr", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200 + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "unexpected end of JSON input", + "comparison": "literal" + } + ] +} diff --git a/adapters/admatic/admatictest/supplemental/response-204.json b/adapters/admatic/admatictest/supplemental/response-204.json new file mode 100644 index 00000000000..849cc85e89b --- /dev/null +++ b/adapters/admatic/admatictest/supplemental/response-204.json @@ -0,0 +1,59 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://pbs.admatic.com.tr?host=layer.serve.admatic.com.tr", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/admatic/admatictest/supplemental/server-error.json b/adapters/admatic/admatictest/supplemental/server-error.json new file mode 100644 index 00000000000..91bb22733bc --- /dev/null +++ b/adapters/admatic/admatictest/supplemental/server-error.json @@ -0,0 +1,65 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://pbs.admatic.com.tr?host=layer.serve.admatic.com.tr", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "host": "layer.serve.admatic.com.tr", + "networkId": 12345 + } + } + } + ] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 500, + "headers": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 500. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/admatic/params_test.go b/adapters/admatic/params_test.go new file mode 100644 index 00000000000..817ee92e803 --- /dev/null +++ b/adapters/admatic/params_test.go @@ -0,0 +1,56 @@ +package admatic + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +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.BidderAdmatic, 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.BidderAdmatic, json.RawMessage(p)); err == nil { + t.Errorf("Schema allowed invalid params: %s", p) + } + } +} + +var validParams = []string{ + `{ "host": "layer.serve.admatic.com.tr", + "networkId": 1111, + "ext": { + "key1": "value1", + "key2": "value2" + } + }`, + `{"host": "layer.serve.admatic.com.tr", "networkId": 1111}`, +} + +var invalidParams = []string{ + `{"ext": { + "key1": "value1", + "key2": "value2" + }`, + `{}`, + `{"host": 123, "networkId":"1111"}`, + `{"host": "layer.serve.admatic.com.tr", "networkId":"1111"}`, + `{"host": 1111, "networkId":1111}`, +} diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index abb8cefcea5..fdbc0dbf213 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -13,6 +13,7 @@ import ( "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/admatic" "github.com/prebid/prebid-server/v2/adapters/admixer" "github.com/prebid/prebid-server/v2/adapters/adnuntius" "github.com/prebid/prebid-server/v2/adapters/adocean" @@ -228,6 +229,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderAdkernel: adkernel.Builder, openrtb_ext.BidderAdkernelAdn: adkernelAdn.Builder, openrtb_ext.BidderAdman: adman.Builder, + openrtb_ext.BidderAdmatic: admatic.Builder, openrtb_ext.BidderAdmixer: admixer.Builder, openrtb_ext.BidderAdnuntius: adnuntius.Builder, openrtb_ext.BidderAdOcean: adocean.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index bc3679267a9..5af05d90b6f 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -29,6 +29,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderAdkernel, BidderAdkernelAdn, BidderAdman, + BidderAdmatic, BidderAdmixer, BidderAdnuntius, BidderAdOcean, @@ -344,6 +345,7 @@ const ( BidderAdkernel BidderName = "adkernel" BidderAdkernelAdn BidderName = "adkernelAdn" BidderAdman BidderName = "adman" + BidderAdmatic BidderName = "admatic" BidderAdmixer BidderName = "admixer" BidderAdnuntius BidderName = "adnuntius" BidderAdOcean BidderName = "adocean" diff --git a/openrtb_ext/imp_admatic.go b/openrtb_ext/imp_admatic.go new file mode 100644 index 00000000000..89e9acc1f72 --- /dev/null +++ b/openrtb_ext/imp_admatic.go @@ -0,0 +1,6 @@ +package openrtb_ext + +type ImpExtAdmatic struct { + Host string `json:"host"` + NetworkId int `json:"networkId"` +} diff --git a/static/bidder-info/admatic.yaml b/static/bidder-info/admatic.yaml new file mode 100644 index 00000000000..a63e910b3fe --- /dev/null +++ b/static/bidder-info/admatic.yaml @@ -0,0 +1,20 @@ +endpoint: "http://pbs.admatic.com.tr?host={{.Host}}" +maintainer: + email: "prebid@admatic.com.tr" +gvlVendorID: 1281 +capabilities: + app: + mediaTypes: + - banner + - video + - native + site: + mediaTypes: + - banner + - video + - native +userSync: + # admatic supports user syncing, but requires configuration by the host. contact this + # bidder directly at the email address in this file to ask about enabling user sync. + supports: + - iframe diff --git a/static/bidder-params/admatic.json b/static/bidder-params/admatic.json new file mode 100644 index 00000000000..016a95cfb0a --- /dev/null +++ b/static/bidder-params/admatic.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "AdMatic Adapter Params", + "description": "A schema which validates params accepted by the AdMatic adapter", + "type": "object", + "properties": { + "host": { + "type": "string", + "description": "Host Name" + }, + "networkId": { + "type": "integer", + "description": "AdMatic Network Id" + } + }, + "required": [ + "host", + "networkId" + ] +} \ No newline at end of file From a1b4451ac2e5b3890a46922aa8892c29f4281891 Mon Sep 17 00:00:00 2001 From: MarinaZhuravlevaCriteo Date: Thu, 18 Jul 2024 22:14:15 +0700 Subject: [PATCH 10/31] Criteo: Add support for native (#3709) --- .../criteotest/exemplary/simple-native.json | 94 +++++++++++++++++++ static/bidder-info/criteo.yaml | 2 + 2 files changed, 96 insertions(+) create mode 100644 adapters/criteo/criteotest/exemplary/simple-native.json diff --git a/adapters/criteo/criteotest/exemplary/simple-native.json b/adapters/criteo/criteotest/exemplary/simple-native.json new file mode 100644 index 00000000000..6181ee17305 --- /dev/null +++ b/adapters/criteo/criteotest/exemplary/simple-native.json @@ -0,0 +1,94 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "https://good.site/url" + }, + "imp": [{ + "id": "test-imp-id", + "native": { + "ver": "1.1", + "request": "{\"ver\":\"1.0\",\"layout\":1,\"adunit\":1,\"plcmttype\":1,\"plcmtcnt\":1,\"seq\":0,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":75}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":60,\"hmin\":60,\"mimes\":[\"image/jpeg\",\"image/jpg\",\"image/png\"]}},{\"id\":3,\"required\":0,\"data\":{\"type\":2,\"len\":75}},{\"id\":4,\"required\":0,\"data\":{\"type\":6,\"len\":1000}},{\"id\":5,\"required\":0,\"data\":{\"type\":7,\"len\":1000}},{\"id\":6,\"required\":0,\"data\":{\"type\":11,\"len\":1000}}]}" + }, + "ext": { + "bidder": { + "zoneid": 123456 + } + } + }] + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "https://ssp-bidder.criteo.com/openrtb/pbs/auction/request?profile=230", + "body": { + "id": "test-request-id", + "site": { + "page": "https://good.site/url" + }, + "imp": [{ + "id": "test-imp-id", + "native": { + "ver": "1.1", + "request": "{\"ver\":\"1.0\",\"layout\":1,\"adunit\":1,\"plcmttype\":1,\"plcmtcnt\":1,\"seq\":0,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":75}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":60,\"hmin\":60,\"mimes\":[\"image/jpeg\",\"image/jpg\",\"image/png\"]}},{\"id\":3,\"required\":0,\"data\":{\"type\":2,\"len\":75}},{\"id\":4,\"required\":0,\"data\":{\"type\":6,\"len\":1000}},{\"id\":5,\"required\":0,\"data\":{\"type\":7,\"len\":1000}},{\"id\":6,\"required\":0,\"data\":{\"type\":11,\"len\":1000}}]}" + }, + "ext": { + "bidder": { + "zoneid": 123456 + } + } + }] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "grid", + "bid": [{ + "id": "randomid", + "impid": "test-imp-id", + "price": 0.500000, + "adid": "12345678", + "adm": "{\"ver\":\"1.0\",\"layout\":1,\"adunit\":1,\"plcmttype\":1,\"plcmtcnt\":1,\"seq\":0,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":75}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":60,\"hmin\":60,\"mimes\":[\"image/jpeg\",\"image/jpg\",\"image/png\"]}},{\"id\":3,\"required\":0,\"data\":{\"type\":2,\"len\":75}},{\"id\":4,\"required\":0,\"data\":{\"type\":6,\"len\":1000}},{\"id\":5,\"required\":0,\"data\":{\"type\":7,\"len\":1000}},{\"id\":6,\"required\":0,\"data\":{\"type\":11,\"len\":1000}}]}", + "ext": { + "prebid": { + "type": "native" + } + }, + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300 + }] + }], + "cur": "USD" + } + } + }], + + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "bid": { + "id": "randomid", + "impid": "test-imp-id", + "price": 0.5, + "adm": "{\"ver\":\"1.0\",\"layout\":1,\"adunit\":1,\"plcmttype\":1,\"plcmtcnt\":1,\"seq\":0,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":75}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":60,\"hmin\":60,\"mimes\":[\"image/jpeg\",\"image/jpg\",\"image/png\"]}},{\"id\":3,\"required\":0,\"data\":{\"type\":2,\"len\":75}},{\"id\":4,\"required\":0,\"data\":{\"type\":6,\"len\":1000}},{\"id\":5,\"required\":0,\"data\":{\"type\":7,\"len\":1000}},{\"id\":6,\"required\":0,\"data\":{\"type\":11,\"len\":1000}}]}", + "adid": "12345678", + "cid": "987", + "crid": "12345678", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "native" + } + } + }, + "type": "native" + }] + }] +} diff --git a/static/bidder-info/criteo.yaml b/static/bidder-info/criteo.yaml index d6419d463de..0695f0cc134 100644 --- a/static/bidder-info/criteo.yaml +++ b/static/bidder-info/criteo.yaml @@ -7,10 +7,12 @@ capabilities: mediaTypes: - banner - video + - native site: mediaTypes: - banner - video + - native userSync: # criteo supports user syncing, but requires configuration by the host. contact this # bidder directly at the email address in this file to ask about enabling user sync. From 5fefeaaed05e9ce9feeec34b8231ac1bd025f021 Mon Sep 17 00:00:00 2001 From: Tetiana Volkova <126241934+tetianaatsmaato@users.noreply.github.com> Date: Thu, 18 Jul 2024 17:35:11 +0200 Subject: [PATCH 11/31] Smaato: Add DSA support tests (#3749) --- .../smaato/smaatotest/exemplary/native.json | 56 +++++++++++++++++-- .../smaatotest/exemplary/simple-banner.json | 56 +++++++++++++++++-- .../smaato/smaatotest/exemplary/video.json | 56 +++++++++++++++++-- 3 files changed, 156 insertions(+), 12 deletions(-) diff --git a/adapters/smaato/smaatotest/exemplary/native.json b/adapters/smaato/smaatotest/exemplary/native.json index 46d2af28cf8..ef9b2109584 100644 --- a/adapters/smaato/smaatotest/exemplary/native.json +++ b/adapters/smaato/smaatotest/exemplary/native.json @@ -41,7 +41,18 @@ "gdpr": 1, "us_privacy": "uspConsentString", "gpp": "gppString", - "gpp_sid": [7] + "gpp_sid": [7], + "dsa": { + "dsarequired": 1, + "pubrender": 1, + "datatopub": 1, + "transparency": [ + { + "domain": "testdomain.com", + "dsaparams": [1,3] + } + ] + } } }, "ext": { @@ -98,7 +109,18 @@ "gdpr": 1, "us_privacy": "uspConsentString", "gpp": "gppString", - "gpp_sid": [7] + "gpp_sid": [7], + "dsa": { + "dsarequired": 1, + "pubrender": 1, + "datatopub": 1, + "transparency": [ + { + "domain": "testdomain.com", + "dsaparams": [1,3] + } + ] + } } }, "ext": { @@ -129,7 +151,20 @@ "nurl": "https://nurl", "price": 0.01, "w": 480, - "h": 320 + "h": 320, + "ext": { + "dsa": { + "behalf": "Advertiser", + "paid": "Advertiser", + "adrender": 1, + "transparency": [ + { + "domain": "dsp1domain.com", + "dsaparams": [1,3] + } + ] + } + } } ] } @@ -159,7 +194,20 @@ "price": 0.01, "w": 480, "h": 320, - "exp": 300 + "exp": 300, + "ext": { + "dsa": { + "behalf": "Advertiser", + "paid": "Advertiser", + "adrender": 1, + "transparency": [ + { + "domain": "dsp1domain.com", + "dsaparams": [1,3] + } + ] + } + } }, "type": "native" } diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner.json b/adapters/smaato/smaatotest/exemplary/simple-banner.json index 00dce8f3b17..d7d348d64a1 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner.json @@ -66,7 +66,18 @@ "gdpr": 1, "us_privacy": "uspConsentString", "gpp": "gppString", - "gpp_sid": [7] + "gpp_sid": [7], + "dsa": { + "dsarequired": 1, + "pubrender": 1, + "datatopub": 1, + "transparency": [ + { + "domain": "testdomain.com", + "dsaparams": [1,3] + } + ] + } } } }, @@ -120,7 +131,18 @@ "gdpr": 1, "us_privacy": "uspConsentString", "gpp": "gppString", - "gpp_sid": [7] + "gpp_sid": [7], + "dsa": { + "dsarequired": 1, + "pubrender": 1, + "datatopub": 1, + "transparency": [ + { + "domain": "testdomain.com", + "dsaparams": [1,3] + } + ] + } } }, "site": { @@ -158,7 +180,20 @@ "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", "price": 0.01, "w": 350, - "h": 50 + "h": 50, + "ext": { + "dsa": { + "behalf": "Advertiser", + "paid": "Advertiser", + "adrender": 1, + "transparency": [ + { + "domain": "dsp1domain.com", + "dsaparams": [1,3] + } + ] + } + } } ] } @@ -188,7 +223,20 @@ "price": 0.01, "w": 350, "h": 50, - "exp": 300 + "exp": 300, + "ext": { + "dsa": { + "behalf": "Advertiser", + "paid": "Advertiser", + "adrender": 1, + "transparency": [ + { + "domain": "dsp1domain.com", + "dsaparams": [1,3] + } + ] + } + } }, "type": "banner" } diff --git a/adapters/smaato/smaatotest/exemplary/video.json b/adapters/smaato/smaatotest/exemplary/video.json index 54ef43bf12a..1aa7d5a557c 100644 --- a/adapters/smaato/smaatotest/exemplary/video.json +++ b/adapters/smaato/smaatotest/exemplary/video.json @@ -69,7 +69,18 @@ "gdpr": 1, "us_privacy": "uspConsentString", "gpp": "gppString", - "gpp_sid": [7] + "gpp_sid": [7], + "dsa": { + "dsarequired": 1, + "pubrender": 1, + "datatopub": 1, + "transparency": [ + { + "domain": "testdomain.com", + "dsaparams": [1,3] + } + ] + } } }, "ext": { @@ -146,7 +157,18 @@ "gdpr": 1, "us_privacy": "uspConsentString", "gpp": "gppString", - "gpp_sid": [7] + "gpp_sid": [7], + "dsa": { + "dsarequired": 1, + "pubrender": 1, + "datatopub": 1, + "transparency": [ + { + "domain": "testdomain.com", + "dsaparams": [1,3] + } + ] + } } }, "device": { @@ -185,7 +207,20 @@ "nurl": "https://nurl", "price": 0.01, "w": 1024, - "h": 768 + "h": 768, + "ext": { + "dsa": { + "behalf": "Advertiser", + "paid": "Advertiser", + "adrender": 1, + "transparency": [ + { + "domain": "dsp1domain.com", + "dsaparams": [1,3] + } + ] + } + } } ] } @@ -215,7 +250,20 @@ "price": 0.01, "w": 1024, "h": 768, - "exp": 300 + "exp": 300, + "ext": { + "dsa": { + "behalf": "Advertiser", + "paid": "Advertiser", + "adrender": 1, + "transparency": [ + { + "domain": "dsp1domain.com", + "dsaparams": [1,3] + } + ] + } + } }, "type": "video" } From 0a3271dc7808d8da9d49c018deea365eaa53bc14 Mon Sep 17 00:00:00 2001 From: Boris Yu Date: Mon, 22 Jul 2024 12:53:25 +0300 Subject: [PATCH 12/31] New Adapter: Displayio (#3691) authored by @xdevel --- adapters/displayio/displayio.go | 197 ++++++++++++++++ adapters/displayio/displayio_test.go | 22 ++ .../displayiotest/exemplary/multi-format.json | 147 ++++++++++++ .../displayiotest/exemplary/multi-imp.json | 211 ++++++++++++++++++ .../exemplary/simple-banner.json | 117 ++++++++++ .../displayiotest/exemplary/simple-video.json | 124 ++++++++++ .../supplemental/bad-response.json | 77 +++++++ .../supplemental/currency-conversion.json | 95 ++++++++ .../displayiotest/supplemental/ext.json | 30 +++ .../supplemental/missing-bidfloor.json | 35 +++ .../supplemental/nobid-response.json | 72 ++++++ .../supplemental/response-code-invalid.json | 74 ++++++ .../supplemental/seatbid-response.json | 77 +++++++ .../supplemental/unexpected-media-type.json | 105 +++++++++ adapters/displayio/params_test.go | 48 ++++ exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_displayio.go | 7 + static/bidder-info/displayio.yaml | 16 ++ static/bidder-params/displayio.json | 25 +++ 20 files changed, 1483 insertions(+) create mode 100644 adapters/displayio/displayio.go create mode 100644 adapters/displayio/displayio_test.go create mode 100644 adapters/displayio/displayiotest/exemplary/multi-format.json create mode 100644 adapters/displayio/displayiotest/exemplary/multi-imp.json create mode 100644 adapters/displayio/displayiotest/exemplary/simple-banner.json create mode 100644 adapters/displayio/displayiotest/exemplary/simple-video.json create mode 100644 adapters/displayio/displayiotest/supplemental/bad-response.json create mode 100644 adapters/displayio/displayiotest/supplemental/currency-conversion.json create mode 100644 adapters/displayio/displayiotest/supplemental/ext.json create mode 100644 adapters/displayio/displayiotest/supplemental/missing-bidfloor.json create mode 100644 adapters/displayio/displayiotest/supplemental/nobid-response.json create mode 100644 adapters/displayio/displayiotest/supplemental/response-code-invalid.json create mode 100644 adapters/displayio/displayiotest/supplemental/seatbid-response.json create mode 100644 adapters/displayio/displayiotest/supplemental/unexpected-media-type.json create mode 100644 adapters/displayio/params_test.go create mode 100644 openrtb_ext/imp_displayio.go create mode 100644 static/bidder-info/displayio.yaml create mode 100644 static/bidder-params/displayio.json diff --git a/adapters/displayio/displayio.go b/adapters/displayio/displayio.go new file mode 100644 index 00000000000..a3af7c9614f --- /dev/null +++ b/adapters/displayio/displayio.go @@ -0,0 +1,197 @@ +package displayio + +import ( + "encoding/json" + "errors" + "fmt" + "net/http" + "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" +) + +type adapter struct { + endpoint *template.Template +} + +type reqDioExt struct { + UserSession string `json:"userSession,omitempty"` + PlacementId string `json:"placementId"` + InventoryId string `json:"inventoryId"` +} + +func (adapter *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + headers.Add("x-openrtb-version", "2.5") + + result := make([]*adapters.RequestData, 0, len(request.Imp)) + errs := make([]error, 0, len(request.Imp)) + + for _, impression := range request.Imp { + var requestExt map[string]interface{} + + if impression.BidFloor == 0 { + errs = append(errs, &errortypes.BadInput{ + Message: "BidFloor should be defined", + }) + continue + } + + if impression.BidFloorCur == "" { + impression.BidFloorCur = "USD" + } + + if impression.BidFloorCur != "USD" { + convertedValue, err := requestInfo.ConvertCurrency(impression.BidFloor, impression.BidFloorCur, "USD") + + if err != nil { + errs = append(errs, err) + continue + } + + impression.BidFloorCur = "USD" + impression.BidFloor = convertedValue + } + + if len(impression.Ext) == 0 { + errs = append(errs, errors.New("impression extensions required")) + continue + } + + var bidderExt adapters.ExtImpBidder + err := json.Unmarshal(impression.Ext, &bidderExt) + + if err != nil { + errs = append(errs, err) + continue + } + + var impressionExt openrtb_ext.ExtImpDisplayio + err = json.Unmarshal(bidderExt.Bidder, &impressionExt) + if err != nil { + errs = append(errs, err) + continue + } + + dioExt := reqDioExt{PlacementId: impressionExt.PlacementId, InventoryId: impressionExt.InventoryId} + + requestCopy := *request + + err = json.Unmarshal(requestCopy.Ext, &requestExt) + if err != nil { + requestExt = make(map[string]interface{}) + } + + requestExt["displayio"] = dioExt + + requestCopy.Ext, err = json.Marshal(requestExt) + if err != nil { + errs = append(errs, err) + continue + } + + requestCopy.Imp = []openrtb2.Imp{impression} + body, err := json.Marshal(requestCopy) + if err != nil { + errs = append(errs, err) + continue + } + + url, err := adapter.buildEndpointURL(&impressionExt) + if err != nil { + return nil, []error{err} + } + + result = append(result, &adapters.RequestData{ + Method: "POST", + Uri: url, + Body: body, + Headers: headers, + ImpIDs: openrtb_ext.GetImpIDs(requestCopy.Imp), + }) + } + + if len(result) == 0 { + return nil, errs + } + return result, errs +} + +// MakeBids translates Displayio bid response to prebid-server specific format +func (adapter *adapter) MakeBids(internalRequest *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 bidResp openrtb2.BidResponse + + if err := json.Unmarshal(responseData.Body, &bidResp); err != nil { + msg := fmt.Sprintf("Bad server response: %d", err) + return nil, []error{&errortypes.BadServerResponse{Message: msg}} + } + + if len(bidResp.SeatBid) != 1 { + msg := fmt.Sprintf("Invalid SeatBids count: %d", len(bidResp.SeatBid)) + return nil, []error{&errortypes.BadServerResponse{Message: msg}} + } + + var errs []error + bidResponse := adapters.NewBidderResponse() + + for _, sb := range bidResp.SeatBid { + for i := range sb.Bid { + bidType, err := getBidMediaTypeFromMtype(&sb.Bid[i]) + if err != nil { + errs = append(errs, err) + } else { + b := &adapters.TypedBid{ + Bid: &sb.Bid[i], + BidType: bidType, + } + bidResponse.Bids = append(bidResponse.Bids, b) + } + } + } + + return bidResponse, errs +} + +func Builder(_ openrtb_ext.BidderName, config config.Adapter, _ config.Server) (adapters.Bidder, error) { + endpoint, 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: endpoint, + } + return bidder, nil +} + +func getBidMediaTypeFromMtype(bid *openrtb2.Bid) (openrtb_ext.BidType, error) { + switch bid.MType { + case openrtb2.MarkupBanner: + return openrtb_ext.BidTypeBanner, nil + case openrtb2.MarkupVideo: + return openrtb_ext.BidTypeVideo, nil + default: + return "", fmt.Errorf("unexpected media type for bid: %s", bid.ImpID) + } +} + +func (adapter *adapter) buildEndpointURL(params *openrtb_ext.ExtImpDisplayio) (string, error) { + endpointParams := macros.EndpointTemplateParams{PublisherID: params.PublisherId} + return macros.ResolveMacros(adapter.endpoint, endpointParams) +} diff --git a/adapters/displayio/displayio_test.go b/adapters/displayio/displayio_test.go new file mode 100644 index 00000000000..9f41a59e2a0 --- /dev/null +++ b/adapters/displayio/displayio_test.go @@ -0,0 +1,22 @@ +package displayio + +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" +) + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderDisplayio, + config.Adapter{Endpoint: "https://adapter.endpoint/?macro={{.PublisherID}}"}, + config.Server{ExternalUrl: "https://server.endpoint/"}, + ) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "displayiotest", bidder) +} diff --git a/adapters/displayio/displayiotest/exemplary/multi-format.json b/adapters/displayio/displayiotest/exemplary/multi-format.json new file mode 100644 index 00000000000..c0e149a8c46 --- /dev/null +++ b/adapters/displayio/displayiotest/exemplary/multi-format.json @@ -0,0 +1,147 @@ +{ + "mockBidRequest": { + "id": "requestId10111011101110111011", + "app": { + "id": "1011" + }, + "imp": [ + { + "id": "impId10111011101110111011", + "tagid": "1011", + "ext": { + "bidder": { + "placementId": "1011", + "publisherId": "101", + "inventoryId": "1011" + } + }, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 5 + ], + "w": 640, + "h": 480 + }, + "bidfloor": 0.5, + "bidfloorcur": "USD" + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://adapter.endpoint/?macro=101", + "body": { + "id": "requestId10111011101110111011", + "app": { + "id": "1011" + }, + "imp": [ + { + "id": "impId10111011101110111011", + "tagid": "1011", + "ext": { + "bidder": { + "placementId": "1011", + "publisherId": "101", + "inventoryId": "1011" + } + }, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 5 + ], + "w": 640, + "h": 480 + }, + "bidfloor": 0.5, + "bidfloorcur": "USD" + } + ], + "ext": { + "displayio": { + "placementId": "1011", + "inventoryId": "1011" + } + } + }, + "impIDs": [ + "impId10111011101110111011" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "bidid": "5778926625248726496", + "seatbid": [ + { + "seat": "seat1", + "bid": [ + { + "id": "12345", + "impid": "impId10111011101110111011", + "price": 0.01, + "adm": "", + "adomain": [ + "domain.test" + ], + "w": 300, + "h": 250, + "mtype": 1 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "12345", + "impid": "impId10111011101110111011", + "price": 0.01, + "adm": "", + "adomain": [ + "domain.test" + ], + "w": 300, + "h": 250, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/displayio/displayiotest/exemplary/multi-imp.json b/adapters/displayio/displayiotest/exemplary/multi-imp.json new file mode 100644 index 00000000000..8588ea5bf01 --- /dev/null +++ b/adapters/displayio/displayiotest/exemplary/multi-imp.json @@ -0,0 +1,211 @@ +{ + "mockBidRequest": { + "id": "test-request-multi-id", + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "placementId": "1010", + "publisherId": "2020", + "inventoryId": "3030" + } + }, + "bidfloor": 0.5 + }, + { + "id": "test-imp-id-2", + "banner": { + "format": [ + { + "w": 300, + "h": 150 + } + ] + }, + "ext": { + "bidder": { + "placementId": "4040", + "publisherId": "5050", + "inventoryId": "6060" + } + }, + "bidfloor": 0.5 + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://adapter.endpoint/?macro=2020", + "body": { + "id": "test-request-multi-id", + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "placementId": "1010", + "publisherId": "2020", + "inventoryId": "3030" + } + }, + "bidfloor": 0.5, + "bidfloorcur": "USD" + } + ], + "ext": { + "displayio": { + "placementId": "1010", + "inventoryId": "3030" + } + } + }, + "impIDs": [ + "test-imp-id-1" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-multi-id", + "seatbid": [ + { + "seat": "seat1", + "bid": [ + { + "id": "testid1", + "impid": "test-imp-id-1", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "mtype": 1, + "h": 90, + "w": 728 + } + ] + } + ], + "cur": "USD" + } + } + }, + { + "expectedRequest": { + "uri": "https://adapter.endpoint/?macro=5050", + "body": { + "id": "test-request-multi-id", + "imp": [ + { + "id": "test-imp-id-2", + "banner": { + "format": [ + { + "w": 300, + "h": 150 + } + ] + }, + "ext": { + "bidder": { + "placementId": "4040", + "publisherId": "5050", + "inventoryId": "6060" + } + }, + "bidfloor": 0.5, + "bidfloorcur": "USD" + } + ], + "ext": { + "displayio": { + "placementId": "4040", + "inventoryId": "6060" + } + } + }, + "impIDs": [ + "test-imp-id-2" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-multi-id", + "seatbid": [ + { + "seat": "seat2", + "bid": [ + { + "id": "testid2", + "impid": "test-imp-id-2", + "price": 0.800000, + "adm": "some-test-ad", + "crid": "crid_11", + "mtype": 1, + "h": 150, + "w": 300 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "testid1", + "impid": "test-imp-id-1", + "price": 0.5, + "adm": "some-test-ad", + "crid": "crid_10", + "mtype": 1, + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + }, + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "testid2", + "impid": "test-imp-id-2", + "price": 0.8, + "adm": "some-test-ad", + "crid": "crid_11", + "mtype": 1, + "w": 300, + "h": 150 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/displayio/displayiotest/exemplary/simple-banner.json b/adapters/displayio/displayiotest/exemplary/simple-banner.json new file mode 100644 index 00000000000..15a5f913210 --- /dev/null +++ b/adapters/displayio/displayiotest/exemplary/simple-banner.json @@ -0,0 +1,117 @@ +{ + "mockBidRequest": { + "app": { + "id": "1011" + }, + "id": "requestId10111011101110111011", + "imp": [ + { + "banner": { + "h": 250, + "w": 300 + }, + "bidfloor": 0.225, + "bidfloorcur": "USD", + "id": "impId10111011101110111011", + "ext": { + "bidder": { + "placementId": "1011", + "publisherId": "101", + "inventoryId": "1011" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://adapter.endpoint/?macro=101", + "body": { + "id": "requestId10111011101110111011", + "app": { + "id": "1011" + }, + "imp": [ + { + "banner": { + "h": 250, + "w": 300 + }, + "bidfloor": 0.225, + "bidfloorcur": "USD", + "id": "impId10111011101110111011", + "ext": { + "bidder": { + "placementId": "1011", + "publisherId": "101", + "inventoryId": "1011" + } + } + } + ], + "ext": { + "displayio": { + "placementId": "1011", + "inventoryId": "1011" + } + } + }, + "impIDs": [ + "impId10111011101110111011" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "12345", + "impid": "impId10111011101110111011", + "price": 0.01, + "adm": "", + "adid": "12235", + "adomain": [ + "domain.test" + ], + "w": 300, + "h": 250, + "mtype": 1 + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "12345", + "impid": "impId10111011101110111011", + "price": 0.01, + "adm": "", + "adid": "12235", + "adomain": [ + "domain.test" + ], + "w": 300, + "h": 250, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/displayio/displayiotest/exemplary/simple-video.json b/adapters/displayio/displayiotest/exemplary/simple-video.json new file mode 100644 index 00000000000..b5d027f33ba --- /dev/null +++ b/adapters/displayio/displayiotest/exemplary/simple-video.json @@ -0,0 +1,124 @@ +{ + "mockBidRequest": { + "app": { + "id": "1011" + }, + "id": "requestId10111011101110111011", + "imp": [ + { + "video": { + "mimes": [ + "video/mp4" + ], + "w": 300, + "h": 250 + }, + "bidfloor": 0.5, + "bidfloorcur": "USD", + "id": "impId10111011101110111011", + "ext": { + "bidder": { + "placementId": "1011", + "publisherId": "101", + "inventoryId": "1011" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://adapter.endpoint/?macro=101", + "body": { + "app": { + "id": "1011" + }, + "id": "requestId10111011101110111011", + "imp": [ + { + "video": { + "mimes": [ + "video/mp4" + ], + "w": 300, + "h": 250 + }, + "bidfloor": 0.5, + "bidfloorcur": "USD", + "id": "impId10111011101110111011", + "ext": { + "bidder": { + "placementId": "1011", + "publisherId": "101", + "inventoryId": "1011" + } + } + } + ], + "ext": { + "displayio": { + "placementId": "1011", + "inventoryId": "1011" + } + } + }, + "impIDs": [ + "impId10111011101110111011" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "requestId10111011101110111011", + "seatbid": [ + { + "bid": [ + { + "id": "12345", + "impid": "impId10111011101110111011", + "price": 2, + "adm": "", + "adid": "12235", + "adomain": [ + "domain.test" + ], + "w": 300, + "h": 250, + "mtype": 2 + } + ], + "seat": "displayio123", + "group": 1 + } + ], + "bidid": "test123", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "12345", + "impid": "impId10111011101110111011", + "price": 2, + "adm": "", + "adid": "12235", + "adomain": [ + "domain.test" + ], + "w": 300, + "h": 250, + "mtype": 2 + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/displayio/displayiotest/supplemental/bad-response.json b/adapters/displayio/displayiotest/supplemental/bad-response.json new file mode 100644 index 00000000000..98cc44e8626 --- /dev/null +++ b/adapters/displayio/displayiotest/supplemental/bad-response.json @@ -0,0 +1,77 @@ +{ + "mockBidRequest": { + "id": "testid", + "imp": [ + { + "id": "testimpid", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "bidfloor": 0.01, + "ext": { + "bidder": { + "placementId": "1101", + "inventoryId": "1101", + "publisherId": "101" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://adapter.endpoint/?macro=101", + "body": { + "id": "testid", + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "id": "testimpid", + "bidfloor": 0.01, + "bidfloorcur": "USD", + "ext": { + "bidder": { + "placementId": "1101", + "inventoryId": "1101", + "publisherId": "101" + } + } + } + ], + "ext": { + "displayio": { + "placementId": "1101", + "inventoryId": "1101" + } + } + }, + "impIDs": [ + "testimpid" + ] + }, + "mockResponse": { + "status": 200, + "body": "" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Bad server response: .*", + "comparison": "regex" + } + ] +} \ No newline at end of file diff --git a/adapters/displayio/displayiotest/supplemental/currency-conversion.json b/adapters/displayio/displayiotest/supplemental/currency-conversion.json new file mode 100644 index 00000000000..32b6b2a16b4 --- /dev/null +++ b/adapters/displayio/displayiotest/supplemental/currency-conversion.json @@ -0,0 +1,95 @@ +{ + "mockBidRequest": { + "id": "testid", + "imp": [ + { + "id": "testimpid", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placementId": "1101", + "inventoryId": "1101", + "publisherId": "101" + } + }, + "bidfloor": 100, + "bidfloorcur": "RUB" + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "RUB": { + "USD": 0.01 + } + }, + "usepbsrates": false + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://adapter.endpoint/?macro=101", + "body": { + "id": "testid", + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "id": "testimpid", + "bidfloorcur": "USD", + "bidfloor": 1, + "ext": { + "bidder": { + "placementId": "1101", + "inventoryId": "1101", + "publisherId": "101" + } + } + } + ], + "ext": { + "displayio": { + "placementId": "1101", + "inventoryId": "1101" + }, + "prebid": { + "currency": { + "rates": { + "RUB": { + "USD": 0.01 + } + }, + "usepbsrates": false + } + } + } + }, + "impIDs": [ + "testimpid" + ] + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedMakeRequestsErrors": [], + "expectedBidResponses": [] +} \ No newline at end of file diff --git a/adapters/displayio/displayiotest/supplemental/ext.json b/adapters/displayio/displayiotest/supplemental/ext.json new file mode 100644 index 00000000000..ad0835d1c61 --- /dev/null +++ b/adapters/displayio/displayiotest/supplemental/ext.json @@ -0,0 +1,30 @@ +{ + "mockBidRequest": { + "id": "testid", + "imp": [ + { + "id": "testimpid", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 50 + } + ] + }, + "bidfloor": 0.5, + "bidfloorcur": "USD" + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "impression extensions required", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/displayio/displayiotest/supplemental/missing-bidfloor.json b/adapters/displayio/displayiotest/supplemental/missing-bidfloor.json new file mode 100644 index 00000000000..d3fe15778ff --- /dev/null +++ b/adapters/displayio/displayiotest/supplemental/missing-bidfloor.json @@ -0,0 +1,35 @@ +{ + "mockBidRequest": { + "id": "testid", + "imp": [ + { + "id": "testimpid", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 50 + } + ] + }, + "ext": { + "bidder": { + "placementId": "1101", + "inventoryId": "1101", + "publisherId": "101" + } + } + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "BidFloor should be defined", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/displayio/displayiotest/supplemental/nobid-response.json b/adapters/displayio/displayiotest/supplemental/nobid-response.json new file mode 100644 index 00000000000..ccfb2c12ca8 --- /dev/null +++ b/adapters/displayio/displayiotest/supplemental/nobid-response.json @@ -0,0 +1,72 @@ +{ + "mockBidRequest": { + "id": "testid", + "imp": [ + { + "id": "testimpid", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placementId": "1101", + "inventoryId": "1101", + "publisherId": "101" + } + }, + "bidfloor": 0.5, + "bidfloorcur": "USD" + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://adapter.endpoint/?macro=101", + "body": { + "id": "testid", + "imp": [ + { + "id": "testimpid", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placementId": "1101", + "inventoryId": "1101", + "publisherId": "101" + } + }, + "bidfloor": 0.5, + "bidfloorcur": "USD" + } + ], + "ext": { + "displayio": { + "placementId": "1101", + "inventoryId": "1101" + } + } + }, + "impIDs": [ + "testimpid" + ] + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/displayio/displayiotest/supplemental/response-code-invalid.json b/adapters/displayio/displayiotest/supplemental/response-code-invalid.json new file mode 100644 index 00000000000..4bfa579c672 --- /dev/null +++ b/adapters/displayio/displayiotest/supplemental/response-code-invalid.json @@ -0,0 +1,74 @@ +{ + "mockBidRequest": { + "id": "testid", + "imp": [ + { + "id": "testimpid", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "bidfloor": 0.01, + "ext": { + "bidder": { + "placementId": "1101", + "inventoryId": "1101", + "publisherId": "101" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://adapter.endpoint/?macro=101", + "body": { + "id": "testid", + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "bidfloor": 0.01, + "bidfloorcur": "USD", + "id": "testimpid", + "ext": { + "bidder": { + "placementId": "1101", + "inventoryId": "1101", + "publisherId": "101" + } + } + } + ], + "ext": { + "displayio": { + "placementId": "1101", + "inventoryId": "1101" + } + } + }, + "impIDs":["testimpid"] + }, + "mockResponse": { + "status": 400 + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: [0-9]{3,3}. Run with request.debug = 1 for more info", + "comparison": "regex" + } + ] +} \ No newline at end of file diff --git a/adapters/displayio/displayiotest/supplemental/seatbid-response.json b/adapters/displayio/displayiotest/supplemental/seatbid-response.json new file mode 100644 index 00000000000..f0467d1f0bb --- /dev/null +++ b/adapters/displayio/displayiotest/supplemental/seatbid-response.json @@ -0,0 +1,77 @@ +{ + "mockBidRequest": { + "id": "testid", + "imp": [ + { + "id": "testimpid", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "bidfloor": 0.01, + "ext": { + "bidder": { + "placementId": "1101", + "inventoryId": "1101", + "publisherId": "101" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://adapter.endpoint/?macro=101", + "body": { + "id": "testid", + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "id": "testimpid", + "bidfloor": 0.01, + "bidfloorcur": "USD", + "ext": { + "bidder": { + "placementId": "1101", + "inventoryId": "1101", + "publisherId": "101" + } + } + } + ], + "ext": { + "displayio": { + "placementId": "1101", + "inventoryId": "1101" + } + } + }, + "impIDs":["testimpid"] + }, + "mockResponse": { + "status": 200, + "body": { + "seatbid": [] + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Invalid SeatBids count: 0", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/displayio/displayiotest/supplemental/unexpected-media-type.json b/adapters/displayio/displayiotest/supplemental/unexpected-media-type.json new file mode 100644 index 00000000000..be66747a4c4 --- /dev/null +++ b/adapters/displayio/displayiotest/supplemental/unexpected-media-type.json @@ -0,0 +1,105 @@ +{ + "mockBidRequest": { + "app": { + "id": "1011" + }, + "id": "requestId10111011101110111011", + "imp": [ + { + "banner": { + "h": 250, + "w": 300 + }, + "bidfloor": 0.225, + "bidfloorcur": "USD", + "id": "impId10111011101110111011", + "ext": { + "bidder": { + "placementId": "1011", + "publisherId": "101", + "inventoryId": "1011" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://adapter.endpoint/?macro=101", + "body": { + "id": "requestId10111011101110111011", + "app": { + "id": "1011" + }, + "imp": [ + { + "banner": { + "h": 250, + "w": 300 + }, + "bidfloor": 0.225, + "bidfloorcur": "USD", + "id": "impId10111011101110111011", + "ext": { + "bidder": { + "placementId": "1011", + "publisherId": "101", + "inventoryId": "1011" + } + } + } + ], + "ext": { + "displayio": { + "placementId": "1011", + "inventoryId": "1011" + } + } + }, + "impIDs": [ + "impId10111011101110111011" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "12345", + "impid": "impId10111011101110111011", + "price": 0.01, + "adm": "", + "adomain": [ + "domain.test" + ], + "w": 300, + "h": 250, + "mtype": 5 + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [] + } + ], + "expectedMakeBidsErrors": [ + { + "value": "unexpected media type for bid: .*", + "comparison": "regex" + } + ] +} \ No newline at end of file diff --git a/adapters/displayio/params_test.go b/adapters/displayio/params_test.go new file mode 100644 index 00000000000..f3e1de922a2 --- /dev/null +++ b/adapters/displayio/params_test.go @@ -0,0 +1,48 @@ +package displayio + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderDisplayio, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected dmx params: %s", validParam) + } + } + for _, invalidParam := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderDisplayio, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema was not supposed to be valid: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"placementId": "anyPlacementId", "publisherId":"anyPublisherId", "inventoryId":"anyInventoryId"}`, +} + +var invalidParams = []string{ + `null`, + `nil`, + ``, + `[]`, + `true`, + `{}`, + `{"placementId": 1, "publisherId":"anyPublisherId", "inventoryId":"anyInventoryId"}`, + `{"placementId": "anyPlacementId", "publisherId":1, "inventoryId":"anyInventoryId"}`, + `{"placementId": "anyPlacementId", "publisherId":"anyPublisherId", "inventoryId":1}`, + `{"publisherId":"anyPublisherId", "inventoryId":"anyInventoryId"}`, + `{"placementId": "anyPlacementId", "inventoryId":"anyInventoryId"}`, + `{"placementId": "anyPlacementId", "publisherId":"anyPublisherId"}`, + `{"placementId": "anyPlacementId"}`, + `{"inventoryId":"anyInventoryId"}`, + `{"publisherId":"anyPublisherId"}`, +} diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index fdbc0dbf213..6edc325a56d 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -80,6 +80,7 @@ import ( "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/displayio" "github.com/prebid/prebid-server/v2/adapters/dmx" "github.com/prebid/prebid-server/v2/adapters/driftpixel" "github.com/prebid/prebid-server/v2/adapters/dxkulture" @@ -296,6 +297,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderDeepintent: deepintent.Builder, openrtb_ext.BidderDefinemedia: definemedia.Builder, openrtb_ext.BidderDianomi: dianomi.Builder, + openrtb_ext.BidderDisplayio: displayio.Builder, openrtb_ext.BidderEdge226: edge226.Builder, openrtb_ext.BidderDmx: dmx.Builder, openrtb_ext.BidderDXKulture: dxkulture.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 5af05d90b6f..7f278c6b82f 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -96,6 +96,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderDeepintent, BidderDefinemedia, BidderDianomi, + BidderDisplayio, BidderEdge226, BidderDmx, BidderDXKulture, @@ -412,6 +413,7 @@ const ( BidderDeepintent BidderName = "deepintent" BidderDefinemedia BidderName = "definemedia" BidderDianomi BidderName = "dianomi" + BidderDisplayio BidderName = "displayio" BidderEdge226 BidderName = "edge226" BidderDmx BidderName = "dmx" BidderDXKulture BidderName = "dxkulture" diff --git a/openrtb_ext/imp_displayio.go b/openrtb_ext/imp_displayio.go new file mode 100644 index 00000000000..bb8c2020276 --- /dev/null +++ b/openrtb_ext/imp_displayio.go @@ -0,0 +1,7 @@ +package openrtb_ext + +type ExtImpDisplayio struct { + PublisherId string `json:"publisherId"` + InventoryId string `json:"inventoryId"` + PlacementId string `json:"placementId"` +} diff --git a/static/bidder-info/displayio.yaml b/static/bidder-info/displayio.yaml new file mode 100644 index 00000000000..4b3b28b745a --- /dev/null +++ b/static/bidder-info/displayio.yaml @@ -0,0 +1,16 @@ +endpoint: "https://prebid.display.io/?publisher={{.PublisherID}}" +endpointCompression: gzip +geoscope: + - global +maintainer: + email: contact@display.io +modifyingVastXmlAllowed: true +capabilities: + app: + mediaTypes: + - banner + - video + site: + mediaTypes: + - banner + - video \ No newline at end of file diff --git a/static/bidder-params/displayio.json b/static/bidder-params/displayio.json new file mode 100644 index 00000000000..1a3fe3875d4 --- /dev/null +++ b/static/bidder-params/displayio.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Display.io Adapter Params", + "description": "A schema which validates params accepted by the Display.io adapter", + "type": "object", + "properties": { + "publisherId": { + "type": "string", + "description": "Publisher Id" + }, + "inventoryId": { + "type": "string", + "description": "Inventory Id" + }, + "placementId": { + "type": "string", + "description": "Placement Id" + } + }, + "required": [ + "publisherId", + "inventoryId", + "placementId" + ] +} \ No newline at end of file From da658e787f536d21769a49316d7d2c5dff39e323 Mon Sep 17 00:00:00 2001 From: Tactics Technology LLC Date: Mon, 22 Jul 2024 03:02:08 -0700 Subject: [PATCH 13/31] CPMStar: add gvlVendorID (#3779) --- static/bidder-info/cpmstar.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/static/bidder-info/cpmstar.yaml b/static/bidder-info/cpmstar.yaml index 94a91e5a3ad..82cb0d0632d 100644 --- a/static/bidder-info/cpmstar.yaml +++ b/static/bidder-info/cpmstar.yaml @@ -1,6 +1,7 @@ endpoint: "https://server.cpmstar.com/openrtbbidrq.aspx" maintainer: email: "prebid@cpmstar.com" +gvlVendorID: 1317 capabilities: app: mediaTypes: From 0f5a1fe23db348a7de010f16d7b4b951f307abd4 Mon Sep 17 00:00:00 2001 From: Adprime <64427228+Adprime@users.noreply.github.com> Date: Mon, 22 Jul 2024 13:02:33 +0300 Subject: [PATCH 14/31] Adprime: add userSync (#3770) Co-authored-by: Aiholkin --- static/bidder-info/adprime.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/static/bidder-info/adprime.yaml b/static/bidder-info/adprime.yaml index 2aab94c6b9d..79d938ad264 100644 --- a/static/bidder-info/adprime.yaml +++ b/static/bidder-info/adprime.yaml @@ -12,3 +12,10 @@ capabilities: - banner - video - native +userSync: + redirect: + url: "https://sync.adprime.com/pbserver?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&ccpa={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&redir={{.RedirectURL}}" + userMacro: "[UID]" + iframe: + url: "https://sync.adprime.com/pbserverIframe?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&ccpa={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&pbserverUrl={{.RedirectURL}}" + userMacro: "[UID]" From f087eeaafec84ade9dca2b7a1851f5f73bde51df Mon Sep 17 00:00:00 2001 From: Laurentiu Badea Date: Wed, 24 Jul 2024 05:41:36 -0700 Subject: [PATCH 15/31] OpenX: accept incoming string fields to support Prebid.js 9 (#3668) --- adapters/openx/openx.go | 9 ++++++--- .../openxtest/exemplary/optional-params.json | 6 +++--- .../openxtest/supplemental/multi-imp.json | 20 +++++++++---------- adapters/openx/params_test.go | 8 +++++++- .../disabled/good/partial.json | 2 +- openrtb_ext/imp_openx.go | 6 ++++-- static/bidder-info/openx.yaml | 1 + static/bidder-params/openx.json | 8 +++++--- 8 files changed, 37 insertions(+), 23 deletions(-) diff --git a/adapters/openx/openx.go b/adapters/openx/openx.go index e59dab534a4..d56339df178 100644 --- a/adapters/openx/openx.go +++ b/adapters/openx/openx.go @@ -133,9 +133,12 @@ func preprocess(imp *openrtb2.Imp, reqExt *openxReqExt) error { reqExt.DelDomain = openxExt.DelDomain reqExt.Platform = openxExt.Platform - imp.TagID = openxExt.Unit - if imp.BidFloor == 0 && openxExt.CustomFloor > 0 { - imp.BidFloor = openxExt.CustomFloor + imp.TagID = openxExt.Unit.String() + if imp.BidFloor == 0 { + customFloor, err := openxExt.CustomFloor.Float64() + if err == nil && customFloor > 0 { + imp.BidFloor = customFloor + } } // outgoing imp.ext should be same as incoming imp.ext minus prebid and bidder diff --git a/adapters/openx/openxtest/exemplary/optional-params.json b/adapters/openx/openxtest/exemplary/optional-params.json index ff8c9f56549..7486cc756d1 100644 --- a/adapters/openx/openxtest/exemplary/optional-params.json +++ b/adapters/openx/openxtest/exemplary/optional-params.json @@ -12,7 +12,7 @@ "unit": "539439964", "delDomain": "se-demo-d.openx.net", "platform": "PLATFORM", - "customFloor": 0.1, + "customFloor": "0.4", "customParams": {"foo": "bar"} } } @@ -25,7 +25,7 @@ }, "ext": { "bidder": { - "unit": "539439964", + "unit": 539439964, "delDomain": "se-demo-d.openx.net", "platform": "PLATFORM", "customFloor": 0.1 @@ -48,7 +48,7 @@ "format": [{"w": 728, "h": 90}] }, "tagid": "539439964", - "bidfloor": 0.1, + "bidfloor": 0.4, "ext": { "customParams": {"foo": "bar"} } diff --git a/adapters/openx/openxtest/supplemental/multi-imp.json b/adapters/openx/openxtest/supplemental/multi-imp.json index c6b770e3a85..d49660a1541 100644 --- a/adapters/openx/openxtest/supplemental/multi-imp.json +++ b/adapters/openx/openxtest/supplemental/multi-imp.json @@ -7,7 +7,7 @@ "banner": {}, "ext": { "bidder": { - "unit": "banner-unit-1", + "unit": "111", "delDomain": "se-demo-d.openx.net" } } @@ -17,7 +17,7 @@ "video": {"mimes": ["video/mp4"]}, "ext": { "bidder": { - "unit": "video-unit-1", + "unit": "333", "delDomain": "se-demo-d.openx.net" } } @@ -27,7 +27,7 @@ "banner": {}, "ext": { "bidder": { - "unit": "banner-unit-2", + "unit": "222", "delDomain": "se-demo-d.openx.net" } } @@ -37,7 +37,7 @@ "video": {"mimes": ["video/mp4"]}, "ext": { "bidder": { - "unit": "video-unit-2", + "unit": "444", "delDomain": "se-demo-d.openx.net" } } @@ -48,7 +48,7 @@ "video": {"mimes": ["video/mp4"]}, "ext": { "bidder": { - "unit": "multi-type-unit", + "unit": "555", "delDomain": "se-demo-d.openx.net" } } @@ -66,18 +66,18 @@ { "id": "banner-imp-1", "banner": {}, - "tagid": "banner-unit-1" + "tagid": "111" }, { "id": "banner-imp-2", "banner": {}, - "tagid": "banner-unit-2" + "tagid": "222" }, { "id": "multi-type-imp", "banner": {}, "video": {"mimes": ["video/mp4"]}, - "tagid": "multi-type-unit" + "tagid": "555" } ], "ext": { @@ -125,7 +125,7 @@ { "id": "video-imp-1", "video": {"mimes": ["video/mp4"]}, - "tagid": "video-unit-1" + "tagid": "333" } ], "ext": { @@ -163,7 +163,7 @@ { "id": "video-imp-2", "video": {"mimes": ["video/mp4"]}, - "tagid": "video-unit-2" + "tagid": "444" } ], "ext": { diff --git a/adapters/openx/params_test.go b/adapters/openx/params_test.go index 4e081dba7e5..8a093b0bff5 100644 --- a/adapters/openx/params_test.go +++ b/adapters/openx/params_test.go @@ -40,14 +40,17 @@ func TestInvalidParams(t *testing.T) { } var validParams = []string{ + `{"unit": 123, "delDomain": "foo.ba"}`, `{"unit": "123", "delDomain": "foo.ba"}`, `{"unit": "123", "delDomain": "foo.bar"}`, `{"unit": "123", "delDomain": "foo.bar", "customFloor": 0.1}`, + `{"unit": "123", "delDomain": "foo.bar", "customFloor": "0.1"}`, `{"unit": "123", "delDomain": "foo.bar", "customParams": {"foo": "bar"}}`, `{"unit": "123", "delDomain": "foo.bar", "customParams": {"foo": ["bar", "baz"]}}`, } var invalidParams = []string{ + `{"unit": "", "delDomain": "foo.bar"}`, `{"unit": "123"}`, `{"delDomain": "foo.bar"}`, `{"unit": "", "delDomain": "foo.bar"}`, @@ -56,7 +59,10 @@ var invalidParams = []string{ `{"unit": "123", "delDomain": "foo.b"}`, `{"unit": "123", "delDomain": "foo.barr"}`, `{"unit": "123", "delDomain": ".bar"}`, - `{"unit": "123", "delDomain": "foo.bar", "customFloor": "0.1"}`, + `{"unit": "123", "delDomain": "foo.bar", "customFloor": ""}`, + `{"unit": "123", "delDomain": "foo.bar", "customFloor": "1."}`, + `{"unit": "123", "delDomain": "foo.bar", "customFloor": "1.0x"}`, + `{"unit": "123", "delDomain": "foo.bar", "customFloor": "-0.1"}`, `{"unit": "123", "delDomain": "foo.bar", "customFloor": -0.1}`, `{"unit": "123", "delDomain": "foo.bar", "customParams": "foo: bar"}`, } diff --git a/endpoints/openrtb2/sample-requests/disabled/good/partial.json b/endpoints/openrtb2/sample-requests/disabled/good/partial.json index 01b6177fb26..0918b67bdc0 100644 --- a/endpoints/openrtb2/sample-requests/disabled/good/partial.json +++ b/endpoints/openrtb2/sample-requests/disabled/good/partial.json @@ -43,7 +43,7 @@ "openx": { "unit": "539439964", "delDomain": "se-demo-d.openx.net", - "customFloor": 0.1, + "customFloor": "0.5", "customParams": {"foo": "bar"} } } diff --git a/openrtb_ext/imp_openx.go b/openrtb_ext/imp_openx.go index 38bce75f17c..880e4a6d457 100644 --- a/openrtb_ext/imp_openx.go +++ b/openrtb_ext/imp_openx.go @@ -1,10 +1,12 @@ package openrtb_ext +import "encoding/json" + // ExtImpOpenx defines the contract for bidrequest.imp[i].ext.prebid.bidder.openx type ExtImpOpenx struct { - Unit string `json:"unit"` + Unit json.Number `json:"unit"` Platform string `json:"platform"` DelDomain string `json:"delDomain"` - CustomFloor float64 `json:"customFloor"` + CustomFloor json.Number `json:"customFloor"` CustomParams map[string]interface{} `json:"customParams"` } diff --git a/static/bidder-info/openx.yaml b/static/bidder-info/openx.yaml index 9837b5dc92c..7fcabad9652 100644 --- a/static/bidder-info/openx.yaml +++ b/static/bidder-info/openx.yaml @@ -2,6 +2,7 @@ endpoint: "http://rtb.openx.net/prebid" maintainer: email: "prebid@openx.com" gvlVendorID: 69 +endpointCompression: gzip capabilities: app: mediaTypes: diff --git a/static/bidder-params/openx.json b/static/bidder-params/openx.json index 6dbd10178e4..0b58e03a15c 100644 --- a/static/bidder-params/openx.json +++ b/static/bidder-params/openx.json @@ -6,8 +6,9 @@ "type": "object", "properties": { "unit": { - "type": "string", + "type": ["number", "string"], "description": "The ad unit id.", + "minimum": 0, "pattern": "^[0-9]+$" }, "delDomain": { @@ -22,9 +23,10 @@ "format": "uuid" }, "customFloor": { - "type": "number", + "type": ["number", "string"], "description": "The minimum CPM price in USD.", - "minimum": 0 + "minimum": 0, + "pattern": "^[0-9]+(\\.[0-9]+)?$" }, "customParams": { "type": "object", From 115f77317c7484cf73710f86d30f4ecb9a76214a Mon Sep 17 00:00:00 2001 From: BIGOAds Date: Wed, 24 Jul 2024 21:34:40 +0800 Subject: [PATCH 16/31] New Adapter: bigoad (#3711) Co-authored-by: linzhucheng --- adapters/bigoad/bigoad.go | 156 +++++++++++++++ adapters/bigoad/bigoad_test.go | 29 +++ .../bigoadtest/exemplary/banner_app.json | 186 ++++++++++++++++++ .../bigoadtest/exemplary/banner_web.json | 135 +++++++++++++ .../bigoadtest/exemplary/native_app.json | 147 ++++++++++++++ .../bigoadtest/exemplary/native_web.json | 134 +++++++++++++ .../bigoadtest/exemplary/video_app.json | 160 +++++++++++++++ .../bigoadtest/exemplary/video_web.json | 158 +++++++++++++++ .../supplemental/empty_seatbid.json | 125 ++++++++++++ .../supplemental/invalid_mtype.json | 164 +++++++++++++++ .../supplemental/invalid_request.json | 31 +++ .../invalid_request_bigo_ext.json | 37 ++++ .../supplemental/invalid_response.json | 111 +++++++++++ adapters/bigoad/param_test.go | 46 +++++ exchange/adapter_builders.go | 2 + macros/macros.go | 1 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_bigoad.go | 5 + static/bidder-info/bigoad.yaml | 26 +++ static/bidder-params/bigoad.json | 13 ++ 20 files changed, 1668 insertions(+) create mode 100644 adapters/bigoad/bigoad.go create mode 100644 adapters/bigoad/bigoad_test.go create mode 100644 adapters/bigoad/bigoadtest/exemplary/banner_app.json create mode 100644 adapters/bigoad/bigoadtest/exemplary/banner_web.json create mode 100644 adapters/bigoad/bigoadtest/exemplary/native_app.json create mode 100644 adapters/bigoad/bigoadtest/exemplary/native_web.json create mode 100644 adapters/bigoad/bigoadtest/exemplary/video_app.json create mode 100644 adapters/bigoad/bigoadtest/exemplary/video_web.json create mode 100644 adapters/bigoad/bigoadtest/supplemental/empty_seatbid.json create mode 100644 adapters/bigoad/bigoadtest/supplemental/invalid_mtype.json create mode 100644 adapters/bigoad/bigoadtest/supplemental/invalid_request.json create mode 100644 adapters/bigoad/bigoadtest/supplemental/invalid_request_bigo_ext.json create mode 100644 adapters/bigoad/bigoadtest/supplemental/invalid_response.json create mode 100644 adapters/bigoad/param_test.go create mode 100644 openrtb_ext/imp_bigoad.go create mode 100644 static/bidder-info/bigoad.yaml create mode 100644 static/bidder-params/bigoad.json diff --git a/adapters/bigoad/bigoad.go b/adapters/bigoad/bigoad.go new file mode 100644 index 00000000000..82a34de0bdb --- /dev/null +++ b/adapters/bigoad/bigoad.go @@ -0,0 +1,156 @@ +package bigoad + +import ( + "encoding/json" + "fmt" + "net/http" + "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" +) + +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(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + bigoadExt, err := getImpExt(&request.Imp[0]) + if err != nil { + return nil, []error{err} + } + + resolvedUrl, err := a.buildEndpointURL(bigoadExt) + if err != nil { + return nil, []error{err} + } + + requestJSON, err := json.Marshal(request) + if err != nil { + return nil, []error{err} + } + + requestData := &adapters.RequestData{ + Method: "POST", + Uri: resolvedUrl, + Body: requestJSON, + Headers: getHeaders(request), + ImpIDs: openrtb_ext.GetImpIDs(request.Imp), + } + + return []*adapters.RequestData{requestData}, nil +} + +func getHeaders(request *openrtb2.BidRequest) http.Header { + headers := http.Header{} + addNonEmptyHeaders(&headers, map[string]string{ + "Content-Type": "application/json;charset=utf-8", + "Accept": "application/json", + "x-openrtb-version": "2.5", + }) + 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 getImpExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpBigoAd, error) { + var bidderExt adapters.ExtImpBidder + if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { + return nil, &errortypes.BadInput{ + Message: fmt.Sprintf("imp %s: unable to unmarshal ext", imp.ID), + } + } + var bigoadExt openrtb_ext.ExtImpBigoAd + if err := json.Unmarshal(bidderExt.Bidder, &bigoadExt); err != nil { + return nil, &errortypes.BadInput{ + Message: fmt.Sprintf("imp %s: unable to unmarshal ext.bidder: %v", imp.ID, err), + } + } + imp.Ext = bidderExt.Bidder + return &bigoadExt, nil +} + +func (a *adapter) buildEndpointURL(params *openrtb_ext.ExtImpBigoAd) (string, error) { + endpointParams := macros.EndpointTemplateParams{SspId: params.SspId} + return macros.ResolveMacros(a.endpoint, endpointParams) +} + +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), + }} + } + + if len(bidResponse.SeatBid) == 0 { + return nil, []error{&errortypes.BadServerResponse{ + Message: "Empty SeatBid array", + }} + } + + bidResponseWithCapacity := adapters.NewBidderResponseWithBidsCapacity(len(bidResponse.SeatBid[0].Bid)) + + var errors []error + seatBid := bidResponse.SeatBid[0] + for i := range seatBid.Bid { + bid := seatBid.Bid[i] + bidType, err := getBidType(request.Imp[0], bid) + 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, 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 + case openrtb2.MarkupVideo: + return openrtb_ext.BidTypeVideo, nil + } + + return "", &errortypes.BadInput{ + Message: fmt.Sprintf("unrecognized bid type in response from bigoad %s", imp.ID), + } +} diff --git a/adapters/bigoad/bigoad_test.go b/adapters/bigoad/bigoad_test.go new file mode 100644 index 00000000000..39ca37dbf56 --- /dev/null +++ b/adapters/bigoad/bigoad_test.go @@ -0,0 +1,29 @@ +package bigoad + +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.BidderBigoAd, + config.Adapter{Endpoint: "https://api.imotech.tech/Ad/GetAdOut?sspid={{.SspId}}"}, + config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "bigoadtest", bidder) +} + +func TestEndpointTemplateMalformed(t *testing.T) { + _, buildErr := Builder(openrtb_ext.BidderBigoAd, config.Adapter{ + Endpoint: "{{Malformed}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + assert.Error(t, buildErr) +} diff --git a/adapters/bigoad/bigoadtest/exemplary/banner_app.json b/adapters/bigoad/bigoadtest/exemplary/banner_app.json new file mode 100644 index 00000000000..69782a0e78d --- /dev/null +++ b/adapters/bigoad/bigoadtest/exemplary/banner_app.json @@ -0,0 +1,186 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "id": "123456789", + "bundle": "com.prebid", + "domain": "prebid.com", + "ver": "3.3.2", + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ] + }, + "device": { + "ifa": "87857b31-8942-4646-ae80-ab9c95bf3fab", + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "geo": { + "lon": 16.0, + "country": "KWT", + "city": "deli" + } + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "tagid", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "sspid": "sspid" + } + } + } + ], + "tmax": 1000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://api.imotech.tech/Ad/GetAdOut?sspid=sspid", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "body": { + "id": "test-request-id", + "app": { + "id": "123456789", + "bundle": "com.prebid", + "domain": "prebid.com", + "ver": "3.3.2", + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ] + }, + "device": { + "ifa": "87857b31-8942-4646-ae80-ab9c95bf3fab", + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "geo": { + "lon": 16.0, + "country": "KWT", + "city": "deli" + } + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "tagid", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "sspid": "sspid" + } + } + ], + "tmax": 1000 + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "bigoad", + "type": "banner", + "bid": [ + { + "id": "test-imp-id", + "impid": "test-imp-id", + "adid": "11110126", + "mtype": 1, + "price": 0.42632559, + "adm": "some-test-ad", + "adomain": [ + "www.lazada.com" + ], + "crid": "test-crid", + "cat": [ + "IAB22", + "IAB8-5" + ], + "attr": [ + 4 + ], + "h": 250, + "w": 300, + "ext": { + "dsp": "bigo" + } + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-imp-id", + "impid": "test-imp-id", + "adid": "11110126", + "price": 0.42632559, + "adm": "some-test-ad", + "mtype": 1, + "adomain": [ + "www.lazada.com" + ], + "crid": "test-crid", + "cat": [ + "IAB22", + "IAB8-5" + ], + "attr": [ + 4 + ], + "h": 250, + "w": 300, + "ext": { + "dsp": "bigo" + } + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/bigoad/bigoadtest/exemplary/banner_web.json b/adapters/bigoad/bigoadtest/exemplary/banner_web.json new file mode 100644 index 00000000000..3da662178fe --- /dev/null +++ b/adapters/bigoad/bigoadtest/exemplary/banner_web.json @@ -0,0 +1,135 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "site": { + "domain": "com.prebid", + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id1", + "tagid": "tagid", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "sspid": "sspid" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "uri": "https://api.imotech.tech/Ad/GetAdOut?sspid=sspid", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id1", + "tagid": "tagid", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "sspid": "sspid" + } + } + ], + "site": { + "domain": "com.prebid", + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "tmax": 1000 + }, + "impIDs": [ + "some-impression-id1" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "some-impression-id1", + "impid": "some-impression-id1", + "mtype": 1, + "price": 3.5, + "adm": "test_adm", + "adomain": [ + "com.prebid" + ], + "crid": "20", + "w": 320, + "h": 50 + } + ], + "type": "banner", + "seat": "bigoad" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "some-impression-id1", + "impid": "some-impression-id1", + "mtype": 1, + "price": 3.5, + "adm": "test_adm", + "crid": "20", + "adomain": [ + "com.prebid" + ], + "w": 320, + "h": 50 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/bigoad/bigoadtest/exemplary/native_app.json b/adapters/bigoad/bigoadtest/exemplary/native_app.json new file mode 100644 index 00000000000..22be64e8a38 --- /dev/null +++ b/adapters/bigoad/bigoadtest/exemplary/native_app.json @@ -0,0 +1,147 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "app": { + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789" + }, + "imp": [ + { + "id": "some-impression-id", + "tagid": "ogTAGID", + "native": { + "ver": "1.1", + "request": "{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "ext": { + "bidder": { + "sspid": "sspid" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "uri": "https://api.imotech.tech/Ad/GetAdOut?sspid=sspid", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "native": { + "ver": "1.1", + "request": "{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "tagid": "ogTAGID", + "ext": { + "sspid": "sspid" + } + } + ], + "app": { + "id": "123456789", + "name": "Awesome App", + "bundle": "com.app.awesome", + "domain": "awesomeapp.com", + "cat": [ + "IAB22-1" + ], + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "mtype": 4 + } + ], + "type": "native", + "seat": "bigoad" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "mtype": 4, + "adomain": [ + "awesome.com" + ] + }, + "type": "native" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/bigoad/bigoadtest/exemplary/native_web.json b/adapters/bigoad/bigoadtest/exemplary/native_web.json new file mode 100644 index 00000000000..61857ca5671 --- /dev/null +++ b/adapters/bigoad/bigoadtest/exemplary/native_web.json @@ -0,0 +1,134 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ipv6": "2607:fb90:f27:4512:d800:cb23:a603:e245", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + "tagid": "ogTAGID", + "native": { + "ver": "1.1", + "request": "{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "ext": { + "bidder": { + "sspid": "sspid" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "uri": "https://api.imotech.tech/Ad/GetAdOut?sspid=sspid", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ipv6": "2607:fb90:f27:4512:d800:cb23:a603:e245", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "tagid": "ogTAGID", + "native": { + "ver": "1.1", + "request": "{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "ext": { + "sspid": "sspid" + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "mtype": 4, + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20" + } + ], + "seat": "bigoad" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "mtype": 4, + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ] + }, + "type": "native" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/bigoad/bigoadtest/exemplary/video_app.json b/adapters/bigoad/bigoadtest/exemplary/video_app.json new file mode 100644 index 00000000000..db9940ebcfe --- /dev/null +++ b/adapters/bigoad/bigoadtest/exemplary/video_app.json @@ -0,0 +1,160 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "app": { + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789" + }, + "imp": [ + { + "id": "some-impression-id", + "tagid": "ogTAGID", + "video": { + "mimes": [ + "video/mp4" + ], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": { + "bidder": { + "sspid": "sspid" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "uri": "https://api.imotech.tech/Ad/GetAdOut?sspid=sspid", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 120, + "maxduration": 150, + "w": 640, + "h": 480 + }, + "tagid": "ogTAGID", + "ext": { + "sspid": "sspid" + } + } + ], + "app": { + "id": "123456789", + "name": "Awesome App", + "bundle": "com.app.awesome", + "domain": "awesomeapp.com", + "cat": [ + "IAB22-1" + ], + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 1280, + "h": 720, + "mtype": 2 + } + ], + "seat": "bigoad" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "w": 1280, + "h": 720, + "mtype": 2 + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/bigoad/bigoadtest/exemplary/video_web.json b/adapters/bigoad/bigoadtest/exemplary/video_web.json new file mode 100644 index 00000000000..c5cf2fcb976 --- /dev/null +++ b/adapters/bigoad/bigoadtest/exemplary/video_web.json @@ -0,0 +1,158 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + "tagid": "ogTAGID", + "video": { + "mimes": [ + "video/mp4" + ], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": { + "bidder": { + "sspid": "sspid" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "uri": "https://api.imotech.tech/Ad/GetAdOut?sspid=sspid", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "tagid": "ogTAGID", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 120, + "maxduration": 150, + "w": 640, + "h": 480 + }, + "ext": { + "sspid": "sspid" + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "mtype": 2, + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 1280, + "h": 720, + "ext": { + "prebid": { + "type": "video" + } + } + } + ], + "seat": "bigoad" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "mtype": 2, + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 1280, + "h": 720, + "ext": { + "prebid": { + "type": "video" + } + } + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/bigoad/bigoadtest/supplemental/empty_seatbid.json b/adapters/bigoad/bigoadtest/supplemental/empty_seatbid.json new file mode 100644 index 00000000000..cce47e6c8f5 --- /dev/null +++ b/adapters/bigoad/bigoadtest/supplemental/empty_seatbid.json @@ -0,0 +1,125 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "app": { + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789" + }, + "imp": [ + { + "id": "some-impression-id", + "tagid": "ogTAGID", + "video": { + "mimes": [ + "video/mp4" + ], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": { + "bidder": { + "sspid": "sspid" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "uri": "https://api.imotech.tech/Ad/GetAdOut?sspid=sspid", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 120, + "maxduration": 150, + "w": 640, + "h": 480 + }, + "tagid": "ogTAGID", + "ext": { + "sspid": "sspid" + } + } + ], + "app": { + "id": "123456789", + "name": "Awesome App", + "bundle": "com.app.awesome", + "domain": "awesomeapp.com", + "cat": [ + "IAB22-1" + ], + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [] + } + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Empty SeatBid array", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/bigoad/bigoadtest/supplemental/invalid_mtype.json b/adapters/bigoad/bigoadtest/supplemental/invalid_mtype.json new file mode 100644 index 00000000000..b84579802a0 --- /dev/null +++ b/adapters/bigoad/bigoadtest/supplemental/invalid_mtype.json @@ -0,0 +1,164 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "id": "123456789", + "bundle": "com.prebid", + "domain": "prebid.com", + "ver": "3.3.2", + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ] + }, + "device": { + "ifa": "87857b31-8942-4646-ae80-ab9c95bf3fab", + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "geo": { + "lon": 16.0, + "country": "KWT", + "city": "deli" + } + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "tagid", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "sspid": "sspid" + } + } + } + ], + "tmax": 1000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://api.imotech.tech/Ad/GetAdOut?sspid=sspid", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "body": { + "id": "test-request-id", + "app": { + "id": "123456789", + "bundle": "com.prebid", + "domain": "prebid.com", + "ver": "3.3.2", + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ] + }, + "device": { + "ifa": "87857b31-8942-4646-ae80-ab9c95bf3fab", + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "geo": { + "lon": 16.0, + "country": "KWT", + "city": "deli" + } + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "tagid", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "sspid": "sspid" + } + } + ], + "tmax": 1000 + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "bigoad", + "type": "banner", + "bid": [ + { + "id": "test-imp-id", + "impid": "test-imp-id", + "mtype": 5, + "adid": "11110126", + "price": 0.42632559, + "adm": "some-test-ad", + "adomain": [ + "www.lazada.com" + ], + "crid": "test-crid", + "cat": [ + "IAB22", + "IAB8-5" + ], + "attr": [ + 4 + ], + "h": 250, + "w": 300, + "ext": { + "dsp": "bigo" + } + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [] + } + ], + "expectedMakeBidsErrors": [ + { + "value": "unrecognized bid type in response from bigoad", + "comparison": "regex" + } + ] +} \ No newline at end of file diff --git a/adapters/bigoad/bigoadtest/supplemental/invalid_request.json b/adapters/bigoad/bigoadtest/supplemental/invalid_request.json new file mode 100644 index 00000000000..846b4d3a14f --- /dev/null +++ b/adapters/bigoad/bigoadtest/supplemental/invalid_request.json @@ -0,0 +1,31 @@ +{ + "expectedMakeRequestsErrors": [ + { + "value": "imp some-impression-id: unable to unmarshal ext", + "comparison": "literal" + } + ], + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "some-impression-id", + "tagid": "my-adcode", + "video": { + "mimes": [ + "video/mp4" + ], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": "Awesome" + } + ], + "site": { + "page": "test.com" + } + }, + "httpCalls": [] +} \ No newline at end of file diff --git a/adapters/bigoad/bigoadtest/supplemental/invalid_request_bigo_ext.json b/adapters/bigoad/bigoadtest/supplemental/invalid_request_bigo_ext.json new file mode 100644 index 00000000000..4c0356c2032 --- /dev/null +++ b/adapters/bigoad/bigoadtest/supplemental/invalid_request_bigo_ext.json @@ -0,0 +1,37 @@ +{ + "expectedMakeRequestsErrors": [ + { + "value": "imp some-impression-id: unable to unmarshal ext.bidder", + "comparison": "regex" + } + ], + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "some-impression-id", + "tagid": "my-adcode", + "video": { + "mimes": [ + "video/mp4" + ], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": { + "prebid": { + "bidder": { + "bigoad": {} + } + } + } + } + ], + "site": { + "page": "test.com" + } + }, + "httpCalls": [] +} \ No newline at end of file diff --git a/adapters/bigoad/bigoadtest/supplemental/invalid_response.json b/adapters/bigoad/bigoadtest/supplemental/invalid_response.json new file mode 100644 index 00000000000..ff910cf095b --- /dev/null +++ b/adapters/bigoad/bigoadtest/supplemental/invalid_response.json @@ -0,0 +1,111 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "app": { + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789" + }, + "imp": [ + { + "id": "some-impression-id", + "tagid": "ogTAGID", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "sspid": "sspid" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "uri": "https://api.imotech.tech/Ad/GetAdOut?sspid=sspid", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "tagid": "ogTAGID", + "ext": { + "sspid": "sspid" + } + } + ], + "app": { + "id": "123456789", + "name": "Awesome App", + "bundle": "com.app.awesome", + "domain": "awesomeapp.com", + "cat": [ + "IAB22-1" + ], + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + }, + "impIDs": [ + "some-impression-id" + ] + }, + "mockResponse": { + "status": 200, + "body": "" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Bad server response", + "comparison": "regex" + } + ] +} \ No newline at end of file diff --git a/adapters/bigoad/param_test.go b/adapters/bigoad/param_test.go new file mode 100644 index 00000000000..fdf4718cd1d --- /dev/null +++ b/adapters/bigoad/param_test.go @@ -0,0 +1,46 @@ +package bigoad + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +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.BidderBigoAd, 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.BidderBigoAd, json.RawMessage(p)); err == nil { + t.Errorf("Schema allowed invalid params: %s", p) + } + } +} + +var validParams = []string{ + `{"sspid": "123"}`, +} + +var invalidParams = []string{ + ``, + `null`, + `[]`, + `{}`, + `{"xxx": "baidu.com"}`, +} diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 6edc325a56d..dd66efaf403 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -54,6 +54,7 @@ import ( "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/bigoad" "github.com/prebid/prebid-server/v2/adapters/blasto" "github.com/prebid/prebid-server/v2/adapters/bliink" "github.com/prebid/prebid-server/v2/adapters/blue" @@ -271,6 +272,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderBidmyadz: bidmyadz.Builder, openrtb_ext.BidderBidsCube: bidscube.Builder, openrtb_ext.BidderBidstack: bidstack.Builder, + openrtb_ext.BidderBigoAd: bigoad.Builder, openrtb_ext.BidderBlasto: blasto.Builder, openrtb_ext.BidderBliink: bliink.Builder, openrtb_ext.BidderBlue: blue.Builder, diff --git a/macros/macros.go b/macros/macros.go index bde843c3cbb..0c8d1428c67 100644 --- a/macros/macros.go +++ b/macros/macros.go @@ -17,6 +17,7 @@ type EndpointTemplateParams struct { GvlID string PageID string SupplyId string + SspId string } // UserSyncPrivacy specifies privacy policy macros, represented as strings, for user sync urls. diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 7f278c6b82f..3f8ac7dbd77 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -70,6 +70,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderBidmyadz, BidderBidsCube, BidderBidstack, + BidderBigoAd, BidderBlasto, BidderBliink, BidderBlue, @@ -387,6 +388,7 @@ const ( BidderBidmyadz BidderName = "bidmyadz" BidderBidsCube BidderName = "bidscube" BidderBidstack BidderName = "bidstack" + BidderBigoAd BidderName = "bigoad" BidderBlasto BidderName = "blasto" BidderBliink BidderName = "bliink" BidderBlue BidderName = "blue" diff --git a/openrtb_ext/imp_bigoad.go b/openrtb_ext/imp_bigoad.go new file mode 100644 index 00000000000..dad9c4fd878 --- /dev/null +++ b/openrtb_ext/imp_bigoad.go @@ -0,0 +1,5 @@ +package openrtb_ext + +type ExtImpBigoAd struct { + SspId string `json:"sspid"` +} diff --git a/static/bidder-info/bigoad.yaml b/static/bidder-info/bigoad.yaml new file mode 100644 index 00000000000..ffe964c9837 --- /dev/null +++ b/static/bidder-info/bigoad.yaml @@ -0,0 +1,26 @@ +endpoint: "https://api.imotech.tech/Ad/GetAdOut?sspid={{.SspId}}" +endpointCompression: gzip +geoscope: + - USA + - RUS + - JPN + - BRA + - KOR + - IDN + - TUR + - SAU + - MEX +maintainer: + email: bigoads-prebid@bigo.sg +modifyingVastXmlAllowed: true +capabilities: + app: + mediaTypes: + - banner + - video + - native + site: + mediaTypes: + - banner + - video + - native \ No newline at end of file diff --git a/static/bidder-params/bigoad.json b/static/bidder-params/bigoad.json new file mode 100644 index 00000000000..418d2186969 --- /dev/null +++ b/static/bidder-params/bigoad.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "BigoAd Adapter Params", + "description": "A schema which validates params accepted by the BigoAd adapter", + "type": "object", + "properties": { + "sspid": { + "type": "string", + "description": "Special id provided by BigoAd" + } + }, + "required": ["sspid"] + } \ No newline at end of file From d1596c817e7080cc2e2a15e6b0b3893ef4be27f1 Mon Sep 17 00:00:00 2001 From: "Ruslan S." Date: Wed, 24 Jul 2024 21:46:37 +0800 Subject: [PATCH 17/31] Smaato: Change server response type (#3734) --- adapters/smaato/banner.go | 21 ++ adapters/smaato/banner_test.go | 42 ++++ adapters/smaato/image.go | 50 ---- adapters/smaato/image_test.go | 51 ---- adapters/smaato/richmedia.go | 50 ---- adapters/smaato/richmedia_test.go | 48 ---- adapters/smaato/smaato.go | 65 ++--- adapters/smaato/smaato_test.go | 4 + .../exemplary/multiple-impressions-skadn.json | 14 +- .../exemplary/multiple-impressions.json | 14 +- .../exemplary/multiple-media-types-skadn.json | 14 +- .../exemplary/multiple-media-types.json | 14 +- .../smaato/smaatotest/exemplary/native.json | 5 +- .../exemplary/simple-banner-app.json | 9 +- .../exemplary/simple-banner-eids.json | 9 +- .../simple-banner-richMedia-app.json | 229 ------------------ .../exemplary/simple-banner-richMedia.json | 194 --------------- .../exemplary/simple-banner-skadn.json | 9 +- .../smaatotest/exemplary/simple-banner.json | 15 +- .../smaatotest/exemplary/video-app.json | 5 +- .../smaato/smaatotest/exemplary/video.json | 5 +- .../supplemental/adtype-header-response.json | 193 --------------- .../supplemental/bad-adm-response.json | 171 ------------- .../bad-adtype-header-response.json | 4 +- .../bad-expires-header-response.json | 7 +- .../bad-status-code-response.json | 2 +- .../supplemental/banner-w-and-h.json | 9 +- .../supplemental/expires-header-response.json | 7 +- .../supplemental/no-bid-response.json | 2 +- .../supplemental/no-consent-info-request.json | 9 +- .../outdated-expires-header-response.json | 7 +- .../video/multiple-adpods-skadn.json | 10 +- .../smaatotest/video/multiple-adpods.json | 10 +- .../smaatotest/video/single-adpod-skadn.json | 5 +- .../smaato/smaatotest/video/single-adpod.json | 5 +- ...e.json => bad-adtype-header-response.json} | 67 +---- .../bad-bid-ext-response.json | 5 +- 37 files changed, 251 insertions(+), 1129 deletions(-) create mode 100644 adapters/smaato/banner.go create mode 100644 adapters/smaato/banner_test.go delete mode 100644 adapters/smaato/image.go delete mode 100644 adapters/smaato/image_test.go delete mode 100644 adapters/smaato/richmedia.go delete mode 100644 adapters/smaato/richmedia_test.go delete mode 100644 adapters/smaato/smaatotest/exemplary/simple-banner-richMedia-app.json delete mode 100644 adapters/smaato/smaatotest/exemplary/simple-banner-richMedia.json delete mode 100644 adapters/smaato/smaatotest/supplemental/adtype-header-response.json delete mode 100644 adapters/smaato/smaatotest/supplemental/bad-adm-response.json rename adapters/smaato/smaatotest/videosupplemental/{bad-adm-response.json => bad-adtype-header-response.json} (77%) diff --git a/adapters/smaato/banner.go b/adapters/smaato/banner.go new file mode 100644 index 00000000000..17fb0a6c188 --- /dev/null +++ b/adapters/smaato/banner.go @@ -0,0 +1,21 @@ +package smaato + +import ( + "fmt" + "net/url" + "strings" +) + +func extractAdmBanner(adMarkup string, curls []string) string { + var clickEvent string + if len(curls) > 0 { + var clicks strings.Builder + for _, clicktracker := range curls { + clicks.WriteString("fetch(decodeURIComponent('" + url.QueryEscape(clicktracker) + "'.replace(/\\+/g, ' ')), " + + "{cache: 'no-cache'});") + } + clickEvent = fmt.Sprintf(`onclick=%s`, clicks.String()) + } + + return fmt.Sprintf(`
%s
`, clickEvent, adMarkup) +} diff --git a/adapters/smaato/banner_test.go b/adapters/smaato/banner_test.go new file mode 100644 index 00000000000..83b08a6b77a --- /dev/null +++ b/adapters/smaato/banner_test.go @@ -0,0 +1,42 @@ +package smaato + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestExtractAdmBanner(t *testing.T) { + tests := []struct { + testName string + adMarkup string + curls []string + expectedAdMarkup string + }{ + { + testName: "extract_banner_without_curls", + adMarkup: ``, + expectedAdMarkup: `
`, + curls: []string{}, + }, + { + testName: "extract_banner_with_nil_curls", + adMarkup: ``, + expectedAdMarkup: `
`, + curls: nil, + }, + { + testName: "extract_banner_with_curls", + adMarkup: ``, + expectedAdMarkup: `
`, + curls: []string{"curls.net"}, + }, + } + + for _, tt := range tests { + t.Run(tt.testName, func(t *testing.T) { + adMarkup := extractAdmBanner(tt.adMarkup, tt.curls) + + assert.Equal(t, tt.expectedAdMarkup, adMarkup) + }) + } +} diff --git a/adapters/smaato/image.go b/adapters/smaato/image.go deleted file mode 100644 index 8e601187ccd..00000000000 --- a/adapters/smaato/image.go +++ /dev/null @@ -1,50 +0,0 @@ -package smaato - -import ( - "encoding/json" - "fmt" - "net/url" - "strings" - - "github.com/prebid/prebid-server/v2/errortypes" -) - -type imageAd struct { - Image image `json:"image"` -} -type image struct { - Img img `json:"img"` - Impressiontrackers []string `json:"impressiontrackers"` - Clicktrackers []string `json:"clicktrackers"` -} -type img struct { - URL string `json:"url"` - W int `json:"w"` - H int `json:"h"` - Ctaurl string `json:"ctaurl"` -} - -func extractAdmImage(adMarkup string) (string, error) { - var imageAd imageAd - if err := json.Unmarshal([]byte(adMarkup), &imageAd); err != nil { - return "", &errortypes.BadServerResponse{ - Message: fmt.Sprintf("Invalid ad markup %s.", adMarkup), - } - } - - var clickEvent strings.Builder - for _, clicktracker := range imageAd.Image.Clicktrackers { - clickEvent.WriteString("fetch(decodeURIComponent('" + url.QueryEscape(clicktracker) + "'.replace(/\\+/g, ' ')), " + - "{cache: 'no-cache'});") - } - - var impressionTracker strings.Builder - for _, impression := range imageAd.Image.Impressiontrackers { - impressionTracker.WriteString(fmt.Sprintf(``, impression)) - } - - imageAdMarkup := fmt.Sprintf(`
%s
`, - &clickEvent, url.QueryEscape(imageAd.Image.Img.Ctaurl), imageAd.Image.Img.URL, imageAd.Image.Img.W, imageAd.Image.Img.H, &impressionTracker) - - return imageAdMarkup, nil -} diff --git a/adapters/smaato/image_test.go b/adapters/smaato/image_test.go deleted file mode 100644 index 1ba99ddd7c5..00000000000 --- a/adapters/smaato/image_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package smaato - -import ( - "github.com/stretchr/testify/assert" - "testing" -) - -func TestExtractAdmImage(t *testing.T) { - tests := []struct { - testName string - adMarkup string - expectedAdMarkup string - expectedError string - }{ - { - testName: "extract image", - adMarkup: "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\"," + - "\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"}," + - "\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"]," + - "\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", - expectedAdMarkup: `
` + - `` + - `` + - `
`, - expectedError: "", - }, - { - testName: "invalid adMarkup", - adMarkup: "{", - expectedAdMarkup: "", - expectedError: "Invalid ad markup {.", - }, - } - - for _, tt := range tests { - t.Run(tt.testName, func(t *testing.T) { - adMarkup, err := extractAdmImage(tt.adMarkup) - - if tt.expectedError != "" { - assert.EqualError(t, err, tt.expectedError) - } else { - assert.NoError(t, err) - } - - assert.Equal(t, tt.expectedAdMarkup, adMarkup) - }) - } -} diff --git a/adapters/smaato/richmedia.go b/adapters/smaato/richmedia.go deleted file mode 100644 index 09e1f2bf3d6..00000000000 --- a/adapters/smaato/richmedia.go +++ /dev/null @@ -1,50 +0,0 @@ -package smaato - -import ( - "encoding/json" - "fmt" - "net/url" - "strings" - - "github.com/prebid/prebid-server/v2/errortypes" -) - -type richMediaAd struct { - RichMedia richmedia `json:"richmedia"` -} -type mediadata struct { - Content string `json:"content"` - W int `json:"w"` - H int `json:"h"` -} - -type richmedia struct { - MediaData mediadata `json:"mediadata"` - Impressiontrackers []string `json:"impressiontrackers"` - Clicktrackers []string `json:"clicktrackers"` -} - -func extractAdmRichMedia(adMarkup string) (string, error) { - var richMediaAd richMediaAd - if err := json.Unmarshal([]byte(adMarkup), &richMediaAd); err != nil { - return "", &errortypes.BadServerResponse{ - Message: fmt.Sprintf("Invalid ad markup %s.", adMarkup), - } - } - - var clickEvent strings.Builder - var impressionTracker strings.Builder - - for _, clicktracker := range richMediaAd.RichMedia.Clicktrackers { - clickEvent.WriteString("fetch(decodeURIComponent('" + url.QueryEscape(clicktracker) + "'), " + - "{cache: 'no-cache'});") - } - for _, impression := range richMediaAd.RichMedia.Impressiontrackers { - impressionTracker.WriteString(fmt.Sprintf(``, impression)) - } - - richmediaAdMarkup := fmt.Sprintf(`
%s%s
`, - &clickEvent, richMediaAd.RichMedia.MediaData.Content, &impressionTracker) - - return richmediaAdMarkup, nil -} diff --git a/adapters/smaato/richmedia_test.go b/adapters/smaato/richmedia_test.go deleted file mode 100644 index eff559852be..00000000000 --- a/adapters/smaato/richmedia_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package smaato - -import ( - "github.com/stretchr/testify/assert" - "testing" -) - -func TestExtractAdmRichMedia(t *testing.T) { - tests := []struct { - testName string - adMarkup string - expectedAdMarkup string - expectedError string - }{ - { - testName: "extract richmedia", - adMarkup: "{\"richmedia\":{\"mediadata\":{\"content\":\"
hello
\"," + - "" + "\"w\":350," + - "\"h\":50},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"]," + - "\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", - expectedAdMarkup: `
hello
` + - `
`, - expectedError: "", - }, - { - testName: "invalid adMarkup", - adMarkup: "{", - expectedAdMarkup: "", - expectedError: "Invalid ad markup {.", - }, - } - - for _, tt := range tests { - t.Run(tt.testName, func(t *testing.T) { - adMarkup, err := extractAdmRichMedia(tt.adMarkup) - - if tt.expectedError != "" { - assert.EqualError(t, err, tt.expectedError) - } else { - assert.NoError(t, err) - } - - assert.Equal(t, tt.expectedAdMarkup, adMarkup) - }) - } -} diff --git a/adapters/smaato/smaato.go b/adapters/smaato/smaato.go index 7dcf4446702..5421578967c 100644 --- a/adapters/smaato/smaato.go +++ b/adapters/smaato/smaato.go @@ -17,7 +17,7 @@ import ( "github.com/prebid/prebid-server/v2/util/timeutil" ) -const clientVersion = "prebid_server_0.7" +const clientVersion = "prebid_server_1.0" type adMarkupType string @@ -57,7 +57,8 @@ type bidRequestExt struct { // bidExt defines Bid.Ext object for Smaato type bidExt struct { - Duration int `json:"duration"` + Duration int `json:"duration"` + Curls []string `json:"curls"` } // videoExt defines Video.Ext object for Smaato @@ -113,18 +114,23 @@ func (adapter *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalR bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) + adMarkupType, err := getAdMarkupType(response) + if err != nil { + return nil, []error{err} + } + var errors []error for _, seatBid := range bidResp.SeatBid { for i := 0; i < len(seatBid.Bid); i++ { bid := seatBid.Bid[i] - adMarkupType, err := getAdMarkupType(response, bid.AdM) + bidExt, err := extractBidExt(&bid) if err != nil { errors = append(errors, err) continue } - bid.AdM, err = renderAdMarkup(adMarkupType, bid.AdM) + bid.AdM, err = renderAdMarkup(adMarkupType, &bidExt, bid) if err != nil { errors = append(errors, err) continue @@ -136,7 +142,7 @@ func (adapter *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalR continue } - bidVideo, err := buildBidVideo(&bid, bidType) + bidVideo, err := buildBidVideo(&bid, &bidExt, bidType) if err != nil { errors = append(errors, err) continue @@ -260,20 +266,12 @@ func (adapter *adapter) makeRequest(request *openrtb2.BidRequest) (*adapters.Req }, nil } -func getAdMarkupType(response *adapters.ResponseData, adMarkup string) (adMarkupType, error) { +func getAdMarkupType(response *adapters.ResponseData) (adMarkupType, error) { if admType := adMarkupType(response.Headers.Get("X-Smt-Adtype")); admType != "" { return admType, nil - } else if strings.HasPrefix(adMarkup, `{"image":`) { - return smtAdTypeImg, nil - } else if strings.HasPrefix(adMarkup, `{"richmedia":`) { - return smtAdTypeRichmedia, nil - } else if strings.HasPrefix(adMarkup, `\"\"", "adomain": [ "smaato.com" ], @@ -347,13 +350,16 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["postbid_iframe"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -415,7 +421,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/multiple-impressions.json b/adapters/smaato/smaatotest/exemplary/multiple-impressions.json index e0055602be9..34d27a5c5a1 100644 --- a/adapters/smaato/smaatotest/exemplary/multiple-impressions.json +++ b/adapters/smaato/smaatotest/exemplary/multiple-impressions.json @@ -160,13 +160,16 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Img"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -174,7 +177,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], @@ -267,13 +270,16 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["postbid_iframe"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -311,7 +317,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/multiple-media-types-skadn.json b/adapters/smaato/smaatotest/exemplary/multiple-media-types-skadn.json index 61de48ea4a8..74eaec95650 100644 --- a/adapters/smaato/smaatotest/exemplary/multiple-media-types-skadn.json +++ b/adapters/smaato/smaatotest/exemplary/multiple-media-types-skadn.json @@ -178,13 +178,16 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Img"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -192,7 +195,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], @@ -324,13 +327,16 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -392,7 +398,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/multiple-media-types.json b/adapters/smaato/smaatotest/exemplary/multiple-media-types.json index 3d579060f90..abccdc34671 100644 --- a/adapters/smaato/smaatotest/exemplary/multiple-media-types.json +++ b/adapters/smaato/smaatotest/exemplary/multiple-media-types.json @@ -150,13 +150,16 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Img"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -164,7 +167,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], @@ -257,13 +260,16 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -301,7 +307,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/native.json b/adapters/smaato/smaatotest/exemplary/native.json index ef9b2109584..7d87cc8d974 100644 --- a/adapters/smaato/smaatotest/exemplary/native.json +++ b/adapters/smaato/smaatotest/exemplary/native.json @@ -124,13 +124,16 @@ } }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["postbid_iframe"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Native"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-app.json b/adapters/smaato/smaatotest/exemplary/simple-banner-app.json index 4f24bb00a9f..53b7d148278 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner-app.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-app.json @@ -158,13 +158,16 @@ "keywords": "keywords" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Img"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -172,7 +175,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], @@ -202,7 +205,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-eids.json b/adapters/smaato/smaatotest/exemplary/simple-banner-eids.json index b9316341a65..6982459bd8d 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner-eids.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-eids.json @@ -153,13 +153,16 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Img"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -167,7 +170,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], @@ -197,7 +200,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia-app.json b/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia-app.json deleted file mode 100644 index 30594685c14..00000000000 --- a/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia-app.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "mockBidRequest": { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "app": { - "id": "app-id", - "name": "app-name", - "bundle": "app-bundle", - "storeurl": "app-storeurl", - "cat": [ - "IAB3-1" - ], - "ver": "app-version", - "paid": 1, - "content": { - "id": "content-id", - "title": "content-title", - "series": "content-series", - "genre": "content-genre", - "producer": { - "id": "producer-id", - "name": "producer-name" - }, - "cat": [ - "IAB8-6" - ], - "livestream": 1, - "language": "en" - }, - "keywords": "keywords" - }, - "imp": [ - { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "banner": { - "format": [ - { - "w": 320, - "h": 50 - }, - { - "w": 320, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "publisherId": "1100042525", - "adspaceId": "130563103" - } - } - } - ], - "device": { - "ua": "test-user-agent", - "ip": "123.123.123.123", - "language": "en", - "dnt": 0 - }, - "user": { - "ext": { - "consent": "gdprConsentString", - "data": { - "keywords": "a,b", - "gender": "M", - "yob": 1984, - "geo": { - "country": "ca" - } - } - } - }, - "regs": { - "coppa": 1, - "ext": { - "gdpr": 1, - "us_privacy": "uspConsentString" - } - } - }, - "httpCalls": [ - { - "expectedRequest": { - "headers": { - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Accept": [ - "application/json" - ] - }, - "uri": "https://prebid/bidder", - "body": { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "imp": [ - { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "tagid": "130563103", - "banner": { - "format": [ - { - "w": 320, - "h": 50 - }, - { - "w": 320, - "h": 250 - } - ] - } - } - ], - "user": { - "gender": "M", - "keywords": "a,b", - "yob": 1984, - "ext": { - "consent": "gdprConsentString" - } - }, - "device": { - "ua": "test-user-agent", - "ip": "123.123.123.123", - "language": "en", - "dnt": 0 - }, - "regs": { - "coppa": 1, - "ext": { - "gdpr": 1, - "us_privacy": "uspConsentString" - } - }, - "app": { - "publisher": { - "id": "1100042525" - }, - "id": "app-id", - "name": "app-name", - "bundle": "app-bundle", - "storeurl": "app-storeurl", - "cat": [ - "IAB3-1" - ], - "ver": "app-version", - "paid": 1, - "content": { - "id": "content-id", - "title": "content-title", - "series": "content-series", - "genre": "content-genre", - "producer": { - "id": "producer-id", - "name": "producer-name" - }, - "cat": [ - "IAB8-6" - ], - "livestream": 1, - "language": "en" - }, - "keywords": "keywords" - }, - "ext": { - "client": "prebid_server_0.7" - } - }, - "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] - }, - "mockResponse": { - "status": 200, - "body": { - "id": "5ebea288-f13a-4754-be6d-4ade66c68877", - "seatbid": [ - { - "seat": "CM6523", - "bid": [ - { - "adm": "{\"richmedia\":{\"mediadata\":{\"content\":\"
hello
\", \"w\":350,\"h\":50},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", - "adomain": [ - "smaato.com" - ], - "bidderName": "smaato", - "cid": "CM6523", - "crid": "CR69381", - "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", - "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", - "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", - "price": 0.01, - "w": 350, - "h": 50 - } - ] - } - ], - "bidid": "04db8629-179d-4bcd-acce-e54722969006", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "adm": "
hello
\"\"\"\"
", - "adomain": [ - "smaato.com" - ], - "cid": "CM6523", - "crid": "CR69381", - "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", - "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", - "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", - "price": 0.01, - "w": 350, - "h": 50, - "exp": 300 - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia.json b/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia.json deleted file mode 100644 index 58dd502c0c0..00000000000 --- a/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "mockBidRequest": { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "site": { - "publisher": { - "id": "1100042525" - }, - "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", - "ext": { - "data": { - "keywords": "power tools", - "search": "drill", - "content": { - "userrating": 4 - } - } - } - }, - "imp": [ - { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "banner": { - "format": [ - { - "w": 320, - "h": 50 - }, - { - "w": 320, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "publisherId": "1100042525", - "adspaceId": "130563103" - } - } - } - ], - "device": { - "ua": "test-user-agent", - "ip": "123.123.123.123", - "language": "en", - "dnt": 0 - }, - "user": { - "ext": { - "consent": "gdprConsentString", - "data": { - "keywords": "a,b", - "gender": "M", - "yob": 1984, - "geo": { - "country": "ca" - } - } - } - }, - "regs": { - "coppa": 1, - "ext": { - "gdpr": 1, - "us_privacy": "uspConsentString" - } - } - }, - "httpCalls": [ - { - "expectedRequest": { - "headers": { - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Accept": [ - "application/json" - ] - }, - "uri": "https://prebid/bidder", - "body": { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "imp": [ - { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "tagid": "130563103", - "banner": { - "format": [ - { - "w": 320, - "h": 50 - }, - { - "w": 320, - "h": 250 - } - ] - } - } - ], - "user": { - "gender": "M", - "keywords": "a,b", - "yob": 1984, - "ext": { - "consent": "gdprConsentString" - } - }, - "device": { - "ua": "test-user-agent", - "ip": "123.123.123.123", - "language": "en", - "dnt": 0 - }, - "regs": { - "coppa": 1, - "ext": { - "gdpr": 1, - "us_privacy": "uspConsentString" - } - }, - "site": { - "publisher": { - "id": "1100042525" - }, - "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", - "keywords": "power tools" - }, - "ext": { - "client": "prebid_server_0.7" - } - }, - "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] - }, - "mockResponse": { - "status": 200, - "body": { - "id": "5ebea288-f13a-4754-be6d-4ade66c68877", - "seatbid": [ - { - "seat": "CM6523", - "bid": [ - { - "adm": "{\"richmedia\":{\"mediadata\":{\"content\":\"
hello
\", \"w\":350,\"h\":50},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", - "adomain": [ - "smaato.com" - ], - "bidderName": "smaato", - "cid": "CM6523", - "crid": "CR69381", - "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", - "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", - "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", - "price": 0.01, - "w": 350, - "h": 50 - } - ] - } - ], - "bidid": "04db8629-179d-4bcd-acce-e54722969006", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "adm": "
hello
\"\"\"\"
", - "adomain": [ - "smaato.com" - ], - "cid": "CM6523", - "crid": "CR69381", - "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", - "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", - "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", - "price": 0.01, - "w": 350, - "h": 50, - "exp": 300 - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-skadn.json b/adapters/smaato/smaatotest/exemplary/simple-banner-skadn.json index 2b0e8e2fe48..2a3f3cbef27 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner-skadn.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-skadn.json @@ -167,13 +167,16 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Img"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -181,7 +184,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], @@ -235,7 +238,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner.json b/adapters/smaato/smaatotest/exemplary/simple-banner.json index d7d348d64a1..0b866589a5d 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner.json @@ -153,13 +153,16 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Img"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -167,7 +170,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], @@ -182,6 +185,9 @@ "w": 350, "h": 50, "ext": { + "curls": [ + "https://track.net/v1/click" + ], "dsa": { "behalf": "Advertiser", "paid": "Advertiser", @@ -210,7 +216,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], @@ -225,6 +231,9 @@ "h": 50, "exp": 300, "ext": { + "curls": [ + "https://track.net/v1/click" + ], "dsa": { "behalf": "Advertiser", "paid": "Advertiser", diff --git a/adapters/smaato/smaatotest/exemplary/video-app.json b/adapters/smaato/smaatotest/exemplary/video-app.json index e2ffafae2bb..0fda52f2914 100644 --- a/adapters/smaato/smaatotest/exemplary/video-app.json +++ b/adapters/smaato/smaatotest/exemplary/video-app.json @@ -165,13 +165,16 @@ "keywords": "keywords" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["postbid_iframe"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ diff --git a/adapters/smaato/smaatotest/exemplary/video.json b/adapters/smaato/smaatotest/exemplary/video.json index 1aa7d5a557c..5b486ae5702 100644 --- a/adapters/smaato/smaatotest/exemplary/video.json +++ b/adapters/smaato/smaatotest/exemplary/video.json @@ -180,13 +180,16 @@ } }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["postbid_iframe"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ diff --git a/adapters/smaato/smaatotest/supplemental/adtype-header-response.json b/adapters/smaato/smaatotest/supplemental/adtype-header-response.json deleted file mode 100644 index bf33878e911..00000000000 --- a/adapters/smaato/smaatotest/supplemental/adtype-header-response.json +++ /dev/null @@ -1,193 +0,0 @@ -{ - "mockBidRequest": { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "site": { - "publisher": { - "id": "1100042525" - }, - "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", - "ext": { - "data": { - "keywords": "power tools", - "search": "drill", - "content": { - "userrating": 4 - } - } - } - }, - "imp": [ - { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "banner": { - "format": [ - { - "w": 320, - "h": 50 - }, - { - "w": 320, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "publisherId": "1100042525", - "adspaceId": "130563103" - } - } - } - ], - "device": { - "ua": "test-user-agent", - "ip": "123.123.123.123", - "language": "en", - "dnt": 0 - }, - "user": { - "ext": { - "consent": "gdprConsentString", - "data": { - "keywords": "a,b", - "gender": "M", - "yob": 1984, - "geo": { - "country": "ca" - } - } - } - }, - "regs": { - "coppa": 1, - "ext": { - "gdpr": 1, - "us_privacy": "uspConsentString" - } - } - }, - "httpCalls": [ - { - "expectedRequest": { - "headers": { - "Content-Type": ["application/json;charset=utf-8"], - "Accept": ["application/json"] - }, - "uri": "https://prebid/bidder", - "body": { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "imp": [ - { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "tagid": "130563103", - "banner": { - "format": [ - { - "w": 320, - "h": 50 - }, - { - "w": 320, - "h": 250 - } - ] - } - } - ], - "user": { - "ext": { - "consent": "gdprConsentString" - }, - "gender": "M", - "keywords": "a,b", - "yob": 1984 - }, - "device": { - "ua": "test-user-agent", - "ip": "123.123.123.123", - "language": "en", - "dnt": 0 - }, - "regs": { - "coppa": 1, - "ext": { - "gdpr": 1, - "us_privacy": "uspConsentString" - } - }, - "site": { - "publisher": { - "id": "1100042525" - }, - "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", - "keywords": "power tools" - }, - "ext": { - "client": "prebid_server_0.7" - } - }, - "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] - }, - "mockResponse": { - "status": 200, - "headers": { - "X-Smt-Adtype": ["Img"] - }, - "body": { - "id": "5ebea288-f13a-4754-be6d-4ade66c68877", - "seatbid": [ - { - "seat": "CM6523", - "bid": [ - { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", - "adomain": [ - "smaato.com" - ], - "bidderName": "smaato", - "cid": "CM6523", - "crid": "CR69381", - "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", - "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", - "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", - "price": 0.01, - "w": 350, - "h": 50 - } - ] - } - ], - "bidid": "04db8629-179d-4bcd-acce-e54722969006", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "adm": "
\"\"\"\"
", - "adomain": [ - "smaato.com" - ], - "cid": "CM6523", - "crid": "CR69381", - "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", - "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", - "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", - "price": 0.01, - "w": 350, - "h": 50, - "exp": 300 - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/smaato/smaatotest/supplemental/bad-adm-response.json b/adapters/smaato/smaatotest/supplemental/bad-adm-response.json deleted file mode 100644 index c86c6f179c4..00000000000 --- a/adapters/smaato/smaatotest/supplemental/bad-adm-response.json +++ /dev/null @@ -1,171 +0,0 @@ -{ - "mockBidRequest": { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "site": { - "publisher": { - "id": "1100042525" - }, - "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", - "ext": { - "data": { - "keywords": "power tools", - "search": "drill", - "content": { - "userrating": 4 - } - } - } - }, - "imp": [ - { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "banner": { - "format": [ - { - "w": 320, - "h": 50 - }, - { - "w": 320, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "publisherId": "1100042525", - "adspaceId": "130563103" - } - } - } - ], - "device": { - "ua": "test-user-agent", - "ip": "123.123.123.123", - "language": "en", - "dnt": 0 - }, - "user": { - "ext": { - "consent": "gdprConsentString", - "data": { - "keywords": "a,b", - "gender": "M", - "yob": 1984, - "geo": { - "country": "ca" - } - } - } - }, - "regs": { - "coppa": 1, - "ext": { - "gdpr": 1, - "us_privacy": "uspConsentString" - } - } - }, - "httpCalls": [ - { - "expectedRequest": { - "headers": { - "Content-Type": ["application/json;charset=utf-8"], - "Accept": ["application/json"] - }, - "uri": "https://prebid/bidder", - "body": { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "imp": [ - { - "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "tagid": "130563103", - "banner": { - "format": [ - { - "w": 320, - "h": 50 - }, - { - "w": 320, - "h": 250 - } - ] - } - } - ], - "user": { - "ext": { - "consent": "gdprConsentString" - }, - "gender": "M", - "keywords": "a,b", - "yob": 1984 - }, - "device": { - "ua": "test-user-agent", - "ip": "123.123.123.123", - "language": "en", - "dnt": 0 - }, - "regs": { - "coppa": 1, - "ext": { - "gdpr": 1, - "us_privacy": "uspConsentString" - } - }, - "site": { - "publisher": { - "id": "1100042525" - }, - "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", - "keywords": "power tools" - }, - "ext": { - "client": "prebid_server_0.7" - } - }, - "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] - }, - "mockResponse": { - "status": 200, - "body": { - "id": "5ebea288-f13a-4754-be6d-4ade66c68877", - "seatbid": [ - { - "seat": "CM6523", - "bid": [ - { - "adm": "{\"badmedia\":{\"mediadata\":{\"content\":\"
hello
\", \"w\":350,\"h\":50},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", - "adomain": [ - "smaato.com" - ], - "bidderName": "smaato", - "cid": "CM6523", - "crid": "CR69381", - "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", - "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", - "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", - "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", - "price": 0.01, - "w": 350, - "h": 50 - } - ] - } - ], - "bidid": "04db8629-179d-4bcd-acce-e54722969006", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [{"currency":"USD","bids":[]}], - "expectedMakeBidsErrors": [ - { - "value": "Invalid ad markup {\"badmedia\":{\"mediadata\":{\"content\":\"
hello
\", \"w\":350,\"h\":50},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}.", - "comparison": "literal" - } - ] -} diff --git a/adapters/smaato/smaatotest/supplemental/bad-adtype-header-response.json b/adapters/smaato/smaatotest/supplemental/bad-adtype-header-response.json index 98d490f9097..800aa6d76f8 100644 --- a/adapters/smaato/smaatotest/supplemental/bad-adtype-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/bad-adtype-header-response.json @@ -123,7 +123,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -140,7 +140,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/supplemental/bad-expires-header-response.json b/adapters/smaato/smaatotest/supplemental/bad-expires-header-response.json index ac38f24537f..1afb1f66eda 100644 --- a/adapters/smaato/smaatotest/supplemental/bad-expires-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/bad-expires-header-response.json @@ -123,7 +123,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -131,6 +131,7 @@ "mockResponse": { "status": 200, "headers": { + "X-Smt-Adtype": ["Img"], "X-Smt-Expires": ["something"] }, "body": { @@ -140,7 +141,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], @@ -170,7 +171,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/supplemental/bad-status-code-response.json b/adapters/smaato/smaatotest/supplemental/bad-status-code-response.json index fa77eb0e321..095b398e461 100644 --- a/adapters/smaato/smaatotest/supplemental/bad-status-code-response.json +++ b/adapters/smaato/smaatotest/supplemental/bad-status-code-response.json @@ -123,7 +123,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] diff --git a/adapters/smaato/smaatotest/supplemental/banner-w-and-h.json b/adapters/smaato/smaatotest/supplemental/banner-w-and-h.json index 7fea2733803..9b135832b69 100644 --- a/adapters/smaato/smaatotest/supplemental/banner-w-and-h.json +++ b/adapters/smaato/smaatotest/supplemental/banner-w-and-h.json @@ -107,13 +107,16 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Img"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -121,7 +124,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], @@ -151,7 +154,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/supplemental/expires-header-response.json b/adapters/smaato/smaatotest/supplemental/expires-header-response.json index 1be49b0d16b..885d5e491be 100644 --- a/adapters/smaato/smaatotest/supplemental/expires-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/expires-header-response.json @@ -123,7 +123,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -131,6 +131,7 @@ "mockResponse": { "status": 200, "headers": { + "X-Smt-Adtype": ["Img"], "X-Smt-Expires": ["1624618800000"] }, "body": { @@ -140,7 +141,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], @@ -170,7 +171,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/supplemental/no-bid-response.json b/adapters/smaato/smaatotest/supplemental/no-bid-response.json index 8127cdec258..f7f80855fe5 100644 --- a/adapters/smaato/smaatotest/supplemental/no-bid-response.json +++ b/adapters/smaato/smaatotest/supplemental/no-bid-response.json @@ -123,7 +123,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] diff --git a/adapters/smaato/smaatotest/supplemental/no-consent-info-request.json b/adapters/smaato/smaatotest/supplemental/no-consent-info-request.json index 81f263797ba..646f4d72e2a 100644 --- a/adapters/smaato/smaatotest/supplemental/no-consent-info-request.json +++ b/adapters/smaato/smaatotest/supplemental/no-consent-info-request.json @@ -70,13 +70,16 @@ } }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Img"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -84,7 +87,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], @@ -114,7 +117,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/supplemental/outdated-expires-header-response.json b/adapters/smaato/smaatotest/supplemental/outdated-expires-header-response.json index 96dea545bf4..1bc27aea876 100644 --- a/adapters/smaato/smaatotest/supplemental/outdated-expires-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/outdated-expires-header-response.json @@ -123,7 +123,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -131,6 +131,7 @@ "mockResponse": { "status": 200, "headers": { + "X-Smt-Adtype": ["Img"], "X-Smt-Expires": ["1524618800000"] }, "body": { @@ -140,7 +141,7 @@ "seat": "CM6523", "bid": [ { - "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adm": "\"\"", "adomain": [ "smaato.com" ], @@ -170,7 +171,7 @@ "bids": [ { "bid": { - "adm": "
\"\"\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/video/multiple-adpods-skadn.json b/adapters/smaato/smaatotest/video/multiple-adpods-skadn.json index 52fb2a4d1f7..749c859bd28 100644 --- a/adapters/smaato/smaatotest/video/multiple-adpods-skadn.json +++ b/adapters/smaato/smaatotest/video/multiple-adpods-skadn.json @@ -301,13 +301,16 @@ } }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1_1","1_2"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -513,13 +516,16 @@ } }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["2_1","2_2"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ diff --git a/adapters/smaato/smaatotest/video/multiple-adpods.json b/adapters/smaato/smaatotest/video/multiple-adpods.json index bd7498ddc7e..36c98c2f741 100644 --- a/adapters/smaato/smaatotest/video/multiple-adpods.json +++ b/adapters/smaato/smaatotest/video/multiple-adpods.json @@ -234,13 +234,16 @@ } }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1_1","1_2"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -387,13 +390,16 @@ } }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["2_1","2_2"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ diff --git a/adapters/smaato/smaatotest/video/single-adpod-skadn.json b/adapters/smaato/smaatotest/video/single-adpod-skadn.json index a61a79e37fe..545cdb5351e 100644 --- a/adapters/smaato/smaatotest/video/single-adpod-skadn.json +++ b/adapters/smaato/smaatotest/video/single-adpod-skadn.json @@ -221,13 +221,16 @@ } }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1_1","1_2"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ diff --git a/adapters/smaato/smaatotest/video/single-adpod.json b/adapters/smaato/smaatotest/video/single-adpod.json index b739c9049d1..ff9fdfce892 100644 --- a/adapters/smaato/smaatotest/video/single-adpod.json +++ b/adapters/smaato/smaatotest/video/single-adpod.json @@ -180,13 +180,16 @@ } }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1_1","1_2"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ diff --git a/adapters/smaato/smaatotest/videosupplemental/bad-adm-response.json b/adapters/smaato/smaatotest/videosupplemental/bad-adtype-header-response.json similarity index 77% rename from adapters/smaato/smaatotest/videosupplemental/bad-adm-response.json rename to adapters/smaato/smaatotest/videosupplemental/bad-adtype-header-response.json index 91e1c25dd96..f422b0af9d9 100644 --- a/adapters/smaato/smaatotest/videosupplemental/bad-adm-response.json +++ b/adapters/smaato/smaatotest/videosupplemental/bad-adtype-header-response.json @@ -176,13 +176,19 @@ } }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, - "impIDs":["1_1","1_2"] + "impIDs": [ + "1_1", + "1_2" + ] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": null + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ @@ -204,29 +210,11 @@ "price": 0.01, "w": 1024, "h": 768, - "cat": ["IAB1"], - "ext": { - "duration": 5 - } - }, - { - "adm": "", - "adomain": [ - "smaato.com" + "cat": [ + "IAB1" ], - "bidderName": "smaato", - "cid": "CM6523", - "crid": "CR69381", - "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", - "impid": "1_2", - "iurl": "https://iurl", - "nurl": "https://nurl", - "price": 0.01, - "w": 1024, - "h": 768, - "cat": ["IAB2"], "ext": { - "duration": 30 + "duration": 5 } } ] @@ -240,38 +228,9 @@ ], "expectedMakeBidsErrors": [ { - "value": "Invalid ad markup .", + "value": "X-Smt-Adtype header is missing!", "comparison": "literal" } ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "adm": "", - "adomain": [ - "smaato.com" - ], - "cid": "CM6523", - "crid": "CR69381", - "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", - "impid": "1_1", - "iurl": "https://iurl", - "nurl": "https://nurl", - "price": 0.01, - "w": 1024, - "h": 768, - "cat": ["IAB1"], - "ext": { - "duration": 5 - }, - "exp": 300 - }, - "type": "video" - } - ] - } - ] + "expectedBidResponses": [] } diff --git a/adapters/smaato/smaatotest/videosupplemental/bad-bid-ext-response.json b/adapters/smaato/smaatotest/videosupplemental/bad-bid-ext-response.json index ff724cb3d2d..6cf7f23803c 100644 --- a/adapters/smaato/smaatotest/videosupplemental/bad-bid-ext-response.json +++ b/adapters/smaato/smaatotest/videosupplemental/bad-bid-ext-response.json @@ -176,13 +176,16 @@ } }, "ext": { - "client": "prebid_server_0.7" + "client": "prebid_server_1.0" } }, "impIDs":["1_1","1_2"] }, "mockResponse": { "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, "body": { "id": "5ebea288-f13a-4754-be6d-4ade66c68877", "seatbid": [ From 536821f25e148c063e66e09d0892ce3f1b69720e Mon Sep 17 00:00:00 2001 From: Patrick Loughrey Date: Wed, 24 Jul 2024 12:37:36 -0400 Subject: [PATCH 18/31] Triplelift Native: Mapping tag_code (#3745) --- .../triplelift_native/triplelift_native.go | 37 +++++++++-- .../exemplary/msn-params.json | 65 +++++++++++++++++++ .../exemplary/tagcode-params.json | 65 +++++++++++++++++++ .../supplemental/badext.json | 2 +- 4 files changed, 164 insertions(+), 5 deletions(-) create mode 100644 adapters/triplelift_native/triplelift_nativetest/exemplary/msn-params.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/exemplary/tagcode-params.json diff --git a/adapters/triplelift_native/triplelift_native.go b/adapters/triplelift_native/triplelift_native.go index c3556cfa8bb..465ea32df59 100644 --- a/adapters/triplelift_native/triplelift_native.go +++ b/adapters/triplelift_native/triplelift_native.go @@ -33,14 +33,30 @@ type TripleliftNativeExtInfo struct { PublisherWhitelistMap map[string]struct{} } +type ExtImpData struct { + TagCode string `json:"tag_code"` +} + +type ExtImp struct { + *adapters.ExtImpBidder + Data *ExtImpData `json:"data,omitempty"` +} + func getBidType(ext TripleliftRespExt) openrtb_ext.BidType { return openrtb_ext.BidTypeNative } -func processImp(imp *openrtb2.Imp) error { +func processImp(imp *openrtb2.Imp, request *openrtb2.BidRequest) error { // get the triplelift extension - var ext adapters.ExtImpBidder + var ext ExtImp var tlext openrtb_ext.ExtImpTriplelift + var siteCopy openrtb2.Site + var extData ExtImpData + + if request.Site != nil { + siteCopy = *request.Site + } + if err := json.Unmarshal(imp.Ext, &ext); err != nil { return err } @@ -53,7 +69,20 @@ func processImp(imp *openrtb2.Imp) error { if tlext.InvCode == "" { return fmt.Errorf("no inv_code specified") } - imp.TagID = tlext.InvCode + + if ext.Data != nil { + extData = *ext.Data + } + + if extData.TagCode != "" { + if siteCopy.Publisher.Domain == "msn.com" { + imp.TagID = extData.TagCode + } else { + imp.TagID = tlext.InvCode + } + } else { + imp.TagID = tlext.InvCode + } // floor is optional if tlext.Floor == nil { return nil @@ -89,7 +118,7 @@ func (a *TripleliftNativeAdapter) MakeRequests(request *openrtb2.BidRequest, ext var validImps []openrtb2.Imp // pre-process the imps for _, imp := range tlRequest.Imp { - if err := processImp(&imp); err == nil { + if err := processImp(&imp, request); err == nil { validImps = append(validImps, imp) } else { errs = append(errs, err) diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/msn-params.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/msn-params.json new file mode 100644 index 00000000000..7806a7bd6ae --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/msn-params.json @@ -0,0 +1,65 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { "publisher": {"id":"foo","name":"foo", "domain": "msn.com"}}, + "imp": [ + { + "native": { + "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "foo", + "floor" : 20 + }, + "data": { + "tag_code": "bar" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "bar", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "foo", + "floor" : 20 + }, + "data": { + "tag_code": "bar" + } + } + } + ], + "site": { + "publisher": { + "id":"foo", + "name":"foo", + "domain": "msn.com" + } + } + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedBidResponses": [] + } + \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/tagcode-params.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/tagcode-params.json new file mode 100644 index 00000000000..c97febcfea2 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/tagcode-params.json @@ -0,0 +1,65 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { "publisher": {"id":"foo","name":"foo", "domain": "foo.com"}}, + "imp": [ + { + "native":{ + "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "foo", + "floor" : 20 + }, + "data": { + "tag_code": "bar" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "foo", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "foo", + "floor" : 20 + }, + "data": { + "tag_code": "bar" + } + } + } + ], + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "foo.com" + } + } + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedBidResponses": [] + } + \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/badext.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/badext.json index 7df178bdd00..f43deb8b7c5 100644 --- a/adapters/triplelift_native/triplelift_nativetest/supplemental/badext.json +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/badext.json @@ -1,7 +1,7 @@ { "expectedMakeRequestsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type adapters.ExtImpBidder", + "value": "json: cannot unmarshal string into Go value of type triplelift_native.ExtImp", "comparison": "literal" }, { From 382f793e658906d5b1dfe244515401db7314adbf Mon Sep 17 00:00:00 2001 From: rtuschkany <35923908+rtuschkany@users.noreply.github.com> Date: Thu, 25 Jul 2024 14:56:01 +0200 Subject: [PATCH 19/31] ConenctAd Adapter Update (#3715) --- adapters/connectad/params_test.go | 4 +-- static/bidder-info/connectad.yaml | 21 ++++++++++--- static/bidder-params/connectad.json | 46 ++++++++++++++++------------- 3 files changed, 45 insertions(+), 26 deletions(-) diff --git a/adapters/connectad/params_test.go b/adapters/connectad/params_test.go index 2ab3c4902e7..94c17aa0d8f 100644 --- a/adapters/connectad/params_test.go +++ b/adapters/connectad/params_test.go @@ -36,13 +36,13 @@ func TestInvalidParams(t *testing.T) { var validParams = []string{ `{"siteId": 123456, "networkId": 123456, "bidfloor": 0.10}`, `{"siteId": 123456, "networkId": 123456}`, + `{"siteId": 123456, "networkId": "123456", "bidfloor": 0.10}`, + `{"siteId": "123456", "networkId": 123456, "bidfloor": 0.10}`, } var invalidParams = []string{ `{}`, `null`, - `{"siteId": 123456, "networkId": "123456", "bidfloor": 0.10}`, - `{"siteId": "123456", "networkId": 123456, "bidfloor": 0.10}`, `{"siteId": 123456, "networkId": 123456, "bidfloor": "0.10"}`, `{"siteId": "123456"}`, `{"networkId": 123456}`, diff --git a/static/bidder-info/connectad.yaml b/static/bidder-info/connectad.yaml index d9bf283c1ac..486ec289301 100644 --- a/static/bidder-info/connectad.yaml +++ b/static/bidder-info/connectad.yaml @@ -1,16 +1,29 @@ +# Please uncomment the appropriate endpoint URL for your datacenter +# Europe endpoint: "http://bidder.connectad.io/API?src=pbs" +# North/South America +# endpoint: "http://bidder-us.connectad.io/API?src=pbs" +# APAC +# endpoint: "http://bidder-apac.connectad.io/API?src=pbs" +geoscope: + - global maintainer: email: "support@connectad.io" +endpointCompression: gzip gvlVendorID: 138 capabilities: app: mediaTypes: - - banner + - banner site: mediaTypes: - - banner + - banner userSync: - iframe: - url: "https://cdn.connectad.io/connectmyusers.php?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&cb={{.RedirectURL}}" + redirect: + url: "https://sync.connectad.io/ImageSyncer?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&cb={{.RedirectURL}}" userMacro: "" # connectad appends the user id to end of the redirect url and does not utilize a macro + iframe: + url: "https://sync.connectad.io/iFrameSyncer?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&cb={{.RedirectURL}}" + userMacro: "" + # connectad appends the user id to end of the redirect url and does not utilize a macro \ No newline at end of file diff --git a/static/bidder-params/connectad.json b/static/bidder-params/connectad.json index 15f4ab66bf3..224345b96fc 100644 --- a/static/bidder-params/connectad.json +++ b/static/bidder-params/connectad.json @@ -1,24 +1,30 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "ConnectAd S2S dapter Params", - "description": "A schema which validates params accepted by the ConnectAd Adapter", - - "type": "object", - "properties": { - "networkId": { - "type": "integer", - "description": "NetworkId" - }, - "siteId": { - "type": "integer", - "description": "SiteId" - }, - "bidfloor": { - "type": "number", - "description": "Requests Floorprice" - } + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "ConnectAd S2S dapter Params", + "description": "A schema which validates params accepted by the ConnectAd Adapter", + + "type": "object", + "properties": { + "networkId": { + "type": [ + "integer", + "string" + ], + "description": "NetworkId" + }, + "siteId": { + "type": [ + "integer", + "string" + ], + "description": "SiteId" }, - "required": ["networkId", "siteId"] - } + "bidfloor": { + "type": "number", + "description": "Requests Floorprice" + } + }, + "required": ["networkId", "siteId"] +} From 83bce5acd411fc2db39317dc77b53a626c985f6a Mon Sep 17 00:00:00 2001 From: Aaron Price <67345931+AaronColbyPrice@users.noreply.github.com> Date: Thu, 25 Jul 2024 05:58:01 -0700 Subject: [PATCH 20/31] PBS Go: 2024 Doc updates including endpoint and ortb support version (#3724) Co-authored-by: aarprice@publicisgroupe.net --- static/bidder-info/conversant.yaml | 8 +++++--- static/bidder-info/epsilon.yaml | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/static/bidder-info/conversant.yaml b/static/bidder-info/conversant.yaml index 7ffd2761fde..8bf426befcb 100644 --- a/static/bidder-info/conversant.yaml +++ b/static/bidder-info/conversant.yaml @@ -1,6 +1,8 @@ -endpoint: "http://api.hb.ad.cpe.dotomi.com/cvx/server/hb/ortb/25" +endpoint: "http://api.hb.ad.cpe.dotomi.com/cvx/server/hb/ortb" +openrtb: + version: 2.6 maintainer: - email: "PublisherIntegration@epsilon.com" + email: "PublisherIntegration@epsilon.com" gvlVendorID: 24 capabilities: app: @@ -15,4 +17,4 @@ userSync: redirect: url: "https://prebid-match.dotomi.com/match/bounce/current?version=1&networkId=72582&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&rurl={{.RedirectURL}}" userMacro: "" - # epsilon appends the user id to end of the redirect url and does not utilize a macro + # epsilon appends the user id to end of the redirect url and does not utilize a macro diff --git a/static/bidder-info/epsilon.yaml b/static/bidder-info/epsilon.yaml index 828bac6cfc4..cb8318102e8 100644 --- a/static/bidder-info/epsilon.yaml +++ b/static/bidder-info/epsilon.yaml @@ -1,6 +1,6 @@ aliasOf: conversant userSync: redirect: - url: "https://prebid-match.dotomi.com/match/bounce/current?version=1&networkId=72582&rurl={{.RedirectURL}}" + url: "https://prebid-match.dotomi.com/match/bounce/current?version=1&networkId=72582&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&rurl={{.RedirectURL}}" userMacro: "" # epsilon/conversant appends the user id to end of the redirect url and does not utilize a macro From 55094fe8f0c8621a0c595858e291db59301757d6 Mon Sep 17 00:00:00 2001 From: Brian Sardo <1168933+bsardo@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:36:16 -0400 Subject: [PATCH 21/31] Fix: Triplelift Native add site.publisher nil check (#3824) --- adapters/triplelift_native/params_test.go | 53 ++++++++ .../triplelift_native/triplelift_native.go | 34 ++--- .../exemplary/app-msn-no-tag-code.json | 112 ++++++++++++++++ .../exemplary/app-msn.json | 112 ++++++++++++++++ .../triplelift_nativetest/exemplary/app.json | 112 ++++++++++++++++ .../exemplary/msn-params.json | 65 ---------- .../exemplary/optional-params.json | 57 -------- .../exemplary/site-msn-no-tag-code.json | 112 ++++++++++++++++ .../exemplary/site-msn.json | 112 ++++++++++++++++ .../triplelift_nativetest/exemplary/site.json | 112 ++++++++++++++++ .../exemplary/tagcode-params.json | 65 ---------- .../supplemental/app-no-publisher.json | 25 ++++ .../supplemental/app-publisher-no-domain.json | 60 +++++++++ .../effective-publisher-allowed.json | 122 ++++++++++++++++++ .../effective-publisher-not-allowed.json | 36 ++++++ .../supplemental/no-imp-ext-data.json | 85 ++++++++++++ .../supplemental/nopub.json | 37 ------ .../supplemental/notgoodstatuscode.json | 87 ------------- .../supplemental/site-no-publisher.json | 25 ++++ .../site-publisher-no-domain.json | 62 +++++++++ static/bidder-params/triplelift_native.json | 1 + 21 files changed, 1155 insertions(+), 331 deletions(-) create mode 100644 adapters/triplelift_native/params_test.go create mode 100644 adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn-no-tag-code.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/exemplary/app.json delete mode 100644 adapters/triplelift_native/triplelift_nativetest/exemplary/msn-params.json delete mode 100644 adapters/triplelift_native/triplelift_nativetest/exemplary/optional-params.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn-no-tag-code.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/exemplary/site.json delete mode 100644 adapters/triplelift_native/triplelift_nativetest/exemplary/tagcode-params.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/supplemental/app-no-publisher.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/supplemental/app-publisher-no-domain.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-allowed.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-not-allowed.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/supplemental/no-imp-ext-data.json delete mode 100644 adapters/triplelift_native/triplelift_nativetest/supplemental/nopub.json delete mode 100644 adapters/triplelift_native/triplelift_nativetest/supplemental/notgoodstatuscode.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/supplemental/site-no-publisher.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/supplemental/site-publisher-no-domain.json diff --git a/adapters/triplelift_native/params_test.go b/adapters/triplelift_native/params_test.go new file mode 100644 index 00000000000..163ca856e00 --- /dev/null +++ b/adapters/triplelift_native/params_test.go @@ -0,0 +1,53 @@ +package triplelift_native + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderTripleliftNative, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected triplelift native params: %s", validParam) + } + } +} + +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, invalidParam := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderTripleliftNative, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"inventoryCode":"1"}`, + `{"inventoryCode":"test"}`, + `{"inventoryCode":"test", "floor":10}`, +} + +var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{}`, + `{"inventoryCode":1}`, + `{"inventoryCode":""}`, + `{"inventoryCode":"1", "floor": "10"}`, +} diff --git a/adapters/triplelift_native/triplelift_native.go b/adapters/triplelift_native/triplelift_native.go index 465ea32df59..57d5f2d7c2f 100644 --- a/adapters/triplelift_native/triplelift_native.go +++ b/adapters/triplelift_native/triplelift_native.go @@ -50,12 +50,6 @@ func processImp(imp *openrtb2.Imp, request *openrtb2.BidRequest) error { // get the triplelift extension var ext ExtImp var tlext openrtb_ext.ExtImpTriplelift - var siteCopy openrtb2.Site - var extData ExtImpData - - if request.Site != nil { - siteCopy = *request.Site - } if err := json.Unmarshal(imp.Ext, &ext); err != nil { return err @@ -66,32 +60,32 @@ func processImp(imp *openrtb2.Imp, request *openrtb2.BidRequest) error { if imp.Native == nil { return fmt.Errorf("no native object specified") } - if tlext.InvCode == "" { - return fmt.Errorf("no inv_code specified") - } - if ext.Data != nil { - extData = *ext.Data - } - - if extData.TagCode != "" { - if siteCopy.Publisher.Domain == "msn.com" { - imp.TagID = extData.TagCode - } else { - imp.TagID = tlext.InvCode - } + if ext.Data != nil && len(ext.Data.TagCode) > 0 && (msnInSite(request) || msnInApp(request)) { + imp.TagID = ext.Data.TagCode } else { imp.TagID = tlext.InvCode } + // floor is optional if tlext.Floor == nil { return nil } imp.BidFloor = *tlext.Floor - // no error + return nil } +// msnInApp returns whether msn.com is in request.app.publisher.domain +func msnInApp(request *openrtb2.BidRequest) bool { + return request.App != nil && request.App.Publisher != nil && request.App.Publisher.Domain == "msn.com" +} + +// msnInSite returns whether msn.com is in request.site.publisher.domain +func msnInSite(request *openrtb2.BidRequest) bool { + return request.Site != nil && request.Site.Publisher != nil && request.Site.Publisher.Domain == "msn.com" +} + // Returns the effective publisher ID func effectivePubID(pub *openrtb2.Publisher) string { if pub != nil { diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn-no-tag-code.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn-no-tag-code.json new file mode 100644 index 00000000000..6950942f19d --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn-no-tag-code.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "" + } + } + }], + "app": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn.json new file mode 100644 index 00000000000..420cab5aff0 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "bar", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "app": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/app.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/app.json new file mode 100644 index 00000000000..d1cd72947b7 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/app.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "foo.com" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "app": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "foo.com" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/msn-params.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/msn-params.json deleted file mode 100644 index 7806a7bd6ae..00000000000 --- a/adapters/triplelift_native/triplelift_nativetest/exemplary/msn-params.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "site": { "publisher": {"id":"foo","name":"foo", "domain": "msn.com"}}, - "imp": [ - { - "native": { - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "id": "test-imp-id", - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor" : 20 - }, - "data": { - "tag_code": "bar" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "tagid": "bar", - "bidfloor": 20, - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor" : 20 - }, - "data": { - "tag_code": "bar" - } - } - } - ], - "site": { - "publisher": { - "id":"foo", - "name":"foo", - "domain": "msn.com" - } - } - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 204 - } - } - ], - "expectedBidResponses": [] - } - \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/optional-params.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/optional-params.json deleted file mode 100644 index f04f3eef557..00000000000 --- a/adapters/triplelift_native/triplelift_nativetest/exemplary/optional-params.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "site": { "publisher": {"id":"foo","name":"foo"}}, - "imp": [ - { - "native":{ - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "id": "test-imp-id", - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor" : 20 - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "tagid": "foo", - "bidfloor": 20, - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor" : 20 - } - } - } - ], - "site": { - "publisher": { - "id": "foo", - "name": "foo" - } - } - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 204 - } - } - ], - "expectedBidResponses": [] -} diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn-no-tag-code.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn-no-tag-code.json new file mode 100644 index 00000000000..48162742a17 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn-no-tag-code.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "" + } + } + }], + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn.json new file mode 100644 index 00000000000..5aaa5a1ddc2 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "bar", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/site.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/site.json new file mode 100644 index 00000000000..d273f4d411d --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/site.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "foo.com" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "foo.com" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/tagcode-params.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/tagcode-params.json deleted file mode 100644 index c97febcfea2..00000000000 --- a/adapters/triplelift_native/triplelift_nativetest/exemplary/tagcode-params.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "site": { "publisher": {"id":"foo","name":"foo", "domain": "foo.com"}}, - "imp": [ - { - "native":{ - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "id": "test-imp-id", - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor" : 20 - }, - "data": { - "tag_code": "bar" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "tagid": "foo", - "bidfloor": 20, - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor" : 20 - }, - "data": { - "tag_code": "bar" - } - } - } - ], - "site": { - "publisher": { - "id": "foo", - "name": "foo", - "domain": "foo.com" - } - } - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 204 - } - } - ], - "expectedBidResponses": [] - } - \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/app-no-publisher.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/app-no-publisher.json new file mode 100644 index 00000000000..56b339a1d79 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/app-no-publisher.json @@ -0,0 +1,25 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": {}, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "expectedMakeRequestsErrors": [{ + "value": "Unsupported publisher for triplelift_native", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/app-publisher-no-domain.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/app-publisher-no-domain.json new file mode 100644 index 00000000000..ac119354c36 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/app-publisher-no-domain.json @@ -0,0 +1,60 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "publisher": { + "id": "foo" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "app": { + "publisher": { + "id": "foo" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 204 + } + }], + "expectedBidResponses": [] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-allowed.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-allowed.json new file mode 100644 index 00000000000..74ac9294783 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-allowed.json @@ -0,0 +1,122 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "baz", + "name": "foo", + "domain": "foo.com", + "ext": { + "prebid": { + "parentAccount": "foo" + } + } + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "site": { + "publisher": { + "id": "baz", + "name": "foo", + "domain": "foo.com", + "ext": { + "prebid": { + "parentAccount": "foo" + } + } + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-not-allowed.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-not-allowed.json new file mode 100644 index 00000000000..d43c18cc402 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-not-allowed.json @@ -0,0 +1,36 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "baz", + "name": "foo", + "domain": "foo.com", + "ext": { + "prebid": { + "parentAccount": "faz" + } + } + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "expectedMakeRequestsErrors": [{ + "value": "Unsupported publisher for triplelift_native", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/no-imp-ext-data.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/no-imp-ext-data.json new file mode 100644 index 00000000000..a46d0483fea --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/no-imp-ext-data.json @@ -0,0 +1,85 @@ +{ + "mockBidRequest": { + "site": { + "publisher": { + "id": "foo", + "name": "foo" + } + }, + "id": "test-request-id", + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "site": { + "publisher": { + "id": "foo", + "name": "foo" + } + }, + "id": "test-request-id", + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "tagid": "invcode", + "ext": { + "bidder": { + "inventoryCode": "invcode" + } + } + }] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 302, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "triplelift_pb": { + "format": 2 + } + } + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [{ + "value": "Unexpected status code: 302. Run with request.debug = 1 for more info", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/nopub.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/nopub.json deleted file mode 100644 index cdeaff3961a..00000000000 --- a/adapters/triplelift_native/triplelift_nativetest/supplemental/nopub.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "expectedMakeRequestsErrors": [ - { - "value": "Unsupported publisher for triplelift_native", - "comparison": "literal" - } - ], - "mockBidRequest": { - "id": "test-request-id", - "app": { "publisher": {"ext":{"prebid":{"parentAccount":"faz"}}, "id":"far","name":"bar"}}, - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor": 20 - } - } - } - ] - }, - "httpCalls": [ - ] -} diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/notgoodstatuscode.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/notgoodstatuscode.json deleted file mode 100644 index 46588f2e068..00000000000 --- a/adapters/triplelift_native/triplelift_nativetest/supplemental/notgoodstatuscode.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "mockBidRequest": { - "site": { "publisher": {"id":"foo","name":"foo"}}, - "id": "test-request-id", - "imp": [ - { - "native":{ - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "id": "test-imp-id", - "ext": { - "bidder": { - "inventoryCode": "aa" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", - "body": { - "site": { "publisher": {"id":"foo","name":"foo"}}, - "id": "test-request-id", - "imp": [ - { - "native":{ - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "id": "test-imp-id", - "tagid" : "aa", - "ext": { - "bidder": { - "inventoryCode": "aa" - } - } - } - ] - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 302, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "triplelift.com" - ], - "iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "triplelift_pb": { - "format": 2 - } - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [ - { - "value": "Unexpected status code: 302. Run with request.debug = 1 for more info", - "comparison": "literal" - } - ] -} diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/site-no-publisher.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/site-no-publisher.json new file mode 100644 index 00000000000..62f9bdab17c --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/site-no-publisher.json @@ -0,0 +1,25 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": {}, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "expectedMakeRequestsErrors": [{ + "value": "Unsupported publisher for triplelift_native", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/site-publisher-no-domain.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/site-publisher-no-domain.json new file mode 100644 index 00000000000..d44ae442fab --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/site-publisher-no-domain.json @@ -0,0 +1,62 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "foo", + "name": "foo" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "site": { + "publisher": { + "id": "foo", + "name": "foo" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 204 + } + }], + "expectedBidResponses": [] +} \ No newline at end of file diff --git a/static/bidder-params/triplelift_native.json b/static/bidder-params/triplelift_native.json index 4fd71c722ba..4cf90ef49e7 100644 --- a/static/bidder-params/triplelift_native.json +++ b/static/bidder-params/triplelift_native.json @@ -7,6 +7,7 @@ "properties": { "inventoryCode": { "type": "string", + "minLength": 1, "description": "TripleLift inventory code for this ad unit (provided to you by your partner manager)" }, "floor" : {"description" : "the bid floor, in usd", "type": "number" } From 466ff838b669f45a1de7a70d0f33fe113e3430cb Mon Sep 17 00:00:00 2001 From: "Ruslan S." Date: Tue, 30 Jul 2024 03:51:44 +0800 Subject: [PATCH 22/31] Smaato: Add DOOH support (#3751) --- adapters/smaato/banner.go | 7 +- adapters/smaato/banner_test.go | 6 +- adapters/smaato/smaato.go | 18 +- .../exemplary/multiple-impressions-skadn.json | 6 +- .../exemplary/multiple-impressions.json | 6 +- .../exemplary/multiple-media-types-skadn.json | 6 +- .../exemplary/multiple-media-types.json | 6 +- .../smaato/smaatotest/exemplary/native.json | 2 +- .../exemplary/simple-banner-app.json | 4 +- .../exemplary/simple-banner-dooh.json | 218 +++++++++++++++++ .../exemplary/simple-banner-eids.json | 4 +- .../exemplary/simple-banner-skadn.json | 4 +- .../smaatotest/exemplary/simple-banner.json | 4 +- .../smaatotest/exemplary/video-app.json | 2 +- .../smaatotest/exemplary/video-dooh.json | 225 ++++++++++++++++++ .../smaato/smaatotest/exemplary/video.json | 2 +- .../bad-adtype-header-response.json | 2 +- .../bad-expires-header-response.json | 4 +- .../bad-status-code-response.json | 2 +- .../supplemental/banner-w-and-h.json | 4 +- .../supplemental/curl-nil-response.json | 207 ++++++++++++++++ .../supplemental/expires-header-response.json | 4 +- ...est.json => no-app-site-dooh-request.json} | 2 +- .../supplemental/no-bid-response.json | 2 +- .../supplemental/no-consent-info-request.json | 4 +- .../outdated-expires-header-response.json | 4 +- .../video/multiple-adpods-skadn.json | 4 +- .../smaatotest/video/multiple-adpods.json | 4 +- .../smaatotest/video/single-adpod-skadn.json | 2 +- .../smaato/smaatotest/video/single-adpod.json | 2 +- .../bad-adtype-header-response.json | 4 +- .../bad-bid-ext-response.json | 2 +- 32 files changed, 718 insertions(+), 55 deletions(-) create mode 100644 adapters/smaato/smaatotest/exemplary/simple-banner-dooh.json create mode 100644 adapters/smaato/smaatotest/exemplary/video-dooh.json create mode 100644 adapters/smaato/smaatotest/supplemental/curl-nil-response.json rename adapters/smaato/smaatotest/supplemental/{no-app-site-request.json => no-app-site-dooh-request.json} (92%) diff --git a/adapters/smaato/banner.go b/adapters/smaato/banner.go index 17fb0a6c188..643405facf3 100644 --- a/adapters/smaato/banner.go +++ b/adapters/smaato/banner.go @@ -7,15 +7,16 @@ import ( ) func extractAdmBanner(adMarkup string, curls []string) string { - var clickEvent string if len(curls) > 0 { + var clickEvent string var clicks strings.Builder for _, clicktracker := range curls { clicks.WriteString("fetch(decodeURIComponent('" + url.QueryEscape(clicktracker) + "'.replace(/\\+/g, ' ')), " + "{cache: 'no-cache'});") } - clickEvent = fmt.Sprintf(`onclick=%s`, clicks.String()) + clickEvent = fmt.Sprintf(`onclick="%s"`, clicks.String()) + return fmt.Sprintf(`
%s
`, clickEvent, adMarkup) } - return fmt.Sprintf(`
%s
`, clickEvent, adMarkup) + return adMarkup } diff --git a/adapters/smaato/banner_test.go b/adapters/smaato/banner_test.go index 83b08a6b77a..bf3e877ae18 100644 --- a/adapters/smaato/banner_test.go +++ b/adapters/smaato/banner_test.go @@ -15,19 +15,19 @@ func TestExtractAdmBanner(t *testing.T) { { testName: "extract_banner_without_curls", adMarkup: ``, - expectedAdMarkup: `
`, + expectedAdMarkup: ``, curls: []string{}, }, { testName: "extract_banner_with_nil_curls", adMarkup: ``, - expectedAdMarkup: `
`, + expectedAdMarkup: ``, curls: nil, }, { testName: "extract_banner_with_curls", adMarkup: ``, - expectedAdMarkup: `
`, + expectedAdMarkup: `
`, curls: []string{"curls.net"}, }, } diff --git a/adapters/smaato/smaato.go b/adapters/smaato/smaato.go index 5421578967c..2d1579c55bd 100644 --- a/adapters/smaato/smaato.go +++ b/adapters/smaato/smaato.go @@ -17,7 +17,7 @@ import ( "github.com/prebid/prebid-server/v2/util/timeutil" ) -const clientVersion = "prebid_server_1.0" +const clientVersion = "prebid_server_1.1" type adMarkupType string @@ -271,7 +271,7 @@ func getAdMarkupType(response *adapters.ResponseData) (adMarkupType, error) { return admType, nil } else { return "", &errortypes.BadServerResponse{ - Message: fmt.Sprintf("X-Smt-Adtype header is missing!"), + Message: fmt.Sprintf("X-Smt-Adtype header is missing."), } } } @@ -330,6 +330,7 @@ func prepareCommonRequest(request *openrtb2.BidRequest) error { } setApp(request) + setDOOH(request) return setExt(request) } @@ -434,6 +435,13 @@ func setApp(request *openrtb2.BidRequest) { } } +func setDOOH(request *openrtb2.BidRequest) { + if request.DOOH != nil { + doohCopy := *request.DOOH + request.DOOH = &doohCopy + } +} + func setPublisherId(request *openrtb2.BidRequest, imp *openrtb2.Imp) error { publisherID, err := jsonparser.GetString(imp.Ext, "bidder", "publisherId") if err != nil { @@ -448,8 +456,12 @@ func setPublisherId(request *openrtb2.BidRequest, imp *openrtb2.Imp) error { // App is already a copy request.App.Publisher = &openrtb2.Publisher{ID: publisherID} return nil + } else if request.DOOH != nil { + // DOOH is already a copy + request.DOOH.Publisher = &openrtb2.Publisher{ID: publisherID} + return nil } else { - return &errortypes.BadInput{Message: "Missing Site/App."} + return &errortypes.BadInput{Message: "Missing Site/App/DOOH."} } } diff --git a/adapters/smaato/smaatotest/exemplary/multiple-impressions-skadn.json b/adapters/smaato/smaatotest/exemplary/multiple-impressions-skadn.json index e9dd531df35..c817cd9543a 100644 --- a/adapters/smaato/smaatotest/exemplary/multiple-impressions-skadn.json +++ b/adapters/smaato/smaatotest/exemplary/multiple-impressions-skadn.json @@ -201,7 +201,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -350,7 +350,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["postbid_iframe"] @@ -421,7 +421,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/multiple-impressions.json b/adapters/smaato/smaatotest/exemplary/multiple-impressions.json index 34d27a5c5a1..3fee0d654c3 100644 --- a/adapters/smaato/smaatotest/exemplary/multiple-impressions.json +++ b/adapters/smaato/smaatotest/exemplary/multiple-impressions.json @@ -160,7 +160,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -270,7 +270,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["postbid_iframe"] @@ -317,7 +317,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/multiple-media-types-skadn.json b/adapters/smaato/smaatotest/exemplary/multiple-media-types-skadn.json index 74eaec95650..c2b7bf97869 100644 --- a/adapters/smaato/smaatotest/exemplary/multiple-media-types-skadn.json +++ b/adapters/smaato/smaatotest/exemplary/multiple-media-types-skadn.json @@ -178,7 +178,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -327,7 +327,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -398,7 +398,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/multiple-media-types.json b/adapters/smaato/smaatotest/exemplary/multiple-media-types.json index abccdc34671..4c6f031016a 100644 --- a/adapters/smaato/smaatotest/exemplary/multiple-media-types.json +++ b/adapters/smaato/smaatotest/exemplary/multiple-media-types.json @@ -150,7 +150,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -260,7 +260,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -307,7 +307,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/native.json b/adapters/smaato/smaatotest/exemplary/native.json index 7d87cc8d974..f229220180e 100644 --- a/adapters/smaato/smaatotest/exemplary/native.json +++ b/adapters/smaato/smaatotest/exemplary/native.json @@ -124,7 +124,7 @@ } }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["postbid_iframe"] diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-app.json b/adapters/smaato/smaatotest/exemplary/simple-banner-app.json index 53b7d148278..d2c5f5453ed 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner-app.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-app.json @@ -158,7 +158,7 @@ "keywords": "keywords" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -205,7 +205,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-dooh.json b/adapters/smaato/smaatotest/exemplary/simple-banner-dooh.json new file mode 100644 index 00000000000..d5fd7ef1f05 --- /dev/null +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-dooh.json @@ -0,0 +1,218 @@ +{ + "mockBidRequest": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "dooh": { + "id": "id", + "name": "name", + "domain": "domain", + "venuetypetax": 1, + "content": { + "id": "content-id", + "title": "content-title", + "series": "content-series", + "genre": "content-genre", + "producer": { + "id": "producer-id", + "name": "producer-name" + }, + "cat": [ + "IAB8-6" + ], + "livestream": 1, + "language": "en" + }, + "keywords": "keywords" + }, + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "banner": { + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisherId": "1100042525", + "adspaceId": "130563103" + } + } + } + ], + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "user": { + "ext": { + "consent": "gdprConsentString", + "data": { + "keywords": "a,b", + "gender": "M", + "yob": 1984, + "geo": { + "country": "ca" + } + } + } + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": ["application/json;charset=utf-8"], + "Accept": ["application/json"] + }, + "uri": "https://prebid/bidder", + "body": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "tagid": "130563103", + "banner": { + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + } + } + ], + "user": { + "ext": { + "consent": "gdprConsentString" + }, + "gender": "M", + "keywords": "a,b", + "yob": 1984 + }, + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + }, + "dooh": { + "publisher": { + "id": "1100042525" + }, + "id": "id", + "name": "name", + "domain": "domain", + "venuetypetax": 1, + "content": { + "id": "content-id", + "title": "content-title", + "series": "content-series", + "genre": "content-genre", + "producer": { + "id": "producer-id", + "name": "producer-name" + }, + "cat": [ + "IAB8-6" + ], + "livestream": 1, + "language": "en" + }, + "keywords": "keywords" + }, + "ext": { + "client": "prebid_server_1.1" + } + }, + "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] + }, + "mockResponse": { + "status": 200, + "headers": { + "X-Smt-Adtype": ["Img"] + }, + "body": { + "id": "5ebea288-f13a-4754-be6d-4ade66c68877", + "seatbid": [ + { + "seat": "CM6523", + "bid": [ + { + "adm": "\"\"", + "adomain": [ + "smaato.com" + ], + "bidderName": "smaato", + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", + "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", + "price": 0.01, + "w": 350, + "h": 50 + } + ] + } + ], + "bidid": "04db8629-179d-4bcd-acce-e54722969006", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "adm": "\"\"", + "adomain": [ + "smaato.com" + ], + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", + "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", + "price": 0.01, + "w": 350, + "h": 50, + "exp": 300 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-eids.json b/adapters/smaato/smaatotest/exemplary/simple-banner-eids.json index 6982459bd8d..ed0b61dcefa 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner-eids.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-eids.json @@ -153,7 +153,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -200,7 +200,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-skadn.json b/adapters/smaato/smaatotest/exemplary/simple-banner-skadn.json index 2a3f3cbef27..cab205f7334 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner-skadn.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-skadn.json @@ -167,7 +167,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -238,7 +238,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner.json b/adapters/smaato/smaatotest/exemplary/simple-banner.json index 0b866589a5d..48ee26ebddc 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner.json @@ -153,7 +153,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -216,7 +216,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "
\"\"
", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/exemplary/video-app.json b/adapters/smaato/smaatotest/exemplary/video-app.json index 0fda52f2914..cd074530838 100644 --- a/adapters/smaato/smaatotest/exemplary/video-app.json +++ b/adapters/smaato/smaatotest/exemplary/video-app.json @@ -165,7 +165,7 @@ "keywords": "keywords" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["postbid_iframe"] diff --git a/adapters/smaato/smaatotest/exemplary/video-dooh.json b/adapters/smaato/smaatotest/exemplary/video-dooh.json new file mode 100644 index 00000000000..98d30df7774 --- /dev/null +++ b/adapters/smaato/smaatotest/exemplary/video-dooh.json @@ -0,0 +1,225 @@ +{ + "mockBidRequest": { + "id": "447a0a1d-389d-4730-a418-3777e95de7bd", + "imp": [ + { + "id": "postbid_iframe", + "video": { + "mimes": [ + "video/mp4", + "video/quicktime", + "video/3gpp", + "video/x-m4v" + ], + "minduration": 5, + "maxduration": 30, + "protocols": [ + 7 + ], + "w": 1024, + "h": 768, + "startdelay": 0, + "linearity": 1, + "skip": 1, + "skipmin": 5, + "api": [ + 7 + ], + "ext": { + "rewarded": 0 + } + }, + "ext": { + "bidder": { + "publisherId": "1100042525", + "adspaceId": "130563103" + } + } + } + ], + "dooh": { + "id": "id", + "name": "name", + "domain": "domain", + "venuetypetax": 1, + "content": { + "id": "content-id", + "title": "content-title", + "series": "content-series", + "genre": "content-genre", + "producer": { + "id": "producer-id", + "name": "producer-name" + }, + "cat": [ + "IAB8-6" + ], + "livestream": 1, + "language": "en" + }, + "keywords": "keywords" + }, + "device": { + "ua": "test-user-agent" + }, + "user": { + "ext": { + "data": {} + } + }, + "ext": { + "prebid": { + "auctiontimestamp": 1598262728811, + "targeting": { + "includewinners": true, + "includebidderkeys": false + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "https://prebid/bidder", + "body": { + "id": "447a0a1d-389d-4730-a418-3777e95de7bd", + "imp": [ + { + "id": "postbid_iframe", + "tagid": "130563103", + "video": { + "w": 1024, + "h": 768, + "ext": { + "rewarded": 0 + }, + "mimes": [ + "video/mp4", + "video/quicktime", + "video/3gpp", + "video/x-m4v" + ], + "minduration": 5, + "startdelay": 0, + "linearity": 1, + "maxduration": 30, + "skip": 1, + "protocols": [ + 7 + ], + "skipmin": 5, + "api": [ + 7 + ] + } + } + ], + "user": { + "ext": { + } + }, + "device": { + "ua": "test-user-agent" + }, + "dooh": { + "publisher": { + "id": "1100042525" + }, + "id": "id", + "name": "name", + "domain": "domain", + "venuetypetax": 1, + "content": { + "id": "content-id", + "title": "content-title", + "series": "content-series", + "genre": "content-genre", + "producer": { + "id": "producer-id", + "name": "producer-name" + }, + "cat": [ + "IAB8-6" + ], + "livestream": 1, + "language": "en" + }, + "keywords": "keywords" + }, + "ext": { + "client": "prebid_server_1.1" + } + }, + "impIDs":["postbid_iframe"] + }, + "mockResponse": { + "status": 200, + "headers": { + "X-Smt-Adtype": ["Video"] + }, + "body": { + "id": "5ebea288-f13a-4754-be6d-4ade66c68877", + "seatbid": [ + { + "seat": "CM6523", + "bid": [ + { + "adm": "", + "adomain": [ + "smaato.com" + ], + "bidderName": "smaato", + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://iurl", + "nurl": "https://nurl", + "price": 0.01, + "w": 1024, + "h": 768 + } + ] + } + ], + "bidid": "04db8629-179d-4bcd-acce-e54722969006", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "adm": "", + "adomain": [ + "smaato.com" + ], + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://iurl", + "nurl": "https://nurl", + "price": 0.01, + "w": 1024, + "h": 768, + "exp": 300 + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/smaato/smaatotest/exemplary/video.json b/adapters/smaato/smaatotest/exemplary/video.json index 5b486ae5702..2207c53cf53 100644 --- a/adapters/smaato/smaatotest/exemplary/video.json +++ b/adapters/smaato/smaatotest/exemplary/video.json @@ -180,7 +180,7 @@ } }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["postbid_iframe"] diff --git a/adapters/smaato/smaatotest/supplemental/bad-adtype-header-response.json b/adapters/smaato/smaatotest/supplemental/bad-adtype-header-response.json index 800aa6d76f8..af739711bf4 100644 --- a/adapters/smaato/smaatotest/supplemental/bad-adtype-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/bad-adtype-header-response.json @@ -123,7 +123,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] diff --git a/adapters/smaato/smaatotest/supplemental/bad-expires-header-response.json b/adapters/smaato/smaatotest/supplemental/bad-expires-header-response.json index 1afb1f66eda..7368c666886 100644 --- a/adapters/smaato/smaatotest/supplemental/bad-expires-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/bad-expires-header-response.json @@ -123,7 +123,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -171,7 +171,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/supplemental/bad-status-code-response.json b/adapters/smaato/smaatotest/supplemental/bad-status-code-response.json index 095b398e461..c00518e096f 100644 --- a/adapters/smaato/smaatotest/supplemental/bad-status-code-response.json +++ b/adapters/smaato/smaatotest/supplemental/bad-status-code-response.json @@ -123,7 +123,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] diff --git a/adapters/smaato/smaatotest/supplemental/banner-w-and-h.json b/adapters/smaato/smaatotest/supplemental/banner-w-and-h.json index 9b135832b69..e3cc2174433 100644 --- a/adapters/smaato/smaatotest/supplemental/banner-w-and-h.json +++ b/adapters/smaato/smaatotest/supplemental/banner-w-and-h.json @@ -107,7 +107,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -154,7 +154,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/supplemental/curl-nil-response.json b/adapters/smaato/smaatotest/supplemental/curl-nil-response.json new file mode 100644 index 00000000000..9f0f3359ea6 --- /dev/null +++ b/adapters/smaato/smaatotest/supplemental/curl-nil-response.json @@ -0,0 +1,207 @@ +{ + "mockBidRequest": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "site": { + "publisher": { + "id": "1100042525" + }, + "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", + "ext": { + "data": { + "keywords": "power tools", + "search": "drill", + "content": { + "userrating": 4 + } + } + } + }, + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "banner": { + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + }, + "instl": 1, + "bidfloor": 0.00123, + "ext": { + "bidder": { + "publisherId": "1100042525", + "adspaceId": "130563103" + } + } + } + ], + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "user": { + "ext": { + "consent": "gdprConsentString", + "data": { + "keywords": "a,b", + "gender": "M", + "yob": 1984, + "geo": { + "country": "ca" + } + } + } + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString", + "gpp": "gppString", + "gpp_sid": [7] + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": ["application/json;charset=utf-8"], + "Accept": ["application/json"] + }, + "uri": "https://prebid/bidder", + "body": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "tagid": "130563103", + "bidfloor": 0.00123, + "instl": 1, + "banner": { + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + } + } + ], + "user": { + "ext": { + "consent": "gdprConsentString" + }, + "gender": "M", + "keywords": "a,b", + "yob": 1984 + }, + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString", + "gpp": "gppString", + "gpp_sid": [7] + } + }, + "site": { + "publisher": { + "id": "1100042525" + }, + "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", + "keywords": "power tools" + }, + "ext": { + "client": "prebid_server_1.1" + } + }, + "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] + }, + "mockResponse": { + "status": 200, + "headers": { + "X-Smt-Adtype": ["Img"] + }, + "body": { + "id": "5ebea288-f13a-4754-be6d-4ade66c68877", + "seatbid": [ + { + "seat": "CM6523", + "bid": [ + { + "adm": "\"\"", + "adomain": [ + "smaato.com" + ], + "bidderName": "smaato", + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", + "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", + "price": 0.01, + "w": 350, + "h": 50, + "ext": { + "curls": null + } + } + ] + } + ], + "bidid": "04db8629-179d-4bcd-acce-e54722969006", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "adm": "\"\"", + "adomain": [ + "smaato.com" + ], + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", + "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", + "price": 0.01, + "w": 350, + "h": 50, + "exp": 300, + "ext": { + "curls": null + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/smaato/smaatotest/supplemental/expires-header-response.json b/adapters/smaato/smaatotest/supplemental/expires-header-response.json index 885d5e491be..a063c7c1757 100644 --- a/adapters/smaato/smaatotest/supplemental/expires-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/expires-header-response.json @@ -123,7 +123,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -171,7 +171,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/supplemental/no-app-site-request.json b/adapters/smaato/smaatotest/supplemental/no-app-site-dooh-request.json similarity index 92% rename from adapters/smaato/smaatotest/supplemental/no-app-site-request.json rename to adapters/smaato/smaatotest/supplemental/no-app-site-dooh-request.json index 04a73b4f40d..c6b2ead79da 100644 --- a/adapters/smaato/smaatotest/supplemental/no-app-site-request.json +++ b/adapters/smaato/smaatotest/supplemental/no-app-site-dooh-request.json @@ -23,7 +23,7 @@ }, "expectedMakeRequestsErrors": [ { - "value": "Missing Site/App.", + "value": "Missing Site/App/DOOH.", "comparison": "literal" } ] diff --git a/adapters/smaato/smaatotest/supplemental/no-bid-response.json b/adapters/smaato/smaatotest/supplemental/no-bid-response.json index f7f80855fe5..be41b1f1c68 100644 --- a/adapters/smaato/smaatotest/supplemental/no-bid-response.json +++ b/adapters/smaato/smaatotest/supplemental/no-bid-response.json @@ -123,7 +123,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] diff --git a/adapters/smaato/smaatotest/supplemental/no-consent-info-request.json b/adapters/smaato/smaatotest/supplemental/no-consent-info-request.json index 646f4d72e2a..6be49b1b4fb 100644 --- a/adapters/smaato/smaatotest/supplemental/no-consent-info-request.json +++ b/adapters/smaato/smaatotest/supplemental/no-consent-info-request.json @@ -70,7 +70,7 @@ } }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -117,7 +117,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/supplemental/outdated-expires-header-response.json b/adapters/smaato/smaatotest/supplemental/outdated-expires-header-response.json index 1bc27aea876..fd52751aae6 100644 --- a/adapters/smaato/smaatotest/supplemental/outdated-expires-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/outdated-expires-header-response.json @@ -123,7 +123,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"] @@ -171,7 +171,7 @@ "bids": [ { "bid": { - "adm": "
\"\"
", + "adm": "\"\"", "adomain": [ "smaato.com" ], diff --git a/adapters/smaato/smaatotest/video/multiple-adpods-skadn.json b/adapters/smaato/smaatotest/video/multiple-adpods-skadn.json index 749c859bd28..a9942bcbd93 100644 --- a/adapters/smaato/smaatotest/video/multiple-adpods-skadn.json +++ b/adapters/smaato/smaatotest/video/multiple-adpods-skadn.json @@ -301,7 +301,7 @@ } }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1_1","1_2"] @@ -516,7 +516,7 @@ } }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["2_1","2_2"] diff --git a/adapters/smaato/smaatotest/video/multiple-adpods.json b/adapters/smaato/smaatotest/video/multiple-adpods.json index 36c98c2f741..c2eac4dc65c 100644 --- a/adapters/smaato/smaatotest/video/multiple-adpods.json +++ b/adapters/smaato/smaatotest/video/multiple-adpods.json @@ -234,7 +234,7 @@ } }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1_1","1_2"] @@ -390,7 +390,7 @@ } }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["2_1","2_2"] diff --git a/adapters/smaato/smaatotest/video/single-adpod-skadn.json b/adapters/smaato/smaatotest/video/single-adpod-skadn.json index 545cdb5351e..3f2070a3021 100644 --- a/adapters/smaato/smaatotest/video/single-adpod-skadn.json +++ b/adapters/smaato/smaatotest/video/single-adpod-skadn.json @@ -221,7 +221,7 @@ } }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1_1","1_2"] diff --git a/adapters/smaato/smaatotest/video/single-adpod.json b/adapters/smaato/smaatotest/video/single-adpod.json index ff9fdfce892..11e6ccf710d 100644 --- a/adapters/smaato/smaatotest/video/single-adpod.json +++ b/adapters/smaato/smaatotest/video/single-adpod.json @@ -180,7 +180,7 @@ } }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1_1","1_2"] diff --git a/adapters/smaato/smaatotest/videosupplemental/bad-adtype-header-response.json b/adapters/smaato/smaatotest/videosupplemental/bad-adtype-header-response.json index f422b0af9d9..e831add95de 100644 --- a/adapters/smaato/smaatotest/videosupplemental/bad-adtype-header-response.json +++ b/adapters/smaato/smaatotest/videosupplemental/bad-adtype-header-response.json @@ -176,7 +176,7 @@ } }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs": [ @@ -228,7 +228,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "X-Smt-Adtype header is missing!", + "value": "X-Smt-Adtype header is missing.", "comparison": "literal" } ], diff --git a/adapters/smaato/smaatotest/videosupplemental/bad-bid-ext-response.json b/adapters/smaato/smaatotest/videosupplemental/bad-bid-ext-response.json index 6cf7f23803c..7fca5d38592 100644 --- a/adapters/smaato/smaatotest/videosupplemental/bad-bid-ext-response.json +++ b/adapters/smaato/smaatotest/videosupplemental/bad-bid-ext-response.json @@ -176,7 +176,7 @@ } }, "ext": { - "client": "prebid_server_1.0" + "client": "prebid_server_1.1" } }, "impIDs":["1_1","1_2"] From ed3e4a121e289526f495ccf005634b13c5e75c33 Mon Sep 17 00:00:00 2001 From: Zhongshi Xi Date: Mon, 29 Jul 2024 16:21:06 -0400 Subject: [PATCH 23/31] Gracefully shutdown analytics module/runner (#3335) --- analytics/agma/agma_module.go | 5 ++++ analytics/agma/agma_module_test.go | 35 ++++++++++++++++++++++++ analytics/build/build.go | 7 +++++ analytics/build/build_test.go | 17 ++++++++++++ analytics/core.go | 1 + analytics/filesystem/file_module.go | 27 +++++++++++++----- analytics/filesystem/file_module_test.go | 25 +++++++++++++++++ analytics/pubstack/pubstack_module.go | 6 ++++ analytics/runner.go | 1 + endpoints/cookie_sync_test.go | 4 +++ endpoints/events/event_test.go | 2 ++ endpoints/openrtb2/amp_auction_test.go | 1 + endpoints/openrtb2/video_auction_test.go | 2 ++ router/router.go | 17 ++++++++++-- 14 files changed, 140 insertions(+), 10 deletions(-) diff --git a/analytics/agma/agma_module.go b/analytics/agma/agma_module.go index 534c189d914..b531393f2ca 100644 --- a/analytics/agma/agma_module.go +++ b/analytics/agma/agma_module.go @@ -261,6 +261,11 @@ func (l *AgmaLogger) LogVideoObject(event *analytics.VideoObject) { l.bufferCh <- data } +func (l *AgmaLogger) Shutdown() { + glog.Info("[AgmaAnalytics] Shutdown, trying to flush buffer") + l.flush() // mutex safe +} + func (l *AgmaLogger) LogCookieSyncObject(event *analytics.CookieSyncObject) {} func (l *AgmaLogger) LogNotificationEventObject(event *analytics.NotificationEvent) {} func (l *AgmaLogger) LogSetUIDObject(event *analytics.SetUIDObject) {} diff --git a/analytics/agma/agma_module_test.go b/analytics/agma/agma_module_test.go index 3e4955bd8a5..550cf418c8d 100644 --- a/analytics/agma/agma_module_test.go +++ b/analytics/agma/agma_module_test.go @@ -664,3 +664,38 @@ func TestRaceEnd2End(t *testing.T) { assert.Equal(t, expected, actual) } + +func TestShutdownFlush(t *testing.T) { + cfg := config.AgmaAnalytics{ + Enabled: true, + Endpoint: config.AgmaAnalyticsHttpEndpoint{ + Url: "http://localhost:8000/event", + Timeout: "5s", + }, + Buffers: config.AgmaAnalyticsBuffer{ + EventCount: 1000, + BufferSize: "100mb", + Timeout: "5m", + }, + Accounts: []config.AgmaAnalyticsAccount{ + { + PublisherId: "track-me", + Code: "abc", + }, + }, + } + mockedSender := new(MockedSender) + mockedSender.On("Send", mock.Anything).Return(nil) + clockMock := clock.NewMock() + logger, err := newAgmaLogger(cfg, mockedSender.Send, clockMock) + assert.NoError(t, err) + + go logger.start() + logger.LogAuctionObject(&mockValidAuctionObject) + logger.Shutdown() + + time.Sleep(10 * time.Millisecond) + + mockedSender.AssertCalled(t, "Send", mock.Anything) + mockedSender.AssertNumberOfCalls(t, "Send", 1) +} diff --git a/analytics/build/build.go b/analytics/build/build.go index 4cba9a3f1a6..3c9d7ccbaea 100644 --- a/analytics/build/build.go +++ b/analytics/build/build.go @@ -129,6 +129,13 @@ func (ea enabledAnalytics) LogNotificationEventObject(ne *analytics.Notification } } +// Shutdown - correctly shutdown all analytics modules and wait for them to finish +func (ea enabledAnalytics) Shutdown() { + for _, module := range ea { + module.Shutdown() + } +} + func evaluateActivities(rw *openrtb_ext.RequestWrapper, ac privacy.ActivityControl, componentName string) (bool, *openrtb_ext.RequestWrapper) { // returned nil request wrapper means that request wrapper was not modified by activities and doesn't have to be changed in analytics object // it is needed in order to use one function for all analytics objects with RequestWrapper diff --git a/analytics/build/build_test.go b/analytics/build/build_test.go index d794c01ab8c..c455c364e83 100644 --- a/analytics/build/build_test.go +++ b/analytics/build/build_test.go @@ -79,6 +79,8 @@ func (m *sampleModule) LogAmpObject(ao *analytics.AmpObject) { *m.count++ } func (m *sampleModule) LogNotificationEventObject(ne *analytics.NotificationEvent) { *m.count++ } +func (m *sampleModule) Shutdown() { *m.count++ } + func initAnalytics(count *int) analytics.Runner { modules := make(enabledAnalytics, 0) modules["sampleModule"] = &sampleModule{count} @@ -92,6 +94,19 @@ func TestNewPBSAnalytics(t *testing.T) { assert.Equal(t, len(instance), 0) } +func TestPBSAnalyticsShutdown(t *testing.T) { + countA := 0 + countB := 0 + modules := make(enabledAnalytics, 0) + modules["sampleModuleA"] = &sampleModule{count: &countA} + modules["sampleModuleB"] = &sampleModule{count: &countB} + + modules.Shutdown() + + assert.Equal(t, 1, countA, "sampleModuleA should have been shutdown") + assert.Equal(t, 1, countB, "sampleModuleB should have been shutdown") +} + func TestNewPBSAnalytics_FileLogger(t *testing.T) { if _, err := os.Stat(TEST_DIR); os.IsNotExist(err) { if err = os.MkdirAll(TEST_DIR, 0755); err != nil { @@ -415,6 +430,8 @@ func (m *mockAnalytics) LogSetUIDObject(ao *analytics.SetUIDObject) {} func (m *mockAnalytics) LogNotificationEventObject(ao *analytics.NotificationEvent) {} +func (m *mockAnalytics) Shutdown() {} + func TestLogObject(t *testing.T) { tests := []struct { description string diff --git a/analytics/core.go b/analytics/core.go index c9e15180f44..bfbbe229fe9 100644 --- a/analytics/core.go +++ b/analytics/core.go @@ -19,6 +19,7 @@ type Module interface { LogSetUIDObject(*SetUIDObject) LogAmpObject(*AmpObject) LogNotificationEventObject(*NotificationEvent) + Shutdown() } // Loggable object of a transaction at /openrtb2/auction endpoint diff --git a/analytics/filesystem/file_module.go b/analytics/filesystem/file_module.go index 01f9c27bf43..1c1b1310c40 100644 --- a/analytics/filesystem/file_module.go +++ b/analytics/filesystem/file_module.go @@ -4,7 +4,8 @@ import ( "bytes" "fmt" - "github.com/chasex/glog" + cglog "github.com/chasex/glog" + "github.com/golang/glog" "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v2/analytics" "github.com/prebid/prebid-server/v2/util/jsonutil" @@ -21,9 +22,14 @@ const ( NOTIFICATION_EVENT RequestType = "/event" ) +type Logger interface { + Debug(v ...interface{}) + Flush() +} + // Module that can perform transactional logging type FileLogger struct { - Logger *glog.Logger + Logger Logger } // Writes AuctionObject to file @@ -85,15 +91,22 @@ func (f *FileLogger) LogNotificationEventObject(ne *analytics.NotificationEvent) f.Logger.Flush() } +// Shutdown the logger +func (f *FileLogger) Shutdown() { + // clear all pending buffered data in case there is any + glog.Info("[FileLogger] Shutdown, trying to flush buffer") + f.Logger.Flush() +} + // Method to initialize the analytic module func NewFileLogger(filename string) (analytics.Module, error) { - options := glog.LogOptions{ + options := cglog.LogOptions{ File: filename, - Flag: glog.LstdFlags, - Level: glog.Ldebug, - Mode: glog.R_Day, + Flag: cglog.LstdFlags, + Level: cglog.Ldebug, + Mode: cglog.R_Day, } - if logger, err := glog.New(options); err == nil { + if logger, err := cglog.New(options); err == nil { return &FileLogger{ logger, }, nil diff --git a/analytics/filesystem/file_module_test.go b/analytics/filesystem/file_module_test.go index 0e0831d14f1..5bc2439ac94 100644 --- a/analytics/filesystem/file_module_test.go +++ b/analytics/filesystem/file_module_test.go @@ -8,12 +8,25 @@ import ( "github.com/prebid/prebid-server/v2/analytics" "github.com/prebid/prebid-server/v2/config" + "github.com/stretchr/testify/mock" "github.com/prebid/openrtb/v20/openrtb2" ) const TEST_DIR string = "testFiles" +type MockLogger struct { + mock.Mock +} + +func (ml *MockLogger) Debug(v ...interface{}) { + ml.Called(v) +} + +func (ml *MockLogger) Flush() { + ml.Called() +} + func TestAmpObject_ToJson(t *testing.T) { ao := &analytics.AmpObject{ Status: http.StatusOK, @@ -97,3 +110,15 @@ func TestFileLogger_LogObjects(t *testing.T) { t.Fatalf("Couldn't initialize file logger: %v", err) } } + +func TestFileLoggerShutdown(t *testing.T) { + mockLogger := &MockLogger{} + fl := &FileLogger{ + Logger: mockLogger, + } + mockLogger.On("Flush").Return(nil) + + fl.Shutdown() + + mockLogger.AssertNumberOfCalls(t, "Flush", 1) +} diff --git a/analytics/pubstack/pubstack_module.go b/analytics/pubstack/pubstack_module.go index 535118c0000..8b012f172dc 100644 --- a/analytics/pubstack/pubstack_module.go +++ b/analytics/pubstack/pubstack_module.go @@ -200,6 +200,12 @@ func (p *PubstackModule) LogAmpObject(ao *analytics.AmpObject) { p.eventChannels[amp].Push(payload) } +// Shutdown - no op since the analytic module already implements system signal handling +// and trying to close a closed channel will cause panic +func (p *PubstackModule) Shutdown() { + glog.Info("[PubstackModule] Shutdown") +} + func (p *PubstackModule) start(c <-chan *Configuration) { for { select { diff --git a/analytics/runner.go b/analytics/runner.go index 7a2c56f77dd..2ca2841214f 100644 --- a/analytics/runner.go +++ b/analytics/runner.go @@ -11,4 +11,5 @@ type Runner interface { LogSetUIDObject(*SetUIDObject) LogAmpObject(*AmpObject, privacy.ActivityControl) LogNotificationEventObject(*NotificationEvent, privacy.ActivityControl) + Shutdown() } diff --git a/endpoints/cookie_sync_test.go b/endpoints/cookie_sync_test.go index edd1958fcb0..7424d65005e 100644 --- a/endpoints/cookie_sync_test.go +++ b/endpoints/cookie_sync_test.go @@ -2198,6 +2198,10 @@ func (m *MockAnalyticsRunner) LogNotificationEventObject(obj *analytics.Notifica m.Called(obj, ac) } +func (m *MockAnalyticsRunner) Shutdown() { + m.Called() +} + type MockGDPRPerms struct { mock.Mock } diff --git a/endpoints/events/event_test.go b/endpoints/events/event_test.go index 81d000fd8a4..1e07bafbc83 100644 --- a/endpoints/events/event_test.go +++ b/endpoints/events/event_test.go @@ -64,6 +64,8 @@ func (e *eventsMockAnalyticsModule) LogNotificationEventObject(ne *analytics.Not e.Invoked = true } +func (e *eventsMockAnalyticsModule) Shutdown() {} + var mockAccountData = map[string]json.RawMessage{ "events_enabled": json.RawMessage(`{"events": {"enabled":true}}`), "events_disabled": json.RawMessage(`{"events": {"enabled":false}}`), diff --git a/endpoints/openrtb2/amp_auction_test.go b/endpoints/openrtb2/amp_auction_test.go index e9b0015afe7..d73e6fb5aa3 100644 --- a/endpoints/openrtb2/amp_auction_test.go +++ b/endpoints/openrtb2/amp_auction_test.go @@ -1734,6 +1734,7 @@ func (logger mockLogger) LogNotificationEventObject(uuidObj *analytics.Notificat func (logger mockLogger) LogAmpObject(ao *analytics.AmpObject, _ privacy.ActivityControl) { *logger.ampObject = *ao } +func (logger mockLogger) Shutdown() {} func TestBuildAmpObject(t *testing.T) { testCases := []struct { diff --git a/endpoints/openrtb2/video_auction_test.go b/endpoints/openrtb2/video_auction_test.go index 55fc7fab957..c9dff0f7c92 100644 --- a/endpoints/openrtb2/video_auction_test.go +++ b/endpoints/openrtb2/video_auction_test.go @@ -1282,6 +1282,8 @@ func (m *mockAnalyticsModule) LogAmpObject(ao *analytics.AmpObject, _ privacy.Ac func (m *mockAnalyticsModule) LogNotificationEventObject(ne *analytics.NotificationEvent, _ privacy.ActivityControl) { } +func (m *mockAnalyticsModule) Shutdown() {} + func mockDeps(t *testing.T, ex *mockExchangeVideo) *endpointDeps { return &endpointDeps{ fakeUUIDGenerator{}, diff --git a/router/router.go b/router/router.go index 0712f6723dc..867c856b06c 100644 --- a/router/router.go +++ b/router/router.go @@ -124,7 +124,8 @@ type Router struct { *httprouter.Router MetricsEngine *metricsConf.DetailedMetricsEngine ParamsValidator openrtb_ext.BidderParamValidator - Shutdown func() + + shutdowns []func() } func New(cfg *config.Configuration, rateConvertor *currency.RateConverter) (r *Router, err error) { @@ -201,11 +202,12 @@ func New(cfg *config.Configuration, rateConvertor *currency.RateConverter) (r *R // Metrics engine r.MetricsEngine = metricsConf.NewMetricsEngine(cfg, openrtb_ext.CoreBidderNames(), syncerKeys, moduleStageNames) shutdown, fetcher, ampFetcher, accounts, categoriesFetcher, videoFetcher, storedRespFetcher := storedRequestsConf.NewStoredRequests(cfg, r.MetricsEngine, generalHttpClient, r.Router) - // todo(zachbadgett): better shutdown - r.Shutdown = shutdown analyticsRunner := analyticsBuild.New(&cfg.Analytics) + // register the analytics runner for shutdown + r.shutdowns = append(r.shutdowns, shutdown, analyticsRunner.Shutdown) + paramsValidator, err := openrtb_ext.NewBidderParamsValidator(schemaDirectory) if err != nil { glog.Fatalf("Failed to create the bidder params validator. %v", err) @@ -301,6 +303,15 @@ func New(cfg *config.Configuration, rateConvertor *currency.RateConverter) (r *R return r, nil } +// Shutdown closes any dependencies of the router that may need closing +func (r *Router) Shutdown() { + glog.Info("[PBS Router] shutting down") + for _, shutdown := range r.shutdowns { + shutdown() + } + glog.Info("[PBS Router] shut down") +} + func checkSupportedUserSyncEndpoints(bidderInfos config.BidderInfos) error { for name, info := range bidderInfos { if info.Syncer == nil { From 843a81cf0fe7771b4220b9bf10dcd7a57c579169 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 30 Jul 2024 23:11:16 +0200 Subject: [PATCH 24/31] Criteo: Add support for paapi (#3759) Co-authored-by: v.raybaud --- adapters/criteo/criteo.go | 46 ++++- adapters/criteo/criteo_test.go | 34 ++++ .../exemplary/simple-banner-paapi.json | 176 ++++++++++++++++++ 3 files changed, 254 insertions(+), 2 deletions(-) create mode 100644 adapters/criteo/criteotest/exemplary/simple-banner-paapi.json diff --git a/adapters/criteo/criteo.go b/adapters/criteo/criteo.go index 69fc8b38f14..7b6a4cfff89 100644 --- a/adapters/criteo/criteo.go +++ b/adapters/criteo/criteo.go @@ -13,7 +13,8 @@ import ( ) type adapter struct { - endpoint string + endpoint string + bidderName string } type BidExt struct { @@ -25,9 +26,23 @@ type ExtPrebid struct { NetworkName string `json:"networkName"` } +type CriteoExt struct { + Igi []*CriteoExtIgi `json:"igi"` +} + +type CriteoExtIgi struct { + ImpId string `json:"impid"` + Igs []*CriteoExtIgs `json:"igs"` +} + +type CriteoExtIgs struct { + Config json.RawMessage `json:"config"` +} + func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { bidder := &adapter{ - endpoint: config.Endpoint, + endpoint: config.Endpoint, + bidderName: string(bidderName), } return bidder, nil } @@ -93,9 +108,36 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R } } + bidResponse.FledgeAuctionConfigs = a.ParseFledgeAuctionConfigs(response) + return bidResponse, nil } +func (a *adapter) ParseFledgeAuctionConfigs(response openrtb2.BidResponse) []*openrtb_ext.FledgeAuctionConfig { + var responseExt CriteoExt + if response.Ext != nil { + if err := json.Unmarshal(response.Ext, &responseExt); err == nil && len(responseExt.Igi) > 0 { + fledgeAuctionConfigs := make([]*openrtb_ext.FledgeAuctionConfig, 0, len(responseExt.Igi)) + for _, igi := range responseExt.Igi { + if len(igi.Igs) > 0 && igi.Igs[0].Config != nil { + fledgeAuctionConfig := &openrtb_ext.FledgeAuctionConfig{ + ImpId: igi.ImpId, + Bidder: a.bidderName, + Config: igi.Igs[0].Config, + } + fledgeAuctionConfigs = append(fledgeAuctionConfigs, fledgeAuctionConfig) + } + } + + if len(fledgeAuctionConfigs) > 0 { + return fledgeAuctionConfigs + } + } + } + + return nil +} + func getBidMeta(ext BidExt) *openrtb_ext.ExtBidPrebidMeta { var bidMeta *openrtb_ext.ExtBidPrebidMeta if ext.Prebid.NetworkName != "" { diff --git a/adapters/criteo/criteo_test.go b/adapters/criteo/criteo_test.go index ae538246444..5a70961e0b3 100644 --- a/adapters/criteo/criteo_test.go +++ b/adapters/criteo/criteo_test.go @@ -1,6 +1,9 @@ package criteo import ( + "fmt" + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/stretchr/testify/assert" "testing" "github.com/prebid/prebid-server/v2/adapters/adapterstest" @@ -21,3 +24,34 @@ func TestJsonSamples(t *testing.T) { // Execute & Verify: adapterstest.RunJSONBidderTest(t, "criteotest", bidder) } + +func TestParseFledgeAuctionConfigs_Nil(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderCriteo, config.Adapter{ + Endpoint: "https://ssp-bidder.criteo.com/openrtb/pbs/auction/request?profile=230"}, + config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + var tests = []struct { + name string + bidResponse openrtb2.BidResponse + }{ + {"no ext", openrtb2.BidResponse{Ext: nil}}, + {"no igi", openrtb2.BidResponse{Ext: []byte("{}")}}, + {"igi empty", openrtb2.BidResponse{Ext: []byte(`{"igi":[]}`)}}, + {"no igs", openrtb2.BidResponse{Ext: []byte(`{"igi":[{}]}`)}}, + {"igs empty", openrtb2.BidResponse{Ext: []byte(`{"igi":[{"impid": "1", "igs": []}]}`)}}, + {"no config", openrtb2.BidResponse{Ext: []byte(`{"igi":[{"impid": "1", "igs": [{}]}]}`)}}, + } + + for _, tt := range tests { + testname := fmt.Sprintf("%s", tt.name) + t.Run(testname, func(t *testing.T) { + fledgeAuctionConfigs := bidder.(*adapter).ParseFledgeAuctionConfigs(tt.bidResponse) + + assert.Nil(t, fledgeAuctionConfigs) + }) + } +} diff --git a/adapters/criteo/criteotest/exemplary/simple-banner-paapi.json b/adapters/criteo/criteotest/exemplary/simple-banner-paapi.json new file mode 100644 index 00000000000..ea92a9026c8 --- /dev/null +++ b/adapters/criteo/criteotest/exemplary/simple-banner-paapi.json @@ -0,0 +1,176 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "eids": [ + { + "source": "criteo.com", + "uids": [ + { + "id": "criteo-eid" + } + ] + } + ] + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "ae": 1, + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ssp-bidder.criteo.com/openrtb/pbs/auction/request?profile=230", + "headers": {}, + "body": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "eids": [ + { + "source": "criteo.com", + "uids": [ + { + "id": "criteo-eid" + } + ] + } + ] + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "ae": 1, + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "currency": "USD", + "seatbid": [ + { + "bid": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ] + } + ], + "ext" : { + "igi": [ + { + "impid": "test-imp-id", + "igs": [ + { + "impid": "test-imp-id", + "config": { + "test": "test" + } + } + ] + } + ] + } + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ], + "fledgeAuctionConfigs": [{ + "impid": "test-imp-id", + "config": { + "test": "test" + }, + "bidder": "criteo" + }] + } + ] +} + From 7c92e10701a338dfede742fcc0269ec3b62d16a0 Mon Sep 17 00:00:00 2001 From: qt-io <104574052+qt-io@users.noreply.github.com> Date: Thu, 1 Aug 2024 20:00:51 +0300 Subject: [PATCH 25/31] New Adapter: QT (#3696) authored by @qt-io --- adapters/qt/params_test.go | 47 ++++ adapters/qt/qt.go | 152 +++++++++++ adapters/qt/qt_test.go | 20 ++ adapters/qt/qttest/exemplary/endpointId.json | 136 ++++++++++ .../qt/qttest/exemplary/multi-format.json | 105 ++++++++ adapters/qt/qttest/exemplary/multi-imp.json | 253 ++++++++++++++++++ .../qt/qttest/exemplary/simple-banner.json | 136 ++++++++++ .../qt/qttest/exemplary/simple-native.json | 120 +++++++++ .../qt/qttest/exemplary/simple-video.json | 131 +++++++++ .../qttest/exemplary/simple-web-banner.json | 136 ++++++++++ .../qttest/supplemental/bad_media_type.json | 83 ++++++ .../qt/qttest/supplemental/bad_response.json | 85 ++++++ .../qt/qttest/supplemental/status-204.json | 80 ++++++ .../qttest/supplemental/status-not-200.json | 85 ++++++ exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_qt.go | 6 + static/bidder-info/qt.yaml | 18 ++ static/bidder-params/qt.json | 22 ++ 19 files changed, 1619 insertions(+) create mode 100644 adapters/qt/params_test.go create mode 100644 adapters/qt/qt.go create mode 100644 adapters/qt/qt_test.go create mode 100644 adapters/qt/qttest/exemplary/endpointId.json create mode 100644 adapters/qt/qttest/exemplary/multi-format.json create mode 100644 adapters/qt/qttest/exemplary/multi-imp.json create mode 100644 adapters/qt/qttest/exemplary/simple-banner.json create mode 100644 adapters/qt/qttest/exemplary/simple-native.json create mode 100644 adapters/qt/qttest/exemplary/simple-video.json create mode 100644 adapters/qt/qttest/exemplary/simple-web-banner.json create mode 100644 adapters/qt/qttest/supplemental/bad_media_type.json create mode 100644 adapters/qt/qttest/supplemental/bad_response.json create mode 100644 adapters/qt/qttest/supplemental/status-204.json create mode 100644 adapters/qt/qttest/supplemental/status-not-200.json create mode 100644 openrtb_ext/imp_qt.go create mode 100644 static/bidder-info/qt.yaml create mode 100644 static/bidder-params/qt.json diff --git a/adapters/qt/params_test.go b/adapters/qt/params_test.go new file mode 100644 index 00000000000..84f9bbed17a --- /dev/null +++ b/adapters/qt/params_test.go @@ -0,0 +1,47 @@ +package qt + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +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.BidderQT, 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.BidderQT, json.RawMessage(p)); err == nil { + t.Errorf("Schema allowed invalid params: %s", p) + } + } +} + +var validParams = []string{ + `{"placementId": "test"}`, + `{"placementId": "1"}`, + `{"endpointId": "test"}`, + `{"endpointId": "1"}`, +} + +var invalidParams = []string{ + `{"placementId": 42}`, + `{"endpointId": 42}`, + `{"placementId": "1", "endpointId": "1"}`, +} diff --git a/adapters/qt/qt.go b/adapters/qt/qt.go new file mode 100644 index 00000000000..ddb306beb91 --- /dev/null +++ b/adapters/qt/qt.go @@ -0,0 +1,152 @@ +package qt + +import ( + "encoding/json" + "fmt" + "net/http" + + "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/openrtb_ext" +) + +type adapter struct { + endpoint string +} + +type reqBodyExt struct { + QTBidderExt reqBodyExtBidder `json:"bidder"` +} + +type reqBodyExtBidder struct { + Type string `json:"type"` + PlacementID string `json:"placementId,omitempty"` + EndpointID string `json:"endpointId,omitempty"` +} + +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { + bidder := &adapter{ + endpoint: config.Endpoint, + } + return bidder, nil +} + +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var errs []error + var adapterRequests []*adapters.RequestData + + reqCopy := *request + for _, imp := range request.Imp { + reqCopy.Imp = []openrtb2.Imp{imp} + + var bidderExt adapters.ExtImpBidder + var qtExt openrtb_ext.ImpExtQT + + if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { + errs = append(errs, err) + continue + } + if err := json.Unmarshal(bidderExt.Bidder, &qtExt); err != nil { + errs = append(errs, err) + continue + } + + impExt := reqBodyExt{QTBidderExt: reqBodyExtBidder{}} + + if qtExt.PlacementID != "" { + impExt.QTBidderExt.PlacementID = qtExt.PlacementID + impExt.QTBidderExt.Type = "publisher" + } else if qtExt.EndpointID != "" { + impExt.QTBidderExt.EndpointID = qtExt.EndpointID + impExt.QTBidderExt.Type = "network" + } + + finalyImpExt, err := json.Marshal(impExt) + if err != nil { + errs = append(errs, err) + continue + } + + reqCopy.Imp[0].Ext = finalyImpExt + + adapterReq, err := a.makeRequest(&reqCopy) + if err != nil { + errs = append(errs, err) + continue + } + + adapterRequests = append(adapterRequests, adapterReq) + } + + return adapterRequests, nil +} + +func (a *adapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, error) { + reqJSON, err := json.Marshal(request) + if err != nil { + return nil, err + } + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + return &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint, + Body: reqJSON, + Headers: headers, + ImpIDs: openrtb_ext.GetImpIDs(request.Imp), + }, nil +} + +func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *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 response openrtb2.BidResponse + if err := json.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + if len(response.Cur) != 0 { + bidResponse.Currency = response.Cur + } + + for _, seatBid := range response.SeatBid { + for i := range seatBid.Bid { + bid := seatBid.Bid[i] + bidType, err := getBidType(bid) + if err != nil { + return nil, []error{err} + } + + b := &adapters.TypedBid{ + Bid: &seatBid.Bid[i], + BidType: bidType, + } + bidResponse.Bids = append(bidResponse.Bids, b) + } + } + return bidResponse, nil +} + +func getBidType(bid openrtb2.Bid) (openrtb_ext.BidType, error) { + // determinate media type by bid response field mtype + switch bid.MType { + case openrtb2.MarkupBanner: + return openrtb_ext.BidTypeBanner, nil + case openrtb2.MarkupVideo: + return openrtb_ext.BidTypeVideo, nil + case openrtb2.MarkupNative: + return openrtb_ext.BidTypeNative, nil + } + + return "", fmt.Errorf("could not define media type for impression: %s", bid.ImpID) +} diff --git a/adapters/qt/qt_test.go b/adapters/qt/qt_test.go new file mode 100644 index 00000000000..a27dd2a815c --- /dev/null +++ b/adapters/qt/qt_test.go @@ -0,0 +1,20 @@ +package qt + +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" +) + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderQT, config.Adapter{ + Endpoint: "https://fake.test.io/pserver"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "qttest", bidder) +} diff --git a/adapters/qt/qttest/exemplary/endpointId.json b/adapters/qt/qttest/exemplary/endpointId.json new file mode 100644 index 00000000000..1716aaa25e8 --- /dev/null +++ b/adapters/qt/qttest/exemplary/endpointId.json @@ -0,0 +1,136 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "endpointId": "test" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://fake.test.io/pserver", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "endpointId": "test", + "type": "network" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + } + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 1, + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "qt" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 1, + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/qt/qttest/exemplary/multi-format.json b/adapters/qt/qttest/exemplary/multi-format.json new file mode 100644 index 00000000000..cb1c6ffd9c6 --- /dev/null +++ b/adapters/qt/qttest/exemplary/multi-format.json @@ -0,0 +1,105 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 5 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "endpointId": "test" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://fake.test.io/pserver", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 5 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "endpointId": "test", + "type": "network" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + } + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedBidResponses": [] +} \ No newline at end of file diff --git a/adapters/qt/qttest/exemplary/multi-imp.json b/adapters/qt/qttest/exemplary/multi-imp.json new file mode 100644 index 00000000000..1613863e2d9 --- /dev/null +++ b/adapters/qt/qttest/exemplary/multi-imp.json @@ -0,0 +1,253 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "imp": [ + { + "id": "test-imp-id1", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "endpointId": "test" + } + } + }, + { + "id": "test-imp-id2", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "endpointId": "test" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://fake.test.io/pserver", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id1", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "endpointId": "test", + "type": "network" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + } + }, + "impIDs":["test-imp-id1"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id1", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 1, + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "qt" + } + ], + "cur": "USD" + } + } + }, + { + "expectedRequest": { + "uri": "https://fake.test.io/pserver", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id2", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "endpointId": "test", + "type": "network" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + } + }, + "impIDs":["test-imp-id2"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id2", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 1, + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "qt" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id1", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 1, + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + }, + { + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id2", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 1, + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/qt/qttest/exemplary/simple-banner.json b/adapters/qt/qttest/exemplary/simple-banner.json new file mode 100644 index 00000000000..8bb08c22f74 --- /dev/null +++ b/adapters/qt/qttest/exemplary/simple-banner.json @@ -0,0 +1,136 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placementId": "test" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://fake.test.io/pserver", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placementId": "test", + "type": "publisher" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + } + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 1, + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "qt" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 1, + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/qt/qttest/exemplary/simple-native.json b/adapters/qt/qttest/exemplary/simple-native.json new file mode 100644 index 00000000000..91d53898a62 --- /dev/null +++ b/adapters/qt/qttest/exemplary/simple-native.json @@ -0,0 +1,120 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "native": { + "request": "{\"ver\":\"1.1\",\"layout\":1,\"adunit\":2,\"plcmtcnt\":6,\"plcmttype\":4,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":75}},{\"id\":2,\"required\":1,\"img\":{\"wmin\":492,\"hmin\":328,\"type\":3,\"mimes\":[\"image/jpeg\",\"image/jpg\",\"image/png\"]}},{\"id\":4,\"required\":0,\"data\":{\"type\":6}},{\"id\":5,\"required\":0,\"data\":{\"type\":7}},{\"id\":6,\"required\":0,\"data\":{\"type\":1,\"len\":20}}]}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "placementId": "test" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://fake.test.io/pserver", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "native": { + "request": "{\"ver\":\"1.1\",\"layout\":1,\"adunit\":2,\"plcmtcnt\":6,\"plcmttype\":4,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":75}},{\"id\":2,\"required\":1,\"img\":{\"wmin\":492,\"hmin\":328,\"type\":3,\"mimes\":[\"image/jpeg\",\"image/jpg\",\"image/png\"]}},{\"id\":4,\"required\":0,\"data\":{\"type\":6}},{\"id\":5,\"required\":0,\"data\":{\"type\":7}},{\"id\":6,\"required\":0,\"data\":{\"type\":1,\"len\":20}}]}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "placementId": "test", + "type": "publisher" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + } + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 4, + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "native" + } + } + } + ], + "seat": "qt" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 4, + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "native" + } + } + }, + "type": "native" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/qt/qttest/exemplary/simple-video.json b/adapters/qt/qttest/exemplary/simple-video.json new file mode 100644 index 00000000000..31906856960 --- /dev/null +++ b/adapters/qt/qttest/exemplary/simple-video.json @@ -0,0 +1,131 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 5 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "placementId": "test" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://fake.test.io/pserver", + "body": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "iPad" + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 5 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "placementId": "test", + "type": "publisher" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "00:01:00", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 2, + "ext": { + "prebid": { + "type": "video" + } + } + } + ], + "seat": "qt" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "00:01:00", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 2, + "ext": { + "prebid": { + "type": "video" + } + } + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/qt/qttest/exemplary/simple-web-banner.json b/adapters/qt/qttest/exemplary/simple-web-banner.json new file mode 100644 index 00000000000..170ccccab59 --- /dev/null +++ b/adapters/qt/qttest/exemplary/simple-web-banner.json @@ -0,0 +1,136 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placementId": "test" + } + } + } + ], + "site": { + "id": "1", + "domain": "test.com" + }, + "device": { + "ip": "123.123.123.123", + "ua": "Ubuntu" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://fake.test.io/pserver", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placementId": "test", + "type": "publisher" + } + } + } + ], + "site": { + "id": "1", + "domain": "test.com" + }, + "device": { + "ip": "123.123.123.123", + "ua": "Ubuntu" + } + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 1, + "w": 468, + "h": 60, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "qt" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "mtype": 1, + "w": 468, + "h": 60, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/qt/qttest/supplemental/bad_media_type.json b/adapters/qt/qttest/supplemental/bad_media_type.json new file mode 100644 index 00000000000..41953fdcfb1 --- /dev/null +++ b/adapters/qt/qttest/supplemental/bad_media_type.json @@ -0,0 +1,83 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "ext": { + "bidder": { + "placementId": "test" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "sdjfksdf-dfsds-dsdg-dsgg" + } + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "https://fake.test.io/pserver", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "ext": { + "bidder": { + "placementId": "test", + "type": "publisher" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "sdjfksdf-dfsds-dsdg-dsgg" + } + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "w": 300, + "h": 250, + "ext": {} + } + ], + "seat": "qt" + } + ], + "cur": "USD" + } + } + }], + "expectedMakeBidsErrors": [ + { + "value": "could not define media type for impression: test-imp-id", + "comparison": "literal" + } + ] +} diff --git a/adapters/qt/qttest/supplemental/bad_response.json b/adapters/qt/qttest/supplemental/bad_response.json new file mode 100644 index 00000000000..d8029b5ed6b --- /dev/null +++ b/adapters/qt/qttest/supplemental/bad_response.json @@ -0,0 +1,85 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placementId": "test" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "sdjfksdf-dfsds-dsdg-dsgg" + } + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "https://fake.test.io/pserver", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placementId": "test", + "type": "publisher" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "sdjfksdf-dfsds-dsdg-dsgg" + } + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": "" + } + }], + "expectedMakeBidsErrors": [ + { + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", + "comparison": "literal" + } + ] +} diff --git a/adapters/qt/qttest/supplemental/status-204.json b/adapters/qt/qttest/supplemental/status-204.json new file mode 100644 index 00000000000..f72a2eb0607 --- /dev/null +++ b/adapters/qt/qttest/supplemental/status-204.json @@ -0,0 +1,80 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placementId": "test" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "sdjfksdf-dfsds-dsdg-dsgg" + } + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "https://fake.test.io/pserver", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placementId": "test", + "type": "publisher" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "sdjfksdf-dfsds-dsdg-dsgg" + } + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 204, + "body": {} + } + }], + "expectedBidResponses": [] +} diff --git a/adapters/qt/qttest/supplemental/status-not-200.json b/adapters/qt/qttest/supplemental/status-not-200.json new file mode 100644 index 00000000000..218aa632618 --- /dev/null +++ b/adapters/qt/qttest/supplemental/status-not-200.json @@ -0,0 +1,85 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placementId": "test" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "sdjfksdf-dfsds-dsdg-dsgg" + } + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "https://fake.test.io/pserver", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placementId": "test", + "type": "publisher" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "sdjfksdf-dfsds-dsdg-dsgg" + } + }, + "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/exchange/adapter_builders.go b/exchange/adapter_builders.go index dd66efaf403..74fb044ec18 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -152,6 +152,7 @@ import ( "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/qt" "github.com/prebid/prebid-server/v2/adapters/readpeak" "github.com/prebid/prebid-server/v2/adapters/relevantdigital" "github.com/prebid/prebid-server/v2/adapters/revcontent" @@ -373,6 +374,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderPubnative: pubnative.Builder, openrtb_ext.BidderPulsepoint: pulsepoint.Builder, openrtb_ext.BidderPWBid: pwbid.Builder, + openrtb_ext.BidderQT: qt.Builder, openrtb_ext.BidderReadpeak: readpeak.Builder, openrtb_ext.BidderRelevantDigital: relevantdigital.Builder, openrtb_ext.BidderRevcontent: revcontent.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 3f8ac7dbd77..15113334222 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -170,6 +170,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderPubnative, BidderPulsepoint, BidderPWBid, + BidderQT, BidderReadpeak, BidderRelevantDigital, BidderRevcontent, @@ -488,6 +489,7 @@ const ( BidderPubnative BidderName = "pubnative" BidderPulsepoint BidderName = "pulsepoint" BidderPWBid BidderName = "pwbid" + BidderQT BidderName = "qt" BidderReadpeak BidderName = "readpeak" BidderRelevantDigital BidderName = "relevantdigital" BidderRevcontent BidderName = "revcontent" diff --git a/openrtb_ext/imp_qt.go b/openrtb_ext/imp_qt.go new file mode 100644 index 00000000000..78e4d11e746 --- /dev/null +++ b/openrtb_ext/imp_qt.go @@ -0,0 +1,6 @@ +package openrtb_ext + +type ImpExtQT struct { + PlacementID string `json:"placementId"` + EndpointID string `json:"endpointId"` +} diff --git a/static/bidder-info/qt.yaml b/static/bidder-info/qt.yaml new file mode 100644 index 00000000000..8c040144bc8 --- /dev/null +++ b/static/bidder-info/qt.yaml @@ -0,0 +1,18 @@ +endpoint: "https://endpoint1.qt.io/pserver" +maintainer: + email: "qtssp-support@qt.io" +capabilities: + site: + mediaTypes: + - banner + - video + - native + app: + mediaTypes: + - banner + - video + - native +userSync: + redirect: + url: "https://cs.qt.io/pbserver?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&redir={{.RedirectURL}}" + userMacro: "[UID]" diff --git a/static/bidder-params/qt.json b/static/bidder-params/qt.json new file mode 100644 index 00000000000..112ada92c18 --- /dev/null +++ b/static/bidder-params/qt.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "QT Adapter Params", + "description": "A schema which validates params accepted by the QT adapter", + "type": "object", + "properties": { + "placementId": { + "type": "string", + "minLength": 1, + "description": "Placement ID" + }, + "endpointId": { + "type": "string", + "minLength": 1, + "description": "Endpoint ID" + } + }, + "oneOf": [ + { "required": ["placementId"] }, + { "required": ["endpointId"] } + ] +} From 8b13ebcb54fbaf521665d696485b2b59986f7d54 Mon Sep 17 00:00:00 2001 From: edandavi Date: Mon, 5 Aug 2024 19:03:03 +0300 Subject: [PATCH 26/31] consumable adapter - use configured endpoint instead of hardcoded value (#3783) authored by @edandavi --- adapters/consumable/consumable.go | 6 +++--- adapters/consumable/consumable_test.go | 29 ++++++++++++++------------ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/adapters/consumable/consumable.go b/adapters/consumable/consumable.go index dd139e58fb0..724a3d45721 100644 --- a/adapters/consumable/consumable.go +++ b/adapters/consumable/consumable.go @@ -41,7 +41,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E requests := []*adapters.RequestData{ { Method: "POST", - Uri: "https://e.serverbid.com/sb/rtb", + Uri: a.endpoint + "/sb/rtb", Body: bodyBytes, Headers: headers, ImpIDs: openrtb_ext.GetImpIDs(request.Imp), @@ -63,7 +63,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E requests := []*adapters.RequestData{ { Method: "POST", - Uri: "https://e.serverbid.com/rtb/bid?s=" + consumableExt.PlacementId, + Uri: a.endpoint + "/rtb/bid?s=" + consumableExt.PlacementId, Body: bodyBytes, Headers: headers, ImpIDs: openrtb_ext.GetImpIDs(request.Imp), @@ -71,8 +71,8 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E } return requests, errs } - } + func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { if adapters.IsResponseStatusCodeNoContent(responseData) { return nil, nil diff --git a/adapters/consumable/consumable_test.go b/adapters/consumable/consumable_test.go index f960597cff3..05fbf88da4f 100644 --- a/adapters/consumable/consumable_test.go +++ b/adapters/consumable/consumable_test.go @@ -15,7 +15,8 @@ import ( func TestJsonSamples(t *testing.T) { bidder, buildErr := Builder(openrtb_ext.BidderConsumable, config.Adapter{ - Endpoint: "http://ib.adnxs.com/openrtb2"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + Endpoint: "https://e.serverbid.com", + }, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) @@ -28,23 +29,25 @@ func TestConsumableMakeBidsWithCategoryDuration(t *testing.T) { bidder := &adapter{} mockedReq := &openrtb2.BidRequest{ - Imp: []openrtb2.Imp{{ - ID: "1_1", - Video: &openrtb2.Video{ - W: ptrutil.ToPtr[int64](640), - H: ptrutil.ToPtr[int64](360), - MIMEs: []string{"video/mp4"}, - MaxDuration: 60, - Protocols: []adcom1.MediaCreativeSubtype{2, 3, 5, 6}, - }, - Ext: json.RawMessage( - `{ + Imp: []openrtb2.Imp{ + { + ID: "1_1", + Video: &openrtb2.Video{ + W: ptrutil.ToPtr[int64](640), + H: ptrutil.ToPtr[int64](360), + MIMEs: []string{"video/mp4"}, + MaxDuration: 60, + Protocols: []adcom1.MediaCreativeSubtype{2, 3, 5, 6}, + }, + Ext: json.RawMessage( + `{ "prebid": {}, "bidder": { "placementId": "123456" } }`, - )}, + ), + }, }, } mockedExtReq := &adapters.RequestData{} From c50e264b3c525b74fba81e316dbab004b78e9f60 Mon Sep 17 00:00:00 2001 From: Laurentiu Badea Date: Tue, 6 Aug 2024 02:27:18 -0700 Subject: [PATCH 27/31] OpenX: return cat/dur for video bids (#3834) --- adapters/openx/openx.go | 16 ++++++++++++++-- .../openx/openxtest/exemplary/simple-video.json | 14 ++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/adapters/openx/openx.go b/adapters/openx/openx.go index d56339df178..83d50b2b56b 100644 --- a/adapters/openx/openx.go +++ b/adapters/openx/openx.go @@ -231,14 +231,26 @@ func (a *OpenxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRe for _, sb := range bidResp.SeatBid { for i := range sb.Bid { bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ - Bid: &sb.Bid[i], - BidType: getMediaTypeForImp(sb.Bid[i].ImpID, internalRequest.Imp), + Bid: &sb.Bid[i], + BidType: getMediaTypeForImp(sb.Bid[i].ImpID, internalRequest.Imp), + BidVideo: getBidVideo(&sb.Bid[i]), }) } } return bidResponse, nil } +func getBidVideo(bid *openrtb2.Bid) *openrtb_ext.ExtBidPrebidVideo { + var primaryCategory string + if len(bid.Cat) > 0 { + primaryCategory = bid.Cat[0] + } + return &openrtb_ext.ExtBidPrebidVideo{ + PrimaryCategory: primaryCategory, + Duration: int(bid.Dur), + } +} + // getMediaTypeForImp figures out which media type this bid is for. // // OpenX doesn't support multi-type impressions. diff --git a/adapters/openx/openxtest/exemplary/simple-video.json b/adapters/openx/openxtest/exemplary/simple-video.json index 4b7d7798b96..e6b67775999 100644 --- a/adapters/openx/openxtest/exemplary/simple-video.json +++ b/adapters/openx/openxtest/exemplary/simple-video.json @@ -60,7 +60,10 @@ "adm": "some-test-ad", "crid": "crid_10", "w": 1024, - "h": 576 + "h": 576, + "cattax": 1, + "cat": ["IAB20"], + "dur": 30 }] } ] @@ -82,7 +85,14 @@ "adm": "some-test-ad", "crid": "crid_10", "w": 1024, - "h": 576 + "h": 576, + "cattax": 1, + "cat": ["IAB20"], + "dur": 30 + }, + "video": { + "duration": 30, + "primary_category": "IAB20" }, "type": "video" } From c3d8379c0583dcfdcad53db34130290972dc7441 Mon Sep 17 00:00:00 2001 From: dkornet-ad <169174147+dkornet-ad@users.noreply.github.com> Date: Tue, 6 Aug 2024 17:49:42 +0300 Subject: [PATCH 28/31] Adtelligent: ext aid type (#3676) authored by @dkornet-ad --- adapters/adtarget/adtarget.go | 8 +++++++- .../supplemental/wrong-impression-ext.json | 2 +- adapters/adtarget/params_test.go | 12 ++++++++---- adapters/adtelligent/adtelligent.go | 8 +++++++- .../supplemental/wrong-impression-ext.json | 2 +- adapters/adtelligent/params_test.go | 12 ++++++++---- openrtb_ext/imp_adtarget.go | 10 ++++++---- openrtb_ext/imp_adtelligent.go | 10 ++++++---- static/bidder-params/adtarget.json | 5 ++++- static/bidder-params/adtelligent.json | 5 ++++- 10 files changed, 52 insertions(+), 22 deletions(-) diff --git a/adapters/adtarget/adtarget.go b/adapters/adtarget/adtarget.go index 8c5d11704a5..7ec92c60a58 100644 --- a/adapters/adtarget/adtarget.go +++ b/adapters/adtarget/adtarget.go @@ -185,7 +185,13 @@ func validateImpressionAndSetExt(imp *openrtb2.Imp) (int, error) { imp.Ext = impExtBuffer - return impExt.SourceId, nil + aid, err := impExt.SourceId.Int64() + if err != nil { + return 0, &errortypes.BadInput{ + Message: fmt.Sprintf("ignoring imp id=%s, aid parsing err: %s", imp.ID, err), + } + } + return int(aid), nil } // Builder builds a new instance of the Adtarget adapter for the given bidder with the given config. diff --git a/adapters/adtarget/adtargettest/supplemental/wrong-impression-ext.json b/adapters/adtarget/adtargettest/supplemental/wrong-impression-ext.json index 1986dfaf13f..ee59cf36439 100644 --- a/adapters/adtarget/adtargettest/supplemental/wrong-impression-ext.json +++ b/adapters/adtarget/adtargettest/supplemental/wrong-impression-ext.json @@ -19,7 +19,7 @@ "expectedMakeRequestsErrors": [ { - "value": "ignoring imp id=unsupported-native-imp, error while decoding impExt, err: json: cannot unmarshal string into Go struct field ExtImpAdtarget.aid of type int", + "value": "ignoring imp id=unsupported-native-imp, error while decoding impExt, err: json: invalid number literal, trying to unmarshal \"\\\"some string instead of int\\\"\" into Number", "comparison": "literal" } ] diff --git a/adapters/adtarget/params_test.go b/adapters/adtarget/params_test.go index d0993215086..9af435d5753 100644 --- a/adapters/adtarget/params_test.go +++ b/adapters/adtarget/params_test.go @@ -33,16 +33,21 @@ func TestInvalidParams(t *testing.T) { for _, invalidParam := range invalidParams { if err := validator.Validate(openrtb_ext.BidderAdtarget, json.RawMessage(invalidParam)); err == nil { - t.Errorf("Schema allowed unexpected params: %s", invalidParam) + ext := openrtb_ext.ExtImpAdtarget{} + err = json.Unmarshal([]byte(invalidParam), &ext) + if err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } } } } var validParams = []string{ `{"aid":123}`, + `{"aid":"123"}`, `{"aid":123,"placementId":1234}`, `{"aid":123,"siteId":4321}`, - `{"aid":123,"siteId":0,"bidFloor":0}`, + `{"aid":"123","siteId":0,"bidFloor":0}`, } var invalidParams = []string{ @@ -53,8 +58,7 @@ var invalidParams = []string{ `4.2`, `[]`, `{}`, - `{"aid":"123"}`, - `{"aid":"0"}`, + `{"aid":"qwerty"}`, `{"aid":"123","placementId":"123"}`, `{"aid":123, "placementId":"123", "siteId":"321"}`, } diff --git a/adapters/adtelligent/adtelligent.go b/adapters/adtelligent/adtelligent.go index 492de0a364b..3bc27a2e604 100644 --- a/adapters/adtelligent/adtelligent.go +++ b/adapters/adtelligent/adtelligent.go @@ -187,7 +187,13 @@ func validateImpression(imp *openrtb2.Imp) (int, error) { imp.Ext = impExtBuffer - return impExt.SourceId, nil + aid, err := impExt.SourceId.Int64() + if err != nil { + return 0, &errortypes.BadInput{ + Message: fmt.Sprintf("ignoring imp id=%s, aid parsing err: %s", imp.ID, err), + } + } + return int(aid), nil } // Builder builds a new instance of the Adtelligent adapter for the given bidder with the given config. diff --git a/adapters/adtelligent/adtelligenttest/supplemental/wrong-impression-ext.json b/adapters/adtelligent/adtelligenttest/supplemental/wrong-impression-ext.json index 63c587ed742..ee59cf36439 100644 --- a/adapters/adtelligent/adtelligenttest/supplemental/wrong-impression-ext.json +++ b/adapters/adtelligent/adtelligenttest/supplemental/wrong-impression-ext.json @@ -19,7 +19,7 @@ "expectedMakeRequestsErrors": [ { - "value": "ignoring imp id=unsupported-native-imp, error while decoding impExt, err: json: cannot unmarshal string into Go struct field ExtImpAdtelligent.aid of type int", + "value": "ignoring imp id=unsupported-native-imp, error while decoding impExt, err: json: invalid number literal, trying to unmarshal \"\\\"some string instead of int\\\"\" into Number", "comparison": "literal" } ] diff --git a/adapters/adtelligent/params_test.go b/adapters/adtelligent/params_test.go index f86a7641af9..89fb7397795 100644 --- a/adapters/adtelligent/params_test.go +++ b/adapters/adtelligent/params_test.go @@ -33,16 +33,21 @@ func TestInvalidParams(t *testing.T) { for _, invalidParam := range invalidParams { if err := validator.Validate(openrtb_ext.BidderAdtelligent, json.RawMessage(invalidParam)); err == nil { - t.Errorf("Schema allowed unexpected params: %s", invalidParam) + ext := openrtb_ext.ExtImpAdtelligent{} + err = json.Unmarshal([]byte(invalidParam), &ext) + if err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } } } } var validParams = []string{ `{"aid":123}`, + `{"aid":"123"}`, `{"aid":123,"placementId":1234}`, `{"aid":123,"siteId":4321}`, - `{"aid":123,"siteId":0,"bidFloor":0}`, + `{"aid":"123","siteId":0,"bidFloor":0}`, } var invalidParams = []string{ @@ -53,8 +58,7 @@ var invalidParams = []string{ `4.2`, `[]`, `{}`, - `{"aid":"123"}`, - `{"aid":"0"}`, + `{"aid":"qwerty"}`, `{"aid":"123","placementId":"123"}`, `{"aid":123, "placementId":"123", "siteId":"321"}`, } diff --git a/openrtb_ext/imp_adtarget.go b/openrtb_ext/imp_adtarget.go index ab6cb5642c6..aa3b6136e58 100644 --- a/openrtb_ext/imp_adtarget.go +++ b/openrtb_ext/imp_adtarget.go @@ -1,9 +1,11 @@ package openrtb_ext +import "encoding/json" + // ExtImpAdtarget defines the contract for bidrequest.imp[i].ext.prebid.bidder.adtarget type ExtImpAdtarget struct { - SourceId int `json:"aid"` - PlacementId int `json:"placementId,omitempty"` - SiteId int `json:"siteId,omitempty"` - BidFloor float64 `json:"bidFloor,omitempty"` + SourceId json.Number `json:"aid"` + PlacementId int `json:"placementId,omitempty"` + SiteId int `json:"siteId,omitempty"` + BidFloor float64 `json:"bidFloor,omitempty"` } diff --git a/openrtb_ext/imp_adtelligent.go b/openrtb_ext/imp_adtelligent.go index c2233209352..b13c44ea360 100644 --- a/openrtb_ext/imp_adtelligent.go +++ b/openrtb_ext/imp_adtelligent.go @@ -1,9 +1,11 @@ package openrtb_ext +import "encoding/json" + // ExtImpAdtelligent defines the contract for bidrequest.imp[i].ext.prebid.bidder.adtelligent type ExtImpAdtelligent struct { - SourceId int `json:"aid"` - PlacementId int `json:"placementId,omitempty"` - SiteId int `json:"siteId,omitempty"` - BidFloor float64 `json:"bidFloor,omitempty"` + SourceId json.Number `json:"aid"` + PlacementId int `json:"placementId,omitempty"` + SiteId int `json:"siteId,omitempty"` + BidFloor float64 `json:"bidFloor,omitempty"` } diff --git a/static/bidder-params/adtarget.json b/static/bidder-params/adtarget.json index 195bf2dd430..980fb623786 100644 --- a/static/bidder-params/adtarget.json +++ b/static/bidder-params/adtarget.json @@ -14,7 +14,10 @@ "description": "An ID which identifies the site selling the impression" }, "aid": { - "type": "integer", + "type": [ + "integer", + "string" + ], "description": "An ID which identifies the channel" }, "bidFloor": { diff --git a/static/bidder-params/adtelligent.json b/static/bidder-params/adtelligent.json index db7931e1ec0..9b241bee149 100644 --- a/static/bidder-params/adtelligent.json +++ b/static/bidder-params/adtelligent.json @@ -14,7 +14,10 @@ "description": "An ID which identifies the site selling the impression" }, "aid": { - "type": "integer", + "type": [ + "integer", + "string" + ], "description": "An ID which identifies the channel" }, "bidFloor": { From efc1e8b194a532605d13a457a24d44c1d7d1764d Mon Sep 17 00:00:00 2001 From: andre-gielow-ttd <124626380+andre-gielow-ttd@users.noreply.github.com> Date: Tue, 6 Aug 2024 12:59:15 -0400 Subject: [PATCH 29/31] New Adapter: TheTradeDesk (#3738) --- adapters/thetradedesk/params_test.go | 53 +++ adapters/thetradedesk/thetradedesk.go | 196 +++++++++ adapters/thetradedesk/thetradedesk_test.go | 385 ++++++++++++++++++ .../exemplary/simple-banner-inapp.json | 144 +++++++ ...mple-banner-multiple-bids-and-formats.json | 231 +++++++++++ .../simple-banner-multiple-bids.json | 215 ++++++++++ .../exemplary/simple-banner.json | 142 +++++++ .../exemplary/simple-empty-publisherId.json | 142 +++++++ .../exemplary/simple-multi-type-banner.json | 151 +++++++ .../exemplary/simple-multi-type-video.json | 151 +++++++ .../exemplary/simple-native.json | 115 ++++++ .../exemplary/simple-video.json | 154 +++++++ .../200-response-from-target.json | 105 +++++ .../204-response-from-target.json | 105 +++++ .../400-response-from-target.json | 105 +++++ .../500-response-from-target.json | 105 +++++ .../supplemental/invalid-mtype.json | 86 ++++ .../supplemental/invalid-publisher.json | 45 ++ exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_thetradedesk.go | 8 + static/bidder-info/thetradedesk.yaml | 23 ++ static/bidder-params/thetradedesk.json | 13 + 23 files changed, 2678 insertions(+) create mode 100644 adapters/thetradedesk/params_test.go create mode 100644 adapters/thetradedesk/thetradedesk.go create mode 100644 adapters/thetradedesk/thetradedesk_test.go create mode 100644 adapters/thetradedesk/thetradedesktest/exemplary/simple-banner-inapp.json create mode 100644 adapters/thetradedesk/thetradedesktest/exemplary/simple-banner-multiple-bids-and-formats.json create mode 100644 adapters/thetradedesk/thetradedesktest/exemplary/simple-banner-multiple-bids.json create mode 100644 adapters/thetradedesk/thetradedesktest/exemplary/simple-banner.json create mode 100644 adapters/thetradedesk/thetradedesktest/exemplary/simple-empty-publisherId.json create mode 100644 adapters/thetradedesk/thetradedesktest/exemplary/simple-multi-type-banner.json create mode 100644 adapters/thetradedesk/thetradedesktest/exemplary/simple-multi-type-video.json create mode 100644 adapters/thetradedesk/thetradedesktest/exemplary/simple-native.json create mode 100644 adapters/thetradedesk/thetradedesktest/exemplary/simple-video.json create mode 100644 adapters/thetradedesk/thetradedesktest/supplemental/200-response-from-target.json create mode 100644 adapters/thetradedesk/thetradedesktest/supplemental/204-response-from-target.json create mode 100644 adapters/thetradedesk/thetradedesktest/supplemental/400-response-from-target.json create mode 100644 adapters/thetradedesk/thetradedesktest/supplemental/500-response-from-target.json create mode 100644 adapters/thetradedesk/thetradedesktest/supplemental/invalid-mtype.json create mode 100644 adapters/thetradedesk/thetradedesktest/supplemental/invalid-publisher.json create mode 100644 openrtb_ext/imp_thetradedesk.go create mode 100644 static/bidder-info/thetradedesk.yaml create mode 100644 static/bidder-params/thetradedesk.json diff --git a/adapters/thetradedesk/params_test.go b/adapters/thetradedesk/params_test.go new file mode 100644 index 00000000000..f18daed3d56 --- /dev/null +++ b/adapters/thetradedesk/params_test.go @@ -0,0 +1,53 @@ +package thetradedesk + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderTheTradeDesk, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected TheTradeDesk params: %s", validParam) + } + } +} + +// TestInvalidParams makes sure that the TheTradeDesk schema rejects all the imp.ext fields we don't support. +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, invalidParam := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderTheTradeDesk, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"publisherId": "123456"}`, + `{"publisherId": "pub-123456"}`, + `{"publisherId": "publisherIDAllString"}`, +} + +var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{}`, + `{"publisherId": 123456}`, + `{"publisherId": 0}`, +} diff --git a/adapters/thetradedesk/thetradedesk.go b/adapters/thetradedesk/thetradedesk.go new file mode 100644 index 00000000000..1ef48a70d4f --- /dev/null +++ b/adapters/thetradedesk/thetradedesk.go @@ -0,0 +1,196 @@ +package thetradedesk + +import ( + "encoding/json" + "errors" + "fmt" + "net/http" + "regexp" + "text/template" + + "github.com/prebid/prebid-server/v2/adapters" + "github.com/prebid/prebid-server/v2/config" + "github.com/prebid/prebid-server/v2/macros" + "github.com/prebid/prebid-server/v2/openrtb_ext" + + "github.com/prebid/openrtb/v20/openrtb2" +) + +const PREBID_INTEGRATION_TYPE = "1" + +type adapter struct { + bidderEndpoint string +} + +type ExtImpBidderTheTradeDesk struct { + adapters.ExtImpBidder +} + +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + pubID, err := getPublisherId(request.Imp) + + if err != nil { + return nil, []error{err} + } + + modifiedImps := make([]openrtb2.Imp, 0, len(request.Imp)) + + for _, imp := range request.Imp { + + if imp.Banner != nil { + if len(imp.Banner.Format) > 0 { + firstFormat := imp.Banner.Format[0] + bannerCopy := *imp.Banner + bannerCopy.H = &firstFormat.H + bannerCopy.W = &firstFormat.W + imp.Banner = &bannerCopy + + } + } + + modifiedImps = append(modifiedImps, imp) + } + + request.Imp = modifiedImps + + if request.Site != nil { + siteCopy := *request.Site + if siteCopy.Publisher != nil { + publisherCopy := *siteCopy.Publisher + if pubID != "" { + publisherCopy.ID = pubID + } + siteCopy.Publisher = &publisherCopy + } else { + siteCopy.Publisher = &openrtb2.Publisher{ID: pubID} + } + request.Site = &siteCopy + } else if request.App != nil { + appCopy := *request.App + if appCopy.Publisher != nil { + publisherCopy := *appCopy.Publisher + if pubID != "" { + publisherCopy.ID = pubID + } + appCopy.Publisher = &publisherCopy + } else { + appCopy.Publisher = &openrtb2.Publisher{ID: pubID} + } + request.App = &appCopy + } + + errs := make([]error, 0, len(request.Imp)) + reqJSON, err := json.Marshal(request) + if err != nil { + errs = append(errs, err) + return nil, errs + } + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + headers.Add("x-integration-type", PREBID_INTEGRATION_TYPE) + return []*adapters.RequestData{{ + Method: "POST", + Uri: a.bidderEndpoint, + Body: reqJSON, + Headers: headers, + ImpIDs: openrtb_ext.GetImpIDs(request.Imp), + }}, errs +} + +func getPublisherId(impressions []openrtb2.Imp) (string, error) { + for _, imp := range impressions { + + var bidderExt ExtImpBidderTheTradeDesk + if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { + return "", err + } + + var ttdExt openrtb_ext.ExtImpTheTradeDesk + if err := json.Unmarshal(bidderExt.Bidder, &ttdExt); err != nil { + return "", err + } + + if ttdExt.PublisherId != "" { + return ttdExt.PublisherId, nil + } + } + return "", nil +} + +func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if adapters.IsResponseStatusCodeNoContent(response) { + return adapters.NewBidderResponse(), nil + } + + if err := adapters.CheckResponseStatusCodeForErrors(response); err != nil { + return nil, []error{err} + } + + var bidResponse openrtb2.BidResponse + if err := json.Unmarshal(response.Body, &bidResponse); err != nil { + return nil, []error{err} + } + + bidderResponse := adapters.NewBidderResponse() + bidderResponse.Currency = bidResponse.Cur + + for _, seatBid := range bidResponse.SeatBid { + for _, bid := range seatBid.Bid { + bid := bid + + bidType, err := getBidType(bid.MType) + + if err != nil { + return nil, []error{err} + } + + b := &adapters.TypedBid{ + Bid: &bid, + BidType: bidType, + } + bidderResponse.Bids = append(bidderResponse.Bids, b) + } + } + + return bidderResponse, nil +} + +func getBidType(markupType openrtb2.MarkupType) (openrtb_ext.BidType, error) { + switch markupType { + case openrtb2.MarkupBanner: + return openrtb_ext.BidTypeBanner, nil + case openrtb2.MarkupVideo: + return openrtb_ext.BidTypeVideo, nil + case openrtb2.MarkupNative: + return openrtb_ext.BidTypeNative, nil + default: + return "", fmt.Errorf("unsupported mtype: %d", markupType) + } +} + +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) + } + + if len(config.ExtraAdapterInfo) > 0 { + isValidEndpoint, err := regexp.Match("([a-z]+)$", []byte(config.ExtraAdapterInfo)) + if !isValidEndpoint || err != nil { + return nil, errors.New("ExtraAdapterInfo must be a simple string provided by TheTradeDesk") + } + } + + urlParams := macros.EndpointTemplateParams{SupplyId: config.ExtraAdapterInfo} + bidderEndpoint, err := macros.ResolveMacros(template, urlParams) + + if err != nil { + return nil, fmt.Errorf("unable to resolve endpoint macros: %v", err) + } + + return &adapter{ + bidderEndpoint: bidderEndpoint, + }, nil +} diff --git a/adapters/thetradedesk/thetradedesk_test.go b/adapters/thetradedesk/thetradedesk_test.go new file mode 100644 index 00000000000..d53b2f860e4 --- /dev/null +++ b/adapters/thetradedesk/thetradedesk_test.go @@ -0,0 +1,385 @@ +package thetradedesk + +import ( + "encoding/json" + "net/http" + "testing" + + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/prebid-server/v2/adapters" + "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 TestEndpointTemplateMalformed(t *testing.T) { + _, buildErr := Builder(openrtb_ext.BidderTheTradeDesk, config.Adapter{ + Endpoint: "{{Malformed}}"}, + config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + assert.Error(t, buildErr) +} + +func TestBadConfig(t *testing.T) { + _, buildErr := Builder(openrtb_ext.BidderTheTradeDesk, config.Adapter{ + Endpoint: `http://it.doesnt.matter/bid`, + ExtraAdapterInfo: "12365217635", + }, + config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + assert.Error(t, buildErr) +} + +func TestCorrectConfig(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderTheTradeDesk, config.Adapter{ + Endpoint: `http://it.doesnt.matter/bid`, + ExtraAdapterInfo: `abcde`, + }, + config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + assert.NoError(t, buildErr) + assert.NotNil(t, bidder) +} + +func TestEmptyConfig(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderTheTradeDesk, config.Adapter{ + Endpoint: `https://direct.adsrvr.org/bid/bidder/{{.SupplyId}}`, + ExtraAdapterInfo: `ttd`, + }, + config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + assert.NoError(t, buildErr) + assert.NotNil(t, bidder) +} + +func TestJsonSamples(t *testing.T) { + bidder, err := Builder( + openrtb_ext.BidderTheTradeDesk, + config.Adapter{Endpoint: "https://direct.adsrvr.org/bid/bidder/{{.SupplyId}}", ExtraAdapterInfo: "ttd"}, + config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "1"}, + ) + assert.Nil(t, err) + adapterstest.RunJSONBidderTest(t, "thetradedesktest", bidder) +} + +func TestGetBidType(t *testing.T) { + type args struct { + markupType openrtb2.MarkupType + } + tests := []struct { + name string + args args + markupType openrtb2.MarkupType + expectedBidTypeId openrtb_ext.BidType + wantErr bool + }{ + { + name: "banner", + args: args{ + markupType: openrtb2.MarkupBanner, + }, + expectedBidTypeId: openrtb_ext.BidTypeBanner, + wantErr: false, + }, + { + name: "video", + args: args{ + markupType: openrtb2.MarkupVideo, + }, + expectedBidTypeId: openrtb_ext.BidTypeVideo, + wantErr: false, + }, + { + name: "native", + args: args{ + markupType: openrtb2.MarkupNative, + }, + expectedBidTypeId: openrtb_ext.BidTypeNative, + wantErr: false, + }, + { + name: "invalid", + args: args{ + markupType: -1, + }, + expectedBidTypeId: "", + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + bidType, err := getBidType(tt.args.markupType) + assert.Equal(t, tt.wantErr, err != nil) + assert.Equal(t, tt.expectedBidTypeId, bidType) + }) + } +} + +func TestGetPublisherId(t *testing.T) { + type args struct { + impressions []openrtb2.Imp + } + tests := []struct { + name string + args args + expectedPublisherId string + wantErr bool + }{ + { + name: "valid_publisher_Id", + args: args{ + impressions: []openrtb2.Imp{ + { + Video: &openrtb2.Video{}, + Ext: json.RawMessage(`{"bidder":{"publisherId":"1"}}`), + }, + }, + }, + expectedPublisherId: "1", + wantErr: false, + }, + { + name: "multiple_valid_publisher_Id", + args: args{ + impressions: []openrtb2.Imp{ + { + Video: &openrtb2.Video{}, + Ext: json.RawMessage(`{"bidder":{"publisherId":"1"}}`), + }, + { + Video: &openrtb2.Video{}, + Ext: json.RawMessage(`{"bidder":{"publisherId":"2"}}`), + }, + }, + }, + expectedPublisherId: "1", + wantErr: false, + }, + { + name: "not_publisherId_present", + args: args{ + impressions: []openrtb2.Imp{ + { + Video: &openrtb2.Video{}, + Ext: json.RawMessage(`{"bidder":{}}`), + }, + }, + }, + expectedPublisherId: "", + wantErr: false, + }, + { + name: "nil_publisherId_present", + args: args{ + impressions: []openrtb2.Imp{ + { + Video: &openrtb2.Video{}, + Ext: json.RawMessage(`{"bidder":{"publisherId":""}}`), + }, + }, + }, + expectedPublisherId: "", + wantErr: false, + }, + { + name: "no_impressions", + args: args{ + impressions: []openrtb2.Imp{}, + }, + expectedPublisherId: "", + wantErr: false, + }, + { + name: "invalid_bidder_object", + args: args{ + impressions: []openrtb2.Imp{ + { + Video: &openrtb2.Video{}, + Ext: json.RawMessage(`{"bidder":{"doesnotexistprop":""}}`), + }, + }, + }, + expectedPublisherId: "", + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + publisherId, err := getPublisherId(tt.args.impressions) + assert.Equal(t, tt.wantErr, err != nil) + assert.Equal(t, tt.expectedPublisherId, publisherId) + }) + } +} + +func TestTheTradeDeskAdapter_MakeRequests(t *testing.T) { + type fields struct { + URI string + } + type args struct { + request *openrtb2.BidRequest + reqInfo *adapters.ExtraRequestInfo + } + tests := []struct { + name string + fields fields + args args + expectedReqData []*adapters.RequestData + wantErr bool + }{ + { + name: "invalid_bidderparams", + args: args{ + request: &openrtb2.BidRequest{Ext: json.RawMessage(`{"prebid":{"bidderparams":{:"123"}}}`)}, + }, + wantErr: true, + }, + { + name: "request_with_App", + args: args{ + request: &openrtb2.BidRequest{ + App: &openrtb2.App{}, + Ext: json.RawMessage(`{"prebid":{"bidderparams":{"wrapper":"123"}}}`), + }, + }, + wantErr: false, + }, + { + name: "request_with_App_and_publisher", + args: args{ + request: &openrtb2.BidRequest{ + App: &openrtb2.App{Publisher: &openrtb2.Publisher{}}, + Ext: json.RawMessage(`{"prebid":{"bidderparams":{"wrapper":"123"}}}`), + }, + }, + wantErr: false, + }, + { + name: "request_with_Site", + args: args{ + request: &openrtb2.BidRequest{ + Site: &openrtb2.Site{}, + Ext: json.RawMessage(`{"prebid":{"bidderparams":{"wrapper":"123"}}}`), + }, + }, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + a := &adapter{ + bidderEndpoint: tt.fields.URI, + } + gotReqData, gotErr := a.MakeRequests(tt.args.request, tt.args.reqInfo) + assert.Equal(t, tt.wantErr, len(gotErr) != 0) + if tt.wantErr == false { + assert.NotNil(t, gotReqData) + } + }) + } +} + +func TestTheTradeDeskAdapter_MakeBids(t *testing.T) { + type fields struct { + URI string + } + type args struct { + internalRequest *openrtb2.BidRequest + externalRequest *adapters.RequestData + response *adapters.ResponseData + } + tests := []struct { + name string + fields fields + args args + wantErr []error + wantResp *adapters.BidderResponse + }{ + { + name: "happy_path_valid_response_with_all_bid_params", + args: args{ + response: &adapters.ResponseData{ + StatusCode: http.StatusOK, + Body: []byte(`{"id": "test-request-id", "seatbid":[{"seat": "958", "bid":[{"mtype": 1, "id": "7706636740145184841", "impid": "test-imp-id", "price": 0.500000, "adid": "29681110", "adm": "some-test-ad", "adomain":["ttd.com"], "crid": "29681110", "h": 250, "w": 300, "dealid": "testdeal", "ext":{"dspid": 6, "deal_channel": 1, "prebiddealpriority": 1}}]}], "bidid": "5778926625248726496", "cur": "USD"}`), + }, + }, + wantErr: nil, + wantResp: &adapters.BidderResponse{ + Bids: []*adapters.TypedBid{ + { + Bid: &openrtb2.Bid{ + ID: "7706636740145184841", + ImpID: "test-imp-id", + Price: 0.500000, + AdID: "29681110", + AdM: "some-test-ad", + ADomain: []string{"ttd.com"}, + CrID: "29681110", + H: 250, + W: 300, + DealID: "testdeal", + Ext: json.RawMessage(`{"dspid": 6, "deal_channel": 1, "prebiddealpriority": 1}`), + MType: openrtb2.MarkupBanner, + }, + BidType: openrtb_ext.BidTypeBanner, + }, + }, + Currency: "USD", + }, + }, + { + name: "ignore_invalid_prebiddealpriority", + args: args{ + response: &adapters.ResponseData{ + StatusCode: http.StatusOK, + Body: []byte(`{"id": "test-request-id", "seatbid":[{"seat": "958", "bid":[{"mtype": 2, "id": "7706636740145184841", "impid": "test-imp-id", "price": 0.500000, "adid": "29681110", "adm": "some-test-ad", "adomain":["ttd.com"], "crid": "29681110", "h": 250, "w": 300, "dealid": "testdeal", "ext":{"dspid": 6, "deal_channel": 1, "prebiddealpriority": -1}}]}], "bidid": "5778926625248726496", "cur": "USD"}`), + }, + }, + wantErr: nil, + wantResp: &adapters.BidderResponse{ + Bids: []*adapters.TypedBid{ + { + Bid: &openrtb2.Bid{ + ID: "7706636740145184841", + ImpID: "test-imp-id", + Price: 0.500000, + AdID: "29681110", + AdM: "some-test-ad", + ADomain: []string{"ttd.com"}, + CrID: "29681110", + H: 250, + W: 300, + DealID: "testdeal", + Ext: json.RawMessage(`{"dspid": 6, "deal_channel": 1, "prebiddealpriority": -1}`), + MType: openrtb2.MarkupVideo, + }, + BidType: openrtb_ext.BidTypeVideo, + }, + }, + Currency: "USD", + }, + }, + { + name: "no_content_response", + args: args{ + response: &adapters.ResponseData{ + StatusCode: http.StatusNoContent, + Body: nil, + }, + }, + wantErr: nil, + wantResp: adapters.NewBidderResponse(), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + a := &adapter{ + bidderEndpoint: tt.fields.URI, + } + gotResp, gotErr := a.MakeBids(tt.args.internalRequest, tt.args.externalRequest, tt.args.response) + assert.Equal(t, tt.wantErr, gotErr, gotErr) + assert.Equal(t, tt.wantResp, gotResp) + }) + } +} diff --git a/adapters/thetradedesk/thetradedesktest/exemplary/simple-banner-inapp.json b/adapters/thetradedesk/thetradedesktest/exemplary/simple-banner-inapp.json new file mode 100644 index 00000000000..e10445382c8 --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/exemplary/simple-banner-inapp.json @@ -0,0 +1,144 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle", + "publisher": { + "id": "this_id_will_be_replaced" + } + }, + "device": { + "ifa": "test-ifa-123456", + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 100, + "h": 150 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle", + "publisher": { + "id": "123456" + } + }, + "device": { + "ifa": "test-ifa-123456", + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "currency": "USD", + "seatbid": [ + { + "bid": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner", + "networkName": "TheTradeDesk" + } + }, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner", + "networkName": "TheTradeDesk" + } + }, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/thetradedesk/thetradedesktest/exemplary/simple-banner-multiple-bids-and-formats.json b/adapters/thetradedesk/thetradedesktest/exemplary/simple-banner-multiple-bids-and-formats.json new file mode 100644 index 00000000000..0180d48dde2 --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/exemplary/simple-banner-multiple-bids-and-formats.json @@ -0,0 +1,231 @@ +{ + "mockBidRequest": { + "id": "test-request-id-multiple-bids", + "site": { + "id": "site-id", + "page": "ttd.com", + "publisher": { + "id": "123456" + } + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 500, + "h": 300 + } + ], + "w": 55, + "h": 33 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + }, + { + "id": "test-imp-id2", + "banner": { + "format": [ + { + "w": 900, + "h": 450 + }, + { + "w": 500, + "h": 300 + } + ], + "w": 88, + "h": 99 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id-multiple-bids", + "site": { + "id": "site-id", + "page": "ttd.com", + "publisher": { + "id": "123456" + } + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 500, + "h": 300 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + }, + { + "id": "test-imp-id2", + "banner": { + "format": [ + { + "w": 900, + "h": 450 + }, + { + "w": 500, + "h": 300 + } + ], + "w": 900, + "h": 450 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id","test-imp-id2"] + }, + "mockResponse": { + "status": 200, + "body": { + "currency": "USD", + "seatbid": [ + { + "bid": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + } + ] + }, + { + "bid": [ + { + "id": "test-slot-id2", + "impid": "test-imp-id2", + "price": 0.5, + "crid": "creative-123", + "adm": "", + "w": 900, + "h": 450, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + }, + "type": "banner" + }, + { + "bid": { + "id": "test-slot-id2", + "impid": "test-imp-id2", + "price": 0.5, + "crid": "creative-123", + "adm": "", + "w": 900, + "h": 450, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/thetradedesk/thetradedesktest/exemplary/simple-banner-multiple-bids.json b/adapters/thetradedesk/thetradedesktest/exemplary/simple-banner-multiple-bids.json new file mode 100644 index 00000000000..4d46fa6907b --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/exemplary/simple-banner-multiple-bids.json @@ -0,0 +1,215 @@ +{ + "mockBidRequest": { + "id": "test-request-id-multiple-bids", + "site": { + "id": "site-id", + "page": "ttd.com", + "publisher": { + "id": "123456" + } + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + }, + { + "id": "test-imp-id2", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id-multiple-bids", + "site": { + "id": "site-id", + "page": "ttd.com", + "publisher": { + "id": "123456" + } + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + }, + { + "id": "test-imp-id2", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id","test-imp-id2"] + }, + "mockResponse": { + "status": 200, + "body": { + "currency": "USD", + "seatbid": [ + { + "bid": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + } + ] + }, + { + "bid": [ + { + "id": "test-slot-id2", + "impid": "test-imp-id2", + "price": 0.5, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + }, + "type": "banner" + }, + { + "bid": { + "id": "test-slot-id2", + "impid": "test-imp-id2", + "price": 0.5, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/thetradedesk/thetradedesktest/exemplary/simple-banner.json b/adapters/thetradedesk/thetradedesktest/exemplary/simple-banner.json new file mode 100644 index 00000000000..4ac6acb0556 --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/exemplary/simple-banner.json @@ -0,0 +1,142 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "ttd.com", + "publisher": { + "id": "123456" + } + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 100, + "h": 150 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "ttd.com", + "publisher": { + "id": "123456" + } + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "currency": "USD", + "seatbid": [ + { + "bid": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/thetradedesk/thetradedesktest/exemplary/simple-empty-publisherId.json b/adapters/thetradedesk/thetradedesktest/exemplary/simple-empty-publisherId.json new file mode 100644 index 00000000000..ef6f6695553 --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/exemplary/simple-empty-publisherId.json @@ -0,0 +1,142 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "ttd.com", + "publisher": { + "id": "did_not_override" + } + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "ttd.com", + "publisher": { + "id": "did_not_override" + } + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "currency": "USD", + "seatbid": [ + { + "bid": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/thetradedesk/thetradedesktest/exemplary/simple-multi-type-banner.json b/adapters/thetradedesk/thetradedesktest/exemplary/simple-multi-type-banner.json new file mode 100644 index 00000000000..10286c96081 --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/exemplary/simple-multi-type-banner.json @@ -0,0 +1,151 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "ttd.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "protocols": [2, 5], + "w": 300, + "h": 250 + }, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "ttd.com", + "publisher": { + "id": "123456" + } + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "protocols": [2, 5], + "w": 300, + "h": 250 + }, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "currency": "USD", + "seatbid": [ + { + "bid": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "h": 250, + "w": 300, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "h": 250, + "w": 300, + "ext": { + "prebid": { + "type": "banner" + } + }, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/thetradedesk/thetradedesktest/exemplary/simple-multi-type-video.json b/adapters/thetradedesk/thetradedesktest/exemplary/simple-multi-type-video.json new file mode 100644 index 00000000000..e8f4bbca57c --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/exemplary/simple-multi-type-video.json @@ -0,0 +1,151 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "ttd.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "protocols": [2, 5], + "w": 300, + "h": 250 + }, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "ttd.com", + "publisher": { + "id": "123456" + } + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "protocols": [2, 5], + "w": 300, + "h": 250 + }, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "currency": "USD", + "seatbid": [ + { + "bid": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "some-test-ad-vast", + "h": 250, + "w": 300, + "ext": { + "prebid": { + "type": "video" + } + }, + "mtype": 2 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "some-test-ad-vast", + "h": 250, + "w": 300, + "ext": { + "prebid": { + "type": "video" + } + }, + "mtype": 2 + }, + "type": "video" + } + ] + } + ] +} + diff --git a/adapters/thetradedesk/thetradedesktest/exemplary/simple-native.json b/adapters/thetradedesk/thetradedesktest/exemplary/simple-native.json new file mode 100644 index 00000000000..4d1b77ab0fb --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/exemplary/simple-native.json @@ -0,0 +1,115 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "ttd.com" + }, + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "" + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "ttd.com", + "publisher": { + "id": "123456" + } + }, + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "" + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "currency": "USD", + "seatbid": [ + { + "bid": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "h": 250, + "w": 300, + "ext": { + "prebid": { + "type": "native" + } + }, + "mtype": 4 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "h": 250, + "w": 300, + "ext": { + "prebid": { + "type": "native" + } + }, + "mtype": 4 + }, + "type": "native" + } + ] + } + ] +} + diff --git a/adapters/thetradedesk/thetradedesktest/exemplary/simple-video.json b/adapters/thetradedesk/thetradedesktest/exemplary/simple-video.json new file mode 100644 index 00000000000..5dc945bab1f --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/exemplary/simple-video.json @@ -0,0 +1,154 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "ttd.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "pbs-local/preroll", + "video": { + "minduration": 0, + "maxduration": 60, + "api": [1,2], + "mimes": [ + "video/mp4", + "video/webm", + "application/javascript" + ], + "placement": 1, + "protocols": [2,3,4,5,6], + "w": 300, + "h": 250, + "playbackmethod": [1,2,3,4,5,6], + "plcmt": 1, + "skip": 1 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "ttd.com", + "publisher": { + "id": "123456" + } + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "pbs-local/preroll", + "video": { + "maxduration": 60, + "api": [1,2], + "mimes": [ + "video/mp4", + "video/webm", + "application/javascript" + ], + "placement": 1, + "protocols": [2,3,4,5,6], + "w": 300, + "h": 250, + "playbackmethod": [1,2,3,4,5,6], + "plcmt": 1, + "skip": 1 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "currency": "USD", + "seatbid": [ + { + "bid": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "some-test-ad-vast", + "h": 250, + "w": 300, + "ext": { + "prebid": { + "type": "video" + } + }, + "mtype": 2 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "some-test-ad-vast", + "h": 250, + "w": 300, + "ext": { + "prebid": { + "type": "video" + } + }, + "mtype": 2 + }, + "type": "video" + } + ] + } + ] +} + diff --git a/adapters/thetradedesk/thetradedesktest/supplemental/200-response-from-target.json b/adapters/thetradedesk/thetradedesktest/supplemental/200-response-from-target.json new file mode 100644 index 00000000000..9769f0499c3 --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/supplemental/200-response-from-target.json @@ -0,0 +1,105 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle", + "publisher": { + "id": "123456" + } + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200 + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "unexpected end of JSON input", + "comparison": "literal" + } + ] + } diff --git a/adapters/thetradedesk/thetradedesktest/supplemental/204-response-from-target.json b/adapters/thetradedesk/thetradedesktest/supplemental/204-response-from-target.json new file mode 100644 index 00000000000..a329982ea50 --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/supplemental/204-response-from-target.json @@ -0,0 +1,105 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle", + "publisher": { + "id": "123456" + } + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [] + } + ] + } diff --git a/adapters/thetradedesk/thetradedesktest/supplemental/400-response-from-target.json b/adapters/thetradedesk/thetradedesktest/supplemental/400-response-from-target.json new file mode 100644 index 00000000000..ad5ffc62b51 --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/supplemental/400-response-from-target.json @@ -0,0 +1,105 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle", + "publisher": { + "id": "123456" + } + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 400 + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] + } diff --git a/adapters/thetradedesk/thetradedesktest/supplemental/500-response-from-target.json b/adapters/thetradedesk/thetradedesktest/supplemental/500-response-from-target.json new file mode 100644 index 00000000000..f2ccb342113 --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/supplemental/500-response-from-target.json @@ -0,0 +1,105 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle", + "publisher": { + "id": "123456" + } + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 500 + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 500. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] + } diff --git a/adapters/thetradedesk/thetradedesktest/supplemental/invalid-mtype.json b/adapters/thetradedesk/thetradedesktest/supplemental/invalid-mtype.json new file mode 100644 index 00000000000..52b392eb835 --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/supplemental/invalid-mtype.json @@ -0,0 +1,86 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "" + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://direct.adsrvr.org/bid/bidder/ttd", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Integration-Type": ["1"] + }, + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "" + }, + "ext": { + "bidder": { + "publisherId": "123456" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "currency": "USD", + "seatbid": [ + { + "bid": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "h": 250, + "w": 300, + "ext": { + "prebid": { + "type": "native" + } + }, + "mtype": -1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "unsupported mtype: -1", + "comparison": "literal" + } + ] +} + diff --git a/adapters/thetradedesk/thetradedesktest/supplemental/invalid-publisher.json b/adapters/thetradedesk/thetradedesktest/supplemental/invalid-publisher.json new file mode 100644 index 00000000000..9e936f38f20 --- /dev/null +++ b/adapters/thetradedesk/thetradedesktest/supplemental/invalid-publisher.json @@ -0,0 +1,45 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle", + "publisher": { + "id": "this_id_will_be_replaced" + } + }, + "device": { + "ifa": "test-ifa-123456", + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisherId": 123456 + } + } + } + ] + }, + "httpCalls": [], + "expectedMakeRequestsErrors": [ + { + "value": "json: cannot unmarshal number into Go struct field ExtImpTheTradeDesk.publisherId of type string", + "comparison": "literal" + } + ] +} + diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 74fb044ec18..173f134567f 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -185,6 +185,7 @@ import ( "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/thetradedesk" "github.com/prebid/prebid-server/v2/adapters/tpmn" "github.com/prebid/prebid-server/v2/adapters/trafficgate" "github.com/prebid/prebid-server/v2/adapters/triplelift" @@ -407,6 +408,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderTeads: teads.Builder, openrtb_ext.BidderTelaria: telaria.Builder, openrtb_ext.BidderTheadx: theadx.Builder, + openrtb_ext.BidderTheTradeDesk: thetradedesk.Builder, openrtb_ext.BidderTpmn: tpmn.Builder, openrtb_ext.BidderTrafficGate: trafficgate.Builder, openrtb_ext.BidderTriplelift: triplelift.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 15113334222..bc422e4ab87 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -203,6 +203,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderTeads, BidderTelaria, BidderTheadx, + BidderTheTradeDesk, BidderTpmn, BidderTrafficGate, BidderTriplelift, @@ -522,6 +523,7 @@ const ( BidderTeads BidderName = "teads" BidderTelaria BidderName = "telaria" BidderTheadx BidderName = "theadx" + BidderTheTradeDesk BidderName = "thetradedesk" BidderTpmn BidderName = "tpmn" BidderTrafficGate BidderName = "trafficgate" BidderTriplelift BidderName = "triplelift" diff --git a/openrtb_ext/imp_thetradedesk.go b/openrtb_ext/imp_thetradedesk.go new file mode 100644 index 00000000000..89cca83f65e --- /dev/null +++ b/openrtb_ext/imp_thetradedesk.go @@ -0,0 +1,8 @@ +package openrtb_ext + +// ExtImpTheTradeDesk defines the contract for bidrequest.imp[i].ext +// PublisherId is mandatory parameters, others are optional parameters + +type ExtImpTheTradeDesk struct { + PublisherId string `json:"publisherId"` +} diff --git a/static/bidder-info/thetradedesk.yaml b/static/bidder-info/thetradedesk.yaml new file mode 100644 index 00000000000..e1354c86ddc --- /dev/null +++ b/static/bidder-info/thetradedesk.yaml @@ -0,0 +1,23 @@ +endpoint: "https://direct.adsrvr.org/bid/bidder/{{.SupplyId}}" +maintainer: + email: "Prebid-Maintainers@thetradedesk.com" +gvlVendorID: 21 +capabilities: + app: + mediaTypes: + - banner + - video + - native + site: + mediaTypes: + - banner + - video + - native +userSync: + # TheTradeDesk supports user syncing, but requires configuration by the host. Contact a technical account manager + # or this bidder directly at the email address in this file to ask about enabling user sync. + supports: + - redirect + - iframe +openrtb: + gpp-supported: true diff --git a/static/bidder-params/thetradedesk.json b/static/bidder-params/thetradedesk.json new file mode 100644 index 00000000000..5a85cf2f516 --- /dev/null +++ b/static/bidder-params/thetradedesk.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "The Trade Desk Adapter Params", + "description": "A schema which validates params accepted by the The Trade Desk adapter", + "type": "object", + "properties": { + "publisherId": { + "type": "string", + "description": "An ID which identifies the publisher" + } + }, + "required": ["publisherId"] +} From e8e2848f04a6bdfc4739ca8bebdeb5d2054ac571 Mon Sep 17 00:00:00 2001 From: SmartHubSolutions <87376145+SmartHubSolutions@users.noreply.github.com> Date: Tue, 6 Aug 2024 20:06:13 +0300 Subject: [PATCH 30/31] SmartHub: add alias FelixAds (#3837) authored by @SmartHubSolutions --- static/bidder-info/felixads.yaml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 static/bidder-info/felixads.yaml diff --git a/static/bidder-info/felixads.yaml b/static/bidder-info/felixads.yaml new file mode 100644 index 00000000000..98a8745a881 --- /dev/null +++ b/static/bidder-info/felixads.yaml @@ -0,0 +1,2 @@ +endpoint: "http://felixads-prebid.smart-hub.io/pbserver/?seat={{.AccountID}}&token={{.SourceId}}" +aliasOf: "smarthub" From 804334a3528381004c32832e0bb7a1329dfea0db Mon Sep 17 00:00:00 2001 From: metax-kehan <115962296+metax-kehan@users.noreply.github.com> Date: Wed, 7 Aug 2024 01:16:51 +0800 Subject: [PATCH 31/31] New Adapter: MetaX (#3712) --- adapters/metax/metax.go | 194 ++++++++++ adapters/metax/metax_test.go | 214 +++++++++++ .../metaxtest/exemplary/app-formats.json | 156 ++++++++ .../metax/metaxtest/exemplary/app-imps.json | 351 ++++++++++++++++++ .../metax/metaxtest/exemplary/no-bid.json | 92 +++++ .../metaxtest/exemplary/no-seat-bid.json | 99 +++++ .../metax/metaxtest/exemplary/no-seat.json | 94 +++++ .../metaxtest/exemplary/simple-app-audio.json | 110 ++++++ .../exemplary/simple-app-banner.json | 122 ++++++ .../exemplary/simple-app-native.json | 99 +++++ .../metaxtest/exemplary/simple-app-video.json | 130 +++++++ .../exemplary/simple-site-audio.json | 110 ++++++ .../exemplary/simple-site-banner.json | 122 ++++++ .../exemplary/simple-site-native.json | 99 +++++ .../exemplary/simple-site-video.json | 130 +++++++ .../supplemental/invalid-adunit-error.json | 35 ++ .../supplemental/invalid-ext-bidder.json | 32 ++ .../metaxtest/supplemental/invalid-ext.json | 30 ++ .../supplemental/invalid-publisher-error.json | 35 ++ .../metaxtest/supplemental/resp-bad-json.json | 80 ++++ .../supplemental/resp-bad-markuptype.json | 100 +++++ .../metaxtest/supplemental/status-400.json | 80 ++++ .../metaxtest/supplemental/status-500.json | 80 ++++ .../metaxtest/supplemental/status-503.json | 80 ++++ adapters/metax/params_test.go | 60 +++ exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_metax.go | 7 + static/bidder-info/metax.yaml | 18 + static/bidder-params/metax.json | 19 + 30 files changed, 2782 insertions(+) create mode 100644 adapters/metax/metax.go create mode 100644 adapters/metax/metax_test.go create mode 100644 adapters/metax/metaxtest/exemplary/app-formats.json create mode 100644 adapters/metax/metaxtest/exemplary/app-imps.json create mode 100644 adapters/metax/metaxtest/exemplary/no-bid.json create mode 100644 adapters/metax/metaxtest/exemplary/no-seat-bid.json create mode 100644 adapters/metax/metaxtest/exemplary/no-seat.json create mode 100644 adapters/metax/metaxtest/exemplary/simple-app-audio.json create mode 100644 adapters/metax/metaxtest/exemplary/simple-app-banner.json create mode 100644 adapters/metax/metaxtest/exemplary/simple-app-native.json create mode 100644 adapters/metax/metaxtest/exemplary/simple-app-video.json create mode 100644 adapters/metax/metaxtest/exemplary/simple-site-audio.json create mode 100644 adapters/metax/metaxtest/exemplary/simple-site-banner.json create mode 100644 adapters/metax/metaxtest/exemplary/simple-site-native.json create mode 100644 adapters/metax/metaxtest/exemplary/simple-site-video.json create mode 100644 adapters/metax/metaxtest/supplemental/invalid-adunit-error.json create mode 100644 adapters/metax/metaxtest/supplemental/invalid-ext-bidder.json create mode 100644 adapters/metax/metaxtest/supplemental/invalid-ext.json create mode 100644 adapters/metax/metaxtest/supplemental/invalid-publisher-error.json create mode 100644 adapters/metax/metaxtest/supplemental/resp-bad-json.json create mode 100644 adapters/metax/metaxtest/supplemental/resp-bad-markuptype.json create mode 100644 adapters/metax/metaxtest/supplemental/status-400.json create mode 100644 adapters/metax/metaxtest/supplemental/status-500.json create mode 100644 adapters/metax/metaxtest/supplemental/status-503.json create mode 100644 adapters/metax/params_test.go create mode 100644 openrtb_ext/imp_metax.go create mode 100644 static/bidder-info/metax.yaml create mode 100644 static/bidder-params/metax.json diff --git a/adapters/metax/metax.go b/adapters/metax/metax.go new file mode 100644 index 00000000000..d10c426434c --- /dev/null +++ b/adapters/metax/metax.go @@ -0,0 +1,194 @@ +package metax + +import ( + "encoding/json" + "errors" + "fmt" + "net/http" + "strconv" + "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/v2/util/ptrutil" +) + +type adapter struct { + template *template.Template +} + +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + errs := make([]error, 0, len(request.Imp)) + + // split impressions + reqDatas := make([]*adapters.RequestData, 0, len(request.Imp)) + for _, imp := range request.Imp { + metaxExt, err := parseBidderExt(&imp) + if err != nil { + errs = append(errs, err) + continue + } + + if err := preprocessImp(&imp); err != nil { + errs = append(errs, err) + continue + } + + endpoint, err := a.getEndpoint(metaxExt) + if err != nil { + errs = append(errs, err) + continue + } + + requestCopy := *request + requestCopy.Imp = []openrtb2.Imp{imp} + reqJSON, err := json.Marshal(requestCopy) + if err != nil { + errs = append(errs, err) + return nil, errs + } + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + reqDatas = append(reqDatas, &adapters.RequestData{ + Method: "POST", + Uri: endpoint, + Body: reqJSON, + Headers: headers, + ImpIDs: openrtb_ext.GetImpIDs(requestCopy.Imp), + }) + } + + return reqDatas, errs +} + +func (a *adapter) MakeBids(bidReq *openrtb2.BidRequest, reqData *adapters.RequestData, respData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if adapters.IsResponseStatusCodeNoContent(respData) { + return nil, nil + } + + if err := adapters.CheckResponseStatusCodeForErrors(respData); err != nil { + return nil, []error{err} + } + + var bidResp openrtb2.BidResponse + if err := json.Unmarshal(respData.Body, &bidResp); err != nil { + return nil, []error{err} + } + + // additional no content check + if len(bidResp.SeatBid) == 0 || len(bidResp.SeatBid[0].Bid) == 0 { + return nil, nil + } + + resp := adapters.NewBidderResponseWithBidsCapacity(len(bidResp.SeatBid[0].Bid)) + if len(bidResp.Cur) != 0 { + resp.Currency = bidResp.Cur + } + for _, sb := range bidResp.SeatBid { + for i := range sb.Bid { + bid := &sb.Bid[i] + bidType, err := getBidType(bid) + if err != nil { + return nil, []error{err} + } + resp.Bids = append(resp.Bids, &adapters.TypedBid{ + Bid: bid, + BidType: bidType, + }) + } + } + return resp, nil +} + +func (a *adapter) getEndpoint(ext *openrtb_ext.ExtImpMetaX) (string, error) { + params := macros.EndpointTemplateParams{ + PublisherID: strconv.Itoa(ext.PublisherID), + AdUnit: strconv.Itoa(ext.Adunit), + } + return macros.ResolveMacros(a.template, params) +} + +func parseBidderExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpMetaX, error) { + var bidderExt adapters.ExtImpBidder + if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { + return nil, err + } + + var metaxExt openrtb_ext.ExtImpMetaX + if err := json.Unmarshal(bidderExt.Bidder, &metaxExt); err != nil { + return nil, errors.New("Wrong MetaX bidder ext") + } + + return &metaxExt, nil +} + +func preprocessImp(imp *openrtb2.Imp) error { + if imp == nil { + return errors.New("imp is nil") + } + + if imp.Banner != nil { + imp.Banner = assignBannerSize(imp.Banner) + } + + return nil +} + +func assignBannerSize(banner *openrtb2.Banner) *openrtb2.Banner { + if banner.W != nil && banner.H != nil { + return banner + } + + if len(banner.Format) == 0 { + return banner + } + + return assignBannerWidthAndHeight(banner, banner.Format[0].W, banner.Format[0].H) +} + +func assignBannerWidthAndHeight(banner *openrtb2.Banner, w, h int64) *openrtb2.Banner { + bannerCopy := *banner + bannerCopy.W = ptrutil.ToPtr(w) + bannerCopy.H = ptrutil.ToPtr(h) + return &bannerCopy +} + +func getBidType(bid *openrtb2.Bid) (openrtb_ext.BidType, error) { + switch bid.MType { + case openrtb2.MarkupBanner: + return openrtb_ext.BidTypeBanner, nil + case openrtb2.MarkupVideo: + return openrtb_ext.BidTypeVideo, nil + case openrtb2.MarkupNative: + return openrtb_ext.BidTypeNative, nil + case openrtb2.MarkupAudio: + return openrtb_ext.BidTypeAudio, nil + default: + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unsupported MType %d", bid.MType), + } + } +} + +// Builder builds a new instance of the MetaX adapter for the given bidder with the given config. +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { + if config.Endpoint == "" { + return nil, errors.New("endpoint is empty") + } + + templ, err := template.New("endpointTemplate").Parse(config.Endpoint) + if err != nil { + return nil, fmt.Errorf("unable to parse endpoint: %v", err) + } + + bidder := &adapter{ + template: templ, + } + return bidder, nil +} diff --git a/adapters/metax/metax_test.go b/adapters/metax/metax_test.go new file mode 100644 index 00000000000..765f3004c81 --- /dev/null +++ b/adapters/metax/metax_test.go @@ -0,0 +1,214 @@ +package metax + +import ( + "encoding/json" + "testing" + + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/prebid-server/v2/adapters" + "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/v2/util/ptrutil" + "github.com/stretchr/testify/assert" +) + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder( + openrtb_ext.BidderMetaX, + config.Adapter{ + Endpoint: "https://hb.metaxads.com/prebid?sid={{.PublisherID}}&adunit={{.AdUnit}}&source=prebid-server", + }, + config.Server{ + ExternalUrl: "http://hosturl.com", + GvlID: 1301, + DataCenter: "2", + }, + ) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "metaxtest", bidder) +} + +func TestParseBidderExt(t *testing.T) { + data := ` +{ + "bidder": { + "publisherId": 1000, + "adunit": 200 + } +}` + imp := &openrtb2.Imp{ + Ext: json.RawMessage([]byte(data)), + } + metaxExt, err := parseBidderExt(imp) + assert.Nil(t, err) + assert.Equal(t, 1000, metaxExt.PublisherID) + assert.Equal(t, 200, metaxExt.Adunit) +} + +func TestPreprocessImp(t *testing.T) { + assert.NotNil(t, preprocessImp(nil)) + + imp1 := &openrtb2.Imp{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ + {W: 300, H: 250}, + {W: 728, H: 90}, + }, + }, + } + err1 := preprocessImp(imp1) + assert.Nil(t, err1) + + imp2 := &openrtb2.Imp{ + Video: &openrtb2.Video{ + W: ptrutil.ToPtr(int64(1920)), + H: ptrutil.ToPtr(int64(1920)), + }, + } + err2 := preprocessImp(imp2) + assert.Nil(t, err2) +} + +func TestAssignBannerSize(t *testing.T) { + b1 := &openrtb2.Banner{ + Format: []openrtb2.Format{ + {W: 300, H: 250}, + {W: 728, H: 90}, + }, + } + b1n := assignBannerSize(b1) + assert.Equal(t, b1n.W, ptrutil.ToPtr(int64(300))) + assert.Equal(t, b1n.H, ptrutil.ToPtr(int64(250))) + assert.NotSame(t, b1, b1n) + + b2 := &openrtb2.Banner{ + Format: []openrtb2.Format{ + {W: 300, H: 250}, + {W: 728, H: 90}, + }, + W: ptrutil.ToPtr(int64(336)), + H: ptrutil.ToPtr(int64(280)), + } + b2n := assignBannerSize(b2) + assert.Equal(t, b2n.W, ptrutil.ToPtr(int64(336))) + assert.Equal(t, b2n.H, ptrutil.ToPtr(int64(280))) + assert.Same(t, b2, b2n) + + b3 := &openrtb2.Banner{ + W: ptrutil.ToPtr(int64(336)), + H: ptrutil.ToPtr(int64(280)), + } + b3n := assignBannerSize(b3) + assert.Equal(t, b3n.W, ptrutil.ToPtr(int64(336))) + assert.Equal(t, b3n.H, ptrutil.ToPtr(int64(280))) + assert.Same(t, b3, b3n) + + b4 := &openrtb2.Banner{ + Format: []openrtb2.Format{ + {W: 300, H: 250}, + {W: 728, H: 90}, + }, + W: ptrutil.ToPtr(int64(336)), + } + b4n := assignBannerSize(b4) + assert.Equal(t, b4n.W, ptrutil.ToPtr(int64(300))) + assert.Equal(t, b4n.H, ptrutil.ToPtr(int64(250))) + assert.NotSame(t, b4, b4n) + + b5 := &openrtb2.Banner{} + b5n := assignBannerSize(b5) + assert.Nil(t, b5n.W) + assert.Nil(t, b5n.H) + assert.Same(t, b5, b5n) +} + +func TestGetBidType(t *testing.T) { + tests := []struct { + bid *openrtb2.Bid + bidtype openrtb_ext.BidType + }{ + {&openrtb2.Bid{AdM: "", MType: openrtb2.MarkupBanner}, openrtb_ext.BidTypeBanner}, + {&openrtb2.Bid{AdM: "", MType: openrtb2.MarkupVideo}, openrtb_ext.BidTypeVideo}, + {&openrtb2.Bid{AdM: "", MType: openrtb2.MarkupNative}, openrtb_ext.BidTypeNative}, + {&openrtb2.Bid{AdM: "", MType: openrtb2.MarkupAudio}, openrtb_ext.BidTypeAudio}, + {&openrtb2.Bid{AdM: "", MType: 0}, ""}, + } + + for _, test := range tests { + bidType, err := getBidType(test.bid) + assert.Equal(t, test.bidtype, bidType) + if bidType == "" { + assert.NotNil(t, err) + } + } +} + +func TestBuilder(t *testing.T) { + serverCfg := config.Server{} + + cfg1 := config.Adapter{Endpoint: "https://hb.metaxads.com/prebid"} + builder1, err1 := Builder("test", cfg1, serverCfg) + assert.NotNil(t, builder1) + assert.Nil(t, err1) + + // empty endpoint + cfg2 := config.Adapter{Endpoint: ""} + builder2, err2 := Builder("test2", cfg2, serverCfg) + assert.Nil(t, builder2) + assert.NotNil(t, err2) + + // invalid endpoint + cfg3 := config.Adapter{Endpoint: "https://hb.metaxads.com/prebid?a={{}}"} + builder3, err3 := Builder("test3", cfg3, serverCfg) + assert.Nil(t, builder3) + assert.NotNil(t, err3) +} + +func TestMakeRequests(t *testing.T) { + builder1, _ := Builder("metax", config.Adapter{Endpoint: "https://hb.metaxads.com/prebid?sid={{.PublisherId}}"}, config.Server{}) + reqDatas1, err1 := builder1.MakeRequests(&openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ + { + Ext: []byte(` + { + "bidder": { + "publisherId": 100, + "adunit": 2 + } + } + `), + }, + }, + Ext: []byte(`{invalid json}`), + }, &adapters.ExtraRequestInfo{}) + assert.Equal(t, 0, len(reqDatas1)) + assert.Equal(t, 1, len(err1)) + + builder2, _ := Builder( + "metax", + config.Adapter{Endpoint: "https://hb.metaxads.com/prebid?sid={{.PublisherID}}&adunit={{.AdUnit}}&source=prebid-server"}, + config.Server{}, + ) + reqDatas2, err2 := builder2.MakeRequests(&openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ + { + Ext: []byte(` + { + "bidder": { + "publisherId": 100, + "adunit": 2 + } + } + `), + }, + }, + Ext: []byte(`{invalid json}`), + }, &adapters.ExtraRequestInfo{}) + assert.Equal(t, 0, len(reqDatas2)) + assert.Equal(t, 1, len(err2)) +} diff --git a/adapters/metax/metaxtest/exemplary/app-formats.json b/adapters/metax/metaxtest/exemplary/app-formats.json new file mode 100644 index 00000000000..013436f20bb --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/app-formats.json @@ -0,0 +1,156 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "native": { + "request": "{json string 1}", + "ver": "1.2" + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "body": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ], + "w": 728, + "h": 90 + }, + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "native": { + "request": "{json string 1}", + "ver": "1.2" + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "metax", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 728, + "h": 90, + "mtype": 1 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 728, + "h": 90, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/metax/metaxtest/exemplary/app-imps.json b/adapters/metax/metaxtest/exemplary/app-imps.json new file mode 100644 index 00000000000..cc77a34baaf --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/app-imps.json @@ -0,0 +1,351 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "imp-1", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + }, + { + "id": "imp-2", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + }, + { + "id": "imp-3", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "imp-1", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "imp-1" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "metax", + "bid": [ + { + "id": "bid-1", + "impid": "imp-1", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 1024, + "h": 576, + "mtype": 2 + } + ] + } + ] + } + } + }, + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "imp-2", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "imp-2" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "metax", + "bid": [ + { + "id": "bid-2", + "impid": "imp-2", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 1024, + "h": 576, + "mtype": 2 + } + ] + } + ] + } + } + }, + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "imp-3", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ], + "w": 728, + "h": 90 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "imp-3" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "metax", + "bid": [ + { + "id": "bid-3", + "impid": "imp-3", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 728, + "h": 90, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "bid-1", + "impid": "imp-1", + "price": 0.5, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 1024, + "h": 576, + "mtype": 2 + }, + "type": "video" + } + ] + }, + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "bid-2", + "impid": "imp-2", + "price": 0.5, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 1024, + "h": 576, + "mtype": 2 + }, + "type": "video" + } + ] + }, + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "bid-3", + "impid": "imp-3", + "price": 0.5, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 728, + "h": 90, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} + + + diff --git a/adapters/metax/metaxtest/exemplary/no-bid.json b/adapters/metax/metaxtest/exemplary/no-bid.json new file mode 100644 index 00000000000..3eb1b79a2eb --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/no-bid.json @@ -0,0 +1,92 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 204, + "body": { + } + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/metax/metaxtest/exemplary/no-seat-bid.json b/adapters/metax/metaxtest/exemplary/no-seat-bid.json new file mode 100644 index 00000000000..fe166b1b634 --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/no-seat-bid.json @@ -0,0 +1,99 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "metax", + "bid": [] + } + ] + } + } + } + ], + "expectedBidResponses": [] +} \ No newline at end of file diff --git a/adapters/metax/metaxtest/exemplary/no-seat.json b/adapters/metax/metaxtest/exemplary/no-seat.json new file mode 100644 index 00000000000..ea83df7f83a --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/no-seat.json @@ -0,0 +1,94 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [] + } + } + } + ], + "expectedBidResponses": [] +} \ No newline at end of file diff --git a/adapters/metax/metaxtest/exemplary/simple-app-audio.json b/adapters/metax/metaxtest/exemplary/simple-app-audio.json new file mode 100644 index 00000000000..5bd6a102fb7 --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/simple-app-audio.json @@ -0,0 +1,110 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "audio": { + "mimes": [ + "audio/mp4" + ], + "protocols": [ + 9, + 10 + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "body": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "audio": { + "mimes": [ + "audio/mp4" + ], + "protocols": [ + 9, + 10 + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "metax", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "test-crid", + "mtype": 3 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "crid": "test-crid", + "mtype": 3 + }, + "type": "audio" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/metax/metaxtest/exemplary/simple-app-banner.json b/adapters/metax/metaxtest/exemplary/simple-app-banner.json new file mode 100644 index 00000000000..329e00a2f59 --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/simple-app-banner.json @@ -0,0 +1,122 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ], + "w": 728, + "h": 90 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "metax", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 728, + "h": 90, + "mtype": 1 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 728, + "h": 90, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/metax/metaxtest/exemplary/simple-app-native.json b/adapters/metax/metaxtest/exemplary/simple-app-native.json new file mode 100644 index 00000000000..52b4305ad70 --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/simple-app-native.json @@ -0,0 +1,99 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{\"ver\":\"1.2\",\"context\":2,\"contextsubtype\":20,\"plcmttype\":11,\"plcmtcnt\":1,\"aurlsupport\":1,\"durlsupport\":1,\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"len\":140}},{\"id\":128,\"required\":0,\"img\":{\"wmin\":836,\"hmin\":627,\"type\":3}}]}" + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{\"ver\":\"1.2\",\"context\":2,\"contextsubtype\":20,\"plcmttype\":11,\"plcmtcnt\":1,\"aurlsupport\":1,\"durlsupport\":1,\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"len\":140}},{\"id\":128,\"required\":0,\"img\":{\"wmin\":836,\"hmin\":627,\"type\":3}}]}" + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "native-json", + "crid": "test-crid", + "mtype": 4 + } + ] + } + ] + } + } + }], + + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "native-json", + "crid": "test-crid", + "mtype": 4 + }, + "type": "native" + }] + }] +} diff --git a/adapters/metax/metaxtest/exemplary/simple-app-video.json b/adapters/metax/metaxtest/exemplary/simple-app-video.json new file mode 100644 index 00000000000..4f4272ee3db --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/simple-app-video.json @@ -0,0 +1,130 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "metax", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 1024, + "h": 576, + "mtype": 2 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 1024, + "h": 576, + "mtype": 2 + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/metax/metaxtest/exemplary/simple-site-audio.json b/adapters/metax/metaxtest/exemplary/simple-site-audio.json new file mode 100644 index 00000000000..ebc240ec9f4 --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/simple-site-audio.json @@ -0,0 +1,110 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "audio": { + "mimes": [ + "audio/mp4" + ], + "protocols": [ + 9, + 10 + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "body": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "audio": { + "mimes": [ + "audio/mp4" + ], + "protocols": [ + 9, + 10 + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "metax", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "test-crid", + "mtype": 3 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "crid": "test-crid", + "mtype": 3 + }, + "type": "audio" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/metax/metaxtest/exemplary/simple-site-banner.json b/adapters/metax/metaxtest/exemplary/simple-site-banner.json new file mode 100644 index 00000000000..cc631fac8a7 --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/simple-site-banner.json @@ -0,0 +1,122 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ], + "w": 728, + "h": 90 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "metax", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 728, + "h": 90, + "mtype": 1 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 728, + "h": 90, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/metax/metaxtest/exemplary/simple-site-native.json b/adapters/metax/metaxtest/exemplary/simple-site-native.json new file mode 100644 index 00000000000..5955b1b86af --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/simple-site-native.json @@ -0,0 +1,99 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{\"ver\":\"1.2\",\"context\":2,\"contextsubtype\":20,\"plcmttype\":11,\"plcmtcnt\":1,\"aurlsupport\":1,\"durlsupport\":1,\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"len\":140}},{\"id\":128,\"required\":0,\"img\":{\"wmin\":836,\"hmin\":627,\"type\":3}}]}" + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{\"ver\":\"1.2\",\"context\":2,\"contextsubtype\":20,\"plcmttype\":11,\"plcmtcnt\":1,\"aurlsupport\":1,\"durlsupport\":1,\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"len\":140}},{\"id\":128,\"required\":0,\"img\":{\"wmin\":836,\"hmin\":627,\"type\":3}}]}" + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "native-json", + "crid": "test-crid", + "mtype": 4 + } + ] + } + ] + } + } + }], + + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "native-json", + "crid": "test-crid", + "mtype": 4 + }, + "type": "native" + }] + }] +} diff --git a/adapters/metax/metaxtest/exemplary/simple-site-video.json b/adapters/metax/metaxtest/exemplary/simple-site-video.json new file mode 100644 index 00000000000..d6084603a0e --- /dev/null +++ b/adapters/metax/metaxtest/exemplary/simple-site-video.json @@ -0,0 +1,130 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "body": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "metax", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 1024, + "h": 576, + "mtype": 2 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 1024, + "h": 576, + "mtype": 2 + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/metax/metaxtest/supplemental/invalid-adunit-error.json b/adapters/metax/metaxtest/supplemental/invalid-adunit-error.json new file mode 100644 index 00000000000..35ce462a422 --- /dev/null +++ b/adapters/metax/metaxtest/supplemental/invalid-adunit-error.json @@ -0,0 +1,35 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": "abc" + } + } + } + ], + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "Wrong MetaX bidder ext", + "comparison": "literal" + } + ] +} diff --git a/adapters/metax/metaxtest/supplemental/invalid-ext-bidder.json b/adapters/metax/metaxtest/supplemental/invalid-ext-bidder.json new file mode 100644 index 00000000000..7016e7dc08e --- /dev/null +++ b/adapters/metax/metaxtest/supplemental/invalid-ext-bidder.json @@ -0,0 +1,32 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": "bad string" + } + } + ], + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "Wrong MetaX bidder ext", + "comparison": "literal" + } + ] +} diff --git a/adapters/metax/metaxtest/supplemental/invalid-ext.json b/adapters/metax/metaxtest/supplemental/invalid-ext.json new file mode 100644 index 00000000000..54d6d9f2c05 --- /dev/null +++ b/adapters/metax/metaxtest/supplemental/invalid-ext.json @@ -0,0 +1,30 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": "" + } + ], + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "json: cannot unmarshal*", + "comparison": "regex" + } + ] +} diff --git a/adapters/metax/metaxtest/supplemental/invalid-publisher-error.json b/adapters/metax/metaxtest/supplemental/invalid-publisher-error.json new file mode 100644 index 00000000000..2a16200f1c1 --- /dev/null +++ b/adapters/metax/metaxtest/supplemental/invalid-publisher-error.json @@ -0,0 +1,35 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "publisherId": "abc", + "adunit": 100000 + } + } + } + ], + "app": { + "bundle": "com.prebid" + }, + "device": { + "ifa": "ec943cb9-61ec-460f-a925-6489c3fcc4e3" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "Wrong MetaX bidder ext", + "comparison": "literal" + } + ] +} diff --git a/adapters/metax/metaxtest/supplemental/resp-bad-json.json b/adapters/metax/metaxtest/supplemental/resp-bad-json.json new file mode 100644 index 00000000000..cc51b14e050 --- /dev/null +++ b/adapters/metax/metaxtest/supplemental/resp-bad-json.json @@ -0,0 +1,80 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "body": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ], + "w": 728, + "h": 90 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": "this is not a valid json" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "json: cannot unmarshal*", + "comparison": "regex" + } + ] +} diff --git a/adapters/metax/metaxtest/supplemental/resp-bad-markuptype.json b/adapters/metax/metaxtest/supplemental/resp-bad-markuptype.json new file mode 100644 index 00000000000..dae139bd452 --- /dev/null +++ b/adapters/metax/metaxtest/supplemental/resp-bad-markuptype.json @@ -0,0 +1,100 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "body": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ], + "w": 728, + "h": 90 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "metax", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "test-crid", + "w": 728, + "h": 90, + "mtype": 0 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unsupported MType 0", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/metax/metaxtest/supplemental/status-400.json b/adapters/metax/metaxtest/supplemental/status-400.json new file mode 100644 index 00000000000..63a86a5388b --- /dev/null +++ b/adapters/metax/metaxtest/supplemental/status-400.json @@ -0,0 +1,80 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "body": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ], + "w": 728, + "h": 90 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 400, + "body": "invalid params" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/metax/metaxtest/supplemental/status-500.json b/adapters/metax/metaxtest/supplemental/status-500.json new file mode 100644 index 00000000000..79841569eb4 --- /dev/null +++ b/adapters/metax/metaxtest/supplemental/status-500.json @@ -0,0 +1,80 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "body": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ], + "w": 728, + "h": 90 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 500, + "body": "Internal Server Error" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 500. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/metax/metaxtest/supplemental/status-503.json b/adapters/metax/metaxtest/supplemental/status-503.json new file mode 100644 index 00000000000..3c8220ee598 --- /dev/null +++ b/adapters/metax/metaxtest/supplemental/status-503.json @@ -0,0 +1,80 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.metaxads.com/prebid?sid=10000000&adunit=100000&source=prebid-server", + "body": { + "id": "test-request-id", + "site": { + "page": "prebid.org" + }, + "user": { + "buyeruid": "be5e209ad46927520000000000000000" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ], + "w": 728, + "h": 90 + }, + "ext": { + "bidder": { + "publisherId": 10000000, + "adunit": 100000 + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 503, + "body": "" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 503. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/metax/params_test.go b/adapters/metax/params_test.go new file mode 100644 index 00000000000..5ffb45308e1 --- /dev/null +++ b/adapters/metax/params_test.go @@ -0,0 +1,60 @@ +package metax + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +// This file actually intends to test static/bidder-params/metax.json +// +// These also validate the format of the external API: request.imp[i].ext.prebid.bidder.metax + +// TestValidParams makes sure that the metax schema accepts all imp.ext fields which we intend to support. +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderMetaX, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected metax params: %s", validParam) + } + } +} + +// TestInvalidParams makes sure that the metax schema rejects all the imp.ext fields we don't support. +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, invalidParam := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderMetaX, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"publisherId": 10000000, "adunit": 100000}`, +} + +var invalidParams = []string{ + ``, + `null`, + `undefined`, + `0`, + `{}`, + `[]`, + `{"publisherId": ""}`, + `{"adunit": ""}`, + `{"publisherId": "", "adunit": ""}`, + `{"publisherId": "10000000", "adunit": "100000"}`, + `{"publisherId": 0, "adunit": 0}`, + `{"publisherId": 10000000, "adunit": 0}`, + `{"publisherId": 0, "adunit": 100000}`, +} diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 173f134567f..b79d03a8afd 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -129,6 +129,7 @@ import ( "github.com/prebid/prebid-server/v2/adapters/marsmedia" "github.com/prebid/prebid-server/v2/adapters/mediago" "github.com/prebid/prebid-server/v2/adapters/medianet" + "github.com/prebid/prebid-server/v2/adapters/metax" "github.com/prebid/prebid-server/v2/adapters/mgid" "github.com/prebid/prebid-server/v2/adapters/mgidX" "github.com/prebid/prebid-server/v2/adapters/minutemedia" @@ -352,6 +353,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderMediafuse: appnexus.Builder, openrtb_ext.BidderMediaGo: mediago.Builder, openrtb_ext.BidderMedianet: medianet.Builder, + openrtb_ext.BidderMetaX: metax.Builder, openrtb_ext.BidderMgid: mgid.Builder, openrtb_ext.BidderMgidX: mgidX.Builder, openrtb_ext.BidderMinuteMedia: minutemedia.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index bc422e4ab87..46d70c7f998 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -147,6 +147,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderMediafuse, BidderMediaGo, BidderMedianet, + BidderMetaX, BidderMgid, BidderMgidX, BidderMinuteMedia, @@ -467,6 +468,7 @@ const ( BidderMediafuse BidderName = "mediafuse" BidderMediaGo BidderName = "mediago" BidderMedianet BidderName = "medianet" + BidderMetaX BidderName = "metax" BidderMgid BidderName = "mgid" BidderMgidX BidderName = "mgidX" BidderMinuteMedia BidderName = "minutemedia" diff --git a/openrtb_ext/imp_metax.go b/openrtb_ext/imp_metax.go new file mode 100644 index 00000000000..ab54505fbf3 --- /dev/null +++ b/openrtb_ext/imp_metax.go @@ -0,0 +1,7 @@ +package openrtb_ext + +// ExtImpMetaX defines the contract for bidrequest.imp[i].ext.prebid.bidder.metax +type ExtImpMetaX struct { + PublisherID int `json:"publisherId"` + Adunit int `json:"adunit"` +} diff --git a/static/bidder-info/metax.yaml b/static/bidder-info/metax.yaml new file mode 100644 index 00000000000..d9867322d01 --- /dev/null +++ b/static/bidder-info/metax.yaml @@ -0,0 +1,18 @@ +# The MetaX Bidding adapter requires setup before beginning. Please contact us at +endpoint: "https://hb.metaxads.com/prebid?sid={{.PublisherID}}&adunit={{.AdUnit}}&source=prebid-server" +maintainer: + email: "prebid@metaxsoft.com" +gvlVendorID: 1301 +capabilities: + app: + mediaTypes: + - banner + - video + - native + - audio + site: + mediaTypes: + - banner + - video + - native + - audio diff --git a/static/bidder-params/metax.json b/static/bidder-params/metax.json new file mode 100644 index 00000000000..3c336c2be3e --- /dev/null +++ b/static/bidder-params/metax.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "MetaX Adapter Params", + "description": "A schema which validates params accepted by the MetaX adapter", + "type": "object", + "properties": { + "publisherId": { + "type": "integer", + "description": "An ID which identifies the publisher", + "minimum": 1 + }, + "adunit": { + "type": "integer", + "description": "An ID which identifies the adunit", + "minimum": 1 + } + }, + "required": ["publisherId", "adunit"] +}