From 35fc1041308650fc9571dd33faff87be2083bfde Mon Sep 17 00:00:00 2001 From: Brian Sardo <1168933+bsardo@users.noreply.github.com> Date: Tue, 7 Jan 2025 12:13:33 -0500 Subject: [PATCH 1/5] Upgrade to Go 1.23 (#4112) --- .devcontainer/devcontainer.json | 2 +- .github/workflows/adapter-code-coverage.yml | 2 +- .github/workflows/validate-merge.yml | 2 +- .github/workflows/validate.yml | 2 +- Dockerfile | 4 ++-- README.md | 2 +- go.mod | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f9bb82598ff..d924cdba4f7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,7 @@ "dockerfile": "Dockerfile", "args": { // Update the VARIANT arg to pick a version of Go - "VARIANT": "1.22", + "VARIANT": "1.23", // Options "INSTALL_NODE": "false", "NODE_VERSION": "lts/*" diff --git a/.github/workflows/adapter-code-coverage.yml b/.github/workflows/adapter-code-coverage.yml index 37936a1d17d..854c2568df2 100644 --- a/.github/workflows/adapter-code-coverage.yml +++ b/.github/workflows/adapter-code-coverage.yml @@ -15,7 +15,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.22.3 + go-version: 1.23.4 - name: Checkout Code uses: actions/checkout@v4 diff --git a/.github/workflows/validate-merge.yml b/.github/workflows/validate-merge.yml index d58a924d984..2d60ca2d28b 100644 --- a/.github/workflows/validate-merge.yml +++ b/.github/workflows/validate-merge.yml @@ -12,7 +12,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.22.3 + go-version: 1.23.4 - name: Checkout Merged Branch uses: actions/checkout@v4 diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index e40b165b8b3..effb57656f8 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -10,7 +10,7 @@ jobs: validate: strategy: matrix: - go-version: [1.21.x, 1.22.x] + go-version: [1.22.x, 1.23.x] os: [ubuntu-20.04] runs-on: ${{ matrix.os }} diff --git a/Dockerfile b/Dockerfile index ad509721ba9..3e17c3aeec7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,8 @@ RUN apt-get update && \ apt-get -y upgrade && \ apt-get install -y wget WORKDIR /tmp -RUN wget https://dl.google.com/go/go1.22.3.linux-amd64.tar.gz && \ - tar -xf go1.22.3.linux-amd64.tar.gz && \ +RUN wget https://dl.google.com/go/go1.23.4.linux-amd64.tar.gz && \ + tar -xf go1.23.4.linux-amd64.tar.gz && \ mv go /usr/local RUN mkdir -p /app/prebid-server/ WORKDIR /app/prebid-server/ diff --git a/README.md b/README.md index b616594a68a..9e4fb436728 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Ensure that you deploy the `/static` directory, as Prebid Server requires those ## Developing -Prebid Server requires [Go](https://go.dev) version 1.21 or newer. You can develop on any operating system that Go supports; however, please note that our helper scripts are written in bash. +Prebid Server requires [Go](https://go.dev) version 1.22 or newer. You can develop on any operating system that Go supports; however, please note that our helper scripts are written in bash. 1. Clone The Repository ``` bash diff --git a/go.mod b/go.mod index 55ac94b617d..bb69f854fd7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/prebid/prebid-server/v3 -go 1.21 +go 1.22 retract v3.0.0 // Forgot to update major version in import path and module name From 6e3a0d58be0582fc73ec1f2a1be2f5854d923c6f Mon Sep 17 00:00:00 2001 From: Dubyk Danylo <45672370+CTMBNara@users.noreply.github.com> Date: Wed, 8 Jan 2025 18:58:33 +0100 Subject: [PATCH 2/5] Rubicon: Update segtax logic (#3915) Co-authored-by: ddubyk --- adapters/rubicon/rubicon.go | 127 ++++- .../exemplary/25-26-transition-period.json | 202 +------ .../rubicontest/exemplary/app-imp-fpd.json | 112 ---- .../exemplary/flexible-schema.json | 112 ---- .../exemplary/hardcode-secure.json | 203 +------ .../exemplary/segtax-attributes.json | 505 ++++++++++++++++++ .../rubicontest/exemplary/simple-banner.json | 199 +------ .../rubicontest/exemplary/simple-native.json | 199 +------ .../rubicontest/exemplary/simple-video.json | 199 +------ .../rubicontest/exemplary/site-imp-fpd.json | 276 +--------- .../rubicontest/exemplary/user-fpd.json | 112 ---- .../supplemental/no-site-content-data.json | 112 ---- .../supplemental/no-site-content.json | 112 ---- go.mod | 1 + go.sum | 2 + 15 files changed, 631 insertions(+), 1842 deletions(-) create mode 100644 adapters/rubicon/rubicontest/exemplary/segtax-attributes.json diff --git a/adapters/rubicon/rubicon.go b/adapters/rubicon/rubicon.go index a1a4083bfc1..ded350b6f00 100644 --- a/adapters/rubicon/rubicon.go +++ b/adapters/rubicon/rubicon.go @@ -8,6 +8,8 @@ import ( "strconv" "strings" + "github.com/golang-collections/collections/stack" + "github.com/prebid/prebid-server/v3/version" "github.com/prebid/prebid-server/v3/adapters" @@ -402,7 +404,7 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *ada siteExtRP := rubiconSiteExt{RP: rubiconSiteExtRP{SiteID: int(siteId)}} if siteCopy.Content != nil { siteTarget := make(map[string]interface{}) - updateExtWithIabAttribute(siteTarget, siteCopy.Content.Data, []int{1, 2, 5, 6}) + updateExtWithIabAndSegtaxAttribute(siteTarget, siteCopy.Content.Data, []int{1, 2, 5, 6}) if len(siteTarget) > 0 { updatedSiteTarget, err := json.Marshal(siteTarget) if err != nil { @@ -751,7 +753,7 @@ func updateUserRpTargetWithFpdAttributes(visitor json.RawMessage, user openrtb2. if err != nil { return nil, err } - updateExtWithIabAttribute(target, user.Data, []int{4}) + updateExtWithIabAndSegtaxAttribute(target, user.Data, []int{4}) updatedTarget, err := json.Marshal(target) if err != nil { @@ -760,13 +762,106 @@ func updateUserRpTargetWithFpdAttributes(visitor json.RawMessage, user openrtb2. return updatedTarget, nil } -func updateExtWithIabAttribute(target map[string]interface{}, data []openrtb2.Data, segTaxes []int) { - var segmentIdsToCopy = getSegmentIdsToCopy(data, segTaxes) - if len(segmentIdsToCopy) == 0 { +func updateExtWithIabAndSegtaxAttribute(target map[string]interface{}, data []openrtb2.Data, segTaxes []int) { + taxonomyIdToSegments := getTaxonomyIdToSegments(data) + if len(taxonomyIdToSegments) == 0 { return } - target["iab"] = segmentIdsToCopy + relevantSegments := pickRelevantSegments(taxonomyIdToSegments) + groupedSegments := groupSegments(relevantSegments, segTaxes) + + for key, value := range groupedSegments { + target[key] = value + } +} + +func getTaxonomyIdToSegments(data []openrtb2.Data) map[int]*stack.Stack { + var taxonomyIdToSegments = make(map[int]*stack.Stack) + for _, dataRecord := range data { + if dataRecord.Ext == nil { + continue + } + + var dataRecordExt rubiconDataExt + err := json.Unmarshal(dataRecord.Ext, &dataRecordExt) + if err != nil { + continue + } + + taxonomyId := dataRecordExt.SegTax + originalSegments := dataRecord.Segment + if len(originalSegments) == 0 { + continue + } + + segments, exists := taxonomyIdToSegments[taxonomyId] + if !exists { + segments = stack.New() + taxonomyIdToSegments[taxonomyId] = segments + } + + for _, originalSegment := range originalSegments { + if originalSegment.ID != "" { + segments.Push(originalSegment) + } + } + + if segments.Len() == 0 { + delete(taxonomyIdToSegments, taxonomyId) + } + } + + return taxonomyIdToSegments +} + +func pickRelevantSegments(taxonomyIdToSegments map[int]*stack.Stack) map[int][]string { + var relevantSegments = make(map[int][]string) + taxonomyIds := make([]int, 0) + + for taxonomyId := range taxonomyIdToSegments { + taxonomyIds = append(taxonomyIds, taxonomyId) + } + + i := 0 + consumedSegmentsCount := 0 + for consumedSegmentsCount < 100 && len(taxonomyIds) > 0 { + taxonomyIdIndex := i % len(taxonomyIds) + taxonomyId := taxonomyIds[taxonomyIdIndex] + currentSegments := taxonomyIdToSegments[taxonomyId] + lastSegment := currentSegments.Pop().(openrtb2.Segment) + + if _, exists := relevantSegments[taxonomyId]; !exists { + relevantSegments[taxonomyId] = make([]string, 0) + } + relevantSegments[taxonomyId] = append(relevantSegments[taxonomyId], lastSegment.ID) + consumedSegmentsCount++ + + if currentSegments.Len() == 0 { + taxonomyIds = append(taxonomyIds[:taxonomyIdIndex], taxonomyIds[taxonomyIdIndex+1:]...) + i-- + } + i++ + } + + return relevantSegments +} + +func groupSegments(taxonomyIdToSegmentsIds map[int][]string, segTaxes []int) map[string][]string { + var groupedSegments = make(map[string][]string) + for taxonomyId, segmentsIds := range taxonomyIdToSegmentsIds { + segmentName := "iab" + if !contains(segTaxes, taxonomyId) { + segmentName = "tax" + strconv.Itoa(taxonomyId) + } + + if _, exists := groupedSegments[segmentName]; !exists { + groupedSegments[segmentName] = make([]string, 0) + } + groupedSegments[segmentName] = append(groupedSegments[segmentName], segmentsIds...) + } + + return groupedSegments } func populateFirstPartyDataAttributes(source json.RawMessage, target map[string]interface{}) error { @@ -845,26 +940,6 @@ func mapFromRawJSON(message json.RawMessage) (map[string]interface{}, error) { return targetAsMap, nil } -func getSegmentIdsToCopy(data []openrtb2.Data, segTaxValues []int) []string { - var segmentIdsToCopy = make([]string, 0, len(data)) - - for _, dataRecord := range data { - if dataRecord.Ext != nil { - var dataExtObject rubiconDataExt - err := jsonutil.Unmarshal(dataRecord.Ext, &dataExtObject) - if err != nil { - continue - } - if contains(segTaxValues, dataExtObject.SegTax) { - for _, segment := range dataRecord.Segment { - segmentIdsToCopy = append(segmentIdsToCopy, segment.ID) - } - } - } - } - return segmentIdsToCopy -} - func contains(s []int, e int) bool { for _, a := range s { if a == e { diff --git a/adapters/rubicon/rubicontest/exemplary/25-26-transition-period.json b/adapters/rubicon/rubicontest/exemplary/25-26-transition-period.json index 52cad5919eb..cc86da97414 100644 --- a/adapters/rubicon/rubicontest/exemplary/25-26-transition-period.json +++ b/adapters/rubicon/rubicontest/exemplary/25-26-transition-period.json @@ -13,44 +13,7 @@ "pagecat": [ "val1", "val2" - ], - "content": { - "data": [ - { - "ext": { - "segtax": 1 - }, - "segment": [ - { - "id": "segmentId1" - }, - { - "id": "segmentId2" - } - ] - }, - { - "ext": { - "segtax": "1" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": 2 - }, - "segment": [ - { - "id": "segmentId3" - } - ] - } - ] - } + ] }, "user": { "yob": 2000, @@ -60,60 +23,6 @@ "lon": -122.346200 }, "gender": "f", - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "consent": "consent" } @@ -131,7 +40,6 @@ "ver": "1.0" } } - }, "regs": { "ext": { @@ -194,53 +102,9 @@ "val1", "val2" ], - "content": { - "data": [ - { - "ext": { - "segtax": 1 - }, - "segment": [ - { - "id": "segmentId1" - }, - { - "id": "segmentId2" - } - ] - }, - { - "ext": { - "segtax": "1" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": 2 - }, - "segment": [ - { - "id": "segmentId3" - } - ] - } - ] - }, "ext": { "rp": { - "site_id": 113932, - "target": { - "iab": [ - "segmentId1", - "segmentId2", - "segmentId3" - ] - } + "site_id": 113932 } }, "publisher": { @@ -252,68 +116,10 @@ } }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "consent": "consent", "rp": { "target": { - "iab": [ - "idToCopy", - "idToCopy2" - ] } } } @@ -388,7 +194,9 @@ } ] }, - "impIDs":["test-imp-id"] + "impIDs": [ + "test-imp-id" + ] }, "mockResponse": { "status": 200, diff --git a/adapters/rubicon/rubicontest/exemplary/app-imp-fpd.json b/adapters/rubicon/rubicontest/exemplary/app-imp-fpd.json index 8982f95bff5..1968f209797 100644 --- a/adapters/rubicon/rubicontest/exemplary/app-imp-fpd.json +++ b/adapters/rubicon/rubicontest/exemplary/app-imp-fpd.json @@ -46,60 +46,6 @@ "lon": -122.346200 }, "gender": "f", - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "data": { "attr1": "val1", @@ -207,60 +153,6 @@ } }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "rp": { "target": { @@ -282,10 +174,6 @@ ], "attr5": [ "3" - ], - "iab": [ - "idToCopy", - "idToCopy2" ] } } diff --git a/adapters/rubicon/rubicontest/exemplary/flexible-schema.json b/adapters/rubicon/rubicontest/exemplary/flexible-schema.json index b9bedd3aa47..41bfb47aedf 100644 --- a/adapters/rubicon/rubicontest/exemplary/flexible-schema.json +++ b/adapters/rubicon/rubicontest/exemplary/flexible-schema.json @@ -46,60 +46,6 @@ "lon": -122.346200 }, "gender": "f", - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "data": { "attr1": "val1", @@ -207,60 +153,6 @@ } }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "rp": { "target": { @@ -282,10 +174,6 @@ ], "attr5": [ "3" - ], - "iab": [ - "idToCopy", - "idToCopy2" ] } } diff --git a/adapters/rubicon/rubicontest/exemplary/hardcode-secure.json b/adapters/rubicon/rubicontest/exemplary/hardcode-secure.json index 2040933b48e..bd65b9f5757 100644 --- a/adapters/rubicon/rubicontest/exemplary/hardcode-secure.json +++ b/adapters/rubicon/rubicontest/exemplary/hardcode-secure.json @@ -13,44 +13,7 @@ "pagecat": [ "val1", "val2" - ], - "content": { - "data": [ - { - "ext": { - "segtax": 1 - }, - "segment": [ - { - "id": "segmentId1" - }, - { - "id": "segmentId2" - } - ] - }, - { - "ext": { - "segtax": "1" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": 2 - }, - "segment": [ - { - "id": "segmentId3" - } - ] - } - ] - } + ] }, "user": { "yob": 2000, @@ -59,61 +22,7 @@ "lat": 47.627500, "lon": -122.346200 }, - "gender": "f", - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ] + "gender": "f" }, "imp": [ { @@ -167,53 +76,9 @@ "val1", "val2" ], - "content": { - "data": [ - { - "ext": { - "segtax": 1 - }, - "segment": [ - { - "id": "segmentId1" - }, - { - "id": "segmentId2" - } - ] - }, - { - "ext": { - "segtax": "1" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": 2 - }, - "segment": [ - { - "id": "segmentId3" - } - ] - } - ] - }, "ext": { "rp": { - "site_id": 113932, - "target": { - "iab": [ - "segmentId1", - "segmentId2", - "segmentId3" - ] - } + "site_id": 113932 } }, "publisher": { @@ -225,67 +90,9 @@ } }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "rp": { "target": { - "iab": [ - "idToCopy", - "idToCopy2" - ] } } } @@ -333,7 +140,9 @@ } ] }, - "impIDs":["test-imp-id"] + "impIDs": [ + "test-imp-id" + ] }, "mockResponse": { "status": 200, diff --git a/adapters/rubicon/rubicontest/exemplary/segtax-attributes.json b/adapters/rubicon/rubicontest/exemplary/segtax-attributes.json new file mode 100644 index 00000000000..d75fb48f0a7 --- /dev/null +++ b/adapters/rubicon/rubicontest/exemplary/segtax-attributes.json @@ -0,0 +1,505 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "site": { + "pagecat": [ + "val1", + "val2" + ], + "content": { + "data": [ + { + "ext": { + "segtax": 1 + }, + "segment": [ + { + "id": "segmentId1" + }, + { + "id": "segmentId2" + } + ] + }, + { + "ext": { + "segtax": "1" + }, + "segment": [ + { + "id": "shouldNotBeCopied" + } + ] + }, + { + "ext": { + "segtax": 2 + }, + "segment": [ + { + "id": "segmentId3" + } + ] + }, + { + "ext": { + "segtax": 10 + }, + "segment": [ + { + "id": "segmentId4" + } + ] + } + ] + } + }, + "user": { + "yob": 2000, + "geo": { + "country": "USA", + "lat": 47.627500, + "lon": -122.346200 + }, + "gender": "f", + "data": [ + { + "ext": { + "segtax": 4 + }, + "segment": [ + { + "id": "idToCopy" + } + ] + }, + { + "ext": { + "segtax": "someValue" + }, + "segment": [ + { + "id": "shouldNotBeCopied" + } + ] + }, + { + "ext": { + "segtax": "4" + }, + "segment": [ + { + "id": "shouldNotBeCopied2" + } + ] + }, + { + "ext": { + "segtax": 4 + }, + "segment": [ + { + "id": "idToCopy2" + } + ] + }, + { + "ext": { + "segtax": [ + 4 + ] + }, + "segment": [ + { + "id": "shouldNotBeCopied3" + } + ] + }, + { + "ext": { + "segtax": 2 + }, + "segment": [ + { + "id": "idToCopy3" + } + ] + } + ], + "ext": { + "consent": "consent" + } + }, + "source": { + "ext": { + "schain": { + "complete": 0, + "nodes": [ + { + "asi": "asi", + "sid": "sid" + } + ], + "ver": "1.0" + } + } + }, + "regs": { + "ext": { + "gdpr": 1, + "us_privacy": "us_privacy" + } + }, + "imp": [ + { + "id": "test-imp-id", + "instl": 1, + "banner": { + "w": 1024, + "h": 576 + }, + "ext": { + "data": { + "pbadslot": "pbadslot" + }, + "bidder": { + "accountId": 1001, + "siteId": 113932, + "zoneId": 535510, + "pchain": "pchain" + }, + "skadn": { + "version": "1.0", + "sourceapp": "000", + "skadnetlist": { + "max": 0, + "excl": [ + 1 + ], + "addl": [ + "x.skadnetwork" + ] + } + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "uri?tk_xint=pbs-test-tracker", + "body": { + "id": "test-request-id", + "device": { + "ext": { + "rp": { + "pixelratio": 0 + } + }, + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" + }, + "site": { + "pagecat": [ + "val1", + "val2" + ], + "content": { + "data": [ + { + "ext": { + "segtax": 1 + }, + "segment": [ + { + "id": "segmentId1" + }, + { + "id": "segmentId2" + } + ] + }, + { + "ext": { + "segtax": "1" + }, + "segment": [ + { + "id": "shouldNotBeCopied" + } + ] + }, + { + "ext": { + "segtax": 2 + }, + "segment": [ + { + "id": "segmentId3" + } + ] + }, + { + "ext": { + "segtax": 10 + }, + "segment": [ + { + "id": "segmentId4" + } + ] + } + ] + }, + "ext": { + "rp": { + "site_id": 113932, + "target": { + "iab": [ + "segmentId2", + "segmentId1", + "segmentId3" + ], + "tax10": [ + "segmentId4" + ] + } + } + }, + "publisher": { + "ext": { + "rp": { + "account_id": 1001 + } + } + } + }, + "user": { + "data": [ + { + "ext": { + "segtax": 4 + }, + "segment": [ + { + "id": "idToCopy" + } + ] + }, + { + "ext": { + "segtax": "someValue" + }, + "segment": [ + { + "id": "shouldNotBeCopied" + } + ] + }, + { + "ext": { + "segtax": "4" + }, + "segment": [ + { + "id": "shouldNotBeCopied2" + } + ] + }, + { + "ext": { + "segtax": 4 + }, + "segment": [ + { + "id": "idToCopy2" + } + ] + }, + { + "ext": { + "segtax": [ + 4 + ] + }, + "segment": [ + { + "id": "shouldNotBeCopied3" + } + ] + }, + { + "ext": { + "segtax": 2 + }, + "segment": [ + { + "id": "idToCopy3" + } + ] + } + ], + "ext": { + "consent": "consent", + "rp": { + "target": { + "iab": [ + "idToCopy2", + "idToCopy" + ], + "tax2": [ + "idToCopy3" + ] + } + } + } + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "source": { + "pchain": "pchain", + "ext": { + "schain": { + "complete": 0, + "nodes": [ + { + "asi": "asi", + "sid": "sid" + } + ], + "ver": "1.0" + } + } + }, + "regs": { + "ext": { + "gdpr": 1, + "us_privacy": "us_privacy" + } + }, + "imp": [ + { + "id": "test-imp-id", + "instl": 1, + "secure": 1, + "banner": { + "ext": { + "rp": { + "mime": "text/html" + } + }, + "w": 1024, + "h": 576 + }, + "ext": { + "rp": { + "target": { + "pbadslot": "pbadslot", + "pbs_login": "xuser", + "pbs_url": "http://hosturl.com", + "pbs_version": "", + "pagecat": [ + "val1", + "val2" + ] + }, + "track": { + "mint": "", + "mint_version": "" + }, + "zone_id": 535510 + }, + "skadn": { + "skadnetlist": { + "max": 0, + "excl": [ + 1 + ], + "addl": [ + "x.skadnetwork" + ] + }, + "sourceapp": "000", + "version": "1.0" + } + } + } + ] + }, + "impIDs": [ + "test-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "buyer": "123", + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "some-test-ad", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "ext": { + "prebid": { + "meta": { + "networkId": 123 + }, + "type": "banner" + } + } + } + ], + "seat": "adman" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "some-test-ad", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "ext": { + "prebid": { + "meta": { + "networkId": 123 + }, + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/rubicon/rubicontest/exemplary/simple-banner.json b/adapters/rubicon/rubicontest/exemplary/simple-banner.json index 86663034adb..e1d2c63b78e 100644 --- a/adapters/rubicon/rubicontest/exemplary/simple-banner.json +++ b/adapters/rubicon/rubicontest/exemplary/simple-banner.json @@ -13,44 +13,7 @@ "pagecat": [ "val1", "val2" - ], - "content": { - "data": [ - { - "ext": { - "segtax": 1 - }, - "segment": [ - { - "id": "segmentId1" - }, - { - "id": "segmentId2" - } - ] - }, - { - "ext": { - "segtax": "1" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": 2 - }, - "segment": [ - { - "id": "segmentId3" - } - ] - } - ] - } + ] }, "user": { "yob": 2000, @@ -60,61 +23,7 @@ "lon": -122.346200 }, "gender": "f", - "consent": "consent", - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ] + "consent": "consent" }, "imp": [ { @@ -171,53 +80,9 @@ "val1", "val2" ], - "content": { - "data": [ - { - "ext": { - "segtax": 1 - }, - "segment": [ - { - "id": "segmentId1" - }, - { - "id": "segmentId2" - } - ] - }, - { - "ext": { - "segtax": "1" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": 2 - }, - "segment": [ - { - "id": "segmentId3" - } - ] - } - ] - }, "ext": { "rp": { - "site_id": 113932, - "target": { - "iab": [ - "segmentId1", - "segmentId2", - "segmentId3" - ] - } + "site_id": 113932 } }, "publisher": { @@ -229,68 +94,10 @@ } }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "consent": "consent", "rp": { "target": { - "iab": [ - "idToCopy", - "idToCopy2" - ] } } } diff --git a/adapters/rubicon/rubicontest/exemplary/simple-native.json b/adapters/rubicon/rubicontest/exemplary/simple-native.json index 576faecbee4..34f24d55c8d 100644 --- a/adapters/rubicon/rubicontest/exemplary/simple-native.json +++ b/adapters/rubicon/rubicontest/exemplary/simple-native.json @@ -13,44 +13,7 @@ "pagecat": [ "val1", "val2" - ], - "content": { - "data": [ - { - "ext": { - "segtax": 1 - }, - "segment": [ - { - "id": "segmentId1" - }, - { - "id": "segmentId2" - } - ] - }, - { - "ext": { - "segtax": "1" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": 2 - }, - "segment": [ - { - "id": "segmentId3" - } - ] - } - ] - } + ] }, "user": { "yob": 2000, @@ -59,61 +22,7 @@ "lat": 47.627500, "lon": -122.346200 }, - "gender": "f", - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ] + "gender": "f" }, "imp": [ { @@ -158,53 +67,9 @@ "val1", "val2" ], - "content": { - "data": [ - { - "ext": { - "segtax": 1 - }, - "segment": [ - { - "id": "segmentId1" - }, - { - "id": "segmentId2" - } - ] - }, - { - "ext": { - "segtax": "1" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": 2 - }, - "segment": [ - { - "id": "segmentId3" - } - ] - } - ] - }, "ext": { "rp": { - "site_id": 113932, - "target": { - "iab": [ - "segmentId1", - "segmentId2", - "segmentId3" - ] - } + "site_id": 113932 } }, "publisher": { @@ -216,67 +81,9 @@ } }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "rp": { "target": { - "iab": [ - "idToCopy", - "idToCopy2" - ] } } } diff --git a/adapters/rubicon/rubicontest/exemplary/simple-video.json b/adapters/rubicon/rubicontest/exemplary/simple-video.json index ccdfab1699c..5f5212be2b8 100644 --- a/adapters/rubicon/rubicontest/exemplary/simple-video.json +++ b/adapters/rubicon/rubicontest/exemplary/simple-video.json @@ -13,44 +13,7 @@ "pagecat": [ "val1", "val2" - ], - "content": { - "data": [ - { - "ext": { - "segtax": 1 - }, - "segment": [ - { - "id": "segmentId1" - }, - { - "id": "segmentId2" - } - ] - }, - { - "ext": { - "segtax": "1" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": 2 - }, - "segment": [ - { - "id": "segmentId3" - } - ] - } - ] - } + ] }, "user": { "yob": 2000, @@ -59,61 +22,7 @@ "lat": 47.627500, "lon": -122.346200 }, - "gender": "f", - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ] + "gender": "f" }, "imp": [ { @@ -167,53 +76,9 @@ "val1", "val2" ], - "content": { - "data": [ - { - "ext": { - "segtax": 1 - }, - "segment": [ - { - "id": "segmentId1" - }, - { - "id": "segmentId2" - } - ] - }, - { - "ext": { - "segtax": "1" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": 2 - }, - "segment": [ - { - "id": "segmentId3" - } - ] - } - ] - }, "ext": { "rp": { - "site_id": 113932, - "target": { - "iab": [ - "segmentId1", - "segmentId2", - "segmentId3" - ] - } + "site_id": 113932 } }, "publisher": { @@ -225,67 +90,9 @@ } }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "rp": { "target": { - "iab": [ - "idToCopy", - "idToCopy2" - ] } } } diff --git a/adapters/rubicon/rubicontest/exemplary/site-imp-fpd.json b/adapters/rubicon/rubicontest/exemplary/site-imp-fpd.json index 9a8468ce15a..ab42f481c66 100644 --- a/adapters/rubicon/rubicontest/exemplary/site-imp-fpd.json +++ b/adapters/rubicon/rubicontest/exemplary/site-imp-fpd.json @@ -39,82 +39,6 @@ ], "attr7": 1.23 } - }, - "content": { - "data": [ - { - "ext": { - "segtax": 1 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "2" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 2 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": 5 - }, - "segment": [ - { - "id": "idToCopy3" - } - ] - }, - { - "ext": { - "segtax": 6 - }, - "segment": [ - { - "id": "idToCopy4" - } - ] - }, - { - "ext": { - "segtax": [ - 2 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ] } }, "user": { @@ -124,61 +48,7 @@ "lat": 47.627500, "lon": -122.346200 }, - "gender": "f", - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ] + "gender": "f" }, "imp": [ { @@ -243,93 +113,9 @@ "page": "somePage", "ref": "someRef", "search": "someSearch", - "content": { - "data": [ - { - "ext": { - "segtax": 1 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "2" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 2 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": 5 - }, - "segment": [ - { - "id": "idToCopy3" - } - ] - }, - { - "ext": { - "segtax": 6 - }, - "segment": [ - { - "id": "idToCopy4" - } - ] - }, - { - "ext": { - "segtax": [ - 2 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ] - }, "ext": { "rp": { - "site_id": 113932, - "target": { - "iab": [ - "idToCopy", - "idToCopy2", - "idToCopy3", - "idToCopy4" - ] - } + "site_id": 113932 } }, "publisher": { @@ -341,67 +127,9 @@ } }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "rp": { "target": { - "iab": [ - "idToCopy", - "idToCopy2" - ] } } } diff --git a/adapters/rubicon/rubicontest/exemplary/user-fpd.json b/adapters/rubicon/rubicontest/exemplary/user-fpd.json index a03234d48d4..f685e5581e8 100644 --- a/adapters/rubicon/rubicontest/exemplary/user-fpd.json +++ b/adapters/rubicon/rubicontest/exemplary/user-fpd.json @@ -18,60 +18,6 @@ "lon": -122.346200 }, "gender": "f", - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "keywords": "someKeywords", "ext": { "rp": { @@ -158,60 +104,6 @@ } }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "rp": { "target": { @@ -225,10 +117,6 @@ ], "dataKey3": [ "true" - ], - "iab": [ - "idToCopy", - "idToCopy2" ] } } diff --git a/adapters/rubicon/rubicontest/supplemental/no-site-content-data.json b/adapters/rubicon/rubicontest/supplemental/no-site-content-data.json index b7d8f84287b..a51bfa09097 100644 --- a/adapters/rubicon/rubicontest/supplemental/no-site-content-data.json +++ b/adapters/rubicon/rubicontest/supplemental/no-site-content-data.json @@ -18,60 +18,6 @@ } }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ] }, "imp": [ { @@ -137,67 +83,9 @@ } }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "rp": { "target": { - "iab": [ - "idToCopy", - "idToCopy2" - ] } } } diff --git a/adapters/rubicon/rubicontest/supplemental/no-site-content.json b/adapters/rubicon/rubicontest/supplemental/no-site-content.json index bcdd9acb9a2..b4f143978e1 100644 --- a/adapters/rubicon/rubicontest/supplemental/no-site-content.json +++ b/adapters/rubicon/rubicontest/supplemental/no-site-content.json @@ -16,60 +16,6 @@ ] }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ] }, "imp": [ { @@ -133,67 +79,9 @@ } }, "user": { - "data": [ - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy" - } - ] - }, - { - "ext": { - "segtax": "someValue" - }, - "segment": [ - { - "id": "shouldNotBeCopied" - } - ] - }, - { - "ext": { - "segtax": "4" - }, - "segment": [ - { - "id": "shouldNotBeCopied2" - } - ] - }, - { - "ext": { - "segtax": 4 - }, - "segment": [ - { - "id": "idToCopy2" - } - ] - }, - { - "ext": { - "segtax": [ - 4 - ] - }, - "segment": [ - { - "id": "shouldNotBeCopied3" - } - ] - } - ], "ext": { "rp": { "target": { - "iab": [ - "idToCopy", - "idToCopy2" - ] } } } diff --git a/go.mod b/go.mod index bb69f854fd7..f5d9ee84483 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,7 @@ require ( github.com/docker/go-units v0.4.0 github.com/go-sql-driver/mysql v1.6.0 github.com/gofrs/uuid v4.2.0+incompatible + github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 github.com/golang/glog v1.1.0 github.com/google/go-cmp v0.6.0 github.com/json-iterator/go v1.1.12 diff --git a/go.sum b/go.sum index d176e89dda9..c7977cb07ed 100644 --- a/go.sum +++ b/go.sum @@ -164,6 +164,8 @@ github.com/gofrs/uuid v4.2.0+incompatible h1:yyYWMnhkhrKwwr8gAOcOCYxOOscHgDS9yZg github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 h1:zN2lZNZRflqFyxVaTIU61KNKQ9C0055u9CAfpmqUvo4= +github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3/go.mod h1:nPpo7qLxd6XL3hWJG/O60sR8ZKfMCiIoNap5GvD12KU= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= From 950b76f678adc19663919c44f0d42a5ae6179d69 Mon Sep 17 00:00:00 2001 From: Tommy Pettersen <42890605+TommyHPettersen@users.noreply.github.com> Date: Wed, 8 Jan 2025 18:59:27 +0100 Subject: [PATCH 3/5] New Adapter: Kobler (#3904) Co-authored-by: acsbendi --- adapters/kobler/kobler.go | 159 ++++++++++++++++++ adapters/kobler/kobler_test.go | 20 +++ .../koblertest/exemplary/simple_banner.json | 120 +++++++++++++ .../convert-currency-invalid-currency.json | 51 ++++++ .../supplemental/convert-currency.json | 148 ++++++++++++++++ .../correct-endpoint-when-testing.json | 130 ++++++++++++++ .../supplemental/no-bid-media-type.json | 110 ++++++++++++ .../supplemental/no-response-body.json | 69 ++++++++ .../koblertest/supplemental/status-204.json | 70 ++++++++ .../koblertest/supplemental/status-404.json | 75 +++++++++ .../wrong-response-body-type.json | 75 +++++++++ adapters/kobler/params_test.go | 51 ++++++ exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_kobler.go | 5 + static/bidder-info/kobler.yaml | 12 ++ static/bidder-params/kobler.json | 13 ++ 17 files changed, 1112 insertions(+) create mode 100644 adapters/kobler/kobler.go create mode 100644 adapters/kobler/kobler_test.go create mode 100644 adapters/kobler/koblertest/exemplary/simple_banner.json create mode 100644 adapters/kobler/koblertest/supplemental/convert-currency-invalid-currency.json create mode 100644 adapters/kobler/koblertest/supplemental/convert-currency.json create mode 100644 adapters/kobler/koblertest/supplemental/correct-endpoint-when-testing.json create mode 100644 adapters/kobler/koblertest/supplemental/no-bid-media-type.json create mode 100644 adapters/kobler/koblertest/supplemental/no-response-body.json create mode 100644 adapters/kobler/koblertest/supplemental/status-204.json create mode 100644 adapters/kobler/koblertest/supplemental/status-404.json create mode 100644 adapters/kobler/koblertest/supplemental/wrong-response-body-type.json create mode 100644 adapters/kobler/params_test.go create mode 100644 openrtb_ext/imp_kobler.go create mode 100644 static/bidder-info/kobler.yaml create mode 100644 static/bidder-params/kobler.json diff --git a/adapters/kobler/kobler.go b/adapters/kobler/kobler.go new file mode 100644 index 00000000000..0a501eca46a --- /dev/null +++ b/adapters/kobler/kobler.go @@ -0,0 +1,159 @@ +package kobler + +import ( + "fmt" + "net/http" + "slices" + "strings" + + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/prebid-server/v3/adapters" + "github.com/prebid/prebid-server/v3/config" + "github.com/prebid/prebid-server/v3/errortypes" + "github.com/prebid/prebid-server/v3/openrtb_ext" + "github.com/prebid/prebid-server/v3/util/jsonutil" +) + +type adapter struct { + endpoint string + devEndpoint string +} + +const ( + devBidderEndpoint = "https://bid-service.dev.essrtb.com/bid/prebid_server_rtb_call" + supportedCurrency = "USD" +) + +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { + bidder := &adapter{ + endpoint: config.Endpoint, + devEndpoint: devBidderEndpoint, + } + + return bidder, nil +} + +func (a adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var requestData []*adapters.RequestData + var errors []error + + testMode := false + + if !slices.Contains(request.Cur, supportedCurrency) { + request.Cur = append(request.Cur, supportedCurrency) + } + + for i := range request.Imp { + if err := convertImpCurrency(&request.Imp[i], reqInfo); err != nil { + errors = append(errors, err) + return nil, errors + } + + // Check the first Imp for test mode, which decides the endpoint. + if i == 0 && request.Imp[i].Ext != nil { + var bidderExt adapters.ExtImpBidder + if err := jsonutil.Unmarshal(request.Imp[i].Ext, &bidderExt); err != nil { + errors = append(errors, &errortypes.BadInput{ + Message: "Error parsing bidderExt object", + }) + continue + } + + var impExt openrtb_ext.ExtImpKobler + if err := jsonutil.Unmarshal(bidderExt.Bidder, &impExt); err != nil { + errors = append(errors, &errortypes.BadInput{ + Message: "Error parsing impExt object", + }) + continue + } + + testMode = impExt.Test + } + } + + requestJSON, err := jsonutil.Marshal(request) + if err != nil { + errors = append(errors, err) + return nil, errors + } + + // Use a separate endpoint for testing purposes in the DEV environment. + // Required due to Kobler's internal test campaign setup. + endpoint := a.endpoint + if testMode { + endpoint = a.devEndpoint + } + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + + requestData = append(requestData, &adapters.RequestData{ + Method: "POST", + Uri: endpoint, + Body: requestJSON, + ImpIDs: openrtb_ext.GetImpIDs(request.Imp), + Headers: headers, + }) + + return requestData, nil +} + +func (a adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if responseData.StatusCode == http.StatusNoContent || responseData.Body == nil { + return nil, nil + } + + if responseData.StatusCode != http.StatusOK { + return nil, []error{&errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info.", responseData.StatusCode), + }} + } + + var response openrtb2.BidResponse + if err := jsonutil.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + bidResponse.Currency = response.Cur + + for _, seatBid := range response.SeatBid { + for i, bid := range seatBid.Bid { + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &seatBid.Bid[i], + BidType: getMediaTypeForBid(bid), + }) + } + } + + return bidResponse, nil +} + +func getMediaTypeForBid(bid openrtb2.Bid) openrtb_ext.BidType { + if bid.Ext != nil { + var bidExt openrtb_ext.ExtBid + err := jsonutil.Unmarshal(bid.Ext, &bidExt) + if err == nil && bidExt.Prebid != nil { + mediaType, err := openrtb_ext.ParseBidType(string(bidExt.Prebid.Type)) + if err == nil { + return mediaType + } + } + } + + return openrtb_ext.BidTypeBanner +} + +func convertImpCurrency(imp *openrtb2.Imp, reqInfo *adapters.ExtraRequestInfo) error { + if imp.BidFloor > 0 && imp.BidFloorCur != "" && strings.ToUpper(imp.BidFloorCur) != supportedCurrency { + convertedValue, err := reqInfo.ConvertCurrency(imp.BidFloor, imp.BidFloorCur, supportedCurrency) + if err != nil { + return err + } + + imp.BidFloor = convertedValue + imp.BidFloorCur = supportedCurrency + } + + return nil +} diff --git a/adapters/kobler/kobler_test.go b/adapters/kobler/kobler_test.go new file mode 100644 index 00000000000..0cd924b8ba5 --- /dev/null +++ b/adapters/kobler/kobler_test.go @@ -0,0 +1,20 @@ +package kobler + +import ( + "testing" + + "github.com/prebid/prebid-server/v3/adapters/adapterstest" + "github.com/prebid/prebid-server/v3/config" + "github.com/prebid/prebid-server/v3/openrtb_ext" +) + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderKargo, config.Adapter{ + Endpoint: "http://fake.endpoint"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "koblertest", bidder) +} diff --git a/adapters/kobler/koblertest/exemplary/simple_banner.json b/adapters/kobler/koblertest/exemplary/simple_banner.json new file mode 100644 index 00000000000..cd3ca2a4084 --- /dev/null +++ b/adapters/kobler/koblertest/exemplary/simple_banner.json @@ -0,0 +1,120 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://fake.endpoint", + "body": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ], + "cur": ["USD"] + }, + "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": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "kobler" + } + ], + "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", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/kobler/koblertest/supplemental/convert-currency-invalid-currency.json b/adapters/kobler/koblertest/supplemental/convert-currency-invalid-currency.json new file mode 100644 index 00000000000..d6cca2ed00d --- /dev/null +++ b/adapters/kobler/koblertest/supplemental/convert-currency-invalid-currency.json @@ -0,0 +1,51 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "bidfloor": 1, + "bidfloorcur": "GBP", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 1.11 + } + }, + "usepbsrates": false + } + } + } + }, + "httpCalls": [], + "expectedBidResponses": [], + "expectedMakeRequestsErrors": [ + { + "value": "Currency conversion rate not found: 'GBP' => 'USD'", + "comparison": "literal" + } + ] +} diff --git a/adapters/kobler/koblertest/supplemental/convert-currency.json b/adapters/kobler/koblertest/supplemental/convert-currency.json new file mode 100644 index 00000000000..90561d75dcd --- /dev/null +++ b/adapters/kobler/koblertest/supplemental/convert-currency.json @@ -0,0 +1,148 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "bidfloor": 1, + "bidfloorcur": "EUR", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 1.11 + } + }, + "usepbsrates": false + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://fake.endpoint", + "body": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "bidfloor": 1.11, + "bidfloorcur": "USD", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 1.11 + } + }, + "usepbsrates": false + } + } + }, + "cur": ["USD"] + }, + "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": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "kobler" + } + ], + "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", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/kobler/koblertest/supplemental/correct-endpoint-when-testing.json b/adapters/kobler/koblertest/supplemental/correct-endpoint-when-testing.json new file mode 100644 index 00000000000..53c546d86fa --- /dev/null +++ b/adapters/kobler/koblertest/supplemental/correct-endpoint-when-testing.json @@ -0,0 +1,130 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + }, + "ext": { + "bidder": { + "test": true + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bid-service.dev.essrtb.com/bid/prebid_server_rtb_call", + "body": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + }, + "ext": { + "bidder": { + "test": true + } + } + } + ], + "cur": ["USD"] + }, + "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": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "kobler" + } + ], + "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", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/kobler/koblertest/supplemental/no-bid-media-type.json b/adapters/kobler/koblertest/supplemental/no-bid-media-type.json new file mode 100644 index 00000000000..588345f66a1 --- /dev/null +++ b/adapters/kobler/koblertest/supplemental/no-bid-media-type.json @@ -0,0 +1,110 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://fake.endpoint", + "body": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ], + "cur": ["USD"] + }, + "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 + } + ], + "seat": "kobler" + } + ], + "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", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/kobler/koblertest/supplemental/no-response-body.json b/adapters/kobler/koblertest/supplemental/no-response-body.json new file mode 100644 index 00000000000..b6d2b4dda2b --- /dev/null +++ b/adapters/kobler/koblertest/supplemental/no-response-body.json @@ -0,0 +1,69 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://fake.endpoint", + "body": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ], + "cur": ["USD"] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200 + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/kobler/koblertest/supplemental/status-204.json b/adapters/kobler/koblertest/supplemental/status-204.json new file mode 100644 index 00000000000..3b26c69c14e --- /dev/null +++ b/adapters/kobler/koblertest/supplemental/status-204.json @@ -0,0 +1,70 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://fake.endpoint", + "body": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ], + "cur": ["USD"] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/kobler/koblertest/supplemental/status-404.json b/adapters/kobler/koblertest/supplemental/status-404.json new file mode 100644 index 00000000000..85d5db94ea7 --- /dev/null +++ b/adapters/kobler/koblertest/supplemental/status-404.json @@ -0,0 +1,75 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://fake.endpoint", + "body": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ], + "cur": ["USD"] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 404, + "body": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 404. Run with request.debug = 1 for more info.", + "comparison": "literal" + } + ] +} diff --git a/adapters/kobler/koblertest/supplemental/wrong-response-body-type.json b/adapters/kobler/koblertest/supplemental/wrong-response-body-type.json new file mode 100644 index 00000000000..84e4741162b --- /dev/null +++ b/adapters/kobler/koblertest/supplemental/wrong-response-body-type.json @@ -0,0 +1,75 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://fake.endpoint", + "body": { + "id": "test-request-id", + "device": { + "devicetype": 2 + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 320, + "h": 100 + } + ] + } + } + ], + "cur": ["USD"] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": "" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "expect { or n, but found \"", + "comparison": "literal" + } + ] +} diff --git a/adapters/kobler/params_test.go b/adapters/kobler/params_test.go new file mode 100644 index 00000000000..bc8b3ec9bf7 --- /dev/null +++ b/adapters/kobler/params_test.go @@ -0,0 +1,51 @@ +package kobler + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v3/openrtb_ext" +) + +var validParams = []string{ + `{}`, + `{ "test": true }`, + `{ "test": false }`, +} + +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.BidderKobler, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected Kobler params: %s", validParam) + } + } +} + +var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{ "key": 2 }`, + `{ "anyparam": "anyvalue" }`, +} + +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.BidderKrushmedia, 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 d1d6a87fb29..477adddc5c2 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -121,6 +121,7 @@ import ( "github.com/prebid/prebid-server/v3/adapters/kayzen" "github.com/prebid/prebid-server/v3/adapters/kidoz" "github.com/prebid/prebid-server/v3/adapters/kiviads" + "github.com/prebid/prebid-server/v3/adapters/kobler" "github.com/prebid/prebid-server/v3/adapters/krushmedia" "github.com/prebid/prebid-server/v3/adapters/lemmadigital" "github.com/prebid/prebid-server/v3/adapters/limelightDigital" @@ -355,6 +356,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderKidoz: kidoz.Builder, openrtb_ext.BidderKiviads: kiviads.Builder, openrtb_ext.BidderLmKiviads: lmkiviads.Builder, + openrtb_ext.BidderKobler: kobler.Builder, openrtb_ext.BidderKrushmedia: krushmedia.Builder, openrtb_ext.BidderLemmadigital: lemmadigital.Builder, openrtb_ext.BidderVungle: vungle.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 3f6b0a67037..c0444950f1e 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -139,6 +139,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderKidoz, BidderKiviads, BidderLmKiviads, + BidderKobler, BidderKrushmedia, BidderLemmadigital, BidderLimelightDigital, @@ -478,6 +479,7 @@ const ( BidderKidoz BidderName = "kidoz" BidderKiviads BidderName = "kiviads" BidderLmKiviads BidderName = "lm_kiviads" + BidderKobler BidderName = "kobler" BidderKrushmedia BidderName = "krushmedia" BidderLemmadigital BidderName = "lemmadigital" BidderLimelightDigital BidderName = "limelightDigital" diff --git a/openrtb_ext/imp_kobler.go b/openrtb_ext/imp_kobler.go new file mode 100644 index 00000000000..2ebce9d9966 --- /dev/null +++ b/openrtb_ext/imp_kobler.go @@ -0,0 +1,5 @@ +package openrtb_ext + +type ExtImpKobler struct { + Test bool `json:"test"` +} diff --git a/static/bidder-info/kobler.yaml b/static/bidder-info/kobler.yaml new file mode 100644 index 00000000000..8429aaa4bb2 --- /dev/null +++ b/static/bidder-info/kobler.yaml @@ -0,0 +1,12 @@ +endpoint: "https://bid.essrtb.com/bid/prebid_server_rtb_call" +endpointCompression: gzip +maintainer: + email: bidding-support@kobler.no +geoscope: + - NOR + - SWE + - DNK +capabilities: + site: + mediaTypes: + - banner diff --git a/static/bidder-params/kobler.json b/static/bidder-params/kobler.json new file mode 100644 index 00000000000..7e85601bfe8 --- /dev/null +++ b/static/bidder-params/kobler.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Kobler Adapter Params", + "description": "A schema which validates params accepted by the Kobler adapter", + "type": "object", + + "properties": { + "test": { + "type": "boolean", + "description": "Whether the request is for testing only. When multiple ad units are submitted together, it is enough to set this parameter on the first one." + } + } +} From 02048f2062c539a94b7123c470ea917d33ec4147 Mon Sep 17 00:00:00 2001 From: Brian Sardo <1168933+bsardo@users.noreply.github.com> Date: Thu, 9 Jan 2025 10:12:00 -0500 Subject: [PATCH 4/5] Fix: Rubicon segtax test (#4143) --- .../rubicon/rubicontest/exemplary/segtax-attributes.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/adapters/rubicon/rubicontest/exemplary/segtax-attributes.json b/adapters/rubicon/rubicontest/exemplary/segtax-attributes.json index d75fb48f0a7..526e02c52a1 100644 --- a/adapters/rubicon/rubicontest/exemplary/segtax-attributes.json +++ b/adapters/rubicon/rubicontest/exemplary/segtax-attributes.json @@ -408,11 +408,7 @@ "pbadslot": "pbadslot", "pbs_login": "xuser", "pbs_url": "http://hosturl.com", - "pbs_version": "", - "pagecat": [ - "val1", - "val2" - ] + "pbs_version": "" }, "track": { "mint": "", From 320d8e9f725995916382a049a9591f1648aa14f8 Mon Sep 17 00:00:00 2001 From: mefjush Date: Thu, 9 Jan 2025 21:19:00 +0100 Subject: [PATCH 5/5] Adhese: Switch to openrtb2 endpoint (#3864) Co-authored-by: skonky --- adapters/adhese/adhese.go | 336 +++++++----------- adapters/adhese/adhese_test.go | 56 ++- .../adhesetest/exemplary/banner-internal.json | 107 ------ .../adhesetest/exemplary/banner-market.json | 153 ++++---- .../exemplary/banner-video-internal.json | 104 ------ .../adhese/adhesetest/exemplary/banner.json | 144 ++++++++ .../adhese/adhesetest/exemplary/video.json | 179 ++++++---- .../req-invalid-empty-imp-ext.json | 38 -- .../supplemental/req-invalid-empty-imp.json | 25 -- .../supplemental/req-invalid-no-imp-ext.json | 37 -- .../supplemental/res-invalid-height.json | 92 ----- .../supplemental/res-invalid-no-body.json | 139 +++++--- .../supplemental/res-invalid-no-origin.json | 81 ----- .../supplemental/res-invalid-price.json | 92 ----- .../res-invalid-status-not-ok.json | 142 +++++--- .../supplemental/res-invalid-width.json | 92 ----- .../supplemental/res-no_bids_200.json | 55 --- .../supplemental/res-no_bids_204.json | 55 --- .../res-no_impression_counter.json | 104 ------ adapters/adhese/utils.go | 45 --- openrtb_ext/imp_adhese.go | 12 +- static/bidder-info/adhese.yaml | 2 +- static/bidder-params/adhese.json | 48 +-- 23 files changed, 727 insertions(+), 1411 deletions(-) delete mode 100644 adapters/adhese/adhesetest/exemplary/banner-internal.json delete mode 100644 adapters/adhese/adhesetest/exemplary/banner-video-internal.json create mode 100644 adapters/adhese/adhesetest/exemplary/banner.json delete mode 100644 adapters/adhese/adhesetest/supplemental/req-invalid-empty-imp-ext.json delete mode 100644 adapters/adhese/adhesetest/supplemental/req-invalid-empty-imp.json delete mode 100644 adapters/adhese/adhesetest/supplemental/req-invalid-no-imp-ext.json delete mode 100644 adapters/adhese/adhesetest/supplemental/res-invalid-height.json delete mode 100644 adapters/adhese/adhesetest/supplemental/res-invalid-no-origin.json delete mode 100644 adapters/adhese/adhesetest/supplemental/res-invalid-price.json delete mode 100644 adapters/adhese/adhesetest/supplemental/res-invalid-width.json delete mode 100644 adapters/adhese/adhesetest/supplemental/res-no_bids_200.json delete mode 100644 adapters/adhese/adhesetest/supplemental/res-no_bids_204.json delete mode 100644 adapters/adhese/adhesetest/supplemental/res-no_impression_counter.json delete mode 100644 adapters/adhese/utils.go diff --git a/adapters/adhese/adhese.go b/adapters/adhese/adhese.go index 181cc661e46..9440a1f580e 100644 --- a/adapters/adhese/adhese.go +++ b/adapters/adhese/adhese.go @@ -1,13 +1,7 @@ package adhese import ( - "encoding/json" "fmt" - "net/http" - "net/url" - "sort" - "strconv" - "strings" "text/template" "github.com/prebid/openrtb/v20/openrtb2" @@ -19,267 +13,187 @@ import ( "github.com/prebid/prebid-server/v3/util/jsonutil" ) -type AdheseAdapter struct { +type adapter struct { endpointTemplate *template.Template } -func extractSlotParameter(parameters openrtb_ext.ExtImpAdhese) string { - return fmt.Sprintf("/sl%s-%s", url.PathEscape(parameters.Location), url.PathEscape(parameters.Format)) -} - -func extractTargetParameters(parameters openrtb_ext.ExtImpAdhese) string { - if len(parameters.Keywords) == 0 { - return "" - } - var parametersAsString = "" - var targetParsed map[string]interface{} - err := jsonutil.Unmarshal(parameters.Keywords, &targetParsed) - if err != nil { - return "" - } - - targetKeys := make([]string, 0, len(targetParsed)) - for key := range targetParsed { - targetKeys = append(targetKeys, key) - } - sort.Strings(targetKeys) - - for _, targetKey := range targetKeys { - var targetingValues = targetParsed[targetKey].([]interface{}) - parametersAsString += "/" + url.PathEscape(targetKey) - for _, targetRawValKey := range targetingValues { - var targetValueParsed = targetRawValKey.(string) - parametersAsString += targetValueParsed + ";" - } - parametersAsString = strings.TrimRight(parametersAsString, ";") - } - - return parametersAsString -} - -func extractGdprParameter(request *openrtb2.BidRequest) string { - if request.User != nil { - var extUser openrtb_ext.ExtUser - if err := jsonutil.Unmarshal(request.User.Ext, &extUser); err == nil { - return "/xt" + extUser.Consent - } - } - return "" -} - -func extractRefererParameter(request *openrtb2.BidRequest) string { - if request.Site != nil && request.Site.Page != "" { - return "/xf" + url.QueryEscape(request.Site.Page) - } - return "" -} +type extTargetsAdhese map[string][]string +type extImpAdheseWrapper map[string]extTargetsAdhese +type wrappedBidExt map[string]map[string]string -func extractIfaParameter(request *openrtb2.BidRequest) string { - if request.Device != nil && request.Device.IFA != "" { - return "/xz" + url.QueryEscape(request.Device.IFA) - } - return "" +func makeSlot(params openrtb_ext.ExtImpAdhese) string { + return fmt.Sprintf("%s-%s", params.Location, params.Format) } -func (a *AdheseAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - errs := make([]error, 0, len(request.Imp)) +func (a *adapter) MakeRequests( + request *openrtb2.BidRequest, + requestInfo *adapters.ExtraRequestInfo, +) ( + []*adapters.RequestData, + []error, +) { - var err error + imp := &request.Imp[0] - // If all the requests are invalid, Call to adaptor is skipped - if len(request.Imp) == 0 { - errs = append(errs, WrapReqError("Imp is empty")) - return nil, errs - } - - var imp = &request.Imp[0] var bidderExt adapters.ExtImpBidder - if err := jsonutil.Unmarshal(imp.Ext, &bidderExt); err != nil { - errs = append(errs, WrapReqError("Request could not be parsed as ExtImpBidder due to: "+err.Error())) - return nil, errs + return nil, []error{&errortypes.BadInput{Message: fmt.Sprintf("Error unmarshalling imp.ext: %v", err)}} } var params openrtb_ext.ExtImpAdhese if err := jsonutil.Unmarshal(bidderExt.Bidder, ¶ms); err != nil { - errs = append(errs, WrapReqError("Request could not be parsed as ExtImpAdhese due to: "+err.Error())) - return nil, errs + return nil, []error{&errortypes.BadInput{Message: fmt.Sprintf("Error unmarshalling bidder ext: %v", err)}} } - // Compose url - endpointParams := macros.EndpointTemplateParams{AccountID: params.Account} + // define a map of targets[] and pre-fill it with the slot + targets := extTargetsAdhese{ + "SL": []string{makeSlot(params)}, + } + // add any additional targets to the map from the params + for k, v := range params.Targets { + targets[k] = v + } - host, err := macros.ResolveMacros(a.endpointTemplate, endpointParams) + // marshal the ext.adhese.bidder object into the ext field + modifiedExt, err := jsonutil.Marshal(extImpAdheseWrapper{ + "adhese": targets, + }) if err != nil { - errs = append(errs, WrapReqError("Could not compose url from template and request account val: "+err.Error())) - return nil, errs + return nil, []error{&errortypes.BadInput{Message: fmt.Sprintf("Error marshalling modified ext: %v", err)}} } - complete_url := fmt.Sprintf("%s%s%s%s%s%s", - host, - extractSlotParameter(params), - extractTargetParameters(params), - extractGdprParameter(request), - extractRefererParameter(request), - extractIfaParameter(request)) - - return []*adapters.RequestData{{ - Method: "GET", - Uri: complete_url, - ImpIDs: []string{imp.ID}, - }}, errs -} -func (a *AdheseAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { - if response.StatusCode == http.StatusNoContent { - return nil, nil - } else if response.StatusCode != http.StatusOK { - return nil, []error{WrapServerError(fmt.Sprintf("Unexpected status code: %d.", response.StatusCode))} - } + // copy the request and dereference any pointers* and override the ext of the + modifiedRequest := *request + modifiedRequest.Imp[0].Ext = modifiedExt - var bidResponse openrtb2.BidResponse + // create a map of macros to resolve + endpointParams := macros.EndpointTemplateParams{AccountID: params.Account} - var adheseBidResponseArray []AdheseBid - if err := jsonutil.Unmarshal(response.Body, &adheseBidResponseArray); err != nil { - return nil, []error{err, WrapServerError(fmt.Sprintf("Response %v could not be parsed as generic Adhese bid.", string(response.Body)))} + // resolve the macros in the endpoint template + endpoint, err := macros.ResolveMacros(a.endpointTemplate, endpointParams) + if err != nil { + return nil, []error{&errortypes.BadServerResponse{Message: fmt.Sprintf("Error resolving macros: %v", err)}} } - if len(adheseBidResponseArray) == 0 { - return nil, nil + // marshal the request body + requestJSON, err := jsonutil.Marshal(modifiedRequest) + + if err != nil { + return nil, []error{err} } - var adheseBid = adheseBidResponseArray[0] - - if adheseBid.Origin == "JERLICIA" { - var extArray []AdheseExt - var originDataArray []AdheseOriginData - if err := jsonutil.Unmarshal(response.Body, &extArray); err != nil { - return nil, []error{err, WrapServerError(fmt.Sprintf("Response %v could not be parsed to JERLICIA ext.", string(response.Body)))} - } - - if err := jsonutil.Unmarshal(response.Body, &originDataArray); err != nil { - return nil, []error{err, WrapServerError(fmt.Sprintf("Response %v could not be parsed to JERLICIA origin data.", string(response.Body)))} - } - bidResponse = convertAdheseBid(adheseBid, extArray[0], originDataArray[0]) - } else { - bidResponse = convertAdheseOpenRtbBid(adheseBid) + var firstImIpd = openrtb_ext.GetImpIDs(request.Imp)[0] + requestData := &adapters.RequestData{ + Method: "POST", + Uri: endpoint, + Body: requestJSON, + ImpIDs: []string{firstImIpd}, } - price, err := strconv.ParseFloat(adheseBid.Extension.Prebid.Cpm.Amount, 64) - if err != nil { - return nil, []error{err, WrapServerError(fmt.Sprintf("Could not parse Price %v as float ", string(adheseBid.Extension.Prebid.Cpm.Amount)))} + return []*adapters.RequestData{requestData}, nil +} + +func inferBidTypeFromImp(i openrtb2.Imp) (openrtb_ext.BidType, []error) { + var mediaTypes []openrtb_ext.BidType + + if i.Banner != nil { + mediaTypes = append(mediaTypes, openrtb_ext.BidTypeBanner) } - width, err := strconv.ParseInt(adheseBid.Width, 10, 64) - if err != nil { - return nil, []error{err, WrapServerError(fmt.Sprintf("Could not parse Width %v as int ", string(adheseBid.Width)))} + if i.Video != nil { + mediaTypes = append(mediaTypes, openrtb_ext.BidTypeVideo) } - height, err := strconv.ParseInt(adheseBid.Height, 10, 64) - if err != nil { - return nil, []error{err, WrapServerError(fmt.Sprintf("Could not parse Height %v as int ", string(adheseBid.Height)))} + if i.Native != nil { + mediaTypes = append(mediaTypes, openrtb_ext.BidTypeNative) } - bidResponse.Cur = adheseBid.Extension.Prebid.Cpm.Currency - if len(bidResponse.SeatBid) > 0 && len(bidResponse.SeatBid[0].Bid) > 0 { - bidResponse.SeatBid[0].Bid[0].Price = price - bidResponse.SeatBid[0].Bid[0].W = width - bidResponse.SeatBid[0].Bid[0].H = height + if i.Audio != nil { + mediaTypes = append(mediaTypes, openrtb_ext.BidTypeAudio) } - bidderResponse := adapters.NewBidderResponseWithBidsCapacity(5) - - if len(bidResponse.SeatBid) == 0 { - return nil, []error{WrapServerError("Response resulted in an empty seatBid array.")} + if len(mediaTypes) == 1 { + // If there's only one media type, return it. + return mediaTypes[0], nil + } else if len(mediaTypes) > 1 { + // Multi-format case: Log or return an error indicating multiple media types. + return "", []error{&errortypes.BadServerResponse{Message: "Multiple media types detected, cannot infer"}} } - var errs []error - for _, sb := range bidResponse.SeatBid { - for i := 0; i < len(sb.Bid); i++ { - bid := sb.Bid[i] - bidderResponse.Bids = append(bidderResponse.Bids, &adapters.TypedBid{ - Bid: &bid, - BidType: getBidType(bid.AdM), - }) - - } - } - return bidderResponse, errs + // If no media type was found + return "", []error{&errortypes.BadServerResponse{Message: "Could not infer bid type from imp"}} } -func convertAdheseBid(adheseBid AdheseBid, adheseExt AdheseExt, adheseOriginData AdheseOriginData) openrtb2.BidResponse { - adheseExtJson, err := json.Marshal(adheseOriginData) +func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + err := adapters.CheckResponseStatusCodeForErrors(responseData) if err != nil { - adheseExtJson = make([]byte, 0) + return nil, []error{err} + } + + noContent := adapters.IsResponseStatusCodeNoContent(responseData) + if noContent { + return nil, nil } - return openrtb2.BidResponse{ - ID: adheseExt.Id, - SeatBid: []openrtb2.SeatBid{{ - Bid: []openrtb2.Bid{{ - DealID: adheseExt.OrderId, - CrID: adheseExt.Id, - AdM: getAdMarkup(adheseBid, adheseExt), - Ext: adheseExtJson, - }}, - Seat: "", - }}, + + var response openrtb2.BidResponse + if err := jsonutil.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{&errortypes.BadServerResponse{Message: "Empty body"}} } -} -func convertAdheseOpenRtbBid(adheseBid AdheseBid) openrtb2.BidResponse { - var response openrtb2.BidResponse = adheseBid.OriginData - if len(response.SeatBid) > 0 && len(response.SeatBid[0].Bid) > 0 { - response.SeatBid[0].Bid[0].AdM = adheseBid.Body + if (len(response.SeatBid)) == 0 { + return nil, []error{&errortypes.BadServerResponse{ + Message: "Empty SeatBid", + }} } - return response -} -func getAdMarkup(adheseBid AdheseBid, adheseExt AdheseExt) string { - if adheseExt.Ext == "js" { - if ContainsAny(adheseBid.Body, []string{" 0 { - counter = "" - } - return adheseBid.Body + counter - } - if ContainsAny(adheseBid.Body, []string{"", - "tracker": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "impressionCounter": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "extension": { - "prebid": { - "cpm": { - "amount": "1", - "currency": "USD" - } - } - } - }] - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "adm": "
", - "w": 728, - "h": 90, - "id": "", - "impid": "", - "price": 1.000000, - "dealid": "888", - "crid": "60613369", - "ext": { - "adFormat": "", - "adType": "leaderboard", - "adspaceId": "", - "libId": "", - "orderProperty": "", - "priority": "", - "viewableImpressionCounter": "" - } - }, - "type": "banner" - } - ] - } - ] -} \ No newline at end of file diff --git a/adapters/adhese/adhesetest/exemplary/banner-market.json b/adapters/adhese/adhesetest/exemplary/banner-market.json index 97240c67fda..6e8b0286d43 100644 --- a/adapters/adhese/adhesetest/exemplary/banner-market.json +++ b/adapters/adhese/adhesetest/exemplary/banner-market.json @@ -1,29 +1,30 @@ { "mockBidRequest": { "id": "test-req", + "user": { + "ext": { + "consent": "dummy" + } + }, "imp": [ { "id": "test-req", "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] + "w": 300, + "h": 250 }, "ext": { "bidder": { + "location": "pbs_test", + "format": "pbs_mr", "account": "market", - "location": "_adhese_prebid_demo_", - "format": "leaderboard", - "targets": - { + "targets": { "ci": ["gent", "brussels"], "ag": ["55"], "tl": ["all"] } - } + }, + "tid": "6811e2a1-3649-4e54-ba03-c9b1401ae728" } } ], @@ -31,71 +32,99 @@ "id": "test", "publisher": { "id": "123" - }, - "page": "dummy" + } } }, "httpCalls": [ { "expectedRequest": { - "uri": "https://ads-market.adhese.com/json/sl_adhese_prebid_demo_-leaderboard/ag55/cigent;brussels/tlall/xfdummy", - "impIDs":["test-req"] + "uri": "https://market.foo.bar/", + "impIDs": ["test-req"], + "body": { + "id": "test-req", + "imp": [ + { + "banner": { + "h": 250, + "w": 300 + }, + "ext": { + "adhese": { + "SL": ["pbs_test-pbs_mr"], + "ag": ["55"], + "ci": ["gent", "brussels"], + "tl": ["all"] + } + }, + "id": "test-req" + } + ], + "site": { + "id": "test", + "publisher": { + "id": "123" + } + }, + "user": { + "ext": { + "consent": "dummy" + } + } + } }, "mockResponse": { "status": 200, - "body": [{ - "origin": "APPNEXUS", - "originInstance": "", - "ext": "js", - "slotName": "_main_page_-leaderboard", - "adType": "leaderboard", - "originData": { - "seatbid": [ - { - "bid": [ - { - "crid": "60613369", - "dealid": null - } - ], - "seat": "958" - } - ] - }, - "width": "728", - "height": "90", - "body": "
", - "tracker": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "impressionCounter": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "extension": { - "prebid": { - "cpm": { - "amount": "1", - "currency": "USD" - } + "body": { + "id": "test-req", + "seatbid": [ + { + "bid": [ + { + "price": 1.087, + "adm": "\\\"\\\"/\\\"
\\\"\\\"
", + "w": 300, + "h": 250, + "crid": "demo-475", + "dealid": "demo-234", + "ext": { + "adhese": { + "adType": "leaderboard", + "adFormat": "superadformat" + } + }, + "id": "a5ec99e8-aa6b-42f4-bf8b-b68dabf96caf", + "impid": "imp_id" + } + ] } - } - }] + ], + "cur": "USD" + } } } ], "expectedBidResponses": [ { "currency": "USD", - "bids": [ - { - "bid": { - "adm": "
", - "w": 728, - "h": 90, - "id": "", - "impid": "", - "crid": "60613369", - "price": 1.000000 - }, - "type": "banner" - } - ] + "bids": [ + { + "bid": { + "adm": "\\\"\\\"/\\\"
\\\"\\\"
", + "w": 300, + "h": 250, + "id": "a5ec99e8-aa6b-42f4-bf8b-b68dabf96caf", + "impid": "imp_id", + "crid": "demo-475", + "dealid": "demo-234", + "price": 1.087, + "ext": { + "adType": "leaderboard", + "adFormat": "superadformat" + } + }, + "type": "banner" + } + ] } ] -} \ No newline at end of file +} diff --git a/adapters/adhese/adhesetest/exemplary/banner-video-internal.json b/adapters/adhese/adhesetest/exemplary/banner-video-internal.json deleted file mode 100644 index 72182bea90c..00000000000 --- a/adapters/adhese/adhesetest/exemplary/banner-video-internal.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-req", - "user": { - "ext": { - "consent" : "dummy" - } - }, - "imp": [ - { - "id": "test-req", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "account": "demo", - "location": "_adhese_prebid_demo_", - "format": "leaderboard", - "targets": - { - "ci": ["gent", "brussels"], - "ag": ["55"], - "tl": ["all"] - } - } - } - } - ], - "site": { - "id": "test", - "publisher": { - "id": "123" - } - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://ads-demo.adhese.com/json/sl_adhese_prebid_demo_-leaderboard/ag55/cigent;brussels/tlall/xtdummy", - "impIDs":["test-req"] - }, - "mockResponse": { - "status": 200, - "body": [{ - "origin": "JERLICIA", - "originInstance": "", - "ext": "js", - "slotName": "_main_page_-leaderboard", - "adType": "leaderboard", - "orderId": "888", - "id": "60613369", - "width": "728", - "height": "90", - "body": "dummy", - "tracker": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "impressionCounter": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "extension": { - "prebid": { - "cpm": { - "amount": "1", - "currency": "USD" - } - } - } - }] - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "adm": "dummy", - "w": 728, - "h": 90, - "id": "", - "impid": "", - "price": 1.000000, - "dealid": "888", - "crid": "60613369", - "ext": { - "adFormat": "", - "adType": "leaderboard", - "adspaceId": "", - "libId": "", - "orderProperty": "", - "priority": "", - "viewableImpressionCounter": "" - } - }, - "type": "video" - } - ] - } - ] -} \ No newline at end of file diff --git a/adapters/adhese/adhesetest/exemplary/banner.json b/adapters/adhese/adhesetest/exemplary/banner.json new file mode 100644 index 00000000000..9fffe9fb6b6 --- /dev/null +++ b/adapters/adhese/adhesetest/exemplary/banner.json @@ -0,0 +1,144 @@ +{ + "mockBidRequest": { + "id": "test-req", + "user": { + "ext": { + "consent": "dummy" + } + }, + "imp": [ + { + "id": "test-req", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "account": "demo", + "location": "pbs_test", + "format": "pbs_mr", + "targets": { + "ci": ["gent", "brussels"], + "ag": ["55"], + "tl": ["all"] + } + }, + "tid": "6811e2a1-3649-4e54-ba03-c9b1401ae728" + } + } + ], + "site": { + "id": "test", + "publisher": { + "id": "123" + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://demo.foo.bar/", + "impIDs": ["test-req"], + "body": { + "id": "test-req", + "imp": [ + { + "banner": { + "h": 250, + "w": 300 + }, + "ext": { + "adhese": { + "SL": ["pbs_test-pbs_mr"], + "ag": ["55"], + "ci": ["gent", "brussels"], + "tl": ["all"] + } + }, + "id": "test-req" + } + ], + "site": { + "id": "test", + "publisher": { + "id": "123" + } + }, + "user": { + "ext": { + "consent": "dummy" + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-req", + "seatbid": [ + { + "bid": [ + { + "price": 1.087, + "adm": "
\"\"
", + "w": 300, + "h": 250, + "crid": "demo-475", + "dealid": "demo-234", + "ext": { + "adhese": { + "id": "2993", + "libId": "475", + "orderId": "234", + "adspaceId": "431", + "priority": "0", + "adType": "pbs_mr", + "adFormat": "pbs_mr", + "viewableImpressionCounter": "https://ads-demo.adhese.com/track/2993-Adhese_IABview/sl219/dtunknown/ogcontrol/II7504ab36-c269-4d5b-bf8d-c59c1867124f/tlall/A2127.68.78.84/?t=1717755902141", + "orderProperty": "" + } + }, + "id": "a5ec99e8-aa6b-42f4-bf8b-b68dabf96caf", + "impid": "imp_id" + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "adm": "
\"\"
", + "w": 300, + "h": 250, + "id": "a5ec99e8-aa6b-42f4-bf8b-b68dabf96caf", + "impid": "imp_id", + "price": 1.087, + "dealid": "demo-234", + "crid": "demo-475", + "ext": { + "adFormat": "pbs_mr", + "adType": "pbs_mr", + "adspaceId": "431", + "orderId": "234", + "id": "2993", + "libId": "475", + "orderProperty": "", + "priority": "0", + "viewableImpressionCounter": "https://ads-demo.adhese.com/track/2993-Adhese_IABview/sl219/dtunknown/ogcontrol/II7504ab36-c269-4d5b-bf8d-c59c1867124f/tlall/A2127.68.78.84/?t=1717755902141" + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/adhese/adhesetest/exemplary/video.json b/adapters/adhese/adhesetest/exemplary/video.json index 2c77d7f2229..7cc72324857 100644 --- a/adapters/adhese/adhesetest/exemplary/video.json +++ b/adapters/adhese/adhesetest/exemplary/video.json @@ -1,82 +1,119 @@ { - "mockBidRequest": { - "imp": [{ - "id":"test-imp-id", - "ext": { - "bidder": { - "account": "demo", - "location": "_adhese_prebid_demo_", - "format": "leaderboard", - "targets": - { - "ci": ["gent", "brussels"], - "ag": ["55"], - "tl": ["all"] - } - } - } - }] - }, - - "httpCalls": [ + "mockBidRequest": { + "id": "test-req", + "imp": [ { - "expectedRequest": { - "uri": "https://ads-demo.adhese.com/json/sl_adhese_prebid_demo_-leaderboard/ag55/cigent;brussels/tlall", - "impIDs":["test-imp-id"] + "id": "test-req", + "video": { + "mimes": ["video/mp4"] }, - "mockResponse": { - "status": 200, - "body": [{ - "origin": "RUBICON", - "ext": "js", - "slotName": "_main_page_-leaderboard", - "adType": "leaderboard", - "originData": { - "seatbid": [ - { - "bid": [ - { - "crid": "60613369", - "dealid": null - } - ], - "seat": "958" - } - ] - }, - "width": "640", - "height": "350", - "body": "", - "extension": { - "prebid": { - "cpm": { - "amount": "2.1", - "currency": "USD" - } - } - } - }] + "ext": { + "bidder": { + "account": "demo", + "location": "_adhese_prebid_demo_", + "format": "preroll", + "targets": { + "ci": ["gent", "brussels"], + "ag": ["55"], + "tl": ["all"] + } + } } } - ], - - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://demo.foo.bar/", + "impIDs": ["test-req"], + "body": { + "id": "test-req", + "imp": [ { - "bid": { - "adm": "", - "w": 640, - "h": 350, - "id": "", - "impid": "", - "crid": "60613369", - "price": 2.1 + "ext": { + "adhese": { + "SL": ["_adhese_prebid_demo_-preroll"], + "ag": ["55"], + "ci": ["gent", "brussels"], + "tl": ["all"] + } + }, + "video": { + "mimes": ["video/mp4"] }, - "type": "video" + "id": "test-req" } ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-req", + "seatbid": [ + { + "bid": [ + { + "price": 1.087, + "adm": " ADHESE vid 00:00:30 ", + "w": 300, + "h": 250, + "crid": "demo-475", + "dealid": "demo-234", + "ext": { + "adhese": { + "id": "2993", + "libId": "475", + "orderId": "234", + "adspaceId": "431", + "priority": "0", + "adType": "preroll", + "adFormat": "preroll", + "viewableImpressionCounter": "https://ads-demo.adhese.com/track/3140-Adhese_IABview/sl290/dtunknown/ogcontrol/II7849444b-2892-4ad0-8bcc-7d410e50d58e/tlall/A2127.68.78.84/?t=1721225407122", + "orderProperty": "" + } + }, + "id": "a5ec99e8-aa6b-42f4-bf8b-b68dabf96caf", + "impid": "imp_id" + } + ] + } + ], + "cur": "USD" + } } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "adm": " ADHESE vid 00:00:30 ", + "w": 300, + "h": 250, + "ext": { + "adFormat": "preroll", + "adType": "preroll", + "adspaceId": "431", + "id": "2993", + "libId": "475", + "orderId": "234", + "orderProperty": "", + "priority": "0", + "viewableImpressionCounter": "https://ads-demo.adhese.com/track/3140-Adhese_IABview/sl290/dtunknown/ogcontrol/II7849444b-2892-4ad0-8bcc-7d410e50d58e/tlall/A2127.68.78.84/?t=1721225407122" + }, + "id": "a5ec99e8-aa6b-42f4-bf8b-b68dabf96caf", + "impid": "imp_id", + "crid": "demo-475", + "price": 1.087, + "dealid": "demo-234" + }, + "type": "video" + } + ] + } ] - } \ No newline at end of file +} diff --git a/adapters/adhese/adhesetest/supplemental/req-invalid-empty-imp-ext.json b/adapters/adhese/adhesetest/supplemental/req-invalid-empty-imp-ext.json deleted file mode 100644 index 9169847be35..00000000000 --- a/adapters/adhese/adhesetest/supplemental/req-invalid-empty-imp-ext.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-req", - "user": { - "ext": { - "consent" : "dummy" - } - }, - "imp": [ - { - "id": "test-req", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": {} - } - ], - "site": { - "id": "test", - "publisher": { - "id": "123" - } - } - }, - "httpCalls": [], - "expectedBidResponses": [], - "expectedMakeRequestsErrors": [ - { - "value": "Request could not be parsed as ExtImpAdhese due to: expect { or n, but found", - "comparison": "startswith" - } - ] -} \ No newline at end of file diff --git a/adapters/adhese/adhesetest/supplemental/req-invalid-empty-imp.json b/adapters/adhese/adhesetest/supplemental/req-invalid-empty-imp.json deleted file mode 100644 index a4fc8230e1e..00000000000 --- a/adapters/adhese/adhesetest/supplemental/req-invalid-empty-imp.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-req", - "user": { - "ext": { - "consent" : "dummy" - } - }, - "imp": [], - "site": { - "id": "test", - "publisher": { - "id": "123" - } - } - }, - "httpCalls": [], - "expectedBidResponses": [], - "expectedMakeRequestsErrors": [ - { - "value": "Imp is empty", - "comparison": "literal" - } - ] - } \ No newline at end of file diff --git a/adapters/adhese/adhesetest/supplemental/req-invalid-no-imp-ext.json b/adapters/adhese/adhesetest/supplemental/req-invalid-no-imp-ext.json deleted file mode 100644 index 76f5315c1cb..00000000000 --- a/adapters/adhese/adhesetest/supplemental/req-invalid-no-imp-ext.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-req", - "user": { - "ext": { - "consent" : "dummy" - } - }, - "imp": [ - { - "id": "test-req", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - } - } - ], - "site": { - "id": "test", - "publisher": { - "id": "123" - } - } - }, - "httpCalls": [], - "expectedBidResponses": [], - "expectedMakeRequestsErrors": [ - { - "value": "Request could not be parsed as ExtImpBidder due to: expect { or n, but found", - "comparison": "startswith" - } - ] - } \ No newline at end of file diff --git a/adapters/adhese/adhesetest/supplemental/res-invalid-height.json b/adapters/adhese/adhesetest/supplemental/res-invalid-height.json deleted file mode 100644 index 4c7989cb56b..00000000000 --- a/adapters/adhese/adhesetest/supplemental/res-invalid-height.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-req", - "imp": [ - { - "id": "test-req", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "account": "market", - "location": "_adhese_prebid_demo_", - "format": "leaderboard", - "targets": - { - "ci": ["gent", "brussels"], - "ag": ["55"], - "tl": ["all"] - } - } - } - } - ], - "site": { - "id": "test", - "publisher": { - "id": "123" - }, - "page": "dummy" - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://ads-market.adhese.com/json/sl_adhese_prebid_demo_-leaderboard/ag55/cigent;brussels/tlall/xfdummy", - "impIDs":["test-req"] - }, - "mockResponse": { - "status": 200, - "body": [{ - "origin": "APPNEXUS", - "originInstance": "", - "ext": "js", - "slotName": "_main_page_-leaderboard", - "adType": "leaderboard", - "originData": { - "seatbid": [ - { - "bid": [ - { - "crid": "60613369", - "dealid": null - } - ], - "seat": "958" - } - ] - }, - "width": "728", - "height": 90, - "body": "
", - "tracker": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "impressionCounter": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "extension": { - "prebid": { - "cpm": { - "amount": "10", - "currency": "USD" - } - } - } - }] - } - } - ], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [ - { - "value": "cannot unmarshal adhese.AdheseBid.Height: expects \" or n, but found 9", - "comparison": "literal" - }, { - "value": "Response (.*\n.*)+ could not be parsed as generic Adhese bid", - "comparison": "regex" - } - ] -} \ No newline at end of file diff --git a/adapters/adhese/adhesetest/supplemental/res-invalid-no-body.json b/adapters/adhese/adhesetest/supplemental/res-invalid-no-body.json index 1ec91d9ad0a..b705237aea0 100644 --- a/adapters/adhese/adhesetest/supplemental/res-invalid-no-body.json +++ b/adapters/adhese/adhesetest/supplemental/res-invalid-no-body.json @@ -1,63 +1,94 @@ { - "mockBidRequest": { - "id": "test-req", - "user": { - "ext": { - "consent" : "dummy" - } - }, - "imp": [ - { - "id": "test-req", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "account": "demo", - "location": "_adhese_prebid_demo_", - "format": "leaderboard", - "targets": - { - "ci": ["gent", "brussels"], - "ag": ["55"], - "tl": ["all"] - } - } - } - } - ], - "site": { - "id": "test", - "publisher": { - "id": "123" - } + "mockBidRequest": { + "id": "test-req", + "user": { + "ext": { + "consent": "dummy" } }, - "httpCalls": [ + "imp": [ { - "expectedRequest": { - "uri": "https://ads-demo.adhese.com/json/sl_adhese_prebid_demo_-leaderboard/ag55/cigent;brussels/tlall/xtdummy", - "impIDs":["test-req"] + "id": "test-req", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] }, - "mockResponse": { - "status": 200 + "ext": { + "bidder": { + "account": "demo", + "location": "_adhese_prebid_demo_", + "format": "leaderboard", + "targets": { + "ci": ["gent", "brussels"], + "ag": ["55"], + "tl": ["all"] + } + } } } ], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [ - { - "value": "decode slice: expect [ or n, but found", - "comparison": "startswith" - },{ - "value": "Response could not be parsed as generic Adhese bid.", - "comparison": "literal" + "site": { + "id": "test", + "publisher": { + "id": "123" + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://demo.foo.bar/", + "impIDs": ["test-req"], + "body": { + "id": "test-req", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "adhese": { + "SL": ["_adhese_prebid_demo_-leaderboard"], + "ag": ["55"], + "ci": ["gent", "brussels"], + "tl": ["all"] + } + }, + "id": "test-req" + } + ], + "site": { + "id": "test", + "publisher": { + "id": "123" + } + }, + "user": { + "ext": { + "consent": "dummy" + } + } + } + }, + "mockResponse": { + "status": 200 } - ] - } \ No newline at end of file + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Empty body", + "comparison": "literal" + } + ] +} diff --git a/adapters/adhese/adhesetest/supplemental/res-invalid-no-origin.json b/adapters/adhese/adhesetest/supplemental/res-invalid-no-origin.json deleted file mode 100644 index 886849bde46..00000000000 --- a/adapters/adhese/adhesetest/supplemental/res-invalid-no-origin.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-req", - "user": { - "ext": { - "consent" : "dummy" - } - }, - "imp": [ - { - "id": "test-req", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "account": "demo", - "location": "_adhese_prebid_demo_", - "format": "leaderboard", - "targets": - { - "ci": ["gent", "brussels"], - "ag": ["55"], - "tl": ["all"] - } - } - } - } - ], - "site": { - "id": "test", - "publisher": { - "id": "123" - } - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://ads-demo.adhese.com/json/sl_adhese_prebid_demo_-leaderboard/ag55/cigent;brussels/tlall/xtdummy", - "impIDs":["test-req"] - }, - "mockResponse": { - "status": 200, - "body": [{ - "originInstance": "", - "ext": "js", - "slotName": "_main_page_-leaderboard", - "adType": "leaderboard", - "orderId": "888", - "id": "60613369", - "width": "728", - "height": "90", - "body": "
", - "tracker": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "impressionCounter": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "extension": { - "prebid": { - "cpm": { - "amount": "1", - "currency": "USD" - } - } - } - }] - } - } - ], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [ - { - "value": "Response resulted in an empty seatBid array.", - "comparison": "literal" - } - ] - } \ No newline at end of file diff --git a/adapters/adhese/adhesetest/supplemental/res-invalid-price.json b/adapters/adhese/adhesetest/supplemental/res-invalid-price.json deleted file mode 100644 index 7fcbc298876..00000000000 --- a/adapters/adhese/adhesetest/supplemental/res-invalid-price.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-req", - "imp": [ - { - "id": "test-req", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "account": "market", - "location": "_adhese_prebid_demo_", - "format": "leaderboard", - "targets": - { - "ci": ["gent", "brussels"], - "ag": ["55"], - "tl": ["all"] - } - } - } - } - ], - "site": { - "id": "test", - "publisher": { - "id": "123" - }, - "page": "dummy" - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://ads-market.adhese.com/json/sl_adhese_prebid_demo_-leaderboard/ag55/cigent;brussels/tlall/xfdummy", - "impIDs":["test-req"] - }, - "mockResponse": { - "status": 200, - "body": [{ - "origin": "APPNEXUS", - "originInstance": "", - "ext": "js", - "slotName": "_main_page_-leaderboard", - "adType": "leaderboard", - "originData": { - "seatbid": [ - { - "bid": [ - { - "crid": "60613369", - "dealid": null - } - ], - "seat": "958" - } - ] - }, - "width": "728", - "height": "90", - "body": "
", - "tracker": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "impressionCounter": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "extension": { - "prebid": { - "cpm": { - "amount": 10, - "currency": "USD" - } - } - } - }] - } - } - ], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [ - { - "value": "cannot unmarshal adhese.CPMValues.Amount: expects \" or n, but found 1", - "comparison": "regex" - }, { - "value": "Response (.*\n.*)+ could not be parsed as generic Adhese bid", - "comparison": "regex" - } - ] -} \ No newline at end of file diff --git a/adapters/adhese/adhesetest/supplemental/res-invalid-status-not-ok.json b/adapters/adhese/adhesetest/supplemental/res-invalid-status-not-ok.json index 4234986dd68..df7ff548b9e 100644 --- a/adapters/adhese/adhesetest/supplemental/res-invalid-status-not-ok.json +++ b/adapters/adhese/adhesetest/supplemental/res-invalid-status-not-ok.json @@ -1,53 +1,88 @@ { - "mockBidRequest": { - "id": "test-req", - "user": { + "mockBidRequest": { + "id": "test-req", + "user": { + "ext": { + "consent": "dummy" + } + }, + "imp": [ + { + "id": "test-req", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, "ext": { - "consent" : "dummy" + "bidder": { + "account": "demo", + "location": "_adhese_prebid_demo_", + "format": "leaderboard", + "targets": { + "ci": ["gent", "brussels"], + "ag": ["55"], + "tl": ["all"] + } + } } - }, - "imp": [ - { + } + ], + "site": { + "id": "test", + "publisher": { + "id": "123" + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://demo.foo.bar/", + "impIDs": ["test-req"], + "body": { "id": "test-req", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "adhese": { + "SL": ["_adhese_prebid_demo_-leaderboard"], + "ag": ["55"], + "ci": ["gent", "brussels"], + "tl": ["all"] + } + }, + "id": "test-req" + } + ], + "site": { + "id": "test", + "publisher": { + "id": "123" + } }, - "ext": { - "bidder": { - "account": "demo", - "location": "_adhese_prebid_demo_", - "format": "leaderboard", - "targets": - { - "ci": ["gent", "brussels"], - "ag": ["55"], - "tl": ["all"] - } + "user": { + "ext": { + "consent": "dummy" } } } - ], - "site": { - "id": "test", - "publisher": { - "id": "123" - } - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://ads-demo.adhese.com/json/sl_adhese_prebid_demo_-leaderboard/ag55/cigent;brussels/tlall/xtdummy", - "impIDs":["test-req"] - }, - "mockResponse": { - "status": 501, - "body": [{ + }, + "mockResponse": { + "status": 501, + "body": [ + { "origin": "JERLICIA", "originInstance": "", "ext": "js", @@ -68,15 +103,16 @@ } } } - }] - } - } - ], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [ - { - "value": "Unexpected status code: 501.", - "comparison": "literal" + } + ] } - ] - } \ No newline at end of file + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 501. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/adhese/adhesetest/supplemental/res-invalid-width.json b/adapters/adhese/adhesetest/supplemental/res-invalid-width.json deleted file mode 100644 index 139a5c598a1..00000000000 --- a/adapters/adhese/adhesetest/supplemental/res-invalid-width.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-req", - "imp": [ - { - "id": "test-req", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "account": "market", - "location": "_adhese_prebid_demo_", - "format": "leaderboard", - "targets": - { - "ci": ["gent", "brussels"], - "ag": ["55"], - "tl": ["all"] - } - } - } - } - ], - "site": { - "id": "test", - "publisher": { - "id": "123" - }, - "page": "dummy" - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://ads-market.adhese.com/json/sl_adhese_prebid_demo_-leaderboard/ag55/cigent;brussels/tlall/xfdummy", - "impIDs":["test-req"] - }, - "mockResponse": { - "status": 200, - "body": [{ - "origin": "APPNEXUS", - "originInstance": "", - "ext": "js", - "slotName": "_main_page_-leaderboard", - "adType": "leaderboard", - "originData": { - "seatbid": [ - { - "bid": [ - { - "crid": "60613369", - "dealid": null - } - ], - "seat": "958" - } - ] - }, - "width": 728, - "height": "90", - "body": "
", - "tracker": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "impressionCounter": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "extension": { - "prebid": { - "cpm": { - "amount": "10", - "currency": "USD" - } - } - } - }] - } - } - ], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [ - { - "value": "cannot unmarshal adhese.AdheseBid.Width: expects \" or n, but found 7", - "comparison": "literal" - }, { - "value": "Response (.*\n.*)+ could not be parsed as generic Adhese bid", - "comparison": "regex" - } - ] -} \ No newline at end of file diff --git a/adapters/adhese/adhesetest/supplemental/res-no_bids_200.json b/adapters/adhese/adhesetest/supplemental/res-no_bids_200.json deleted file mode 100644 index f8b0b5f17cd..00000000000 --- a/adapters/adhese/adhesetest/supplemental/res-no_bids_200.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-req", - "user": { - "ext": { - "consent" : "dummy" - } - }, - "imp": [ - { - "id": "test-req", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "account": "demo", - "location": "_adhese_prebid_demo_", - "format": "leaderboard", - "targets": - { - "ci": ["gent", "brussels"], - "ag": ["55"], - "tl": ["all"] - } - } - } - } - ], - "site": { - "id": "test", - "publisher": { - "id": "123" - } - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://ads-demo.adhese.com/json/sl_adhese_prebid_demo_-leaderboard/ag55/cigent;brussels/tlall/xtdummy", - "impIDs":["test-req"] - }, - "mockResponse": { - "status": 200, - "body": [] - } - } - ], - "expectedBidResponses": [] -} \ No newline at end of file diff --git a/adapters/adhese/adhesetest/supplemental/res-no_bids_204.json b/adapters/adhese/adhesetest/supplemental/res-no_bids_204.json deleted file mode 100644 index e678406a75f..00000000000 --- a/adapters/adhese/adhesetest/supplemental/res-no_bids_204.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-req", - "user": { - "ext": { - "consent" : "dummy" - } - }, - "imp": [ - { - "id": "test-req", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "account": "demo", - "location": "_adhese_prebid_demo_", - "format": "leaderboard", - "targets": - { - "ci": ["gent", "brussels"], - "ag": ["55"], - "tl": ["all"] - } - } - } - } - ], - "site": { - "id": "test", - "publisher": { - "id": "123" - } - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://ads-demo.adhese.com/json/sl_adhese_prebid_demo_-leaderboard/ag55/cigent;brussels/tlall/xtdummy", - "impIDs":["test-req"] - }, - "mockResponse": { - "status": 204, - "body": [] - } - } - ], - "expectedBidResponses": [] -} \ No newline at end of file diff --git a/adapters/adhese/adhesetest/supplemental/res-no_impression_counter.json b/adapters/adhese/adhesetest/supplemental/res-no_impression_counter.json deleted file mode 100644 index 20539464aa5..00000000000 --- a/adapters/adhese/adhesetest/supplemental/res-no_impression_counter.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-req", - "user": { - "ext": { - "consent" : "dummy" - } - }, - "imp": [ - { - "id": "test-req", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "account": "demo", - "location": "_adhese_prebid_demo_", - "format": "leaderboard", - "targets": - { - "ci": ["gent", "brussels"], - "ag": ["55"], - "tl": ["all"] - } - } - } - } - ], - "site": { - "id": "test", - "publisher": { - "id": "123" - } - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://ads-demo.adhese.com/json/sl_adhese_prebid_demo_-leaderboard/ag55/cigent;brussels/tlall/xtdummy", - "impIDs":["test-req"] - }, - "mockResponse": { - "status": 200, - "body": [{ - "origin": "JERLICIA", - "originInstance": "", - "ext": "js", - "slotName": "_main_page_-leaderboard", - "adType": "leaderboard", - "orderId": "888", - "id": "60613369", - "width": "728", - "height": "90", - "body": "
", - "tracker": "https://hosts-demo.adhese.com/rtb_gateway/handlers/client/track/?id=a2f39296-6dd0-4b3c-be85-7baa22e7ff4a", - "impressionCounter": "", - "extension": { - "prebid": { - "cpm": { - "amount": "1", - "currency": "USD" - } - } - } - }] - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "adm": "
", - "w": 728, - "h": 90, - "id": "", - "impid": "", - "price": 1.000000, - "dealid": "888", - "crid": "60613369", - "ext": { - "adFormat": "", - "adType": "leaderboard", - "adspaceId": "", - "libId": "", - "orderProperty": "", - "priority": "", - "viewableImpressionCounter": "" - } - }, - "type": "banner" - } - ] - } - ] -} \ No newline at end of file diff --git a/adapters/adhese/utils.go b/adapters/adhese/utils.go deleted file mode 100644 index a6b7d7aae8d..00000000000 --- a/adapters/adhese/utils.go +++ /dev/null @@ -1,45 +0,0 @@ -package adhese - -import "github.com/prebid/openrtb/v20/openrtb2" - -type AdheseOriginData struct { - Priority string `json:"priority"` - OrderProperty string `json:"orderProperty"` - AdFormat string `json:"adFormat"` - AdType string `json:"adType"` - AdspaceId string `json:"adspaceId"` - LibId string `json:"libId"` - SlotID string `json:"slotID,omitempty"` - ViewableImpressionCounter string `json:"viewableImpressionCounter"` -} - -type AdheseExt struct { - Id string `json:"id"` - OrderId string `json:"orderId"` - ImpressionCounter string `json:"impressionCounter"` - Tag string `json:"tag,omitempty"` - Ext string `json:"ext"` -} - -type AdheseBid struct { - Origin string `json:"origin"` - OriginData openrtb2.BidResponse `json:"originData"` - OriginInstance string `json:"originInstance,omitempty"` - Body string `json:"body,omitempty"` - Height string `json:"height"` - Width string `json:"width"` - Extension Prebid `json:"extension"` -} - -type Prebid struct { - Prebid CPM `json:"prebid"` -} - -type CPM struct { - Cpm CPMValues `json:"cpm"` -} - -type CPMValues struct { - Amount string `json:"amount"` - Currency string `json:"currency"` -} diff --git a/openrtb_ext/imp_adhese.go b/openrtb_ext/imp_adhese.go index 1c822018b24..4250b453b1b 100644 --- a/openrtb_ext/imp_adhese.go +++ b/openrtb_ext/imp_adhese.go @@ -1,12 +1,8 @@ package openrtb_ext -import ( - "encoding/json" -) - type ExtImpAdhese struct { - Account string `json:"account"` - Location string `json:"location"` - Format string `json:"format"` - Keywords json.RawMessage `json:"targets,omitempty"` + Account string `json:"account"` + Location string `json:"location"` + Format string `json:"format"` + Targets map[string][]string `json:"targets,omitempty"` } diff --git a/static/bidder-info/adhese.yaml b/static/bidder-info/adhese.yaml index 532c114de5b..fc8c053a48d 100644 --- a/static/bidder-info/adhese.yaml +++ b/static/bidder-info/adhese.yaml @@ -1,4 +1,4 @@ -endpoint: "https://ads-{{.AccountID}}.adhese.com/json" +endpoint: "https://ads-{{.AccountID}}.adhese.com/openrtb2" maintainer: email: info@adhese.com gvlVendorID: 553 diff --git a/static/bidder-params/adhese.json b/static/bidder-params/adhese.json index a1bd608b7a8..14234a8bd15 100644 --- a/static/bidder-params/adhese.json +++ b/static/bidder-params/adhese.json @@ -1,25 +1,27 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Adhese Adapter Parameters", - "description": "Validation for parameters handled by the Adhese adapter", - "type": "object", - "properties": { - "account": { - "type": "string", - "description": "Your Adhese account name. If unknown, please contact your sales rep" - }, - "location": { - "type": "string", - "description": "The location you want to refer to for a specific section or page, as defined in your Adhese inventory" - }, - "format": { - "type": "string", - "description": "The format you accept for this unit, as defined in your Adhese inventory" - }, - "targets": { - "type": "object", - "description": "Target params, as defined in your Adhese setup." - } - }, - "required": ["account", "location", "format"] + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Adhese Adapter Parameters", + "description": "Validation for parameters handled by the Adhese adapter", + "type": "object", + "properties": { + "account": { + "type": "string", + "minLength": 1, + "description": "Your Adhese account name. If unknown, please contact your sales rep" + }, + "location": { + "type": "string", + "minLength": 1, + "description": "The location you want to refer to for a specific section or page, as defined in your Adhese inventory" + }, + "format": { + "type": "string", + "description": "The format you accept for this unit, as defined in your Adhese inventory" + }, + "targets": { + "type": "object", + "description": "Target params, as defined in your Adhese setup." + } + }, + "required": ["account", "location", "format"] }