diff --git a/adapters/33across/usersync_test.go b/adapters/33across/usersync_test.go index f54a5d5f8c7..fd2ebcd195b 100644 --- a/adapters/33across/usersync_test.go +++ b/adapters/33across/usersync_test.go @@ -5,20 +5,30 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func Test33AcrossSyncer(t *testing.T) { - syncURL := "https://ic.tynt.com/r/d?m=xch&rt=html&ri=123&ru=%2Fsetuid%3Fbidder%3D33across%26uid%3D33XUSERID33X&id=zzz000000000002zzz" + syncURL := "https://ic.tynt.com/r/d?m=xch&rt=html&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&ru=%2Fsetuid%3Fbidder%3D33across%26uid%3D33XUSERID33X&id=zzz000000000002zzz" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) syncer := New33AcrossSyncer(syncURLTemplate) - syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{}) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "A", + Consent: "B", + }, + CCPA: ccpa.Policy{ + Value: "C", + }, + }) assert.NoError(t, err) - assert.Equal(t, "https://ic.tynt.com/r/d?m=xch&rt=html&ri=123&ru=%2Fsetuid%3Fbidder%3D33across%26uid%3D33XUSERID33X&id=zzz000000000002zzz", syncInfo.URL) + assert.Equal(t, "https://ic.tynt.com/r/d?m=xch&rt=html&gdpr=A&gdpr_consent=B&us_privacy=C&ru=%2Fsetuid%3Fbidder%3D33across%26uid%3D33XUSERID33X&id=zzz000000000002zzz", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) assert.EqualValues(t, 58, syncer.GDPRVendorID()) assert.False(t, syncInfo.SupportCORS) diff --git a/adapters/adform/adform_test.go b/adapters/adform/adform_test.go index 52662da6140..9399efebd3b 100644 --- a/adapters/adform/adform_test.go +++ b/adapters/adform/adform_test.go @@ -17,10 +17,12 @@ import ( "fmt" + "github.com/mxmCherry/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/mxmCherry/openrtb" + + "github.com/stretchr/testify/assert" ) func TestJsonSamples(t *testing.T) { @@ -597,3 +599,77 @@ func TestPriceTypeUrlParameterCreation(t *testing.T) { } } } + +// Asserts that toOpenRtbBidResponse() creates a *adapters.BidderResponse with +// the currency of the last valid []*adformBid element and the expected number of bids +func TestToOpenRtbBidResponse(t *testing.T) { + expectedBids := 3 + lastCurrency, anotherCurrency, emptyCurrency := "EUR", "USD", "" + + request := &openrtb.BidRequest{ + ID: "test-request-id", + Imp: []openrtb.Imp{ + { + ID: "banner-imp-no1", + Ext: json.RawMessage(`{"bidder1": { "mid": "32341" }}`), + Banner: &openrtb.Banner{}, + }, + { + ID: "banner-imp-no2", + Ext: json.RawMessage(`{"bidder1": { "mid": "32342" }}`), + Banner: &openrtb.Banner{}, + }, + { + ID: "banner-imp-no3", + Ext: json.RawMessage(`{"bidder1": { "mid": "32343" }}`), + Banner: &openrtb.Banner{}, + }, + { + ID: "banner-imp-no4", + Ext: json.RawMessage(`{"bidder1": { "mid": "32344" }}`), + Banner: &openrtb.Banner{}, + }, + }, + Device: &openrtb.Device{UA: "ua", IP: "ip"}, + User: &openrtb.User{BuyerUID: "buyerUID"}, + } + + testAdformBids := []*adformBid{ + { + ResponseType: "banner", + Banner: "banner-content1", + Price: 1.23, + Currency: anotherCurrency, + Width: 300, + Height: 200, + DealId: "dealId1", + CreativeId: "creativeId1", + }, + {}, + { + ResponseType: "banner", + Banner: "banner-content3", + Price: 1.24, + Currency: emptyCurrency, + Width: 300, + Height: 200, + DealId: "dealId3", + CreativeId: "creativeId3", + }, + { + ResponseType: "banner", + Banner: "banner-content4", + Price: 1.25, + Currency: lastCurrency, + Width: 300, + Height: 200, + DealId: "dealId4", + CreativeId: "creativeId4", + }, + } + + actualBidResponse := toOpenRtbBidResponse(testAdformBids, request) + + assert.Equalf(t, expectedBids, len(actualBidResponse.Bids), "bid count") + assert.Equalf(t, lastCurrency, actualBidResponse.Currency, "currency") +} diff --git a/adapters/adkernel/usersync_test.go b/adapters/adkernel/usersync_test.go index 958e89b3e9e..53435d5e3a0 100644 --- a/adapters/adkernel/usersync_test.go +++ b/adapters/adkernel/usersync_test.go @@ -5,12 +5,13 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestAdkernelAdnSyncer(t *testing.T) { - syncURL := "https://sync.adkernel.com/user-sync?t=image&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Dadkernel%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BUID%7D" + syncURL := "https://sync.adkernel.com/user-sync?t=image&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Dadkernel%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BUID%7D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -21,10 +22,13 @@ func TestAdkernelAdnSyncer(t *testing.T) { Signal: "1", Consent: "BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw", }, + CCPA: ccpa.Policy{ + Value: "1NYN", + }, }) assert.NoError(t, err) - assert.Equal(t, "https://sync.adkernel.com/user-sync?t=image&gdpr=1&gdpr_consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Dadkernel%26gdpr%3D1%26gdpr_consent%3DBONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw%26uid%3D%7BUID%7D", syncInfo.URL) + assert.Equal(t, "https://sync.adkernel.com/user-sync?t=image&gdpr=1&gdpr_consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&us_privacy=1NYN&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Dadkernel%26gdpr%3D1%26gdpr_consent%3DBONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw%26uid%3D%7BUID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) assert.EqualValues(t, adkernelGDPRVendorID, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/adkernelAdn/usersync_test.go b/adapters/adkernelAdn/usersync_test.go index c5521561054..2f90e73d348 100644 --- a/adapters/adkernelAdn/usersync_test.go +++ b/adapters/adkernelAdn/usersync_test.go @@ -5,12 +5,13 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestAdkernelAdnSyncer(t *testing.T) { - syncURL := "https://tag.adkernel.com/syncr?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3DadkernelAdn%26uid%3D%7BUID%7D" + syncURL := "https://tag.adkernel.com/syncr?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3DadkernelAdn%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BUID%7D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -21,10 +22,13 @@ func TestAdkernelAdnSyncer(t *testing.T) { Signal: "1", Consent: "BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw", }, + CCPA: ccpa.Policy{ + Value: "1NYN", + }, }) assert.NoError(t, err) - assert.Equal(t, "https://tag.adkernel.com/syncr?gdpr=1&gdpr_consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3DadkernelAdn%26uid%3D%7BUID%7D", syncInfo.URL) + assert.Equal(t, "https://tag.adkernel.com/syncr?gdpr=1&gdpr_consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&us_privacy=1NYN&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3DadkernelAdn%26gdpr%3D1%26gdpr_consent%3DBONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw%26uid%3D%7BUID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) assert.EqualValues(t, adkernelGDPRVendorID, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/adtelligent/adtelligenttest/supplemental/audio.json b/adapters/adtelligent/adtelligenttest/supplemental/audio.json index aa9a40bcc99..d8904251e11 100644 --- a/adapters/adtelligent/adtelligenttest/supplemental/audio.json +++ b/adapters/adtelligent/adtelligenttest/supplemental/audio.json @@ -9,7 +9,7 @@ }, "ext": { "bidder": { - "placementId": 10433394 + "placementId": 1 } } } diff --git a/adapters/adtelligent/adtelligenttest/supplemental/native.json b/adapters/adtelligent/adtelligenttest/supplemental/native.json index 90ddff2f679..00fb3984bc7 100644 --- a/adapters/adtelligent/adtelligenttest/supplemental/native.json +++ b/adapters/adtelligent/adtelligenttest/supplemental/native.json @@ -9,7 +9,7 @@ }, "ext": { "bidder": { - "placementId": 10433394 + "placementId": 1 } } } diff --git a/adapters/applogy/applogy.go b/adapters/applogy/applogy.go new file mode 100644 index 00000000000..6fc957cc4f0 --- /dev/null +++ b/adapters/applogy/applogy.go @@ -0,0 +1,160 @@ +package applogy + +import ( + "encoding/json" + "errors" + "net/http" + "strconv" + + "github.com/mxmCherry/openrtb" + "github.com/PubMatic-OpenWrap/prebid-server/adapters" + "github.com/PubMatic-OpenWrap/prebid-server/errortypes" + "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" +) + +type ApplogyAdapter struct { + endpoint string +} + +func (a *ApplogyAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + impressions := request.Imp + result := make([]*adapters.RequestData, 0, len(impressions)) + errs := make([]error, 0, len(impressions)) + + for i, impression := range impressions { + if impression.Banner == nil && impression.Video == nil && impression.Native == nil { + errs = append(errs, &errortypes.BadInput{ + Message: "Applogy only supports banner, video or native ads", + }) + continue + } + if impression.Banner != nil { + banner := impression.Banner + if banner.W == nil || banner.H == nil || *banner.W == 0 || *banner.H == 0 { + if len(banner.Format) == 0 { + errs = append(errs, &errortypes.BadInput{ + Message: "banner size information missing", + }) + continue + } + format := banner.Format[0] + banner.W = &format.W + banner.H = &format.H + } + } + if len(impression.Ext) == 0 { + errs = append(errs, errors.New("impression extensions required")) + continue + } + var bidderExt adapters.ExtImpBidder + err := json.Unmarshal(impression.Ext, &bidderExt) + if err != nil { + errs = append(errs, err) + continue + } + if len(bidderExt.Bidder) == 0 { + errs = append(errs, errors.New("bidder required")) + continue + } + var impressionExt openrtb_ext.ExtImpApplogy + err = json.Unmarshal(bidderExt.Bidder, &impressionExt) + if err != nil { + errs = append(errs, err) + continue + } + if impressionExt.Token == "" { + errs = append(errs, errors.New("Applogy token required")) + continue + } + request.Imp = impressions[i : i+1] + body, err := json.Marshal(request) + if err != nil { + errs = append(errs, err) + continue + } + result = append(result, &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint + "/" + impressionExt.Token, + Body: body, + Headers: headers, + }) + } + + request.Imp = impressions + + if len(result) == 0 { + return nil, errs + } + return result, errs +} + +func (a *ApplogyAdapter) MakeBids(request *openrtb.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + var errs []error + + switch responseData.StatusCode { + case http.StatusNoContent: + return nil, nil + case http.StatusBadRequest: + return nil, []error{&errortypes.BadInput{ + Message: "unexpected status code: " + strconv.Itoa(responseData.StatusCode), + }} + case http.StatusOK: + break + default: + return nil, []error{&errortypes.BadServerResponse{ + Message: "unexpected status code: " + strconv.Itoa(responseData.StatusCode), + }} + } + + var bidResponse openrtb.BidResponse + err := json.Unmarshal(responseData.Body, &bidResponse) + if err != nil { + return nil, []error{&errortypes.BadServerResponse{ + Message: err.Error(), + }} + } + + response := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + + for _, seatBid := range bidResponse.SeatBid { + for _, bid := range seatBid.Bid { + bid := bid // pin https://github.com/kyoh86/scopelint#whats-this + var bidType openrtb_ext.BidType + for _, impression := range request.Imp { + if impression.ID != bid.ImpID { + continue + } + switch { + case impression.Banner != nil: + bidType = openrtb_ext.BidTypeBanner + case impression.Video != nil: + bidType = openrtb_ext.BidTypeVideo + case impression.Native != nil: + bidType = openrtb_ext.BidTypeNative + } + break + } + if bidType == "" { + errs = append(errs, &errortypes.BadServerResponse{ + Message: "ignoring bid id=" + bid.ID + ", request doesn't contain any valid impression with id=" + bid.ImpID, + }) + continue + } + response.Bids = append(response.Bids, &adapters.TypedBid{ + Bid: &bid, + BidType: bidType, + }) + } + } + + return response, errs +} + +func NewApplogyBidder(endpoint string) *ApplogyAdapter { + return &ApplogyAdapter{ + endpoint: endpoint, + } +} diff --git a/adapters/applogy/applogy_test.go b/adapters/applogy/applogy_test.go new file mode 100644 index 00000000000..4e656259f35 --- /dev/null +++ b/adapters/applogy/applogy_test.go @@ -0,0 +1,11 @@ +package applogy + +import ( + "testing" + + "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" +) + +func TestJsonSamples(t *testing.T) { + adapterstest.RunJSONBidderTest(t, "applogytest", NewApplogyBidder("http://example.com/prebid")) +} diff --git a/adapters/applogy/applogytest/exemplary/simple-banner.json b/adapters/applogy/applogytest/exemplary/simple-banner.json new file mode 100644 index 00000000000..a3926dea623 --- /dev/null +++ b/adapters/applogy/applogytest/exemplary/simple-banner.json @@ -0,0 +1,170 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "banner": { + "format": [{ + "h": 250, + "w": 300 + }] + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }, { + "id": "test-impression-id-2", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }, { + "id": "test-impression-id-3", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "token": "test-token-2" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-1", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "banner": { + "format": [{ + "h": 250, + "w": 300 + }], + "h": 250, + "w": 300 + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id", + "seatbid": [{ + "bid": [{ + "id": "test-bid-id-1", + "impid": "test-impression-id-1", + "price": 1 + }] + }] + } + } + }, { + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-1", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-2", + "banner": { + "h": 250, + "w": 300 + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id-2", + "seatbid": [{ + "bid": [{ + "id": "test-bid-id-2", + "impid": "test-impression-id-2", + "price": 2 + }] + }] + } + } + }, { + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-2", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-3", + "banner": { + "h": 250, + "w": 300 + }, + "ext": { + "bidder": { + "token": "test-token-2" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id-3", + "seatbid": [{ + "bid": [{ + "id": "test-bid-id-3", + "impid": "test-impression-id-3", + "price": 3 + }] + }] + } + } + }], + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "id": "test-bid-id-1", + "impid": "test-impression-id-1", + "price": 1 + }, + "type": "banner" + }] + }, { + "bids": [{ + "bid": { + "id": "test-bid-id-2", + "impid": "test-impression-id-2", + "price": 2 + }, + "type": "banner" + }] + }, { + "bids": [{ + "bid": { + "id": "test-bid-id-3", + "impid": "test-impression-id-3", + "price": 3 + }, + "type": "banner" + }] + }] +} diff --git a/adapters/applogy/applogytest/exemplary/simple-native.json b/adapters/applogy/applogytest/exemplary/simple-native.json new file mode 100644 index 00000000000..84565ec5575 --- /dev/null +++ b/adapters/applogy/applogytest/exemplary/simple-native.json @@ -0,0 +1,164 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "native": { + "request": "{\"ver\":\"1.1\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":4,\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":500}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":1,\"hmin\":1}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":15000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":40}},{\"id\":6,\"required\":0,\"data\":{\"type\":500}}]}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }, { + "id": "test-impression-id-2", + "native": { + "request": "{\"ver\":\"1.1\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":4,\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":500}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":1,\"hmin\":1}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":15000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":40}},{\"id\":6,\"required\":0,\"data\":{\"type\":500}}]}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }, { + "id": "test-impression-id-3", + "native": { + "request": "{\"ver\":\"1.1\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":4,\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":500}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":1,\"hmin\":1}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":15000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":40}},{\"id\":6,\"required\":0,\"data\":{\"type\":500}}]}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "token": "test-token-2" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-1", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "native": { + "request": "{\"ver\":\"1.1\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":4,\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":500}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":1,\"hmin\":1}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":15000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":40}},{\"id\":6,\"required\":0,\"data\":{\"type\":500}}]}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id", + "seatbid": [{ + "bid": [{ + "id": "test-bid-id-1", + "impid": "test-impression-id-1", + "price": 1 + }] + }] + } + } + }, { + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-1", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-2", + "native": { + "request": "{\"ver\":\"1.1\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":4,\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":500}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":1,\"hmin\":1}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":15000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":40}},{\"id\":6,\"required\":0,\"data\":{\"type\":500}}]}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id-2", + "seatbid": [{ + "bid": [{ + "id": "test-bid-id-2", + "impid": "test-impression-id-2", + "price": 2 + }] + }] + } + } + }, { + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-2", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-3", + "native": { + "request": "{\"ver\":\"1.1\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":4,\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":500}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":1,\"hmin\":1}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":15000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":40}},{\"id\":6,\"required\":0,\"data\":{\"type\":500}}]}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "token": "test-token-2" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id-3", + "seatbid": [{ + "bid": [{ + "id": "test-bid-id-3", + "impid": "test-impression-id-3", + "price": 3 + }] + }] + } + } + }], + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "id": "test-bid-id-1", + "impid": "test-impression-id-1", + "price": 1 + }, + "type": "native" + }] + }, { + "bids": [{ + "bid": { + "id": "test-bid-id-2", + "impid": "test-impression-id-2", + "price": 2 + }, + "type": "native" + }] + }, { + "bids": [{ + "bid": { + "id": "test-bid-id-3", + "impid": "test-impression-id-3", + "price": 3 + }, + "type": "native" + }] + }] +} diff --git a/adapters/applogy/applogytest/exemplary/simple-video.json b/adapters/applogy/applogytest/exemplary/simple-video.json new file mode 100644 index 00000000000..30237cccd10 --- /dev/null +++ b/adapters/applogy/applogytest/exemplary/simple-video.json @@ -0,0 +1,182 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "video": { + "w": 900, + "h": 250, + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }, { + "id": "test-impression-id-2", + "video": { + "w": 900, + "h": 250, + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }, { + "id": "test-impression-id-3", + "video": { + "w": 900, + "h": 250, + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "bidder": { + "token": "test-token-2" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-1", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "video": { + "w": 900, + "h": 250, + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id", + "seatbid": [{ + "bid": [{ + "id": "test-bid-id-1", + "impid": "test-impression-id-1", + "price": 1 + }] + }] + } + } + }, { + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-1", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-2", + "video": { + "w": 900, + "h": 250, + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id-2", + "seatbid": [{ + "bid": [{ + "id": "test-bid-id-2", + "impid": "test-impression-id-2", + "price": 2 + }] + }] + } + } + }, { + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-2", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-3", + "video": { + "w": 900, + "h": 250, + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "bidder": { + "token": "test-token-2" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id-3", + "seatbid": [{ + "bid": [{ + "id": "test-bid-id-3", + "impid": "test-impression-id-3", + "price": 3 + }] + }] + } + } + }], + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "id": "test-bid-id-1", + "impid": "test-impression-id-1", + "price": 1 + }, + "type": "video" + }] + }, { + "bids": [{ + "bid": { + "id": "test-bid-id-2", + "impid": "test-impression-id-2", + "price": 2 + }, + "type": "video" + }] + }, { + "bids": [{ + "bid": { + "id": "test-bid-id-3", + "impid": "test-impression-id-3", + "price": 3 + }, + "type": "video" + }] + }] +} diff --git a/adapters/applogy/applogytest/supplemental/all-failed.json b/adapters/applogy/applogytest/supplemental/all-failed.json new file mode 100644 index 00000000000..7f0244afcfb --- /dev/null +++ b/adapters/applogy/applogytest/supplemental/all-failed.json @@ -0,0 +1,16 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "banner": { + "w": 300, + "h": 250 + } + }] + }, + "expectedMakeRequestsErrors": [{ + "value": "impression extensions required", + "comparison": "literal" + }] +} diff --git a/adapters/applogy/applogytest/supplemental/invalid-params.json b/adapters/applogy/applogytest/supplemental/invalid-params.json new file mode 100644 index 00000000000..6b5d5e3224d --- /dev/null +++ b/adapters/applogy/applogytest/supplemental/invalid-params.json @@ -0,0 +1,133 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "banner": {} + }, { + "id": "test-impression-id-2", + "banner": { + "w": 300, + "h": 250 + } + }, { + "id": "test-impression-id-3", + "banner": { + "w": 300, + "h": 250 + }, + "ext": {} + }, { + "id": "test-impression-id-4" + }, { + "id": "test-impression-id-5", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "token": "test-token-5" + } + } + }, { + "id": "test-impression-id-0", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": "invalid bidder" + } + }, { + "id": "test-impression-id-0", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": {} + } + }, { + "id": "test-impression-id-0", + "banner": { + "w": 300, + "h": 250 + }, + "ext": "invalid ext" + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-5", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-5", + "banner": { + "h": 250, + "w": 300 + }, + "ext": { + "bidder": { + "token": "test-token-5" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id", + "seatbid": [{ + "bid": [{ + "id": "test-bid-id-5", + "impid": "test-impression-id-5", + "price": 5 + }, { + "id": "test-bid-id-6", + "impid": "test-impression-id-6", + "price": 6 + }] + }] + } + } + }], + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "id": "test-bid-id-5", + "impid": "test-impression-id-5", + "price": 5 + }, + "type": "banner" + }] + }], + "expectedMakeRequestsErrors": [{ + "value": "banner size information missing", + "comparison": "literal" + }, { + "value": "impression extensions required", + "comparison": "literal" + }, { + "value": "bidder required", + "comparison": "literal" + }, { + "value": "Applogy only supports banner, video or native ads", + "comparison": "literal" + }, { + "value": "json: cannot unmarshal string into Go value of type openrtb_ext.ExtImpApplogy", + "comparison": "literal" + }, { + "value": "Applogy token required", + "comparison": "literal" + }, { + "value": "json: cannot unmarshal string into Go value of type adapters.ExtImpBidder", + "comparison": "literal" + }], + "expectedMakeBidsErrors": [{ + "value": "ignoring bid id=test-bid-id-6, request doesn't contain any valid impression with id=test-impression-id-6", + "comparison": "literal" + }] +} diff --git a/adapters/applogy/applogytest/supplemental/status-204.json b/adapters/applogy/applogytest/supplemental/status-204.json new file mode 100644 index 00000000000..c3516b184b5 --- /dev/null +++ b/adapters/applogy/applogytest/supplemental/status-204.json @@ -0,0 +1,41 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-1", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "banner": { + "h": 250, + "w": 300 + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }] + } + }, + "mockResponse": { + "status": 204, + "body": {} + } + }] +} diff --git a/adapters/applogy/applogytest/supplemental/status-400.json b/adapters/applogy/applogytest/supplemental/status-400.json new file mode 100644 index 00000000000..95e271bae8e --- /dev/null +++ b/adapters/applogy/applogytest/supplemental/status-400.json @@ -0,0 +1,45 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-1", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "banner": { + "h": 250, + "w": 300 + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }] + } + }, + "mockResponse": { + "status": 400, + "body": {} + } + }], + "expectedMakeBidsErrors": [{ + "value": "unexpected status code: 400", + "comparison": "literal" + }] +} diff --git a/adapters/applogy/applogytest/supplemental/status-502.json b/adapters/applogy/applogytest/supplemental/status-502.json new file mode 100644 index 00000000000..c0b1641653a --- /dev/null +++ b/adapters/applogy/applogytest/supplemental/status-502.json @@ -0,0 +1,45 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://example.com/prebid/test-token-1", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-impression-id-1", + "banner": { + "h": 250, + "w": 300 + }, + "ext": { + "bidder": { + "token": "test-token-1" + } + } + }] + } + }, + "mockResponse": { + "status": 502, + "body": {} + } + }], + "expectedMakeBidsErrors": [{ + "value": "unexpected status code: 502", + "comparison": "literal" + }] +} diff --git a/adapters/appnexus/appnexus_test.go b/adapters/appnexus/appnexus_test.go index 7dc77b13ba5..48735aa20e0 100644 --- a/adapters/appnexus/appnexus_test.go +++ b/adapters/appnexus/appnexus_test.go @@ -16,10 +16,10 @@ import ( "fmt" + "github.com/mxmCherry/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/mxmCherry/openrtb" ) func TestJsonSamples(t *testing.T) { diff --git a/adapters/appnexus/appnexusplatformtest/exemplary/simple-auction.json b/adapters/appnexus/appnexusplatformtest/exemplary/simple-auction.json index 8e4f52951b8..03c3f4c5880 100644 --- a/adapters/appnexus/appnexusplatformtest/exemplary/simple-auction.json +++ b/adapters/appnexus/appnexusplatformtest/exemplary/simple-auction.json @@ -14,7 +14,7 @@ }, "ext": { "bidder": { - "placement_id": 10433394 + "placement_id": 1 } } } @@ -46,7 +46,7 @@ }, "ext": { "appnexus": { - "placement_id": 10433394 + "placement_id": 1 } } } diff --git a/adapters/appnexus/appnexusplatformtest/video/simple-video.json b/adapters/appnexus/appnexusplatformtest/video/simple-video.json index 3c28b48a083..85960427d81 100644 --- a/adapters/appnexus/appnexusplatformtest/video/simple-video.json +++ b/adapters/appnexus/appnexusplatformtest/video/simple-video.json @@ -14,7 +14,7 @@ }, "ext": { "bidder": { - "placement_id": 10433394 + "placement_id": 1 } } } @@ -46,7 +46,7 @@ }, "ext": { "appnexus": { - "placement_id": 10433394 + "placement_id": 1 } } } diff --git a/adapters/appnexus/appnexustest/amp/simple-banner.json b/adapters/appnexus/appnexustest/amp/simple-banner.json index b5ea656c822..646359b4267 100644 --- a/adapters/appnexus/appnexustest/amp/simple-banner.json +++ b/adapters/appnexus/appnexustest/amp/simple-banner.json @@ -18,7 +18,7 @@ }, "ext": { "bidder": { - "placement_id": 10433394 + "placement_id": 1 } } } @@ -58,7 +58,7 @@ }, "ext": { "appnexus": { - "placement_id": 10433394 + "placement_id": 1 } } } diff --git a/adapters/appnexus/appnexustest/amp/simple-video.json b/adapters/appnexus/appnexustest/amp/simple-video.json index f44ed06605c..a6f96be34b8 100644 --- a/adapters/appnexus/appnexustest/amp/simple-video.json +++ b/adapters/appnexus/appnexustest/amp/simple-video.json @@ -14,7 +14,7 @@ }, "ext": { "bidder": { - "placement_id": 10433394 + "placement_id": 1 } } } @@ -48,7 +48,7 @@ }, "ext": { "appnexus": { - "placement_id": 10433394 + "placement_id": 1 } } } diff --git a/adapters/appnexus/appnexustest/exemplary/simple-banner.json b/adapters/appnexus/appnexustest/exemplary/simple-banner.json index 976f35b208a..e5bd311648f 100644 --- a/adapters/appnexus/appnexustest/exemplary/simple-banner.json +++ b/adapters/appnexus/appnexustest/exemplary/simple-banner.json @@ -18,7 +18,7 @@ }, "ext": { "bidder": { - "placement_id": 10433394 + "placement_id": 1 } } } @@ -56,7 +56,7 @@ }, "ext": { "appnexus": { - "placement_id": 10433394 + "placement_id": 1 } } } diff --git a/adapters/appnexus/appnexustest/exemplary/simple-video.json b/adapters/appnexus/appnexustest/exemplary/simple-video.json index 5afef01fa64..15755c7de37 100644 --- a/adapters/appnexus/appnexustest/exemplary/simple-video.json +++ b/adapters/appnexus/appnexustest/exemplary/simple-video.json @@ -14,7 +14,7 @@ }, "ext": { "bidder": { - "placement_id": 10433394 + "placement_id": 1 } } } @@ -46,7 +46,7 @@ }, "ext": { "appnexus": { - "placement_id": 10433394 + "placement_id": 1 } } } diff --git a/adapters/appnexus/appnexustest/exemplary/video-invalid-category.json b/adapters/appnexus/appnexustest/exemplary/video-invalid-category.json index 283f13cf111..d3686af00a9 100644 --- a/adapters/appnexus/appnexustest/exemplary/video-invalid-category.json +++ b/adapters/appnexus/appnexustest/exemplary/video-invalid-category.json @@ -14,7 +14,7 @@ }, "ext": { "bidder": { - "placement_id": 10433394 + "placement_id": 1 } } } @@ -46,7 +46,7 @@ }, "ext": { "appnexus": { - "placement_id": 10433394 + "placement_id": 1 } } } diff --git a/adapters/appnexus/appnexustest/params/race/banner.json b/adapters/appnexus/appnexustest/params/race/banner.json index 2e2b39e9429..a37e0036357 100644 --- a/adapters/appnexus/appnexustest/params/race/banner.json +++ b/adapters/appnexus/appnexustest/params/race/banner.json @@ -1,5 +1,5 @@ { - "placement_id": 10433394, + "placement_id": 1, "reserve": 20, "position": "below", "traffic_source_code": "trafficSource", diff --git a/adapters/appnexus/appnexustest/params/race/video.json b/adapters/appnexus/appnexustest/params/race/video.json index 2e2b39e9429..a37e0036357 100644 --- a/adapters/appnexus/appnexustest/params/race/video.json +++ b/adapters/appnexus/appnexustest/params/race/video.json @@ -1,5 +1,5 @@ { - "placement_id": 10433394, + "placement_id": 1, "reserve": 20, "position": "below", "traffic_source_code": "trafficSource", diff --git a/adapters/appnexus/appnexustest/supplemental/displaymanager-test.json b/adapters/appnexus/appnexustest/supplemental/displaymanager-test.json index a1602ff9a74..d5c981c6945 100644 --- a/adapters/appnexus/appnexustest/supplemental/displaymanager-test.json +++ b/adapters/appnexus/appnexustest/supplemental/displaymanager-test.json @@ -26,7 +26,7 @@ }, "ext": { "bidder": { - "placement_id": 10433394 + "placement_id": 1 } } } @@ -73,7 +73,7 @@ "displaymanagerver": "prebid-mobile-1.0.0", "ext": { "appnexus": { - "placement_id": 10433394 + "placement_id": 1 } } } diff --git a/adapters/appnexus/appnexustest/supplemental/explicit-dimensions.json b/adapters/appnexus/appnexustest/supplemental/explicit-dimensions.json index 11b5d887187..06e7724a23b 100644 --- a/adapters/appnexus/appnexustest/supplemental/explicit-dimensions.json +++ b/adapters/appnexus/appnexustest/supplemental/explicit-dimensions.json @@ -16,7 +16,7 @@ }, "ext": { "bidder": { - "placementId": 10433394 + "placementId": 1 } } } @@ -49,7 +49,7 @@ }, "ext": { "appnexus": { - "placement_id": 10433394 + "placement_id": 1 } } } diff --git a/adapters/appnexus/appnexustest/supplemental/multi-bid.json b/adapters/appnexus/appnexustest/supplemental/multi-bid.json index 1e3089b1e71..7234551ea3f 100644 --- a/adapters/appnexus/appnexustest/supplemental/multi-bid.json +++ b/adapters/appnexus/appnexustest/supplemental/multi-bid.json @@ -18,7 +18,7 @@ }, "ext": { "bidder": { - "placement_id": 10433394 + "placement_id": 1 } } } @@ -56,7 +56,7 @@ }, "ext": { "appnexus": { - "placement_id": 10433394 + "placement_id": 1 } } } diff --git a/adapters/audienceNetwork/audienceNetworktest/supplemental/banner-format-only.json b/adapters/audienceNetwork/audienceNetworktest/supplemental/banner-format-only.json new file mode 100644 index 00000000000..52b7655593a --- /dev/null +++ b/adapters/audienceNetwork/audienceNetworktest/supplemental/banner-format-only.json @@ -0,0 +1,140 @@ +{ + "mockBidRequest": { + "id": "test-req-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 640, + "h": 480 + }, + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisherid": "123", + "placementid": "456" + } + } + } + ], + "site": { + "domain": "prebid.org", + "page": "prebid.org" + }, + "device": { + "ip": "152.193.6.74" + }, + "user": { + "id": "db089de9-a62e-4861-a881-0ff15e052516", + "buyeruid": "v4_bidder_token" + }, + "tmax": 500 + }, + "httpcalls": [ + { + "expectedRequest": { + "uri": "https://an.facebook.com/placementbid.ortb", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Fb-Pool-Routing-Token": [ + "v4_bidder_token" + ] + }, + "body": { + "id": "test-req-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": -1, + "h": 250 + }, + "tagid": "123_456" + } + ], + "ext": { + "appnexus": { + "hb_source": 5 + }, + "prebid": {} + }, + "site": { + "domain": "prebid.org", + "page": "prebid.org", + "publisher": { + "id": "123" + } + }, + "device": { + "ip": "152.193.6.74" + }, + "user": { + "id": "db089de9-a62e-4861-a881-0ff15e052516", + "buyeruid": "v4_bidder_token" + }, + "tmax": 500, + "ext": { + "authentication_id": "b2f9edfd707106adb6b692520081ad7e2a345444af1a895310228297a1b6247e", + "platformid": "test-platform-id" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-req-id", + "seatbid": [ + { + "bid": [ + { + "id": "987", + "impid": "test-imp-id", + "price": 1.000000, + "adm": "{\"type\":\"ID\",\"bid_id\":\"987\",\"placement_id\":\"123_456\",\"resolved_placement_id\":\"123_456\",\"sdk_version\":\"5.5.0\",\"device_id\":\"abc\",\"template\":1,\"payload\":null,\"bid_time_token\":\"v4_bidder_token=\"}", + "nurl": "https://www.facebook.com/audiencenetwork/nurl/?partner=test-platform-id&app=def&placement=456&auction=123&impression=123&request=123478&bid=987&ortb_loss_code=0&clearing_price=${AUCTION_PRICE}&app_version=iOS-1.0", + "lurl": "https://www.facebook.com/audiencenetwork/nurl/?partner=test-platform-id&app=def&placement=456&auction=123&impression=123&request=123478&bid=987&ortb_loss_code=${AUCTION_LOSS}&clearing_price=${AUCTION_PRICE}&app_version=iOS-1.0", + "burl": "https://www.facebook.com/audiencenetwork/burl/?partner=test-platform-id&app=def&placement=456&auction=123&impression=123&request=123478&bid=987&clearing_price=${AUCTION_PRICE}" + } + ] + } + ], + "bidid": "654", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "987", + "impid": "test-imp-id", + "price": 1, + "adm": "{\"type\":\"ID\",\"bid_id\":\"987\",\"placement_id\":\"123_456\",\"resolved_placement_id\":\"123_456\",\"sdk_version\":\"5.5.0\",\"device_id\":\"abc\",\"template\":1,\"payload\":null,\"bid_time_token\":\"v4_bidder_token=\"}", + "adid": "987", + "crid": "987", + "nurl": "https://www.facebook.com/audiencenetwork/nurl/?partner=test-platform-id&app=def&placement=456&auction=123&impression=123&request=123478&bid=987&ortb_loss_code=0&clearing_price=${AUCTION_PRICE}&app_version=iOS-1.0", + "lurl": "https://www.facebook.com/audiencenetwork/nurl/?partner=test-platform-id&app=def&placement=456&auction=123&impression=123&request=123478&bid=987&ortb_loss_code=${AUCTION_LOSS}&clearing_price=${AUCTION_PRICE}&app_version=iOS-1.0", + "burl": "https://www.facebook.com/audiencenetwork/burl/?partner=test-platform-id&app=def&placement=456&auction=123&impression=123&request=123478&bid=987&clearing_price=${AUCTION_PRICE}" + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/audienceNetwork/facebook.go b/adapters/audienceNetwork/facebook.go index 07304de4eeb..87075db9d45 100644 --- a/adapters/audienceNetwork/facebook.go +++ b/adapters/audienceNetwork/facebook.go @@ -184,8 +184,17 @@ func (this *FacebookAdapter) modifyImp(out *openrtb.Imp) error { } if out.Banner.H == nil { - return &errortypes.BadInput{ - Message: fmt.Sprintf("imp #%s: banner height required", out.ID), + for _, f := range out.Banner.Format { + if _, ok := supportedBannerHeights[f.H]; ok { + h := f.H + out.Banner.H = &h + break + } + } + if out.Banner.H == nil { + return &errortypes.BadInput{ + Message: fmt.Sprintf("imp #%s: banner height required", out.ID), + } } } diff --git a/adapters/beachfront/usersync_test.go b/adapters/beachfront/usersync_test.go index f2bb7e8c6b3..38efd0a54d7 100644 --- a/adapters/beachfront/usersync_test.go +++ b/adapters/beachfront/usersync_test.go @@ -5,20 +5,30 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestBeachfrontSyncer(t *testing.T) { - syncURL := "localhost" + syncURL := "https://sync.bfmio.com/sync_s2s?gdpr={{.GDPR}}&us_privacy={{.USPrivacy}}&url=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Dbeachfront%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5Bio_cid%5D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) syncer := NewBeachfrontSyncer(syncURLTemplate) - syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{}) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "A", + Consent: "B", + }, + CCPA: ccpa.Policy{ + Value: "C", + }, + }) assert.NoError(t, err) - assert.Equal(t, "localhost", syncInfo.URL) + assert.Equal(t, "https://sync.bfmio.com/sync_s2s?gdpr=A&us_privacy=C&url=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Dbeachfront%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D%5Bio_cid%5D", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/brightroll/usersync_test.go b/adapters/brightroll/usersync_test.go index 191f0effb48..1ca0325495e 100644 --- a/adapters/brightroll/usersync_test.go +++ b/adapters/brightroll/usersync_test.go @@ -9,7 +9,7 @@ import ( ) func TestBrightrollSyncer(t *testing.T) { - syncURL := "http://test-bh.ybp.yahoo.com/sync/appnexuspbs?gdpr={{.GDPR}}&euconsent={{.GDPRConsent}}&url=localhost%2Fsetuid%3Fbidder%3Dbrightroll%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUID%7D" + syncURL := "http://test-bh.ybp.yahoo.com/sync/appnexuspbs?gdpr={{.GDPR}}&euconsent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&url=localhost%2Fsetuid%3Fbidder%3Dbrightroll%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUID%7D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -18,7 +18,7 @@ func TestBrightrollSyncer(t *testing.T) { syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{}) assert.NoError(t, err) - assert.Equal(t, "http://test-bh.ybp.yahoo.com/sync/appnexuspbs?gdpr=&euconsent=&url=localhost%2Fsetuid%3Fbidder%3Dbrightroll%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24%7BUID%7D", syncInfo.URL) + assert.Equal(t, "http://test-bh.ybp.yahoo.com/sync/appnexuspbs?gdpr=&euconsent=&us_privacy=&url=localhost%2Fsetuid%3Fbidder%3Dbrightroll%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24%7BUID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) assert.EqualValues(t, 25, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/consumable/usersync_test.go b/adapters/consumable/usersync_test.go index a7487bcf16c..af332282208 100644 --- a/adapters/consumable/usersync_test.go +++ b/adapters/consumable/usersync_test.go @@ -5,12 +5,13 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestConsumableSyncer(t *testing.T) { - syncURL := "//e.serverbid.com/udb/9969/match?redir=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dconsumable%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D" + syncURL := "//e.serverbid.com/udb/9969/match?gdpr={{.GDPR}}&euconsent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dconsumable%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -18,12 +19,16 @@ func TestConsumableSyncer(t *testing.T) { syncer := NewConsumableSyncer(syncURLTemplate) u, err := syncer.GetUsersyncInfo(privacy.Policies{ GDPR: gdpr.Policy{ - Signal: "0", + Signal: "A", + Consent: "B", + }, + CCPA: ccpa.Policy{ + Value: "C", }, }) assert.NoError(t, err) - assert.Equal(t, "//e.serverbid.com/udb/9969/match?redir=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dconsumable%26gdpr%3D0%26gdpr_consent%3D%26uid%3D", u.URL) + assert.Equal(t, "//e.serverbid.com/udb/9969/match?gdpr=A&euconsent=B&us_privacy=C&redir=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dconsumable%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D", u.URL) assert.Equal(t, "redirect", u.Type) assert.Equal(t, uint16(65535), syncer.GDPRVendorID()) assert.Equal(t, false, u.SupportCORS) diff --git a/adapters/conversant/conversant.go b/adapters/conversant/conversant.go index 0146b8029db..928cfbb48e1 100644 --- a/adapters/conversant/conversant.go +++ b/adapters/conversant/conversant.go @@ -8,10 +8,10 @@ import ( "io/ioutil" "net/http" + "github.com/mxmCherry/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/mxmCherry/openrtb" "golang.org/x/net/context/ctxhttp" ) diff --git a/adapters/conversant/conversant_test.go b/adapters/conversant/conversant_test.go index 3060fcf89c4..8b0ca5f6454 100644 --- a/adapters/conversant/conversant_test.go +++ b/adapters/conversant/conversant_test.go @@ -11,12 +11,12 @@ import ( "testing" "time" + "github.com/mxmCherry/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/pbs" "github.com/PubMatic-OpenWrap/prebid-server/usersync" - "github.com/mxmCherry/openrtb" ) // Constants diff --git a/adapters/datablocks/usersync_test.go b/adapters/datablocks/usersync_test.go index e499ebb1a84..409503a2329 100644 --- a/adapters/datablocks/usersync_test.go +++ b/adapters/datablocks/usersync_test.go @@ -5,12 +5,13 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestDatablocksSyncer(t *testing.T) { - syncURL := "https://sync.v5prebid.datablocks.net/s2ssync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Ddatablocks%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7Buid%7D" + syncURL := "https://sync.v5prebid.datablocks.net/s2ssync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Ddatablocks%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7Buid%7D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -21,10 +22,13 @@ func TestDatablocksSyncer(t *testing.T) { Signal: "1", Consent: "BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw", }, + CCPA: ccpa.Policy{ + Value: "1NYN", + }, }) assert.NoError(t, err) - assert.Equal(t, "https://sync.v5prebid.datablocks.net/s2ssync?gdpr=1&gdpr_consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Ddatablocks%26gdpr%3D1%26gdpr_consent%3DBONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw%26uid%3D%24%7Buid%7D", syncInfo.URL) + assert.Equal(t, "https://sync.v5prebid.datablocks.net/s2ssync?gdpr=1&gdpr_consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&us_privacy=1NYN&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Ddatablocks%26gdpr%3D1%26gdpr_consent%3DBONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw%26uid%3D%24%7Buid%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) assert.EqualValues(t, datablocksGDPRVendorID, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/emx_digital/usersync_test.go b/adapters/emx_digital/usersync_test.go index 43a448934e0..971a202e87f 100644 --- a/adapters/emx_digital/usersync_test.go +++ b/adapters/emx_digital/usersync_test.go @@ -5,12 +5,13 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestEMXDigitalSyncer(t *testing.T) { - syncURL := "https://cs.emxdgt.com/um?ssp=pbs&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redirect=localhost%2Fsetuid%3Fbidder%3Demx_digital%26uid%3D%24UID" + syncURL := "https://cs.emxdgt.com/um?ssp=pbs&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect=localhost%2Fsetuid%3Fbidder%3Demx_digital%26uid%3D%24UID" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -21,10 +22,13 @@ func TestEMXDigitalSyncer(t *testing.T) { Signal: "1", Consent: "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA", }, + CCPA: ccpa.Policy{ + Value: "1NYN", + }, }) assert.NoError(t, err) - assert.Equal(t, "https://cs.emxdgt.com/um?ssp=pbs&gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&redirect=localhost%2Fsetuid%3Fbidder%3Demx_digital%26uid%3D%24UID", syncInfo.URL) + assert.Equal(t, "https://cs.emxdgt.com/um?ssp=pbs&gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&us_privacy=1NYN&redirect=localhost%2Fsetuid%3Fbidder%3Demx_digital%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) assert.EqualValues(t, 183, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/engagebdr/usersync_test.go b/adapters/engagebdr/usersync_test.go index 75a636ae96a..cb914eaa57e 100644 --- a/adapters/engagebdr/usersync_test.go +++ b/adapters/engagebdr/usersync_test.go @@ -5,12 +5,13 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestEngageBDRSyncer(t *testing.T) { - syncURL := "https://match.bnmla.com/usersync/prbds2s?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D" + syncURL := "https://match.bnmla.com/usersync/s2s?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r=localhost%2Fsetuid%3Fbidder%3Dengagebdr%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -21,10 +22,13 @@ func TestEngageBDRSyncer(t *testing.T) { Signal: "1", Consent: "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA", }, + CCPA: ccpa.Policy{ + Value: "1NYN", + }, }) assert.NoError(t, err) - assert.Equal(t, "https://match.bnmla.com/usersync/prbds2s?gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&r=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D", syncInfo.URL) + assert.Equal(t, "https://match.bnmla.com/usersync/s2s?gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&us_privacy=1NYN&r=localhost%2Fsetuid%3Fbidder%3Dengagebdr%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) assert.EqualValues(t, 62, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/gumgum/usersync_test.go b/adapters/gumgum/usersync_test.go index 3bc203b0019..884e7c6b462 100644 --- a/adapters/gumgum/usersync_test.go +++ b/adapters/gumgum/usersync_test.go @@ -5,12 +5,13 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestGumGumSyncer(t *testing.T) { - syncURL := "https://rtb.gumgum.com/usync/prbds2s?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D" + syncURL := "https://rtb.gumgum.com/usync/prbds2s?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -21,10 +22,13 @@ func TestGumGumSyncer(t *testing.T) { Signal: "1", Consent: "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA", }, + CCPA: ccpa.Policy{ + Value: "1NYN", + }, }) assert.NoError(t, err) - assert.Equal(t, "https://rtb.gumgum.com/usync/prbds2s?gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&r=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D", syncInfo.URL) + assert.Equal(t, "https://rtb.gumgum.com/usync/prbds2s?gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&us_privacy=1NYN&r=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) assert.EqualValues(t, 61, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/improvedigital/usersync_test.go b/adapters/improvedigital/usersync_test.go index ff9f739a8ae..70bea22363f 100644 --- a/adapters/improvedigital/usersync_test.go +++ b/adapters/improvedigital/usersync_test.go @@ -5,12 +5,13 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestImprovedigitalSyncer(t *testing.T) { - syncURL := "//not_localhost/synclocalhost%2Fsetuid%3Fbidder%3Dimprovedigital%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BPUB_USER_ID%7D" + syncURL := "https://ad.360yield.com/server_match?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r=%2Fsetuid%3Fbidder%3Dimprovedigital%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BPUB_USER_ID%7D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -18,12 +19,16 @@ func TestImprovedigitalSyncer(t *testing.T) { syncer := NewImprovedigitalSyncer(syncURLTemplate) syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ GDPR: gdpr.Policy{ - Signal: "0", + Signal: "A", + Consent: "B", + }, + CCPA: ccpa.Policy{ + Value: "C", }, }) assert.NoError(t, err) - assert.Equal(t, "//not_localhost/synclocalhost%2Fsetuid%3Fbidder%3Dimprovedigital%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%7BPUB_USER_ID%7D", syncInfo.URL) + assert.Equal(t, "https://ad.360yield.com/server_match?gdpr=A&gdpr_consent=B&us_privacy=C&r=%2Fsetuid%3Fbidder%3Dimprovedigital%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D%7BPUB_USER_ID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) assert.EqualValues(t, 253, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/lifestreet/lifestreet_test.go b/adapters/lifestreet/lifestreet_test.go index 5702c93b042..39ecf388c9f 100644 --- a/adapters/lifestreet/lifestreet_test.go +++ b/adapters/lifestreet/lifestreet_test.go @@ -16,9 +16,9 @@ import ( "fmt" + "github.com/mxmCherry/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/mxmCherry/openrtb" ) type lsTagInfo struct { diff --git a/adapters/lockerdome/usersync_test.go b/adapters/lockerdome/usersync_test.go index 6770595d436..acfa788e5f7 100644 --- a/adapters/lockerdome/usersync_test.go +++ b/adapters/lockerdome/usersync_test.go @@ -9,7 +9,7 @@ import ( ) func TestLockerDomeSyncer(t *testing.T) { - syncURL := "https://lockerdome.com/usync/prebidserver?pid=&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redirect=https%3A%2F%2Flocalhost%2Fsetuid%3Fbidder%3Dlockerdome%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7B%7Buid%7D%7D" + syncURL := "https://lockerdome.com/usync/prebidserver?pid=&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect=https%3A%2F%2Flocalhost%2Fsetuid%3Fbidder%3Dlockerdome%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7B%7Buid%7D%7D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -18,7 +18,7 @@ func TestLockerDomeSyncer(t *testing.T) { syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{}) assert.NoError(t, err) - assert.Equal(t, "https://lockerdome.com/usync/prebidserver?pid=&gdpr=&gdpr_consent=&redirect=https%3A%2F%2Flocalhost%2Fsetuid%3Fbidder%3Dlockerdome%26gdpr%3D%26gdpr_consent%3D%26uid%3D%7B%7Buid%7D%7D", syncInfo.URL) + assert.Equal(t, "https://lockerdome.com/usync/prebidserver?pid=&gdpr=&gdpr_consent=&us_privacy=&redirect=https%3A%2F%2Flocalhost%2Fsetuid%3Fbidder%3Dlockerdome%26gdpr%3D%26gdpr_consent%3D%26uid%3D%7B%7Buid%7D%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/marsmedia/marsmedia.go b/adapters/marsmedia/marsmedia.go new file mode 100644 index 00000000000..f38fb485e63 --- /dev/null +++ b/adapters/marsmedia/marsmedia.go @@ -0,0 +1,169 @@ +package marsmedia + +import ( + "encoding/json" + "fmt" + "net/http" + "strconv" + + "github.com/mxmCherry/openrtb" + "github.com/PubMatic-OpenWrap/prebid-server/adapters" + "github.com/PubMatic-OpenWrap/prebid-server/errortypes" + "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" +) + +type MarsmediaAdapter struct { + URI string +} + +func (a *MarsmediaAdapter) MakeRequests(requestIn *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + + request := *requestIn + + if len(request.Imp) == 0 { + return nil, []error{&errortypes.BadInput{ + Message: "No impression in the bid request", + }} + } + + var bidderExt adapters.ExtImpBidder + if err := json.Unmarshal(request.Imp[0].Ext, &bidderExt); err != nil { + return nil, []error{&errortypes.BadInput{ + Message: "ext.bidder not provided", + }} + } + + var marsmediaExt openrtb_ext.ExtImpMarsmedia + if err := json.Unmarshal(bidderExt.Bidder, &marsmediaExt); err != nil { + return nil, []error{&errortypes.BadInput{ + Message: "ext.bidder.zone not provided", + }} + } + + if marsmediaExt.ZoneID == "" { + return nil, []error{&errortypes.BadInput{ + Message: "Zone is empty", + }} + } + + validImpExists := false + for i := 0; i < len(request.Imp); i++ { + if request.Imp[i].Banner != nil { + bannerCopy := *requestIn.Imp[i].Banner + if len(bannerCopy.Format) > 0 { + firstFormat := bannerCopy.Format[0] + bannerCopy.W = &(firstFormat.W) + bannerCopy.H = &(firstFormat.H) + request.Imp[i].Banner = &bannerCopy + validImpExists = true + } else if bannerCopy.W != nil && bannerCopy.H != nil { + validImpExists = true + } else { + return nil, []error{&errortypes.BadInput{ + Message: "No valid banner format in the bid request", + }} + } + } else if request.Imp[i].Video != nil { + validImpExists = true + } + } + if !validImpExists { + return nil, []error{&errortypes.BadInput{ + Message: "No valid impression in the bid request", + }} + } + + request.AT = 1 //Defaulting to first price auction for all prebid requests + + reqJSON, err := json.Marshal(request) + if err != nil { + return nil, []error{&errortypes.BadInput{ + Message: fmt.Sprintf("Json not encoded. err: %s", err), + }} + } + + uri := a.URI + "&zone=" + marsmediaExt.ZoneID + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + headers.Add("x-openrtb-version", "2.5") + + if request.Device != nil { + addHeaderIfNonEmpty(headers, "User-Agent", request.Device.UA) + addHeaderIfNonEmpty(headers, "X-Forwarded-For", request.Device.IP) + addHeaderIfNonEmpty(headers, "Accept-Language", request.Device.Language) + if request.Device.DNT != nil { + addHeaderIfNonEmpty(headers, "DNT", strconv.Itoa(int(*request.Device.DNT))) + } + } + + return []*adapters.RequestData{{ + Method: "POST", + Uri: uri, + Body: reqJSON, + Headers: headers, + }}, []error{} +} + +func (a *MarsmediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { + + if response.StatusCode == http.StatusNoContent { + return nil, nil + } + + if response.StatusCode == http.StatusBadRequest { + return nil, []error{&errortypes.BadInput{ + Message: fmt.Sprintf("Unexpected status code: %d. ", response.StatusCode), + }} + } + + if response.StatusCode != http.StatusOK { + return nil, []error{&errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), + }} + } + + var bidResp openrtb.BidResponse + if err := json.Unmarshal(response.Body, &bidResp); err != nil { + return nil, []error{&errortypes.BadServerResponse{ + Message: fmt.Sprintf("Bad server response: %d. ", err), + }} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(bidResp.SeatBid[0].Bid)) + sb := bidResp.SeatBid[0] + for i := 0; i < len(sb.Bid); i++ { + bid := sb.Bid[i] + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &bid, + BidType: getMediaTypeForImp(bid.ImpID, internalRequest.Imp), + }) + } + return bidResponse, nil +} + +func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue string) { + if len(headerValue) > 0 { + headers.Add(headerName, headerValue) + } +} + +// getMediaTypeForImp figures out which media type this bid is for. +func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { + mediaType := openrtb_ext.BidTypeBanner //default type + for _, imp := range imps { + if imp.ID == impId { + if imp.Video != nil { + mediaType = openrtb_ext.BidTypeVideo + } + return mediaType + } + } + return mediaType +} + +func NewMarsmediaBidder(endpoint string) *MarsmediaAdapter { + return &MarsmediaAdapter{ + URI: endpoint, + } +} diff --git a/adapters/marsmedia/marsmedia_test.go b/adapters/marsmedia/marsmedia_test.go new file mode 100644 index 00000000000..6b93e755834 --- /dev/null +++ b/adapters/marsmedia/marsmedia_test.go @@ -0,0 +1,11 @@ +package marsmedia + +import ( + "testing" + + "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" +) + +func TestJsonSamples(t *testing.T) { + adapterstest.RunJSONBidderTest(t, "marsmediatest", NewMarsmediaBidder("http://bid306.rtbsrv.com/bidder/?bid=f3xtet")) +} diff --git a/adapters/marsmedia/marsmediatest/exemplary/simple-banner.json b/adapters/marsmedia/marsmediatest/exemplary/simple-banner.json new file mode 100644 index 00000000000..17f2c038cb0 --- /dev/null +++ b/adapters/marsmedia/marsmediatest/exemplary/simple-banner.json @@ -0,0 +1,105 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "at" : 1, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zone": "9999" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://bid306.rtbsrv.com/bidder/?bid=f3xtet&zone=9999", + "body": { + "id": "test-request-id", + "at" : 1, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "zone": "9999" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "marsmedia", + "bid": [{ + "id": "1", + "impid": "test-imp-id", + "price": 1.1, + "adid": "17586", + "adm": "some-test-ad", + "nurl" : "some-test-nurl", + "iurl" : "some-test-iurl", + "adomain": ["wooga.com"], + "cid": "17586", + "crid": "17586", + "h": 250, + "w": 300 + }] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + + "expectedBids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": ["yahoo.com"], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300 + }, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ] +} diff --git a/adapters/marsmedia/marsmediatest/exemplary/simple-video.json b/adapters/marsmedia/marsmediatest/exemplary/simple-video.json new file mode 100644 index 00000000000..3a636374563 --- /dev/null +++ b/adapters/marsmedia/marsmediatest/exemplary/simple-video.json @@ -0,0 +1,85 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "protocols": [2, 5], + "w": 1024, + "h": 576 + }, + "ext":{ + "bidder":{ + "zone": "9999" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://bid306.rtbsrv.com/bidder/?bid=f3xtet&zone=9999", + "body": { + "id": "test-request-id", + "at":1, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "protocols": [2, 5], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "zone": "9999" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "Marsmedia", + "bid": [{ + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "w": 1024, + "h": 576 + }] + } + ] + } + } + } + ], + + "expectedBids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "crid": "crid_10", + "w": 1024, + "h": 576 + }, + "type": "video" + } + ] +} diff --git a/adapters/marsmedia/marsmediatest/exemplary/valid-extension.json b/adapters/marsmedia/marsmediatest/exemplary/valid-extension.json new file mode 100644 index 00000000000..38bacb19d6b --- /dev/null +++ b/adapters/marsmedia/marsmediatest/exemplary/valid-extension.json @@ -0,0 +1,85 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "protocols": [2, 5], + "w": 1024, + "h": 576 + }, + "ext":{ + "bidder":{ + "zone": "9999" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://bid306.rtbsrv.com/bidder/?bid=f3xtet&zone=9999", + "body": { + "id": "test-request-id", + "at":1, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "protocols": [2, 5], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "zone": "9999" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "Marsmedia", + "bid": [{ + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "w": 1024, + "h": 576 + }] + } + ] + } + } + } + ], + + "expectedBids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "crid": "crid_10", + "w": 1024, + "h": 576 + }, + "type": "video" + } + ] +} diff --git a/adapters/marsmedia/marsmediatest/params/race/banner.json b/adapters/marsmedia/marsmediatest/params/race/banner.json new file mode 100644 index 00000000000..3a7279576be --- /dev/null +++ b/adapters/marsmedia/marsmediatest/params/race/banner.json @@ -0,0 +1,3 @@ +{ + "zone": "9999" +} diff --git a/adapters/marsmedia/marsmediatest/params/race/video.json b/adapters/marsmedia/marsmediatest/params/race/video.json new file mode 100644 index 00000000000..3a7279576be --- /dev/null +++ b/adapters/marsmedia/marsmediatest/params/race/video.json @@ -0,0 +1,3 @@ +{ + "zone": "9999" +} diff --git a/adapters/marsmedia/marsmediatest/supplemental/invalid-extension.json b/adapters/marsmedia/marsmediatest/supplemental/invalid-extension.json new file mode 100644 index 00000000000..4ee31fe4cbf --- /dev/null +++ b/adapters/marsmedia/marsmediatest/supplemental/invalid-extension.json @@ -0,0 +1,31 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-invalid-ext-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + } + + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "ext.bidder.zone not provided", + "comparison": "literal" + } + ] +} diff --git a/adapters/marsmedia/marsmediatest/supplemental/invalid-imp.json b/adapters/marsmedia/marsmediatest/supplemental/invalid-imp.json new file mode 100644 index 00000000000..641066d719f --- /dev/null +++ b/adapters/marsmedia/marsmediatest/supplemental/invalid-imp.json @@ -0,0 +1,16 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "ext": { + "bidder": { + "zone": "9999" + } + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "No impression in the bid request", + "comparison": "literal" + } + ] +} diff --git a/adapters/marsmedia/marsmediatest/supplemental/missing-extension.json b/adapters/marsmedia/marsmediatest/supplemental/missing-extension.json new file mode 100644 index 00000000000..82ec775da30 --- /dev/null +++ b/adapters/marsmedia/marsmediatest/supplemental/missing-extension.json @@ -0,0 +1,22 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-missing-ext-id", + "video": { + "mimes": ["video/mp4"], + "protocols": [2, 5], + "w": 1024, + "h": 576 + } + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "ext.bidder not provided", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/marsmedia/marsmediatest/supplemental/missing-param.json b/adapters/marsmedia/marsmediatest/supplemental/missing-param.json new file mode 100644 index 00000000000..70117f3bcd0 --- /dev/null +++ b/adapters/marsmedia/marsmediatest/supplemental/missing-param.json @@ -0,0 +1,34 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-missing-req-param-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "zone":"" + } + } + + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "Zone is empty", + "comparison": "literal" + } + ] +} diff --git a/adapters/marsmedia/params_test.go b/adapters/marsmedia/params_test.go new file mode 100644 index 00000000000..2e3b483824d --- /dev/null +++ b/adapters/marsmedia/params_test.go @@ -0,0 +1,59 @@ +package marsmedia + +import ( + "encoding/json" + "testing" + + "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" +) + +// This file actually intends to test static/bidder-params/marsmedia.json +// +// These also validate the format of the external API: request.imp[i].ext.marsmedia + +// TestValidParams makes sure that the Marsmedia schema accepts all imp.ext fields which we intend to support. +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderMarsmedia, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected Marsmedia params: %s", validParam) + } + } +} + +// TestInvalidParams makes sure that the Marsmedia schema rejects all the imp.ext fields we don't support. +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, invalidParam := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderMarsmedia, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"zone": "9999"}`, +} + +var invalidParams = []string{ + `{"zone": 100}`, + `{"headerbidding": false}`, + `{"zone": true}`, + `{"zoneId": 123, "headerbidding": true}`, + `{"zoneID": "1"}`, + ``, + `null`, + `true`, + `9`, + `1.2`, + `[]`, + `{}`, +} diff --git a/adapters/marsmedia/usersync.go b/adapters/marsmedia/usersync.go new file mode 100644 index 00000000000..63d06d9dcc5 --- /dev/null +++ b/adapters/marsmedia/usersync.go @@ -0,0 +1,12 @@ +package marsmedia + +import ( + "text/template" + + "github.com/PubMatic-OpenWrap/prebid-server/adapters" + "github.com/PubMatic-OpenWrap/prebid-server/usersync" +) + +func NewMarsmediaSyncer(temp *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("marsmedia", 0, temp, adapters.SyncTypeRedirect) +} diff --git a/adapters/marsmedia/usersync_test.go b/adapters/marsmedia/usersync_test.go new file mode 100644 index 00000000000..c5d04cf6a8f --- /dev/null +++ b/adapters/marsmedia/usersync_test.go @@ -0,0 +1,36 @@ +package marsmedia + +import ( + "testing" + "text/template" + + "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/stretchr/testify/assert" +) + +func TestMarsmediaSyncer(t *testing.T) { + syncURL := "https://dmp.rtbsrv.com/dmp/profiles/cm?p_id=179&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect=localhost:8000%2Fsetuid%3Fbidder%3Dmarsmedia%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D" + syncURLTemplate := template.Must( + template.New("sync-template").Parse(syncURL), + ) + + syncer := NewMarsmediaSyncer(syncURLTemplate) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "A", + Consent: "B", + }, + CCPA: ccpa.Policy{ + Value: "C", + }, + }) + + assert.NoError(t, err) + assert.Equal(t, "https://dmp.rtbsrv.com/dmp/profiles/cm?p_id=179&gdpr=A&gdpr_consent=B&us_privacy=C&redirect=localhost:8000%2Fsetuid%3Fbidder%3Dmarsmedia%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D%24%7BUUID%7D", syncInfo.URL) + assert.Equal(t, "redirect", syncInfo.Type) + assert.EqualValues(t, 0, syncer.GDPRVendorID()) + assert.Equal(t, false, syncInfo.SupportCORS) + +} diff --git a/adapters/mgid/mgid_test.go b/adapters/mgid/mgid_test.go index 7a1f8f040e6..d768db2d64c 100644 --- a/adapters/mgid/mgid_test.go +++ b/adapters/mgid/mgid_test.go @@ -1,9 +1,8 @@ package mgid import ( - "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" + "testing" ) func TestJsonSamples(t *testing.T) { diff --git a/adapters/pubmatic/usersync_test.go b/adapters/pubmatic/usersync_test.go index 15032c2dda6..fb702cbc349 100644 --- a/adapters/pubmatic/usersync_test.go +++ b/adapters/pubmatic/usersync_test.go @@ -5,12 +5,13 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestPubmaticSyncer(t *testing.T) { - syncURL := "//ads.pubmatic.com/AdServer/js/user_sync.html?predirect=localhost%2Fsetuid%3Fbidder%3Dpubmatic%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D" + syncURL := "//ads.pubmatic.com/AdServer/js/user_sync.html?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&predirect=localhost%2Fsetuid%3Fbidder%3Dpubmatic%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -18,13 +19,15 @@ func TestPubmaticSyncer(t *testing.T) { syncer := NewPubmaticSyncer(syncURLTemplate) syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ GDPR: gdpr.Policy{ - Signal: "1", - Consent: "BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw", + Signal: "A", + Consent: "B", + }, + CCPA: ccpa.Policy{ + Value: "C", }, }) - assert.NoError(t, err) - assert.Equal(t, "//ads.pubmatic.com/AdServer/js/user_sync.html?predirect=localhost%2Fsetuid%3Fbidder%3Dpubmatic%26gdpr%3D1%26gdpr_consent%3DBONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw%26uid%3D", syncInfo.URL) + assert.Equal(t, "//ads.pubmatic.com/AdServer/js/user_sync.html?gdpr=A&gdpr_consent=B&us_privacy=C&predirect=localhost%2Fsetuid%3Fbidder%3Dpubmatic%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) assert.EqualValues(t, 76, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/rhythmone/usersync_test.go b/adapters/rhythmone/usersync_test.go index 66939c55009..020b5eac29e 100644 --- a/adapters/rhythmone/usersync_test.go +++ b/adapters/rhythmone/usersync_test.go @@ -5,12 +5,13 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestRhythmoneSyncer(t *testing.T) { - syncURL := "https://sync.1rx.io/usersync2/rmphb?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir=localhost%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BRX_UUID%5D" + syncURL := "https://sync.1rx.io/usersync2/rmphb?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir=localhost%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BRX_UUID%5D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -21,10 +22,13 @@ func TestRhythmoneSyncer(t *testing.T) { Signal: "1", Consent: "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA", }, + CCPA: ccpa.Policy{ + Value: "1NYN", + }, }) assert.NoError(t, err) - assert.Equal(t, "https://sync.1rx.io/usersync2/rmphb?gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&redir=localhost%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D%5BRX_UUID%5D", syncInfo.URL) + assert.Equal(t, "https://sync.1rx.io/usersync2/rmphb?gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&us_privacy=1NYN&redir=localhost%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D%5BRX_UUID%5D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) assert.EqualValues(t, 36, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/rubicon/rubicon.go b/adapters/rubicon/rubicon.go index cac8a81e97b..0fa6c51903c 100644 --- a/adapters/rubicon/rubicon.go +++ b/adapters/rubicon/rubicon.go @@ -685,6 +685,13 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap isVideo := isVideo(thisImp) if isVideo { + if rubiconExt.Video.VideoSizeID == 0 { + errs = append(errs, &errortypes.BadInput{ + Message: fmt.Sprintf("imp[%d].ext.bidder.rubicon.video.size_id must be defined for video impression", i), + }) + continue + } + videoCopy := *thisImp.Video videoExt := rubiconVideoExt{Skip: rubiconExt.Video.Skip, SkipDelay: rubiconExt.Video.SkipDelay, RP: rubiconVideoExtRP{SizeID: rubiconExt.Video.VideoSizeID}} videoCopy.Ext, err = json.Marshal(&videoExt) diff --git a/adapters/rubicon/rubicon_test.go b/adapters/rubicon/rubicon_test.go index 53cb392560d..c12443ac4e9 100644 --- a/adapters/rubicon/rubicon_test.go +++ b/adapters/rubicon/rubicon_test.go @@ -1244,8 +1244,9 @@ func TestOpenRTBRequestWithVideoImpEvenIfImpHasBannerButAllRequiredVideoFields(t "zoneId": 8394, "siteId": 283282, "accountId": 7891, - "inventory": {"key1" : "val1"}, - "visitor": {"key2" : "val2"} + "inventory": {"key1": "val1"}, + "visitor": {"key2": "val2"}, + "video": {"size_id": 1} }}`), }}, } diff --git a/adapters/rubicon/rubicontest/supplemental/required-video-size-id.json b/adapters/rubicon/rubicontest/supplemental/required-video-size-id.json new file mode 100644 index 00000000000..cf0a594e13c --- /dev/null +++ b/adapters/rubicon/rubicontest/supplemental/required-video-size-id.json @@ -0,0 +1,31 @@ +{ + "mockBidRequest": { + "id": "test-req-id", + "imp": [ + { + "id": "test-imp-1", + "video": { + "w": 640, + "h": 480, + "linearity": 1 + }, + "ext": { + "bidder": { + "accountId": 1001, + "siteId":113932, + "zoneId":535510 + } + } + } + ], + "site": { + "page": "prebid.org" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "imp[0].ext.bidder.rubicon.video.size_id must be defined for video impression", + "comparison": "literal" + } + ] +} diff --git a/adapters/triplelift/usersync_test.go b/adapters/triplelift/usersync_test.go index 67735cff1dc..30b1a33b3e9 100644 --- a/adapters/triplelift/usersync_test.go +++ b/adapters/triplelift/usersync_test.go @@ -9,7 +9,7 @@ import ( ) func TestTripleliftSyncer(t *testing.T) { - syncURL := "//eb2.3lift.com/getuid?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&redir=https%3A%2F%2Feb2.3lift.com%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID" + syncURL := "//eb2.3lift.com/getuid?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir=https%3A%2F%2Feb2.3lift.com%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -18,7 +18,7 @@ func TestTripleliftSyncer(t *testing.T) { syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{}) assert.NoError(t, err) - assert.Equal(t, "//eb2.3lift.com/getuid?gdpr=&cmp_cs=&redir=https%3A%2F%2Feb2.3lift.com%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) + assert.Equal(t, "//eb2.3lift.com/getuid?gdpr=&cmp_cs=&us_privacy=&redir=https%3A%2F%2Feb2.3lift.com%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) assert.EqualValues(t, 28, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/triplelift_native/usersync_test.go b/adapters/triplelift_native/usersync_test.go index 8ec24e3a673..ec229e2e68c 100644 --- a/adapters/triplelift_native/usersync_test.go +++ b/adapters/triplelift_native/usersync_test.go @@ -9,7 +9,7 @@ import ( ) func TestTripleliftSyncer(t *testing.T) { - syncURL := "//eb2.3lift.com/getuid?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&redir=https%3A%2F%2Feb2.3lift.com%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID" + syncURL := "//eb2.3lift.com/getuid?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir=https%3A%2F%2Feb2.3lift.com%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -18,7 +18,7 @@ func TestTripleliftSyncer(t *testing.T) { syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{}) assert.NoError(t, err) - assert.Equal(t, "//eb2.3lift.com/getuid?gdpr=&cmp_cs=&redir=https%3A%2F%2Feb2.3lift.com%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) + assert.Equal(t, "//eb2.3lift.com/getuid?gdpr=&cmp_cs=&us_privacy=&redir=https%3A%2F%2Feb2.3lift.com%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) assert.EqualValues(t, 28, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/unruly/usersync_test.go b/adapters/unruly/usersync_test.go index d1a5a2b5830..29ed7a0b1b7 100644 --- a/adapters/unruly/usersync_test.go +++ b/adapters/unruly/usersync_test.go @@ -5,12 +5,13 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestUnrulySyncer(t *testing.T) { - syncURL := "//unrulymedia.com/pixel?redir=external.com%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID" + syncURL := "https://usermatch.targeting.unrulymedia.com/pbsync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&rurl=%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -18,12 +19,16 @@ func TestUnrulySyncer(t *testing.T) { syncer := NewUnrulySyncer(syncURLTemplate) syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ GDPR: gdpr.Policy{ - Signal: "0", + Signal: "A", + Consent: "B", + }, + CCPA: ccpa.Policy{ + Value: "C", }, }) assert.NoError(t, err) - assert.Equal(t, "//unrulymedia.com/pixel?redir=external.com%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) + assert.Equal(t, "https://usermatch.targeting.unrulymedia.com/pbsync?gdpr=A&consent=B&us_privacy=C&rurl=%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) assert.EqualValues(t, 162, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/visx/usersync_test.go b/adapters/visx/usersync_test.go index d8a64078a88..8854a5afef5 100644 --- a/adapters/visx/usersync_test.go +++ b/adapters/visx/usersync_test.go @@ -5,12 +5,13 @@ import ( "text/template" "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) func TestVisxSyncer(t *testing.T) { - syncURL := "//not_localhost/synclocalhost%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D" + syncURL := "https://t.visx.net/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir=%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -18,12 +19,16 @@ func TestVisxSyncer(t *testing.T) { syncer := NewVisxSyncer(syncURLTemplate) syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ GDPR: gdpr.Policy{ - Signal: "0", + Signal: "A", + Consent: "B", + }, + CCPA: ccpa.Policy{ + Value: "C", }, }) assert.NoError(t, err) - assert.Equal(t, "//not_localhost/synclocalhost%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24%7BUUID%7D", syncInfo.URL) + assert.Equal(t, "https://t.visx.net/s2s_sync?gdpr=A&gdpr_consent=B&us_privacy=C&redir=%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D%24%7BUUID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/adapters/yieldmo/usersync_test.go b/adapters/yieldmo/usersync_test.go index 2ae0d1d8e43..10cba77a060 100644 --- a/adapters/yieldmo/usersync_test.go +++ b/adapters/yieldmo/usersync_test.go @@ -10,7 +10,7 @@ import ( ) func TestYieldmoSyncer(t *testing.T) { - syncURL := "//ads.yieldmo.com/pbsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redirectUri=http%3A%2F%2Flocalhost%2F%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID" + syncURL := "//ads.yieldmo.com/pbsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirectUri=http%3A%2F%2Flocalhost%2F%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -23,7 +23,7 @@ func TestYieldmoSyncer(t *testing.T) { }) assert.NoError(t, err) - assert.Equal(t, "//ads.yieldmo.com/pbsync?gdpr=0&gdpr_consent=&redirectUri=http%3A%2F%2Flocalhost%2F%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) + assert.Equal(t, "//ads.yieldmo.com/pbsync?gdpr=0&gdpr_consent=&us_privacy=&redirectUri=http%3A%2F%2Flocalhost%2F%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.False(t, syncInfo.SupportCORS) diff --git a/analytics/config/config.go b/analytics/config/config.go index 7cd80a16d2a..181f6dec04e 100644 --- a/analytics/config/config.go +++ b/analytics/config/config.go @@ -29,6 +29,12 @@ func (ea enabledAnalytics) LogAuctionObject(ao *analytics.AuctionObject) { } } +func (ea enabledAnalytics) LogVideoObject(vo *analytics.VideoObject) { + for _, module := range ea { + module.LogVideoObject(vo) + } +} + func (ea enabledAnalytics) LogCookieSyncObject(cso *analytics.CookieSyncObject) { for _, module := range ea { module.LogCookieSyncObject(cso) diff --git a/analytics/config/config_test.go b/analytics/config/config_test.go index 097c557065b..6326a5e656a 100644 --- a/analytics/config/config_test.go +++ b/analytics/config/config_test.go @@ -45,6 +45,11 @@ func TestSampleModule(t *testing.T) { if count != 4 { t.Errorf("PBSAnalyticsModule failed at LogAmpObject") } + + am.LogVideoObject(&analytics.VideoObject{}) + if count != 5 { + t.Errorf("PBSAnalyticsModule failed at LogVideoObject") + } } type sampleModule struct { @@ -53,6 +58,8 @@ type sampleModule struct { func (m *sampleModule) LogAuctionObject(ao *analytics.AuctionObject) { *m.count++ } +func (m *sampleModule) LogVideoObject(vo *analytics.VideoObject) { *m.count++ } + func (m *sampleModule) LogCookieSyncObject(cso *analytics.CookieSyncObject) { *m.count++ } func (m *sampleModule) LogSetUIDObject(so *analytics.SetUIDObject) { *m.count++ } diff --git a/analytics/core.go b/analytics/core.go index 98a9abcf087..c33e8ad6c76 100644 --- a/analytics/core.go +++ b/analytics/core.go @@ -2,6 +2,7 @@ package analytics import ( "github.com/mxmCherry/openrtb" + "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/usersync" ) @@ -15,6 +16,7 @@ import ( type PBSAnalyticsModule interface { LogAuctionObject(*AuctionObject) + LogVideoObject(*VideoObject) LogCookieSyncObject(*CookieSyncObject) LogSetUIDObject(*SetUIDObject) LogAmpObject(*AmpObject) @@ -38,6 +40,16 @@ type AmpObject struct { Origin string } +//Loggable object of a transaction at /openrtb2/video endpoint +type VideoObject struct { + Status int + Errors []error + Request *openrtb.BidRequest + Response *openrtb.BidResponse + VideoRequest *openrtb_ext.BidRequestVideo + VideoResponse *openrtb_ext.BidResponseVideo +} + //Loggable object of a transaction at /setuid type SetUIDObject struct { Status int diff --git a/analytics/filesystem/file_module.go b/analytics/filesystem/file_module.go index 20bfb8cb893..dc513df03a9 100644 --- a/analytics/filesystem/file_module.go +++ b/analytics/filesystem/file_module.go @@ -14,6 +14,7 @@ type RequestType string const ( COOKIE_SYNC RequestType = "/cookie_sync" AUCTION RequestType = "/openrtb2/auction" + VIDEO RequestType = "/openrtb2/video" SETUID RequestType = "/set_uid" AMP RequestType = "/openrtb2/amp" ) @@ -32,6 +33,15 @@ func (f *FileLogger) LogAuctionObject(ao *analytics.AuctionObject) { f.Logger.Flush() } +//Writes VideoObject to file +func (f *FileLogger) LogVideoObject(vo *analytics.VideoObject) { + //Code to parse the object and log in a way required + var b bytes.Buffer + b.WriteString(jsonifyVideoObject(vo)) + f.Logger.Debug(b.String()) + f.Logger.Flush() +} + //Logs SetUIDObject to file func (f *FileLogger) LogSetUIDObject(so *analytics.SetUIDObject) { //Code to parse the object and log in a way required @@ -98,6 +108,23 @@ func jsonifyAuctionObject(ao *analytics.AuctionObject) string { } } +func jsonifyVideoObject(vo *analytics.VideoObject) string { + type alias analytics.VideoObject + b, err := json.Marshal(&struct { + Type RequestType `json:"type"` + *alias + }{ + Type: VIDEO, + alias: (*alias)(vo), + }) + + if err == nil { + return string(b) + } else { + return fmt.Sprintf("Transactional Logs Error: Video object badly formed %v", err) + } +} + func jsonifyCookieSync(cso *analytics.CookieSyncObject) string { type alias analytics.CookieSyncObject diff --git a/analytics/filesystem/file_module_test.go b/analytics/filesystem/file_module_test.go index 36e90d76659..9835a273e1a 100644 --- a/analytics/filesystem/file_module_test.go +++ b/analytics/filesystem/file_module_test.go @@ -34,6 +34,15 @@ func TestAuctionObject_ToJson(t *testing.T) { } } +func TestVideoObject_ToJson(t *testing.T) { + vo := &analytics.VideoObject{ + Status: http.StatusOK, + } + if voJson := jsonifyVideoObject(vo); strings.Contains(voJson, "Transactional Logs Error") { + t.Fatalf("AuctionObject failed to convert to json") + } +} + func TestSetUIDObject_ToJson(t *testing.T) { so := &analytics.SetUIDObject{ Status: http.StatusOK, @@ -64,6 +73,7 @@ func TestFileLogger_LogObjects(t *testing.T) { defer os.RemoveAll(TEST_DIR) if fl, err := NewFileLogger(TEST_DIR + "//test"); err == nil { fl.LogAuctionObject(&analytics.AuctionObject{}) + fl.LogVideoObject(&analytics.VideoObject{}) fl.LogAmpObject(&analytics.AmpObject{}) fl.LogSetUIDObject(&analytics.SetUIDObject{}) fl.LogCookieSyncObject(&analytics.CookieSyncObject{}) diff --git a/config/config.go b/config/config.go index 7ad474aa70e..5935123b3e4 100644 --- a/config/config.go +++ b/config/config.go @@ -484,36 +484,37 @@ func (cfg *Configuration) GetCachedAssetURL(uuid string) string { // func (cfg *Configuration) setDerivedDefaults() { externalURL := cfg.ExternalURL - setDefaultUsersync(cfg.Adapters, openrtb_ext.Bidder33Across, "https://ic.tynt.com/r/d?m=xch&rt=html&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&ru="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3D33across%26uid%3D33XUSERID33X&id=zzz000000000002zzz") + setDefaultUsersync(cfg.Adapters, openrtb_ext.Bidder33Across, "https://ic.tynt.com/r/d?m=xch&rt=html&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&ru="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3D33across%26uid%3D33XUSERID33X&id=zzz000000000002zzz") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdform, "https://cm.adform.net/cookie?redirect_url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadform%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdkernel, "https://sync.adkernel.com/user-sync?t=image&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadkernel%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BUID%7D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdkernelAdn, "https://tag.adkernel.com/syncr?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3DadkernelAdn%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BUID%7D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdkernel, "https://sync.adkernel.com/user-sync?t=image&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadkernel%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BUID%7D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdkernelAdn, "https://tag.adkernel.com/syncr?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3DadkernelAdn%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BUID%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdpone, "https://usersync.adpone.com/csync?redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadpone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Buid%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdtelligent, "https://sync.adtelligent.com/csync?t=p&ep=0&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadtelligent%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Buid%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdvangelists, "https://nep.advangelists.com/xp/user-sync?acctid={aid}&&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadvangelists%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAppnexus, "https://ib.adnxs.com/getuid?"+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadnxs%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderBeachfront, "https://sync.bfmio.com/sync_s2s?gdpr={{.GDPR}}&url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dbeachfront%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5Bio_cid%5D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderBrightroll, "https://pr-bh.ybp.yahoo.com/sync/appnexusprebidserver/?gdpr={{.GDPR}}&euconsent={{.GDPRConsent}}&url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dbrightroll%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderConsumable, "https://e.serverbid.com/udb/9969/match?gdpr={{.GDPR}}&euconsent={{.GDPRConsent}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dconsumable%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderConversant, "https://prebid-match.dotomi.com/PubMatic-OpenWrap/match?rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dconversant%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderDatablocks, "https://sync.v5prebid.datablocks.net/s2ssync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Ddatablocks%26gdpr%3D%24%7Bgdpr%7D%26gdpr_consent%3D%24%7Bgdpr_consent%7D%26uid%3D%24%7Buid%7D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEmxDigital, "https://cs.emxdgt.com/um?ssp=pbs&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Demx_digital%26uid%3D%24UID") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEngageBDR, "https://match.bnmla.com/usersync/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderBeachfront, "https://sync.bfmio.com/sync_s2s?gdpr={{.GDPR}}&us_privacy={{.USPrivacy}}&url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dbeachfront%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5Bio_cid%5D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderBrightroll, "https://pr-bh.ybp.yahoo.com/sync/appnexusprebidserver/?gdpr={{.GDPR}}&euconsent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dbrightroll%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderConsumable, "https://e.serverbid.com/udb/9969/match?gdpr={{.GDPR}}&euconsent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dconsumable%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderConversant, "https://prebid-match.dotomi.com/prebid/match?rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dconversant%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderDatablocks, "https://sync.v5prebid.datablocks.net/s2ssync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Ddatablocks%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7Buid%7D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEmxDigital, "https://cs.emxdgt.com/um?ssp=pbs&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Demx_digital%26uid%3D%24UID") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEngageBDR, "https://match.bnmla.com/usersync/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dengagebdr%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEPlanning, "https://ads.us.e-planning.net/uspd/1/?du=https%3A%2F%2Fads.us.e-planning.net%2Fgetuid%2F1%2F5a1ad71d2d53a0f5%3F"+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Deplanning%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") // openrtb_ext.BidderFacebook doesn't have a good default. // openrtb_ext.BidderGamma doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderGamoshi, "https://rtb.gamoshi.io/user_sync_prebid?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dgamoshi%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5Bgusr%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderGrid, "https://x.bidswitch.net/check_uuid/"+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dgrid%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BBSW_UUID%7D?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderGumGum, "https://rtb.gumgum.com/usync/prbds2s?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderImprovedigital, "https://ad.360yield.com/server_match?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dimprovedigital%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BPUB_USER_ID%7D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderGumGum, "https://rtb.gumgum.com/usync/prbds2s?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderImprovedigital, "https://ad.360yield.com/server_match?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dimprovedigital%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BPUB_USER_ID%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderIx, "https://ssum.casalemedia.com/usermatchredir?s=184932&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dix%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderLifestreet, "https://ads.lfstmedia.com/idsync/137062?synced=1&ttl=1s&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dlifestreet%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%24visitor_cookie%24%24") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderLockerDome, "https://lockerdome.com/usync/prebidserver?pid="+cfg.Adapters["lockerdome"].PlatformID+"&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dlockerdome%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7B%7Buid%7D%7D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderLockerDome, "https://lockerdome.com/usync/prebidserver?pid="+cfg.Adapters["lockerdome"].PlatformID+"&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dlockerdome%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7B%7Buid%7D%7D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderMarsmedia, "https://dmp.rtbsrv.com/dmp/profiles/cm?p_id=179&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dmarsmedia%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderMgid, "https://cm.mgid.com/m?cdsp=363893&adu="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dmgid%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Bmuidn%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderOpenx, "https://rtb.openx.net/sync/prebid?r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dopenx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUID%7D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderPubmatic, "https://ads.pubmatic.com/AdServer/js/user_sync.html?predirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dpubmatic%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderPubmatic, "https://ads.pubmatic.com/AdServer/js/user_sync.html?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&predirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dpubmatic%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderPulsepoint, "https://bh.contextweb.com/rtset?pid=561205&ev=1&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dpulsepoint%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25%25VGUID%25%25") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderRhythmone, "https://sync.1rx.io/usersync2/rmphb?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BRX_UUID%5D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderRhythmone, "https://sync.1rx.io/usersync2/rmphb?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BRX_UUID%5D") // openrtb_ext.BidderRTBHouse doesn't have a good default. // openrtb_ext.BidderRubicon doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderSharethrough, "https://match.sharethrough.com/FGMrCMMc/v1?redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dsharethrough%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") @@ -522,12 +523,12 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderSovrn, "https://ap.lijit.com/pixel?redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dsovrn%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderSynacormedia, "https://sync.technoratimedia.com/services?srv=cs&pid=70&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dsynacormedia%26uid%3D%5BUSER_ID%5D") // openrtb_ext.BidderTappx doesn't have a good default. - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTriplelift, "https://eb2.3lift.com/getuid?gpdr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTripleliftNative, "https://eb2.3lift.com/sync?gpdr={{.GDPR}}&cmp_cs={{.GDPRConsent}}") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderUnruly, "https://usermatch.targeting.unrulymedia.com/pbsync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderVisx, "https://t.visx.net/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTriplelift, "https://eb2.3lift.com/getuid?gpdr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTripleliftNative, "https://eb2.3lift.com/sync?gpdr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtriplelift_native%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderUnruly, "https://usermatch.targeting.unrulymedia.com/pbsync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderVisx, "https://t.visx.net/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") // openrtb_ext.BidderVrtcal doesn't have a good default. - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldmo, "https://ads.yieldmo.com/pbsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldmo, "https://ads.yieldmo.com/pbsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") } func setDefaultUsersync(m map[string]Adapter, bidder openrtb_ext.BidderName, defaultValue string) { @@ -668,6 +669,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.adpone.endpoint", "http://rtb.adpone.com/bid-request?src=prebid_server") v.SetDefault("adapters.adtelligent.endpoint", "http://hb.adtelligent.com/auction") v.SetDefault("adapters.advangelists.endpoint", "http://nep.advangelists.com/xp/get?pubid={{.PublisherID}}") + v.SetDefault("adapters.applogy.endpoint", "http://rtb.applogy.com/v1/prebid") v.SetDefault("adapters.appnexus.endpoint", "http://ib.adnxs.com/openrtb2") // Docs: https://wiki.appnexus.com/display/supply/Incoming+Bid+Request+from+SSPs v.SetDefault("adapters.appnexus.platform_id", "5") v.SetDefault("adapters.beachfront.endpoint", "https://display.bfmio.com/prebid_display") @@ -687,7 +689,8 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.kubient.endpoint", "http://kbntx.ch/prebid") v.SetDefault("adapters.lifestreet.endpoint", "https://prebid.s2s.lfstmedia.com/adrequest") v.SetDefault("adapters.lockerdome.endpoint", "https://lockerdome.com/ladbid/prebidserver/openrtb2") - v.SetDefault("adapters.mgid.endpoint", "https://prebid.mgid.com/PubMatic-OpenWrap/") + v.SetDefault("adapters.marsmedia.endpoint", "https://bid306.rtbsrv.com/bidder/?bid=f3xtet") + v.SetDefault("adapters.mgid.endpoint", "https://prebid.mgid.com/prebid/") v.SetDefault("adapters.openx.endpoint", "http://rtb.openx.net/prebid") v.SetDefault("adapters.pubmatic.endpoint", "https://hbopenbid.pubmatic.com/translator?source=prebid-server") v.SetDefault("adapters.pubnative.endpoint", "http://dsp.pubnative.net/bid/v1/request") diff --git a/config/config_test.go b/config/config_test.go index 61157d144f9..a6bc8f82daa 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -272,7 +272,7 @@ func TestFullConfig(t *testing.T) { cmpStrings(t, "adapters.brightroll.usersync_url", cfg.Adapters[string(openrtb_ext.BidderBrightroll)].UserSyncURL, "http://test-bh.ybp.yahoo.com/sync/appnexuspbs?gdpr={{.GDPR}}&euconsent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&url=%s") cmpStrings(t, "adapters.adkerneladn.usersync_url", cfg.Adapters[strings.ToLower(string(openrtb_ext.BidderAdkernelAdn))].UserSyncURL, "https://tag.adkernel.com/syncr?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r=") cmpStrings(t, "adapters.rhythmone.endpoint", cfg.Adapters[string(openrtb_ext.BidderRhythmone)].Endpoint, "http://tag.1rx.io/rmp") - cmpStrings(t, "adapters.rhythmone.usersync_url", cfg.Adapters[string(openrtb_ext.BidderRhythmone)].UserSyncURL, "https://sync.1rx.io/usersync2/rmphb?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir=http%3A%2F%2Fprebid-server.prebid.org%2F%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BRX_UUID%5D") + cmpStrings(t, "adapters.rhythmone.usersync_url", cfg.Adapters[string(openrtb_ext.BidderRhythmone)].UserSyncURL, "https://sync.1rx.io/usersync2/rmphb?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir=http%3A%2F%2Fprebid-server.prebid.org%2F%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BRX_UUID%5D") cmpBools(t, "account_required", cfg.AccountRequired, true) cmpBools(t, "account_adapter_details", cfg.Metrics.Disabled.AccountAdapterDetails, true) cmpStrings(t, "certificates_file", cfg.PemCertsFile, "/etc/ssl/cert.pem") diff --git a/currencies/rate_converter_test.go b/currencies/rate_converter_test.go index 6cee1481732..63ccd035c0c 100644 --- a/currencies/rate_converter_test.go +++ b/currencies/rate_converter_test.go @@ -379,6 +379,7 @@ func TestRates(t *testing.T) { {from: "", to: "EUR", expectedRate: 0, hasError: true}, {from: "CNY", to: "", expectedRate: 0, hasError: true}, {from: "", to: "", expectedRate: 0, hasError: true}, + {from: "USD", to: "USD", expectedRate: 1, hasError: false}, } mockedHttpServer := httptest.NewServer(http.HandlerFunc( diff --git a/docs/developers/stored-requests.md b/docs/developers/stored-requests.md index 4b54b4e945f..8b7177160c3 100644 --- a/docs/developers/stored-requests.md +++ b/docs/developers/stored-requests.md @@ -34,7 +34,7 @@ Add the file `stored_requests/data/by_id/stored_imps/{id}.json` and populate it }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } @@ -88,7 +88,7 @@ You can also store _part_ of the Imp on the server. For example: }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/amp_auction_test.go b/endpoints/openrtb2/amp_auction_test.go index bee7d95fe7b..c7d076896bb 100644 --- a/endpoints/openrtb2/amp_auction_test.go +++ b/endpoints/openrtb2/amp_auction_test.go @@ -966,7 +966,7 @@ func getTestBidRequest(nilUser bool, nilExt bool, consentString string, digitrus Imp: []openrtb.Imp{ { ID: "/19968336/header-bid-tag-0", - Ext: json.RawMessage(`{"appnexus": { "placementId":10433394 }}`), + Ext: json.RawMessage(`{"appnexus": { "placementId":12883451 }}`), Banner: &openrtb.Banner{ Format: []openrtb.Format{ { diff --git a/endpoints/openrtb2/auction_benchmark_test.go b/endpoints/openrtb2/auction_benchmark_test.go index db021df192c..2ac82b5c52f 100644 --- a/endpoints/openrtb2/auction_benchmark_test.go +++ b/endpoints/openrtb2/auction_benchmark_test.go @@ -21,7 +21,7 @@ import ( // dummyServer returns the header bidding test ad. This response was scraped from a real appnexus server response. func dummyServer(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(`{"id":"some-request-id","seatbid":[{"bid":[{"id":"4625436751433509010","impid":"my-imp-id","price":0.5,"adm":"\u003cscript type=\"application/javascript\" src=\"http://nym1-ib.adnxs.com/ab?e=wqT_3QKABqAAAwAAAwDWAAUBCM-OiNAFELuV09Pqi86EVRj6t-7QyLin_REqLQkAAAECCOA_EQEHNAAA4D8ZAAAAgOtR4D8hERIAKREJoDDy5vwEOL4HQL4HSAJQ1suTDljhgEhgAGiRQHixhQSAAQGKAQNVU0SSBQbwUpgBrAKgAfoBqAEBsAEAuAECwAEDyAEC0AEA2AEA4AEB8AEAigI6dWYoJ2EnLCA0OTQ0NzIsIDE1MTAwODIzODMpO3VmKCdyJywgMjk2ODExMTAsMh4A8JySAvkBIVR6WGNkQWk2MEljRUVOYkxrdzRZQUNEaGdFZ3dBRGdBUUFSSXZnZFE4dWI4QkZnQVlQX19fXzhQYUFCd0FYZ0JnQUVCaUFFQmtBRUJtQUVCb0FFQnFBRURzQUVBdVFFcGk0aURBQURnUDhFQktZdUlnd0FBNERfSkFTZlJKRUdtbi00XzJRRUFBQUFBQUFEd1AtQUJBUFVCBQ8oSmdDQUtBQ0FMVUMFEARMMAkI8ExNQUNBY2dDQWRBQ0FkZ0NBZUFDQU9nQ0FQZ0NBSUFEQVpBREFKZ0RBYWdEdXRDSEJMb0RDVTVaVFRJNk16STNOdy4umgItITh3aENuZzb8ALg0WUJJSUFRb0FEb0pUbGxOTWpvek1qYzPYAugH4ALH0wHyAhAKBkFEVl9JRBIGNCV1HPICEQoGQ1BHARMcBzE5Nzc5MzMBJwgFQ1AFE_B-ODUxMzU5NIADAYgDAZADAJgDFKADAaoDAMADrALIAwDYAwDgAwDoAwD4AwCABACSBAkvb3BlbnJ0YjKYBACoBACyBAwIABAAGAAgADAAOAC4BADABADIBADSBAlOWU0yOjMyNzfaBAIIAeAEAPAE1suTDogFAZgFAKAF_____wUDXAGqBQ9zb21lLXJlcXVlc3QtaWTABQDJBUmbTPA_0gUJCQAAAAAAAAAA2AUB4AUB\u0026s=61dc0e8770543def5a3a77b4589830d1274b26f1\u0026test=1\u0026pp=${AUCTION_PRICE}\u0026\"\u003e\u003c/script\u003e","adid":"29681110","adomain":["appnexus.com"],"iurl":"http://nym1-ib.adnxs.com/cr?id=29681110","cid":"958","crid":"29681110","w":300,"h":250,"ext":{"bidder":{"appnexus":{"brand_id":1,"auction_id":6127490747252132539,"bidder_id":2}}}}],"seat":"appnexus"}],"ext":{"debug":{"httpcalls":{"appnexus":[{"uri":"http://ib.adnxs.com/openrtb2","requestbody":"{\"id\":\"some-request-id\",\"imp\":[{\"id\":\"my-imp-id\",\"banner\":{\"format\":[{\"w\":300,\"h\":250},{\"w\":300,\"h\":600}]},\"ext\":{\"appnexus\":{\"placement_id\":10433394}}}],\"test\":1,\"tmax\":500}","responsebody":"{\"id\":\"some-request-id\",\"seatbid\":[{\"bid\":[{\"id\":\"4625436751433509010\",\"impid\":\"my-imp-id\",\"price\": 0.500000,\"adid\":\"29681110\",\"adm\":\"\u003cscript type=\\\"application/javascript\\\" src=\\\"http://nym1-ib.adnxs.com/ab?e=wqT_3QKABqAAAwAAAwDWAAUBCM-OiNAFELuV09Pqi86EVRj6t-7QyLin_REqLQkAAAECCOA_EQEHNAAA4D8ZAAAAgOtR4D8hERIAKREJoDDy5vwEOL4HQL4HSAJQ1suTDljhgEhgAGiRQHixhQSAAQGKAQNVU0SSBQbwUpgBrAKgAfoBqAEBsAEAuAECwAEDyAEC0AEA2AEA4AEB8AEAigI6dWYoJ2EnLCA0OTQ0NzIsIDE1MTAwODIzODMpO3VmKCdyJywgMjk2ODExMTAsMh4A8JySAvkBIVR6WGNkQWk2MEljRUVOYkxrdzRZQUNEaGdFZ3dBRGdBUUFSSXZnZFE4dWI4QkZnQVlQX19fXzhQYUFCd0FYZ0JnQUVCaUFFQmtBRUJtQUVCb0FFQnFBRURzQUVBdVFFcGk0aURBQURnUDhFQktZdUlnd0FBNERfSkFTZlJKRUdtbi00XzJRRUFBQUFBQUFEd1AtQUJBUFVCBQ8oSmdDQUtBQ0FMVUMFEARMMAkI8ExNQUNBY2dDQWRBQ0FkZ0NBZUFDQU9nQ0FQZ0NBSUFEQVpBREFKZ0RBYWdEdXRDSEJMb0RDVTVaVFRJNk16STNOdy4umgItITh3aENuZzb8ALg0WUJJSUFRb0FEb0pUbGxOTWpvek1qYzPYAugH4ALH0wHyAhAKBkFEVl9JRBIGNCV1HPICEQoGQ1BHARMcBzE5Nzc5MzMBJwgFQ1AFE_B-ODUxMzU5NIADAYgDAZADAJgDFKADAaoDAMADrALIAwDYAwDgAwDoAwD4AwCABACSBAkvb3BlbnJ0YjKYBACoBACyBAwIABAAGAAgADAAOAC4BADABADIBADSBAlOWU0yOjMyNzfaBAIIAeAEAPAE1suTDogFAZgFAKAF_____wUDXAGqBQ9zb21lLXJlcXVlc3QtaWTABQDJBUmbTPA_0gUJCQAAAAAAAAAA2AUB4AUB\u0026s=61dc0e8770543def5a3a77b4589830d1274b26f1\u0026test=1\u0026pp=${AUCTION_PRICE}\u0026\\\"\u003e\u003c/script\u003e\",\"adomain\":[\"appnexus.com\"],\"iurl\":\"http://nym1-ib.adnxs.com/cr?id=29681110\",\"cid\":\"958\",\"crid\":\"29681110\",\"h\": 250,\"w\": 300,\"ext\":{\"appnexus\":{\"brand_id\": 1,\"auction_id\": 6127490747252132539,\"bidder_id\": 2}}}],\"seat\":\"958\"}],\"bidid\":\"8271358638249766712\",\"cur\":\"USD\"}","status":200}]}},"responsetimemillis":{"appnexus":42}}}`)) + w.Write([]byte(`{"id":"some-request-id","seatbid":[{"bid":[{"id":"4625436751433509010","impid":"my-imp-id","price":0.5,"adm":"\u003cscript type=\"application/javascript\" src=\"http://nym1-ib.adnxs.com/ab?e=wqT_3QKABqAAAwAAAwDWAAUBCM-OiNAFELuV09Pqi86EVRj6t-7QyLin_REqLQkAAAECCOA_EQEHNAAA4D8ZAAAAgOtR4D8hERIAKREJoDDy5vwEOL4HQL4HSAJQ1suTDljhgEhgAGiRQHixhQSAAQGKAQNVU0SSBQbwUpgBrAKgAfoBqAEBsAEAuAECwAEDyAEC0AEA2AEA4AEB8AEAigI6dWYoJ2EnLCA0OTQ0NzIsIDE1MTAwODIzODMpO3VmKCdyJywgMjk2ODExMTAsMh4A8JySAvkBIVR6WGNkQWk2MEljRUVOYkxrdzRZQUNEaGdFZ3dBRGdBUUFSSXZnZFE4dWI4QkZnQVlQX19fXzhQYUFCd0FYZ0JnQUVCaUFFQmtBRUJtQUVCb0FFQnFBRURzQUVBdVFFcGk0aURBQURnUDhFQktZdUlnd0FBNERfSkFTZlJKRUdtbi00XzJRRUFBQUFBQUFEd1AtQUJBUFVCBQ8oSmdDQUtBQ0FMVUMFEARMMAkI8ExNQUNBY2dDQWRBQ0FkZ0NBZUFDQU9nQ0FQZ0NBSUFEQVpBREFKZ0RBYWdEdXRDSEJMb0RDVTVaVFRJNk16STNOdy4umgItITh3aENuZzb8ALg0WUJJSUFRb0FEb0pUbGxOTWpvek1qYzPYAugH4ALH0wHyAhAKBkFEVl9JRBIGNCV1HPICEQoGQ1BHARMcBzE5Nzc5MzMBJwgFQ1AFE_B-ODUxMzU5NIADAYgDAZADAJgDFKADAaoDAMADrALIAwDYAwDgAwDoAwD4AwCABACSBAkvb3BlbnJ0YjKYBACoBACyBAwIABAAGAAgADAAOAC4BADABADIBADSBAlOWU0yOjMyNzfaBAIIAeAEAPAE1suTDogFAZgFAKAF_____wUDXAGqBQ9zb21lLXJlcXVlc3QtaWTABQDJBUmbTPA_0gUJCQAAAAAAAAAA2AUB4AUB\u0026s=61dc0e8770543def5a3a77b4589830d1274b26f1\u0026test=1\u0026pp=${AUCTION_PRICE}\u0026\"\u003e\u003c/script\u003e","adid":"29681110","adomain":["appnexus.com"],"iurl":"http://nym1-ib.adnxs.com/cr?id=29681110","cid":"958","crid":"29681110","w":300,"h":250,"ext":{"bidder":{"appnexus":{"brand_id":1,"auction_id":6127490747252132539,"bidder_id":2}}}}],"seat":"appnexus"}],"ext":{"debug":{"httpcalls":{"appnexus":[{"uri":"http://ib.adnxs.com/openrtb2","requestbody":"{\"id\":\"some-request-id\",\"imp\":[{\"id\":\"my-imp-id\",\"banner\":{\"format\":[{\"w\":300,\"h\":250},{\"w\":300,\"h\":600}]},\"ext\":{\"appnexus\":{\"placement_id\":12883451}}}],\"test\":1,\"tmax\":500}","responsebody":"{\"id\":\"some-request-id\",\"seatbid\":[{\"bid\":[{\"id\":\"4625436751433509010\",\"impid\":\"my-imp-id\",\"price\": 0.500000,\"adid\":\"29681110\",\"adm\":\"\u003cscript type=\\\"application/javascript\\\" src=\\\"http://nym1-ib.adnxs.com/ab?e=wqT_3QKABqAAAwAAAwDWAAUBCM-OiNAFELuV09Pqi86EVRj6t-7QyLin_REqLQkAAAECCOA_EQEHNAAA4D8ZAAAAgOtR4D8hERIAKREJoDDy5vwEOL4HQL4HSAJQ1suTDljhgEhgAGiRQHixhQSAAQGKAQNVU0SSBQbwUpgBrAKgAfoBqAEBsAEAuAECwAEDyAEC0AEA2AEA4AEB8AEAigI6dWYoJ2EnLCA0OTQ0NzIsIDE1MTAwODIzODMpO3VmKCdyJywgMjk2ODExMTAsMh4A8JySAvkBIVR6WGNkQWk2MEljRUVOYkxrdzRZQUNEaGdFZ3dBRGdBUUFSSXZnZFE4dWI4QkZnQVlQX19fXzhQYUFCd0FYZ0JnQUVCaUFFQmtBRUJtQUVCb0FFQnFBRURzQUVBdVFFcGk0aURBQURnUDhFQktZdUlnd0FBNERfSkFTZlJKRUdtbi00XzJRRUFBQUFBQUFEd1AtQUJBUFVCBQ8oSmdDQUtBQ0FMVUMFEARMMAkI8ExNQUNBY2dDQWRBQ0FkZ0NBZUFDQU9nQ0FQZ0NBSUFEQVpBREFKZ0RBYWdEdXRDSEJMb0RDVTVaVFRJNk16STNOdy4umgItITh3aENuZzb8ALg0WUJJSUFRb0FEb0pUbGxOTWpvek1qYzPYAugH4ALH0wHyAhAKBkFEVl9JRBIGNCV1HPICEQoGQ1BHARMcBzE5Nzc5MzMBJwgFQ1AFE_B-ODUxMzU5NIADAYgDAZADAJgDFKADAaoDAMADrALIAwDYAwDgAwDoAwD4AwCABACSBAkvb3BlbnJ0YjKYBACoBACyBAwIABAAGAAgADAAOAC4BADABADIBADSBAlOWU0yOjMyNzfaBAIIAeAEAPAE1suTDogFAZgFAKAF_____wUDXAGqBQ9zb21lLXJlcXVlc3QtaWTABQDJBUmbTPA_0gUJCQAAAAAAAAAA2AUB4AUB\u0026s=61dc0e8770543def5a3a77b4589830d1274b26f1\u0026test=1\u0026pp=${AUCTION_PRICE}\u0026\\\"\u003e\u003c/script\u003e\",\"adomain\":[\"appnexus.com\"],\"iurl\":\"http://nym1-ib.adnxs.com/cr?id=29681110\",\"cid\":\"958\",\"crid\":\"29681110\",\"h\": 250,\"w\": 300,\"ext\":{\"appnexus\":{\"brand_id\": 1,\"auction_id\": 6127490747252132539,\"bidder_id\": 2}}}],\"seat\":\"958\"}],\"bidid\":\"8271358638249766712\",\"cur\":\"USD\"}","status":200}]}},"responsetimemillis":{"appnexus":42}}}`)) } // newDummyRequest returns a request which fetches the header bidding test ad. @@ -45,7 +45,7 @@ func newDummyRequest() *http.Request { }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/auction_test.go b/endpoints/openrtb2/auction_test.go index bc8f6960c96..820d195f5f2 100644 --- a/endpoints/openrtb2/auction_test.go +++ b/endpoints/openrtb2/auction_test.go @@ -88,7 +88,7 @@ func TestExplicitUserId(t *testing.T) { }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } @@ -425,7 +425,7 @@ func buildNativeRequest(t *testing.T, nativeData []byte) []byte { buf := bytes.NewBuffer(nil) buf.WriteString(`{"id":"req-id","site":{"page":"some.page.com"},"tmax":500,"imp":[{"id":"some-imp","native":{"request":`) buf.Write(serialized) - buf.WriteString(`},"ext":{"appnexus":{"placementId":10433394}}}]}`) + buf.WriteString(`},"ext":{"appnexus":{"placementId":12883451}}}]}`) return buf.Bytes() } diff --git a/endpoints/openrtb2/interstitial_test.go b/endpoints/openrtb2/interstitial_test.go index e680478e63e..1c6eb2555db 100644 --- a/endpoints/openrtb2/interstitial_test.go +++ b/endpoints/openrtb2/interstitial_test.go @@ -22,7 +22,7 @@ var request = &openrtb.BidRequest{ }, }, Instl: 1, - Ext: json.RawMessage(`{"appnexus": {"placementId": 10433394}}`), + Ext: json.RawMessage(`{"appnexus": {"placementId": 12883451}}`), }, }, Device: &openrtb.Device{ diff --git a/endpoints/openrtb2/sample-requests/account-required/no-acct.json b/endpoints/openrtb2/sample-requests/account-required/no-acct.json index 4ba8dec52c3..d84d797017d 100644 --- a/endpoints/openrtb2/sample-requests/account-required/no-acct.json +++ b/endpoints/openrtb2/sample-requests/account-required/no-acct.json @@ -28,7 +28,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/account-required/with-acct.json b/endpoints/openrtb2/sample-requests/account-required/with-acct.json index d1ab715cdbe..fb4c6313051 100644 --- a/endpoints/openrtb2/sample-requests/account-required/with-acct.json +++ b/endpoints/openrtb2/sample-requests/account-required/with-acct.json @@ -29,7 +29,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/aliased/simple.json b/endpoints/openrtb2/sample-requests/aliased/simple.json index e656be43ed5..e7f6ba21b83 100644 --- a/endpoints/openrtb2/sample-requests/aliased/simple.json +++ b/endpoints/openrtb2/sample-requests/aliased/simple.json @@ -13,7 +13,7 @@ }, "ext": { "test1": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/aliased/site.json b/endpoints/openrtb2/sample-requests/aliased/site.json index 981b69b5524..cf7e9a77533 100644 --- a/endpoints/openrtb2/sample-requests/aliased/site.json +++ b/endpoints/openrtb2/sample-requests/aliased/site.json @@ -23,10 +23,10 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 }, "test1": { - "placementId": 10433394 + "placementId": 12883451 }, "test2": { "accountId": 1001, diff --git a/endpoints/openrtb2/sample-requests/blacklisted/blacklisted-acct.json b/endpoints/openrtb2/sample-requests/blacklisted/blacklisted-acct.json index 8977480de33..ee04a9464e9 100644 --- a/endpoints/openrtb2/sample-requests/blacklisted/blacklisted-acct.json +++ b/endpoints/openrtb2/sample-requests/blacklisted/blacklisted-acct.json @@ -42,7 +42,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 }, "districtm": { "placementId": 105 diff --git a/endpoints/openrtb2/sample-requests/blacklisted/blacklisted-app.json b/endpoints/openrtb2/sample-requests/blacklisted/blacklisted-app.json index 219595e409a..1ace4b53666 100644 --- a/endpoints/openrtb2/sample-requests/blacklisted/blacklisted-app.json +++ b/endpoints/openrtb2/sample-requests/blacklisted/blacklisted-app.json @@ -39,7 +39,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 }, "districtm": { "placementId": 105 diff --git a/endpoints/openrtb2/sample-requests/disabled/bad/bad-alias.json b/endpoints/openrtb2/sample-requests/disabled/bad/bad-alias.json index 8299f96ce6b..096c028cfe9 100644 --- a/endpoints/openrtb2/sample-requests/disabled/bad/bad-alias.json +++ b/endpoints/openrtb2/sample-requests/disabled/bad/bad-alias.json @@ -15,7 +15,7 @@ }, "ext": { "test1": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/disabled/bad/bad-bidder.json b/endpoints/openrtb2/sample-requests/disabled/bad/bad-bidder.json index 1934b638492..5f637b1a4fc 100644 --- a/endpoints/openrtb2/sample-requests/disabled/bad/bad-bidder.json +++ b/endpoints/openrtb2/sample-requests/disabled/bad/bad-bidder.json @@ -15,7 +15,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/disabled/good/partial.json b/endpoints/openrtb2/sample-requests/disabled/good/partial.json index 0f6bf1dd005..fe0c492be2d 100644 --- a/endpoints/openrtb2/sample-requests/disabled/good/partial.json +++ b/endpoints/openrtb2/sample-requests/disabled/good/partial.json @@ -23,7 +23,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 }, "rubicon": { "accountId": 1001, diff --git a/endpoints/openrtb2/sample-requests/invalid-stored/bad_incoming_1.json b/endpoints/openrtb2/sample-requests/invalid-stored/bad_incoming_1.json index ccb54c0547e..2a647d7d8c8 100644 --- a/endpoints/openrtb2/sample-requests/invalid-stored/bad_incoming_1.json +++ b/endpoints/openrtb2/sample-requests/invalid-stored/bad_incoming_1.json @@ -24,7 +24,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-stored/bad_incoming_2.json b/endpoints/openrtb2/sample-requests/invalid-stored/bad_incoming_2.json index 6023f86970e..d18a20d7a13 100644 --- a/endpoints/openrtb2/sample-requests/invalid-stored/bad_incoming_2.json +++ b/endpoints/openrtb2/sample-requests/invalid-stored/bad_incoming_2.json @@ -24,7 +24,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/alias-bidder-self.json b/endpoints/openrtb2/sample-requests/invalid-whole/alias-bidder-self.json index f081b365dd9..666253ec85b 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/alias-bidder-self.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/alias-bidder-self.json @@ -13,7 +13,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/alias-unknown-core.json b/endpoints/openrtb2/sample-requests/invalid-whole/alias-unknown-core.json index acf3bc0dd4f..6c1925d65b1 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/alias-unknown-core.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/alias-unknown-core.json @@ -15,7 +15,7 @@ }, "ext": { "unknown": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/app-bad-ext.json b/endpoints/openrtb2/sample-requests/invalid-whole/app-bad-ext.json index 2516a268754..672b05724c8 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/app-bad-ext.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/app-bad-ext.json @@ -32,7 +32,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/banner-h-only.json b/endpoints/openrtb2/sample-requests/invalid-whole/banner-h-only.json index 7040e8dfc3c..515824e65d9 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/banner-h-only.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/banner-h-only.json @@ -13,7 +13,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/banner-h-zero.json b/endpoints/openrtb2/sample-requests/invalid-whole/banner-h-zero.json index d98cfba100b..f18f63e5e28 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/banner-h-zero.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/banner-h-zero.json @@ -14,7 +14,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/banner-w-only.json b/endpoints/openrtb2/sample-requests/invalid-whole/banner-w-only.json index 52a7bdd2ba2..70739a65834 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/banner-w-only.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/banner-w-only.json @@ -13,7 +13,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/banner-w-zero.json b/endpoints/openrtb2/sample-requests/invalid-whole/banner-w-zero.json index 0b927f26e3c..b3453ab4cb7 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/banner-w-zero.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/banner-w-zero.json @@ -14,7 +14,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/bid-adjustment-invalid-bidder.json b/endpoints/openrtb2/sample-requests/invalid-whole/bid-adjustment-invalid-bidder.json index 985f99126c4..569e16d2d20 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/bid-adjustment-invalid-bidder.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/bid-adjustment-invalid-bidder.json @@ -13,7 +13,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/bid-adjustment-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/bid-adjustment-negative.json index 984998000c5..4db6ee09bd8 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/bid-adjustment-negative.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/bid-adjustment-negative.json @@ -13,7 +13,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/cache-nothing.json b/endpoints/openrtb2/sample-requests/invalid-whole/cache-nothing.json index 605040c6cfc..d4b875498ae 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/cache-nothing.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/cache-nothing.json @@ -15,7 +15,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/digitrust.json b/endpoints/openrtb2/sample-requests/invalid-whole/digitrust.json index 2b65ed19db0..1be93853a0b 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/digitrust.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/digitrust.json @@ -25,7 +25,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/format-empty-array.json b/endpoints/openrtb2/sample-requests/invalid-whole/format-empty-array.json index e159601b6e8..15e41cc5fb2 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/format-empty-array.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/format-empty-array.json @@ -13,7 +13,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/imp-id-duplicates.json b/endpoints/openrtb2/sample-requests/invalid-whole/imp-id-duplicates.json index 095542ef59e..53517c268b6 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/imp-id-duplicates.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/imp-id-duplicates.json @@ -18,7 +18,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } }, diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/interstital-bad-perc.json b/endpoints/openrtb2/sample-requests/invalid-whole/interstital-bad-perc.json index f04f3d8aa25..6854ea9a470 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/interstital-bad-perc.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/interstital-bad-perc.json @@ -20,7 +20,7 @@ "instl": 1, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/interstitial-empty.json b/endpoints/openrtb2/sample-requests/invalid-whole/interstitial-empty.json index 5fa28059b0d..a69f287dfab 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/interstitial-empty.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/interstitial-empty.json @@ -14,7 +14,7 @@ "instl": 1, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/no-site-or-app.json b/endpoints/openrtb2/sample-requests/invalid-whole/no-site-or-app.json index 1cbfdd501c2..c56dae324fc 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/no-site-or-app.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/no-site-or-app.json @@ -12,7 +12,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/regs-ext-gdpr-invalid.json b/endpoints/openrtb2/sample-requests/invalid-whole/regs-ext-gdpr-invalid.json index 6737295ae82..dff3023c702 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/regs-ext-gdpr-invalid.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/regs-ext-gdpr-invalid.json @@ -17,7 +17,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/regs-ext-gdpr-string.json b/endpoints/openrtb2/sample-requests/invalid-whole/regs-ext-gdpr-string.json index 3abc88c70da..ce887889034 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/regs-ext-gdpr-string.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/regs-ext-gdpr-string.json @@ -17,7 +17,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/regs-ext-malformed.json b/endpoints/openrtb2/sample-requests/invalid-whole/regs-ext-malformed.json index 7c2805fcdbb..a403103d6fb 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/regs-ext-malformed.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/regs-ext-malformed.json @@ -17,7 +17,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/site-app-both.json b/endpoints/openrtb2/sample-requests/invalid-whole/site-app-both.json index abbcdac325f..4b643705640 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/site-app-both.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/site-app-both.json @@ -16,7 +16,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/site-empty.json b/endpoints/openrtb2/sample-requests/invalid-whole/site-empty.json index 430b25f67a0..3d53314dbb7 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/site-empty.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/site-empty.json @@ -13,7 +13,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/site-ext-amp.json b/endpoints/openrtb2/sample-requests/invalid-whole/site-ext-amp.json index 17cd68b9232..bebe4625578 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/site-ext-amp.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/site-ext-amp.json @@ -28,7 +28,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/storedrequest-id-int.json b/endpoints/openrtb2/sample-requests/invalid-whole/storedrequest-id-int.json index 3fe94a993ad..5d510d21dbd 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/storedrequest-id-int.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/storedrequest-id-int.json @@ -15,7 +15,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/unknown-bidder.json b/endpoints/openrtb2/sample-requests/invalid-whole/unknown-bidder.json index f11be6fd51c..3914ae7ae49 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/unknown-bidder.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/unknown-bidder.json @@ -24,7 +24,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 }, "unknownbidder": { "param1": "foobar", diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-consent-int.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-consent-int.json index c7a6a53b087..5bc0ed33eab 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-consent-int.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-consent-int.json @@ -17,7 +17,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-eids-uids-empty.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-eids-uids-empty.json index e9914e3b7db..ebbb4e2701c 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-eids-uids-empty.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-eids-uids-empty.json @@ -17,7 +17,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-empty.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-empty.json index 4f66917ff3f..3d73d73117e 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-empty.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-empty.json @@ -17,7 +17,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-id-uids-empty.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-id-uids-empty.json index 1ca50079a9a..bbd0dadfd70 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-id-uids-empty.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-id-uids-empty.json @@ -17,7 +17,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-source-empty.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-source-empty.json index 8526298047f..5efff0626ef 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-source-empty.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-source-empty.json @@ -17,7 +17,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-source-unique.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-source-unique.json index 52565d47228..e508b113aff 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-source-unique.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-source-unique.json @@ -17,7 +17,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-uids-id-empty.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-uids-id-empty.json index 33a33b9f416..3a9659b7327 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-uids-id-empty.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-eids-uids-id-empty.json @@ -17,7 +17,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-prebid-buyeruids-empty.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-prebid-buyeruids-empty.json index d967463d2d1..44bee775844 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-prebid-buyeruids-empty.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-prebid-buyeruids-empty.json @@ -18,7 +18,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-prebid-buyeruids-unknown.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-prebid-buyeruids-unknown.json index bad67e2d3d8..78773066744 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-prebid-buyeruids-unknown.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-prebid-buyeruids-unknown.json @@ -18,7 +18,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-prebid-empty.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-prebid-empty.json index 8113a70be68..f2e497514b7 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-prebid-empty.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-ext-prebid-empty.json @@ -18,7 +18,7 @@ }, "ext": { "appnexus":{ - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-gdpr-badtype.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-gdpr-badtype.json index 3abc88c70da..ce887889034 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/user-gdpr-badtype.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-gdpr-badtype.json @@ -17,7 +17,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-gdpr-invalid.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-gdpr-invalid.json index b2b554846ca..0729a22db80 100644 --- a/endpoints/openrtb2/sample-requests/invalid-whole/user-gdpr-invalid.json +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-gdpr-invalid.json @@ -17,7 +17,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/valid-whole/exemplary/all-ext.json b/endpoints/openrtb2/sample-requests/valid-whole/exemplary/all-ext.json index 17b249a1494..3e2beedefac 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/exemplary/all-ext.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/exemplary/all-ext.json @@ -39,7 +39,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 }, "districtm": { "placementId": 105 diff --git a/endpoints/openrtb2/sample-requests/valid-whole/exemplary/prebid-test-ad.json b/endpoints/openrtb2/sample-requests/valid-whole/exemplary/prebid-test-ad.json index b4fd8693953..fc4794328a4 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/exemplary/prebid-test-ad.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/exemplary/prebid-test-ad.json @@ -23,7 +23,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/aliased-buyeruids.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/aliased-buyeruids.json index 1eb74614340..82125592e46 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/aliased-buyeruids.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/aliased-buyeruids.json @@ -16,7 +16,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/aliases.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/aliases.json index 6c8608ba3c6..f6137e4a019 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/aliases.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/aliases.json @@ -13,7 +13,7 @@ }, "ext": { "unknown": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/app.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/app.json index cad5e852e69..66e05d7636b 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/app.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/app.json @@ -28,7 +28,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/bid-adjustments.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/bid-adjustments.json index 2ce81b97b25..0cf52a8915f 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/bid-adjustments.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/bid-adjustments.json @@ -13,7 +13,7 @@ }, "ext": { "unknown": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/cache-bids.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/cache-bids.json index 884ec898dab..a4c93b3d3cb 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/cache-bids.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/cache-bids.json @@ -13,7 +13,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/cache-vast.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/cache-vast.json index 7878767af78..fe9445358ba 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/cache-vast.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/cache-vast.json @@ -13,7 +13,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/ccpa-invalid.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/ccpa-invalid.json index bf04930420b..f3b677635c0 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/ccpa-invalid.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/ccpa-invalid.json @@ -15,7 +15,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/digitrust.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/digitrust.json index 0017f5e7203..ca8e090760d 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/digitrust.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/digitrust.json @@ -23,7 +23,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/gdpr-no-consentstring.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/gdpr-no-consentstring.json index 77f1f86bede..5a63c6d11ce 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/gdpr-no-consentstring.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/gdpr-no-consentstring.json @@ -15,7 +15,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/gdpr.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/gdpr.json index 1234f58ddce..ef9f10d0cd0 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/gdpr.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/gdpr.json @@ -15,7 +15,7 @@ "id": "/19968336/header-bid-tag-0", "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } }, "banner": { diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/interstitial-device-only.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/interstitial-device-only.json index 2c85ef143d3..64146eaebe8 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/interstitial-device-only.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/interstitial-device-only.json @@ -10,7 +10,7 @@ "instl": 1, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/interstitial-no-extension.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/interstitial-no-extension.json index 1e6604e7d2a..15cd832053f 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/interstitial-no-extension.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/interstitial-no-extension.json @@ -17,7 +17,7 @@ "instl": 1, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/interstitial.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/interstitial.json index c5d373797ff..64fc2fe2653 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/interstitial.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/interstitial.json @@ -17,7 +17,7 @@ "instl": 1, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/site-amp.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/site-amp.json index c0dbb355fea..30c0afc800a 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/site-amp.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/site-amp.json @@ -26,7 +26,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/site.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/site.json index f0a02103c34..7a25249c763 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/site.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/site.json @@ -23,7 +23,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/timeout.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/timeout.json index 611d96ca581..b3dbe1f5d4b 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/timeout.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/timeout.json @@ -22,7 +22,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/user.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/user.json index 951a7774fe4..243b0739b7b 100644 --- a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/user.json +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/user.json @@ -23,7 +23,7 @@ }, "ext": { "appnexus": { - "placementId": 10433394 + "placementId": 12883451 } } } diff --git a/endpoints/openrtb2/video_auction.go b/endpoints/openrtb2/video_auction.go index 8541fca6441..ed461c957d7 100644 --- a/endpoints/openrtb2/video_auction.go +++ b/endpoints/openrtb2/video_auction.go @@ -65,7 +65,7 @@ func NewVideoEndpoint(ex exchange.Exchange, validator openrtb_ext.BidderParamVal */ func (deps *endpointDeps) VideoAuctionEndpoint(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { - ao := analytics.AuctionObject{ + vo := analytics.VideoObject{ Status: http.StatusOK, Errors: make([]error, 0), } @@ -82,7 +82,7 @@ func (deps *endpointDeps) VideoAuctionEndpoint(w http.ResponseWriter, r *http.Re defer func() { deps.metricsEngine.RecordRequest(labels) deps.metricsEngine.RecordRequestTime(labels, time.Since(start)) - deps.analytics.LogAuctionObject(&ao) + deps.analytics.LogVideoObject(&vo) }() lr := &io.LimitedReader{ @@ -91,7 +91,7 @@ func (deps *endpointDeps) VideoAuctionEndpoint(w http.ResponseWriter, r *http.Re } requestJson, err := ioutil.ReadAll(lr) if err != nil { - handleError(&labels, w, []error{err}, &ao) + handleError(&labels, w, []error{err}, &vo) return } @@ -102,35 +102,37 @@ func (deps *endpointDeps) VideoAuctionEndpoint(w http.ResponseWriter, r *http.Re if err != nil { if deps.cfg.VideoStoredRequestRequired { - handleError(&labels, w, []error{err}, &ao) + handleError(&labels, w, []error{err}, &vo) return } } else { storedRequest, errs := deps.loadStoredVideoRequest(context.Background(), storedRequestId) if len(errs) > 0 { - handleError(&labels, w, errs, &ao) + handleError(&labels, w, errs, &vo) return } //merge incoming req with stored video req resolvedRequest, err = jsonpatch.MergePatch(storedRequest, requestJson) if err != nil { - handleError(&labels, w, []error{err}, &ao) + handleError(&labels, w, []error{err}, &vo) return } } //unmarshal and validate combined result videoBidReq, errL, podErrors := deps.parseVideoRequest(resolvedRequest) if len(errL) > 0 { - handleError(&labels, w, errL, &ao) + handleError(&labels, w, errL, &vo) return } + vo.VideoRequest = videoBidReq + var bidReq = &openrtb.BidRequest{} if deps.defaultRequest { if err := json.Unmarshal(deps.defReqJSON, bidReq); err != nil { err = fmt.Errorf("Invalid JSON in Default Request Settings: %s", err) - handleError(&labels, w, []error{err}, &ao) + handleError(&labels, w, []error{err}, &vo) return } } @@ -154,7 +156,7 @@ func (deps *endpointDeps) VideoAuctionEndpoint(w http.ResponseWriter, r *http.Re } err := errors.New(fmt.Sprintf("all pods are incorrect: %s", strings.Join(resPodErr, "; "))) errL = append(errL, err) - handleError(&labels, w, errL, &ao) + handleError(&labels, w, errL, &vo) return } @@ -166,7 +168,7 @@ func (deps *endpointDeps) VideoAuctionEndpoint(w http.ResponseWriter, r *http.Re errL = deps.validateRequest(bidReq) if len(errL) > 0 { - handleError(&labels, w, errL, &ao) + handleError(&labels, w, errL, &vo) return } @@ -194,16 +196,16 @@ func (deps *endpointDeps) VideoAuctionEndpoint(w http.ResponseWriter, r *http.Re if acctIdErr := validateAccount(deps.cfg, labels.PubID); acctIdErr != nil { errL = append(errL, acctIdErr) - handleError(&labels, w, errL, &ao) + handleError(&labels, w, errL, &vo) return } //execute auction logic response, err := deps.ex.HoldAuction(ctx, bidReq, usersyncs, labels, &deps.categories) - ao.Request = bidReq - ao.Response = response + vo.Request = bidReq + vo.Response = response if err != nil { errL := []error{err} - handleError(&labels, w, errL, &ao) + handleError(&labels, w, errL, &vo) return } @@ -211,18 +213,20 @@ func (deps *endpointDeps) VideoAuctionEndpoint(w http.ResponseWriter, r *http.Re bidResp, err := buildVideoResponse(response, podErrors) if err != nil { errL := []error{err} - handleError(&labels, w, errL, &ao) + handleError(&labels, w, errL, &vo) return } if bidReq.Test == 1 { bidResp.Ext = response.Ext } + vo.VideoResponse = bidResp + resp, err := json.Marshal(bidResp) //resp, err := json.Marshal(response) if err != nil { errL := []error{err} - handleError(&labels, w, errL, &ao) + handleError(&labels, w, errL, &vo) return } @@ -238,7 +242,7 @@ func cleanupVideoBidRequest(videoReq *openrtb_ext.BidRequestVideo, podErrors []P return videoReq } -func handleError(labels *pbsmetrics.Labels, w http.ResponseWriter, errL []error, ao *analytics.AuctionObject) { +func handleError(labels *pbsmetrics.Labels, w http.ResponseWriter, errL []error, vo *analytics.VideoObject) { labels.RequestStatus = pbsmetrics.RequestStatusErr var errors string var status int = http.StatusInternalServerError @@ -256,10 +260,10 @@ func handleError(labels *pbsmetrics.Labels, w http.ResponseWriter, errL []error, errors = fmt.Sprintf("%s %s", errors, er.Error()) } w.WriteHeader(status) - ao.Status = status + vo.Status = status fmt.Fprintf(w, "Critical error while running the video endpoint: %v", errors) glog.Errorf("/openrtb2/video Critical error: %v", errors) - ao.Errors = append(ao.Errors, errL...) + vo.Errors = append(vo.Errors, errL...) } func (deps *endpointDeps) createImpressions(videoReq *openrtb_ext.BidRequestVideo, podErrors []PodError) ([]openrtb.Imp, []PodError) { diff --git a/endpoints/openrtb2/video_auction_test.go b/endpoints/openrtb2/video_auction_test.go index c112a808fdd..cda35ba9d28 100644 --- a/endpoints/openrtb2/video_auction_test.go +++ b/endpoints/openrtb2/video_auction_test.go @@ -650,7 +650,7 @@ func TestMergeOpenRTBToVideoRequest(t *testing.T) { } func TestHandleError(t *testing.T) { - ao := analytics.AuctionObject{ + vo := analytics.VideoObject{ Status: 200, Errors: make([]error, 0), } @@ -667,14 +667,14 @@ func TestHandleError(t *testing.T) { recorder := httptest.NewRecorder() err1 := errors.New("Error for testing handleError 1") err2 := errors.New("Error for testing handleError 2") - handleError(&labels, recorder, []error{err1, err2}, &ao) + handleError(&labels, recorder, []error{err1, err2}, &vo) assert.Equal(t, pbsmetrics.RequestStatusErr, labels.RequestStatus, "labels.RequestStatus should indicate an error") assert.Equal(t, 500, recorder.Code, "Error status should be written to writer") - assert.Equal(t, 500, ao.Status, "AnalyticsObject should have error status") - assert.Equal(t, 2, len(ao.Errors), "New errors should be appended to AnalyticsObject Errors") - assert.Equal(t, "Error for testing handleError 1", ao.Errors[0].Error(), "Error in AnalyticsObject should have test error message for first error") - assert.Equal(t, "Error for testing handleError 2", ao.Errors[1].Error(), "Error in AnalyticsObject should have test error message for second error") + assert.Equal(t, 500, vo.Status, "Analytics object should have error status") + assert.Equal(t, 2, len(vo.Errors), "New errors should be appended to Analytics object Errors") + assert.Equal(t, "Error for testing handleError 1", vo.Errors[0].Error(), "Error in Analytics object should have test error message for first error") + assert.Equal(t, "Error for testing handleError 2", vo.Errors[1].Error(), "Error in Analytics object should have test error message for second error") } func TestHandleErrorMetrics(t *testing.T) { @@ -692,11 +692,11 @@ func TestHandleErrorMetrics(t *testing.T) { assert.Equal(t, int64(0), met.RequestStatuses[pbsmetrics.ReqTypeVideo][pbsmetrics.RequestStatusOK].Count(), "OK requests count should be 0") assert.Equal(t, int64(1), met.RequestStatuses[pbsmetrics.ReqTypeVideo][pbsmetrics.RequestStatusErr].Count(), "Error requests count should be 1") - assert.Equal(t, 1, len(mod.auctionObjects), "Mock AnalyticsModule should have 1 AuctionObject") - assert.Equal(t, 500, mod.auctionObjects[0].Status, "AnalyticsObject should have 500 status") - assert.Equal(t, 2, len(mod.auctionObjects[0].Errors), "AnalyticsObject should have Errors length of 2") - assert.Equal(t, "request missing required field: PodConfig.DurationRangeSec", mod.auctionObjects[0].Errors[0].Error(), "First error in AnalyticsObject should have message regarding DurationRangeSec") - assert.Equal(t, "request missing required field: PodConfig.Pods", mod.auctionObjects[0].Errors[1].Error(), "Second error in AnalyticsObject should have message regarding Pods") + assert.Equal(t, 1, len(mod.videoObjects), "Mock AnalyticsModule should have 1 AuctionObject") + assert.Equal(t, 500, mod.videoObjects[0].Status, "AnalyticsObject should have 500 status") + assert.Equal(t, 2, len(mod.videoObjects[0].Errors), "AnalyticsObject should have Errors length of 2") + assert.Equal(t, "request missing required field: PodConfig.DurationRangeSec", mod.videoObjects[0].Errors[0].Error(), "First error in AnalyticsObject should have message regarding DurationRangeSec") + assert.Equal(t, "request missing required field: PodConfig.Pods", mod.videoObjects[0].Errors[1].Error(), "Second error in AnalyticsObject should have message regarding Pods") } func mockDepsWithMetrics(t *testing.T, ex *mockExchangeVideo) (*endpointDeps, *pbsmetrics.Metrics, *mockAnalyticsModule) { @@ -722,12 +722,17 @@ func mockDepsWithMetrics(t *testing.T, ex *mockExchangeVideo) (*endpointDeps, *p type mockAnalyticsModule struct { auctionObjects []*analytics.AuctionObject + videoObjects []*analytics.VideoObject } func (m *mockAnalyticsModule) LogAuctionObject(ao *analytics.AuctionObject) { m.auctionObjects = append(m.auctionObjects, ao) } +func (m *mockAnalyticsModule) LogVideoObject(vo *analytics.VideoObject) { + m.videoObjects = append(m.videoObjects, vo) +} + func (m *mockAnalyticsModule) LogCookieSyncObject(cso *analytics.CookieSyncObject) { return } func (m *mockAnalyticsModule) LogSetUIDObject(so *analytics.SetUIDObject) { return } diff --git a/exchange/adapter_map.go b/exchange/adapter_map.go index b2e5906667e..6a4c6e869d4 100644 --- a/exchange/adapter_map.go +++ b/exchange/adapter_map.go @@ -15,6 +15,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/adapters/adpone" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adtelligent" "github.com/PubMatic-OpenWrap/prebid-server/adapters/advangelists" + "github.com/PubMatic-OpenWrap/prebid-server/adapters/applogy" "github.com/PubMatic-OpenWrap/prebid-server/adapters/appnexus" "github.com/PubMatic-OpenWrap/prebid-server/adapters/audienceNetwork" "github.com/PubMatic-OpenWrap/prebid-server/adapters/beachfront" @@ -33,6 +34,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/adapters/ix" "github.com/PubMatic-OpenWrap/prebid-server/adapters/lifestreet" "github.com/PubMatic-OpenWrap/prebid-server/adapters/lockerdome" + "github.com/PubMatic-OpenWrap/prebid-server/adapters/marsmedia" "github.com/PubMatic-OpenWrap/prebid-server/adapters/mgid" "github.com/PubMatic-OpenWrap/prebid-server/adapters/openx" "github.com/PubMatic-OpenWrap/prebid-server/adapters/pubmatic" @@ -70,6 +72,7 @@ func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapter openrtb_ext.BidderAdpone: adpone.NewAdponeBidder(cfg.Adapters[string(openrtb_ext.BidderAdpone)].Endpoint), openrtb_ext.BidderAdtelligent: adtelligent.NewAdtelligentBidder(cfg.Adapters[string(openrtb_ext.BidderAdtelligent)].Endpoint), openrtb_ext.BidderAdvangelists: advangelists.NewAdvangelistsBidder(cfg.Adapters[string(openrtb_ext.BidderAdvangelists)].Endpoint), + openrtb_ext.BidderApplogy: applogy.NewApplogyBidder(cfg.Adapters[string(openrtb_ext.BidderApplogy)].Endpoint), openrtb_ext.BidderAppnexus: appnexus.NewAppNexusBidder(client, cfg.Adapters[string(openrtb_ext.BidderAppnexus)].Endpoint, cfg.Adapters[string(openrtb_ext.BidderAppnexus)].PlatformID), // TODO #615: Update the config setup so that the Beachfront URLs can be configured, and use those in TestRaceIntegration in exchange_test.go openrtb_ext.BidderBeachfront: beachfront.NewBeachfrontBidder(), @@ -90,6 +93,7 @@ func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapter openrtb_ext.BidderImprovedigital: improvedigital.NewImprovedigitalBidder(cfg.Adapters[string(openrtb_ext.BidderImprovedigital)].Endpoint), openrtb_ext.BidderKubient: kubient.NewKubientBidder(cfg.Adapters[string(openrtb_ext.BidderKubient)].Endpoint), openrtb_ext.BidderLockerDome: lockerdome.NewLockerDomeBidder(cfg.Adapters[string(openrtb_ext.BidderLockerDome)].Endpoint), + openrtb_ext.BidderMarsmedia: marsmedia.NewMarsmediaBidder(cfg.Adapters[string(openrtb_ext.BidderMarsmedia)].Endpoint), openrtb_ext.BidderMgid: mgid.NewMgidBidder(cfg.Adapters[string(openrtb_ext.BidderMgid)].Endpoint), openrtb_ext.BidderOpenx: openx.NewOpenxBidder(cfg.Adapters[string(openrtb_ext.BidderOpenx)].Endpoint), openrtb_ext.BidderPubmatic: pubmatic.NewPubmaticBidder(client, cfg.Adapters[string(openrtb_ext.BidderPubmatic)].Endpoint), diff --git a/exchange/exchange.go b/exchange/exchange.go index e429d7395f3..7d6b9ca26b2 100644 --- a/exchange/exchange.go +++ b/exchange/exchange.go @@ -13,6 +13,8 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/golang/glog" + "github.com/mxmCherry/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/currencies" @@ -21,8 +23,6 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbsmetrics" "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" - "github.com/golang/glog" - "github.com/mxmCherry/openrtb" ) // Exchange runs Auctions. Implementations must be threadsafe, and will be shared across many goroutines. @@ -337,6 +337,7 @@ func (e *exchange) buildBidResponse(ctx context.Context, liveAdapters []openrtb_ if adapterBids[a] != nil && len(adapterBids[a].bids) > 0 { sb := e.makeSeatBid(adapterBids[a], a, adapterExtra, auc) seatBids = append(seatBids, *sb) + bidResponse.Cur = adapterBids[a].currency } } diff --git a/exchange/exchange_test.go b/exchange/exchange_test.go index 881bf231e4f..4863cf0aa77 100644 --- a/exchange/exchange_test.go +++ b/exchange/exchange_test.go @@ -28,7 +28,6 @@ import ( pbc "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb" - "github.com/rcrowley/go-metrics" "github.com/stretchr/testify/assert" "github.com/yudai/gojsondiff" @@ -104,17 +103,17 @@ func TestCharacterEscape(t *testing.T) { Imp: []openrtb.Imp{{ ID: "some-impression-id", Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, - Ext: json.RawMessage(`{"appnexus": {"placementId": 10433394}}`), + Ext: json.RawMessage(`{"appnexus": {"placementId": 1}}`), }}, Site: &openrtb.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, Device: &openrtb.Device{UA: "curl/7.54.0", IP: "::1"}, AT: 1, TMax: 500, - Ext: json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 10433394}}}],"tmax": 500}`), + Ext: json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 1}}}],"tmax": 500}`), } //resolvedRequest json.RawMessage - resolvedRequest := json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 10433394}}}],"tmax": 500}`) + resolvedRequest := json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 1}}}],"tmax": 500}`) //adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, adapterExtra := make(map[openrtb_ext.BidderName]*seatResponseExtra, 1) @@ -232,7 +231,7 @@ func TestGetBidCacheInfo(t *testing.T) { } //resolvedRequest json.RawMessage - resolvedRequest := json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 10433394}}}],"tmax": 500}`) + resolvedRequest := json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 1}}}],"tmax": 500}`) //adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, adapterExtra := map[openrtb_ext.BidderName]*seatResponseExtra{ @@ -260,7 +259,7 @@ func TestGetBidCacheInfo(t *testing.T) { "siteId": 113932, "zoneId": 535510 }, - "appnexus": { "placementId": 10433394 }, + "appnexus": { "placementId": 1 }, "pubmatic": { "publisherId": "156209", "adSlot": "pubmatic_test2@300x250" }, "pulsepoint": { "cf": "300X250", "cp": 512379, "ct": 486653 }, "conversant": { "site_id": "108060" }, @@ -315,51 +314,145 @@ func TestGetBidCacheInfo(t *testing.T) { assert.Equal(t, expCacheURL, cacheURL, "[TestGetBidCacheInfo] cacheId field in ext should equal \"%s\" \n", expCacheURL) } -func buildBidResponseParams(bidderName openrtb_ext.BidderName, bidRequest *openrtb.BidRequest) ([]openrtb_ext.BidderName, map[openrtb_ext.BidderName]*pbsOrtbSeatBid, json.RawMessage, map[openrtb_ext.BidderName]*seatResponseExtra) { - //liveAdapters []openrtb_ext.BidderName, - liveAdapters := []openrtb_ext.BidderName{bidderName} +func TestBidResponseCurrency(t *testing.T) { + // Init objects + cfg := &config.Configuration{Adapters: make(map[string]config.Adapter, 1)} + cfg.Adapters["appnexus"] = config.Adapter{Endpoint: "http://ib.adnxs.com"} - //adapterBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid, - adapterBids := map[openrtb_ext.BidderName]*pbsOrtbSeatBid{ - bidderName: { - bids: []*pbsOrtbBid{ + handlerNoBidServer := func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(204) } + server := httptest.NewServer(http.HandlerFunc(handlerNoBidServer)) + defer server.Close() + + e := NewExchange(server.Client(), nil, cfg, pbsmetrics.NewMetrics(metrics.NewRegistry(), openrtb_ext.BidderList(), config.DisabledMetrics{}), adapters.ParseBidderInfos(cfg.Adapters, "../static/bidder-info", openrtb_ext.BidderList()), gdpr.AlwaysAllow{}, currencies.NewRateConverterDefault()).(*exchange) + + liveAdapters := make([]openrtb_ext.BidderName, 1) + liveAdapters[0] = "appnexus" + + bidRequest := &openrtb.BidRequest{ + ID: "some-request-id", + Imp: []openrtb.Imp{{ + ID: "some-impression-id", + Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, + Ext: json.RawMessage(`{"appnexus": {"placementId": 10433394}}`), + }}, + Site: &openrtb.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, + Device: &openrtb.Device{UA: "curl/7.54.0", IP: "::1"}, + AT: 1, + TMax: 500, + Ext: json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 10433394}}}],"tmax": 500}`), + } + + resolvedRequest := json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 1}}}],"tmax": 500}`) + + adapterExtra := map[openrtb_ext.BidderName]*seatResponseExtra{ + "appnexus": {ResponseTimeMillis: 5}, + } + + var errList []error + + sampleBid := &openrtb.Bid{ + ID: "some-imp-id", + Price: 9.517803, + W: 300, + H: 250, + Ext: nil, + } + aPbsOrtbBidArr := []*pbsOrtbBid{{bid: sampleBid, bidType: openrtb_ext.BidTypeBanner}} + sampleSeatBid := []openrtb.SeatBid{ + { + Seat: "appnexus", + Bid: []openrtb.Bid{ { - bid: &openrtb.Bid{ - ID: "some-imp-id", - Price: 9.517803, - W: 300, - H: 250, - }, - bidType: openrtb_ext.BidTypeBanner, - bidTargets: map[string]string{ - "pricegranularity": "med", - "includewinners": "true", - "includebidderkeys": "false", - }, + ID: "some-imp-id", + Price: 9.517803, + W: 300, + H: 250, + Ext: json.RawMessage(`{"prebid":{"type":"banner"}}`), }, }, - currency: "USD", - //ext: bidRequest.Ext, }, } + emptySeatBid := []openrtb.SeatBid{} - //resolvedRequest json.RawMessage - resolvedRequest := json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 10433394}}}],"tmax": 500}`) - - //adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, - adapterExtra := map[openrtb_ext.BidderName]*seatResponseExtra{ - bidderName: { - ResponseTimeMillis: 5, - Errors: []openrtb_ext.ExtBidderError{ - { - Code: 999, - Message: "Post ib.adnxs.com/openrtb2?query1&query2: unsupported protocol scheme \"\"", + // Test cases + type aTest struct { + description string + adapterBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid + expectedBidResponse *openrtb.BidResponse + } + testCases := []aTest{ + { + description: "1) Adapter to bids map comes with a non-empty currency field and non-empty bid array", + adapterBids: map[openrtb_ext.BidderName]*pbsOrtbSeatBid{ + openrtb_ext.BidderName("appnexus"): { + bids: aPbsOrtbBidArr, + currency: "USD", }, }, + expectedBidResponse: &openrtb.BidResponse{ + ID: "some-request-id", + SeatBid: sampleSeatBid, + Cur: "USD", + Ext: json.RawMessage(`{"responsetimemillis":{"appnexus":5},"tmaxrequest":500} +`), + }, + }, + { + description: "2) Adapter to bids map comes with a non-empty currency field but an empty bid array", + adapterBids: map[openrtb_ext.BidderName]*pbsOrtbSeatBid{ + openrtb_ext.BidderName("appnexus"): { + bids: nil, + currency: "USD", + }, + }, + expectedBidResponse: &openrtb.BidResponse{ + ID: "some-request-id", + SeatBid: emptySeatBid, + Cur: "", + Ext: json.RawMessage(`{"responsetimemillis":{"appnexus":5},"tmaxrequest":500} +`), + }, + }, + { + description: "3) Adapter to bids map comes with an empty currency string and a non-empty bid array", + adapterBids: map[openrtb_ext.BidderName]*pbsOrtbSeatBid{ + openrtb_ext.BidderName("appnexus"): { + bids: aPbsOrtbBidArr, + currency: "", + }, + }, + expectedBidResponse: &openrtb.BidResponse{ + ID: "some-request-id", + SeatBid: sampleSeatBid, + Cur: "", + Ext: json.RawMessage(`{"responsetimemillis":{"appnexus":5},"tmaxrequest":500} +`), + }, + }, + { + description: "4) Adapter to bids map comes with an empty currency string and an empty bid array", + adapterBids: map[openrtb_ext.BidderName]*pbsOrtbSeatBid{ + openrtb_ext.BidderName("appnexus"): { + bids: nil, + currency: "", + }, + }, + expectedBidResponse: &openrtb.BidResponse{ + ID: "some-request-id", + SeatBid: emptySeatBid, + Cur: "", + Ext: json.RawMessage(`{"responsetimemillis":{"appnexus":5},"tmaxrequest":500} +`), + }, }, } - return liveAdapters, adapterBids, resolvedRequest, adapterExtra + // Run tests + for i := range testCases { + actualBidResp, err := e.buildBidResponse(context.Background(), liveAdapters, testCases[i].adapterBids, bidRequest, resolvedRequest, adapterExtra, nil, false, errList) + assert.NoError(t, err, fmt.Sprintf("[TEST_FAILED] e.buildBidResponse resturns error in test: %s Error message: %s \n", testCases[i].description, err)) + assert.Equalf(t, testCases[i].expectedBidResponse, actualBidResp, fmt.Sprintf("[TEST_FAILED] Objects must be equal for test: %s \n Expected: >>%s<< \n Actual: >>%s<< ", testCases[i].description, testCases[i].expectedBidResponse.Ext, actualBidResp.Ext)) + } } // TestRaceIntegration runs an integration test using all the sample params from diff --git a/exchange/legacy.go b/exchange/legacy.go index f0b9d0cf0cb..9977f5794df 100644 --- a/exchange/legacy.go +++ b/exchange/legacy.go @@ -6,13 +6,13 @@ import ( "errors" "fmt" + "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/currencies" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbs" "github.com/PubMatic-OpenWrap/prebid-server/usersync" - "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" ) // AdaptLegacyAdapter turns a bidder.Adapter into an adaptedBidder. diff --git a/exchange/legacy_test.go b/exchange/legacy_test.go index 768e2eff94b..fa9988a29a9 100644 --- a/exchange/legacy_test.go +++ b/exchange/legacy_test.go @@ -7,14 +7,14 @@ import ( "reflect" "testing" + "github.com/buger/jsonparser" + "github.com/evanphx/json-patch" + "github.com/mxmCherry/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/currencies" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbs" "github.com/PubMatic-OpenWrap/prebid-server/usersync" - "github.com/buger/jsonparser" - jsonpatch "github.com/evanphx/json-patch" - "github.com/mxmCherry/openrtb" ) func TestSiteVideo(t *testing.T) { diff --git a/exchange/targeting_test.go b/exchange/targeting_test.go index fa93a6644a8..efb5ae4a4f8 100644 --- a/exchange/targeting_test.go +++ b/exchange/targeting_test.go @@ -15,9 +15,9 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/pbsmetrics" metricsConf "github.com/PubMatic-OpenWrap/prebid-server/pbsmetrics/config" + "github.com/mxmCherry/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/mxmCherry/openrtb" "github.com/stretchr/testify/assert" ) diff --git a/exchange/utils.go b/exchange/utils.go index 5ef8b9741ce..e4283898c26 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -6,13 +6,13 @@ import ( "fmt" "math/rand" + "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/gdpr" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbsmetrics" "github.com/PubMatic-OpenWrap/prebid-server/privacy" "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" ) // cleanOpenRTBRequests splits the input request into requests which are sanitized for each bidder. Intended behavior is: diff --git a/exchange/utils_test.go b/exchange/utils_test.go index b3bffc9bb0c..78b8813326e 100644 --- a/exchange/utils_test.go +++ b/exchange/utils_test.go @@ -153,7 +153,7 @@ func newAdapterAliasBidRequest(t *testing.T) *openrtb.BidRequest { H: 600, }}, }, - Ext: json.RawMessage(`{"appnexus": {"placementId": 10433394},"brightroll": {"placementId": 105}}`), + Ext: json.RawMessage(`{"appnexus": {"placementId": 1},"brightroll": {"placementId": 105}}`), }}, Ext: json.RawMessage(`{"prebid":{"aliases":{"brightroll":"appnexus"}}}`), } @@ -199,7 +199,7 @@ func newCCPABidRequest(t *testing.T) *openrtb.BidRequest { H: 600, }}, }, - Ext: json.RawMessage(`{"appnexus": {"placementId": 10433394}}`), + Ext: json.RawMessage(`{"appnexus": {"placementId": 1}}`), }}, } } diff --git a/gdpr/impl.go b/gdpr/impl.go index 04a6387e681..54e1fbf57e9 100644 --- a/gdpr/impl.go +++ b/gdpr/impl.go @@ -3,11 +3,11 @@ package gdpr import ( "context" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/prebid/go-gdpr/consentconstants" "github.com/prebid/go-gdpr/vendorconsent" "github.com/prebid/go-gdpr/vendorlist" + "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" ) // This file implements GDPR permissions for the app. diff --git a/gdpr/vendorlist-fetching.go b/gdpr/vendorlist-fetching.go index df46ee5cba7..f0e5b4e16d4 100644 --- a/gdpr/vendorlist-fetching.go +++ b/gdpr/vendorlist-fetching.go @@ -10,9 +10,9 @@ import ( "sync/atomic" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/golang/glog" "github.com/prebid/go-gdpr/vendorlist" + "github.com/PubMatic-OpenWrap/prebid-server/config" "golang.org/x/net/context/ctxhttp" ) diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index eb8fef81c33..9621b23dc81 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -27,6 +27,7 @@ const ( BidderAdpone BidderName = "adpone" BidderAdtelligent BidderName = "adtelligent" BidderAdvangelists BidderName = "advangelists" + BidderApplogy BidderName = "applogy" BidderAppnexus BidderName = "appnexus" BidderBeachfront BidderName = "beachfront" BidderBrightroll BidderName = "brightroll" @@ -46,6 +47,7 @@ const ( BidderKubient BidderName = "kubient" BidderLifestreet BidderName = "lifestreet" BidderLockerDome BidderName = "lockerdome" + BidderMarsmedia BidderName = "marsmedia" BidderMgid BidderName = "mgid" BidderOpenx BidderName = "openx" BidderPubmatic BidderName = "pubmatic" @@ -78,6 +80,7 @@ var BidderMap = map[string]BidderName{ "adpone": BidderAdpone, "adtelligent": BidderAdtelligent, "advangelists": BidderAdvangelists, + "applogy": BidderApplogy, "appnexus": BidderAppnexus, "beachfront": BidderBeachfront, "brightroll": BidderBrightroll, @@ -97,6 +100,7 @@ var BidderMap = map[string]BidderName{ "kubient": BidderKubient, "lifestreet": BidderLifestreet, "lockerdome": BidderLockerDome, + "marsmedia": BidderMarsmedia, "mgid": BidderMgid, "openx": BidderOpenx, "pubmatic": BidderPubmatic, diff --git a/openrtb_ext/imp_applogy.go b/openrtb_ext/imp_applogy.go new file mode 100644 index 00000000000..45774a05afb --- /dev/null +++ b/openrtb_ext/imp_applogy.go @@ -0,0 +1,5 @@ +package openrtb_ext + +type ExtImpApplogy struct { + Token string `json:"token"` +} diff --git a/openrtb_ext/imp_marsmedia.go b/openrtb_ext/imp_marsmedia.go new file mode 100644 index 00000000000..39bc433d661 --- /dev/null +++ b/openrtb_ext/imp_marsmedia.go @@ -0,0 +1,6 @@ +package openrtb_ext + +// ExtImpMarsmedia defines the contract for bidrequest.imp[i].ext.marsmedia +type ExtImpMarsmedia struct { + ZoneID string `json:"zone"` +} diff --git a/pbs/pbsrequest_test.go b/pbs/pbsrequest_test.go index 223ef0d956e..29c40cec427 100644 --- a/pbs/pbsrequest_test.go +++ b/pbs/pbsrequest_test.go @@ -199,7 +199,7 @@ var dummyConfig = ` "bidder": "appnexus", "bid_id": "22222224", "params": { - "placementId": "10433394" + "placementId": "1" } } ] diff --git a/pbs/usersync.go b/pbs/usersync.go index dbc2e27e4eb..c48f5e944a6 100644 --- a/pbs/usersync.go +++ b/pbs/usersync.go @@ -9,13 +9,13 @@ import ( "strings" "time" + "github.com/golang/glog" + "github.com/julienschmidt/httprouter" "github.com/PubMatic-OpenWrap/prebid-server/analytics" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/pbsmetrics" "github.com/PubMatic-OpenWrap/prebid-server/ssl" "github.com/PubMatic-OpenWrap/prebid-server/usersync" - "github.com/golang/glog" - "github.com/julienschmidt/httprouter" ) // Recaptcha code from https://github.com/haisum/recaptcha/blob/master/recaptcha.go diff --git a/pbsmetrics/go_metrics.go b/pbsmetrics/go_metrics.go index df757728a38..bb64088b143 100644 --- a/pbsmetrics/go_metrics.go +++ b/pbsmetrics/go_metrics.go @@ -5,9 +5,9 @@ import ( "sync" "time" + "github.com/golang/glog" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/golang/glog" metrics "github.com/rcrowley/go-metrics" ) diff --git a/static/bidder-info/applogy.yaml b/static/bidder-info/applogy.yaml new file mode 100644 index 00000000000..bb908c94e70 --- /dev/null +++ b/static/bidder-info/applogy.yaml @@ -0,0 +1,13 @@ +maintainer: + email: work@applogy.com +capabilities: + app: + mediaTypes: + - banner + - video + - native + site: + mediaTypes: + - banner + - video + - native diff --git a/static/bidder-info/marsmedia.yaml b/static/bidder-info/marsmedia.yaml new file mode 100644 index 00000000000..e0267205a27 --- /dev/null +++ b/static/bidder-info/marsmedia.yaml @@ -0,0 +1,11 @@ +maintainer: + email: "prebid@mars.media" +capabilities: + app: + mediaTypes: + - banner + - video + site: + mediaTypes: + - banner + - video diff --git a/static/bidder-params/applogy.json b/static/bidder-params/applogy.json new file mode 100644 index 00000000000..2650640c115 --- /dev/null +++ b/static/bidder-params/applogy.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Applogy Adapter Params", + "description": "A schema which validates params accepted by the Applogy adapter", + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "Applogy token" + } + }, + "required": ["token"] +} diff --git a/static/bidder-params/marsmedia.json b/static/bidder-params/marsmedia.json new file mode 100644 index 00000000000..208a42e8474 --- /dev/null +++ b/static/bidder-params/marsmedia.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Marsmedia Adapter Params", + "description": "A schema which validates params accepted by the Marsmedia adapter", + "type": "object", + "properties": { + "zone": { + "type": "string", + "description": "Zone ID to use." + } + }, + "required": ["zone"] +} diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index c664ee0b5cb..3dafe0c2f9b 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -6,6 +6,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/adapters/adpone" + "github.com/golang/glog" ttx "github.com/PubMatic-OpenWrap/prebid-server/adapters/33across" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adform" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adkernel" @@ -30,6 +31,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/adapters/ix" "github.com/PubMatic-OpenWrap/prebid-server/adapters/lifestreet" "github.com/PubMatic-OpenWrap/prebid-server/adapters/lockerdome" + "github.com/PubMatic-OpenWrap/prebid-server/adapters/marsmedia" "github.com/PubMatic-OpenWrap/prebid-server/adapters/mgid" "github.com/PubMatic-OpenWrap/prebid-server/adapters/openx" "github.com/PubMatic-OpenWrap/prebid-server/adapters/pubmatic" @@ -52,7 +54,6 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/usersync" - "github.com/golang/glog" ) // NewSyncerMap returns a map of all the usersyncer objects. @@ -86,6 +87,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderIx, ix.NewIxSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderLifestreet, lifestreet.NewLifestreetSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderLockerDome, lockerdome.NewLockerDomeSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderMarsmedia, marsmedia.NewMarsmediaSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderMgid, mgid.NewMgidSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderOpenx, openx.NewOpenxSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderPubmatic, pubmatic.NewPubmaticSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 42b1e890e67..1e93d75111d 100644 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -39,6 +39,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderIx): syncConfig, string(openrtb_ext.BidderLifestreet): syncConfig, string(openrtb_ext.BidderLockerDome): syncConfig, + string(openrtb_ext.BidderMarsmedia): syncConfig, string(openrtb_ext.BidderMgid): syncConfig, string(openrtb_ext.BidderOpenx): syncConfig, string(openrtb_ext.BidderPubmatic): syncConfig, @@ -62,6 +63,7 @@ func TestNewSyncerMap(t *testing.T) { } adaptersWithoutSyncers := map[openrtb_ext.BidderName]bool{ + openrtb_ext.BidderApplogy: true, openrtb_ext.BidderTappx: true, openrtb_ext.BidderKubient: true, openrtb_ext.BidderPubnative: true,