diff --git a/adapters/intenze/intenze.go b/adapters/intenze/intenze.go index 2a9ec562b81..93902bde3e2 100644 --- a/adapters/intenze/intenze.go +++ b/adapters/intenze/intenze.go @@ -4,13 +4,14 @@ import ( "encoding/json" "fmt" "net/http" + "net/url" "text/template" "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v4/adapters" "github.com/prebid/prebid-server/v4/config" "github.com/prebid/prebid-server/v4/errortypes" - "github.com/prebid/prebid-server/v4/macros" + "github.com/prebid/prebid-server/v4/openrtb_ext" "github.com/prebid/prebid-server/v4/util/jsonutil" ) @@ -19,15 +20,19 @@ 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) - } +var exchangeSubdomainsRegions = map[string]string{ + "us-east": "lb-east", + "eu": "n2", + "apac": "lb-apac", +} +var sspSubdomainsRegions = map[string]string{ + "us-east": "us-east-ssp", + "eu": "eu-ssp", + "apac": "apac-ssp", +} - bidder := &adapter{ - endpoint: template, - } +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { + bidder := &adapter{} return bidder, nil } @@ -55,6 +60,7 @@ func getHeaders(request *openrtb2.BidRequest) http.Header { } func (a *adapter) MakeRequests(openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) (requestsToBidder []*adapters.RequestData, errs []error) { + impExt, err := getImpressionExt(&openRTBRequest.Imp[0]) if err != nil { return nil, []error{err} @@ -99,8 +105,42 @@ func getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtIntenze, error) { } func (a *adapter) buildEndpointURL(params *openrtb_ext.ExtIntenze) (string, error) { - endpointParams := macros.EndpointTemplateParams{AccountID: params.AccountID} - return macros.ResolveMacros(a.endpoint, endpointParams) + if params.AccountID == nil && params.PlacementID == nil { + return "", &errortypes.BadInput{ + Message: "either accountId or placementId expected", + } + } + + var route = "" + var subdomain, queryKey, queryValue string + var regionMap map[string]string + + if params.AccountID != nil { + subdomain = "lb-east" + queryKey = "pass" + queryValue = *params.AccountID + regionMap = exchangeSubdomainsRegions + } else { + subdomain = "us-east-ssp" + queryKey = "placementId" + route = "pbs-serve" + queryValue = *params.PlacementID + regionMap = sspSubdomainsRegions + } + + if params.Region != nil { + var exists bool + subdomain, exists = regionMap[*params.Region] + if !exists { + return "", &errortypes.BadInput{ + Message: fmt.Sprintf("invalid region: %s. Expected us-east, eu or apac", *params.Region), + } + } + } + + endpoint := fmt.Sprintf("https://%s.intenze.co/%s?%s=%s", subdomain, route, queryKey, url.QueryEscape(queryValue)) + + return endpoint, nil } func checkResponseStatusCodes(response *adapters.ResponseData) error { diff --git a/adapters/intenze/intenze_test.go b/adapters/intenze/intenze_test.go index 00d97a6b317..7bfcea8bf53 100644 --- a/adapters/intenze/intenze_test.go +++ b/adapters/intenze/intenze_test.go @@ -6,7 +6,6 @@ import ( "github.com/prebid/prebid-server/v4/adapters/adapterstest" "github.com/prebid/prebid-server/v4/config" "github.com/prebid/prebid-server/v4/openrtb_ext" - "github.com/stretchr/testify/assert" ) func TestJsonSamples(t *testing.T) { @@ -19,10 +18,3 @@ func TestJsonSamples(t *testing.T) { adapterstest.RunJSONBidderTest(t, "intenzetest", bidder) } - -func TestEndpointTemplateMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderIntenze, config.Adapter{ - Endpoint: "{{Malformed}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) - - assert.Error(t, buildErr) -} diff --git a/adapters/intenze/intenzetest/exemplary/banner-app.json b/adapters/intenze/intenzetest/exemplary/banner-app.json index 1b80ff5bf0d..1a004ac3d0a 100644 --- a/adapters/intenze/intenzetest/exemplary/banner-app.json +++ b/adapters/intenze/intenzetest/exemplary/banner-app.json @@ -59,7 +59,7 @@ "123.123.123.123" ] }, - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "device": { diff --git a/adapters/intenze/intenzetest/exemplary/banner-web.json b/adapters/intenze/intenzetest/exemplary/banner-web.json index 825ee9c72c5..79a37747037 100644 --- a/adapters/intenze/intenzetest/exemplary/banner-web.json +++ b/adapters/intenze/intenzetest/exemplary/banner-web.json @@ -66,7 +66,7 @@ "123.123.123.123" ] }, - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "device": { diff --git a/adapters/intenze/intenzetest/exemplary/native-app.json b/adapters/intenze/intenzetest/exemplary/native-app.json index 57bc6dd7277..d18bf7bec14 100644 --- a/adapters/intenze/intenzetest/exemplary/native-app.json +++ b/adapters/intenze/intenzetest/exemplary/native-app.json @@ -59,7 +59,7 @@ "123.123.123.123" ] }, - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "device": { diff --git a/adapters/intenze/intenzetest/exemplary/native-web.json b/adapters/intenze/intenzetest/exemplary/native-web.json index 31dedc44031..4ae35420571 100644 --- a/adapters/intenze/intenzetest/exemplary/native-web.json +++ b/adapters/intenze/intenzetest/exemplary/native-web.json @@ -53,7 +53,7 @@ "2607:fb90:f27:4512:d800:cb23:a603:e245" ] }, - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "device": { diff --git a/adapters/intenze/intenzetest/exemplary/simple-account-apac.json b/adapters/intenze/intenzetest/exemplary/simple-account-apac.json new file mode 100644 index 00000000000..ccd6fa40243 --- /dev/null +++ b/adapters/intenze/intenzetest/exemplary/simple-account-apac.json @@ -0,0 +1,155 @@ +{ + "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": "1", + "tagid": "ogTAGID", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "region": "apac", + "accountId": "accountId" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "https://lb-apac.intenze.co/?pass=accountId", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "1", + "banner": { + "w": 320, + "h": 50 + }, + "tagid": "ogTAGID" + } + ], + "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": [ + "1" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "mtype": 1 + } + ], + "type": "banner", + "seat": "intenze" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/intenze/intenzetest/exemplary/simple-account-eu.json b/adapters/intenze/intenzetest/exemplary/simple-account-eu.json new file mode 100644 index 00000000000..177cd1f388e --- /dev/null +++ b/adapters/intenze/intenzetest/exemplary/simple-account-eu.json @@ -0,0 +1,155 @@ +{ + "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": "1", + "tagid": "ogTAGID", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "region": "eu", + "accountId": "accountId" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "https://n2.intenze.co/?pass=accountId", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "1", + "banner": { + "w": 320, + "h": 50 + }, + "tagid": "ogTAGID" + } + ], + "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": [ + "1" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "mtype": 1 + } + ], + "type": "banner", + "seat": "intenze" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/intenze/intenzetest/exemplary/simple-placement-apac.json b/adapters/intenze/intenzetest/exemplary/simple-placement-apac.json new file mode 100644 index 00000000000..a2801b81fa0 --- /dev/null +++ b/adapters/intenze/intenzetest/exemplary/simple-placement-apac.json @@ -0,0 +1,155 @@ +{ + "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": "1", + "tagid": "ogTAGID", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "region": "apac", + "placementId": "123" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "https://apac-ssp.intenze.co/pbs-serve?placementId=123", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "1", + "banner": { + "w": 320, + "h": 50 + }, + "tagid": "ogTAGID" + } + ], + "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": [ + "1" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "mtype": 1 + } + ], + "type": "banner", + "seat": "intenze" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/intenze/intenzetest/exemplary/simple-placement-default-us-east.json b/adapters/intenze/intenzetest/exemplary/simple-placement-default-us-east.json new file mode 100644 index 00000000000..6b28c5976a6 --- /dev/null +++ b/adapters/intenze/intenzetest/exemplary/simple-placement-default-us-east.json @@ -0,0 +1,154 @@ +{ + "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": "1", + "tagid": "ogTAGID", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "placementId": "123" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "https://us-east-ssp.intenze.co/pbs-serve?placementId=123", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "1", + "banner": { + "w": 320, + "h": 50 + }, + "tagid": "ogTAGID" + } + ], + "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": [ + "1" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "mtype": 1 + } + ], + "type": "banner", + "seat": "intenze" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/intenze/intenzetest/exemplary/simple-placement-eu.json b/adapters/intenze/intenzetest/exemplary/simple-placement-eu.json new file mode 100644 index 00000000000..5b7b3fe82a2 --- /dev/null +++ b/adapters/intenze/intenzetest/exemplary/simple-placement-eu.json @@ -0,0 +1,155 @@ +{ + "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": "1", + "tagid": "ogTAGID", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "region": "eu", + "placementId": "123" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "https://eu-ssp.intenze.co/pbs-serve?placementId=123", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "1", + "banner": { + "w": 320, + "h": 50 + }, + "tagid": "ogTAGID" + } + ], + "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": [ + "1" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "mtype": 1 + } + ], + "type": "banner", + "seat": "intenze" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/intenze/intenzetest/exemplary/video-app.json b/adapters/intenze/intenzetest/exemplary/video-app.json index dd836ee34c6..cb67a2ecf82 100644 --- a/adapters/intenze/intenzetest/exemplary/video-app.json +++ b/adapters/intenze/intenzetest/exemplary/video-app.json @@ -64,7 +64,7 @@ "123.123.123.123" ] }, - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "device": { diff --git a/adapters/intenze/intenzetest/exemplary/video-web.json b/adapters/intenze/intenzetest/exemplary/video-web.json index c8b596f06a5..90a489e5277 100644 --- a/adapters/intenze/intenzetest/exemplary/video-web.json +++ b/adapters/intenze/intenzetest/exemplary/video-web.json @@ -58,7 +58,7 @@ "123.123.123.123" ] }, - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "device": { diff --git a/adapters/intenze/intenzetest/supplemental/bad_media_type.json b/adapters/intenze/intenzetest/supplemental/bad_media_type.json index 6b8050c0e73..6b9f8b4b8f3 100644 --- a/adapters/intenze/intenzetest/supplemental/bad_media_type.json +++ b/adapters/intenze/intenzetest/supplemental/bad_media_type.json @@ -59,7 +59,7 @@ "123.123.123.123" ] }, - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "device": { diff --git a/adapters/intenze/intenzetest/supplemental/empty-seatbid-array.json b/adapters/intenze/intenzetest/supplemental/empty-seatbid-array.json index 3302320c065..ad35a7a37da 100644 --- a/adapters/intenze/intenzetest/supplemental/empty-seatbid-array.json +++ b/adapters/intenze/intenzetest/supplemental/empty-seatbid-array.json @@ -64,7 +64,7 @@ "123.123.123.123" ] }, - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "device": { diff --git a/adapters/intenze/intenzetest/supplemental/invalid-region.json b/adapters/intenze/intenzetest/supplemental/invalid-region.json new file mode 100644 index 00000000000..01230c7d0e1 --- /dev/null +++ b/adapters/intenze/intenzetest/supplemental/invalid-region.json @@ -0,0 +1,36 @@ +{ + "expectedMakeRequestsErrors": [ + { + "value": "invalid region: unknown. Expected us-east, eu or apac", + "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": { + "bidder": { + "region": "unknown", + "placementId": "123" + } + } + } + ], + "site": { + "page": "test.com" + } + }, + "httpCalls": [] +} \ No newline at end of file diff --git a/adapters/intenze/intenzetest/supplemental/invalid-response.json b/adapters/intenze/intenzetest/supplemental/invalid-response.json index 585ea659634..244b4b9ec8e 100644 --- a/adapters/intenze/intenzetest/supplemental/invalid-response.json +++ b/adapters/intenze/intenzetest/supplemental/invalid-response.json @@ -59,7 +59,7 @@ "123.123.123.123" ] }, - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "device": { diff --git a/adapters/intenze/intenzetest/supplemental/no-account-no-placement.json b/adapters/intenze/intenzetest/supplemental/no-account-no-placement.json new file mode 100644 index 00000000000..5da7753df70 --- /dev/null +++ b/adapters/intenze/intenzetest/supplemental/no-account-no-placement.json @@ -0,0 +1,33 @@ +{ + "expectedMakeRequestsErrors": [ + { + "value": "either accountId or placementId expected", + "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": { + "bidder": {} + } + } + ], + "site": { + "page": "test.com" + } + }, + "httpCalls": [] +} \ No newline at end of file diff --git a/adapters/intenze/intenzetest/supplemental/status-code-bad-request.json b/adapters/intenze/intenzetest/supplemental/status-code-bad-request.json index 746a56355bb..c7f6d69ee86 100644 --- a/adapters/intenze/intenzetest/supplemental/status-code-bad-request.json +++ b/adapters/intenze/intenzetest/supplemental/status-code-bad-request.json @@ -41,7 +41,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "imp": [ diff --git a/adapters/intenze/intenzetest/supplemental/status-code-no-content.json b/adapters/intenze/intenzetest/supplemental/status-code-no-content.json index ad8a50ccc1b..44cd2b89d23 100644 --- a/adapters/intenze/intenzetest/supplemental/status-code-no-content.json +++ b/adapters/intenze/intenzetest/supplemental/status-code-no-content.json @@ -35,7 +35,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "imp": [ diff --git a/adapters/intenze/intenzetest/supplemental/status-code-other-error.json b/adapters/intenze/intenzetest/supplemental/status-code-other-error.json index 59ef26aa881..df801458773 100644 --- a/adapters/intenze/intenzetest/supplemental/status-code-other-error.json +++ b/adapters/intenze/intenzetest/supplemental/status-code-other-error.json @@ -35,7 +35,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "imp": [ diff --git a/adapters/intenze/intenzetest/supplemental/status-code-service-unavailable.json b/adapters/intenze/intenzetest/supplemental/status-code-service-unavailable.json index 138865eefbb..47711927788 100644 --- a/adapters/intenze/intenzetest/supplemental/status-code-service-unavailable.json +++ b/adapters/intenze/intenzetest/supplemental/status-code-service-unavailable.json @@ -35,7 +35,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://lb-east.intenze.co/?pass=accountId", + "uri": "https://lb-east.intenze.co/?pass=accountId", "body": { "id": "some-request-id", "imp": [ diff --git a/adapters/intenze/params_test.go b/adapters/intenze/params_test.go index 51fbd2dc384..de32c6d227d 100644 --- a/adapters/intenze/params_test.go +++ b/adapters/intenze/params_test.go @@ -9,6 +9,8 @@ import ( var validParams = []string{ `{"accountId": "hash"}`, + `{"placementId": "id"}`, + `{"region": "us-east", "placementId": "id"}`, } func TestValidParams(t *testing.T) { @@ -31,9 +33,6 @@ var invalidParams = []string{ `5`, `4.2`, `[]`, - `{}`, - `{"adCode": "string", "seatCode": 5, "originalPublisherid": "string"}`, - `{ "accountid": "" }`, } func TestInvalidParams(t *testing.T) { diff --git a/openrtb_ext/imp_intenze.go b/openrtb_ext/imp_intenze.go index 991c4817acf..85b1a515b2c 100644 --- a/openrtb_ext/imp_intenze.go +++ b/openrtb_ext/imp_intenze.go @@ -1,5 +1,7 @@ package openrtb_ext type ExtIntenze struct { - AccountID string `json:"accountId"` + Region *string `json:"region,omitempty"` + AccountID *string `json:"accountId,omitempty"` + PlacementID *string `json:"placementId,omitempty"` } diff --git a/static/bidder-params/intenze.json b/static/bidder-params/intenze.json index 1d42a6535fc..4487377ed58 100644 --- a/static/bidder-params/intenze.json +++ b/static/bidder-params/intenze.json @@ -4,13 +4,20 @@ "description": "A schema which validates params accepted by the Intenze adapter", "type": "object", "properties": { + "region": { + "type": "string", + "description": "Target region traffic. By default us-east.", + "minLength": 1 + }, "accountId": { "type": "string", - "description": "Account id", + "description": "Use this for Account ID of Ad Exchange", + "minLength": 1 + }, + "placementId": { + "type": "string", + "description": "Use this for Placement ID of SSP", "minLength": 1 } - }, - "required": [ - "accountId" - ] + } } \ No newline at end of file