From 68298aa1723de416df51765838e17a93058114f4 Mon Sep 17 00:00:00 2001 From: wuzhijian Date: Thu, 27 Feb 2025 18:12:23 +0800 Subject: [PATCH 01/11] New Adapter: Flatads --- adapters/flatads/flatads.go | 156 +++++++++++++ adapters/flatads/flatads_test.go | 29 +++ .../flatads/flatadstest/exemplary/banner.json | 122 ++++++++++ .../flatadstest/exemplary/headers_ipv4.json | 124 ++++++++++ .../flatadstest/exemplary/headers_ipv6.json | 123 ++++++++++ .../flatadstest/exemplary/multiple-imps.json | 213 ++++++++++++++++++ .../flatads/flatadstest/exemplary/native.json | 114 ++++++++++ .../exemplary/optional-params.json | 126 +++++++++++ .../flatads/flatadstest/exemplary/video.json | 120 ++++++++++ .../flatadstest/supplemental/bad-request.json | 92 ++++++++ .../multiple-imps-with-error.json | 145 ++++++++++++ .../response-200-without-body.json | 90 ++++++++ .../supplemental/response-204.json | 85 +++++++ .../supplemental/server-error.json | 73 ++++++ adapters/flatads/params_test.go | 56 +++++ exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_flatads.go | 6 + static/bidder-info/flatads.yaml | 21 ++ static/bidder-params/flatads.json | 20 ++ 20 files changed, 1719 insertions(+) create mode 100644 adapters/flatads/flatads.go create mode 100644 adapters/flatads/flatads_test.go create mode 100644 adapters/flatads/flatadstest/exemplary/banner.json create mode 100644 adapters/flatads/flatadstest/exemplary/headers_ipv4.json create mode 100644 adapters/flatads/flatadstest/exemplary/headers_ipv6.json create mode 100644 adapters/flatads/flatadstest/exemplary/multiple-imps.json create mode 100644 adapters/flatads/flatadstest/exemplary/native.json create mode 100644 adapters/flatads/flatadstest/exemplary/optional-params.json create mode 100644 adapters/flatads/flatadstest/exemplary/video.json create mode 100644 adapters/flatads/flatadstest/supplemental/bad-request.json create mode 100644 adapters/flatads/flatadstest/supplemental/multiple-imps-with-error.json create mode 100644 adapters/flatads/flatadstest/supplemental/response-200-without-body.json create mode 100644 adapters/flatads/flatadstest/supplemental/response-204.json create mode 100644 adapters/flatads/flatadstest/supplemental/server-error.json create mode 100644 adapters/flatads/params_test.go create mode 100644 openrtb_ext/imp_flatads.go create mode 100644 static/bidder-info/flatads.yaml create mode 100644 static/bidder-params/flatads.json diff --git a/adapters/flatads/flatads.go b/adapters/flatads/flatads.go new file mode 100644 index 00000000000..140b72240f5 --- /dev/null +++ b/adapters/flatads/flatads.go @@ -0,0 +1,156 @@ +package flatads + +import ( + "fmt" + "net/http" + "text/template" + + "github.com/prebid/openrtb/v20/openrtb2" + "github.com/prebid/prebid-server/v3/adapters" + "github.com/prebid/prebid-server/v3/config" + "github.com/prebid/prebid-server/v3/errortypes" + "github.com/prebid/prebid-server/v3/macros" + "github.com/prebid/prebid-server/v3/openrtb_ext" + "github.com/prebid/prebid-server/v3/util/jsonutil" +) + +type adapter struct { + endpoint *template.Template +} + +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { + endpointTemplate, err := template.New("endpointTemplate").Parse(config.Endpoint) + if err != nil { + return nil, fmt.Errorf("unable to parse endpoint template: %v", err) + } + + bidder := &adapter{ + endpoint: endpointTemplate, + } + return bidder, nil +} + +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var requests []*adapters.RequestData + var errs []error + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + if request.Device != nil { + if len(request.Device.UA) > 0 { + headers.Add("User-Agent", request.Device.UA) + } + + if len(request.Device.IPv6) > 0 { + headers.Add("X-Forwarded-For", request.Device.IPv6) + } + + if len(request.Device.IP) > 0 { + headers.Add("X-Forwarded-For", request.Device.IP) + } + } + requestCopy := *request + for _, imp := range request.Imp { + requestCopy.Imp = []openrtb2.Imp{imp} + + endpoint, err := a.buildEndpointFromRequest(&imp) + if err != nil { + errs = append(errs, err) + continue + } + + requestJSON, err := jsonutil.Marshal(requestCopy) + if err != nil { + errs = append(errs, err) + continue + } + + request := &adapters.RequestData{ + Method: http.MethodPost, + Body: requestJSON, + Uri: endpoint, + Headers: headers, + ImpIDs: openrtb_ext.GetImpIDs(requestCopy.Imp), + } + + requests = append(requests, request) + } + + return requests, errs +} + +func (a *adapter) buildEndpointFromRequest(imp *openrtb2.Imp) (string, error) { + var impExt adapters.ExtImpBidder + if err := jsonutil.Unmarshal(imp.Ext, &impExt); err != nil { + return "", &errortypes.BadInput{ + Message: fmt.Sprintf("Failed to deserialize bidder impression extension: %v", err), + } + } + + var flatadsExt openrtb_ext.ImpExtFlatads + if err := jsonutil.Unmarshal(impExt.Bidder, &flatadsExt); err != nil { + return "", &errortypes.BadInput{ + Message: fmt.Sprintf("Failed to deserialize Flatads extension: %v", err), + } + } + + endpointParams := macros.EndpointTemplateParams{ + TokenID: flatadsExt.Token, + PublisherID: flatadsExt.PublisherId, + } + + return macros.ResolveMacros(a.endpoint, endpointParams) +} + +func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if adapters.IsResponseStatusCodeNoContent(responseData) { + return nil, nil + } + + err := adapters.CheckResponseStatusCodeForErrors(responseData) + if err != nil { + return nil, []error{err} + } + var response openrtb2.BidResponse + if err := jsonutil.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + if len(response.Cur) != 0 { + bidResponse.Currency = response.Cur + } + + for _, seatBid := range response.SeatBid { + for i := range seatBid.Bid { + + bidMediaType, err := getMediaTypeForBid(seatBid.Bid[i].ImpID, request.Imp) + if err != nil { + return nil, []error{err} + } + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &seatBid.Bid[i], + BidType: bidMediaType, + }) + } + } + return bidResponse, nil +} + +func getMediaTypeForBid(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { + for _, imp := range imps { + if imp.ID == impID { + if imp.Banner != nil { + return openrtb_ext.BidTypeBanner, nil + } else if imp.Video != nil { + return openrtb_ext.BidTypeVideo, nil + } else if imp.Native != nil { + return openrtb_ext.BidTypeNative, nil + } + } + } + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("The impression with ID %s is not present into the request", impID), + } +} diff --git a/adapters/flatads/flatads_test.go b/adapters/flatads/flatads_test.go new file mode 100644 index 00000000000..7899c26f7bc --- /dev/null +++ b/adapters/flatads/flatads_test.go @@ -0,0 +1,29 @@ +package flatads + +import ( + "testing" + + "github.com/prebid/prebid-server/v3/adapters/adapterstest" + "github.com/prebid/prebid-server/v3/config" + "github.com/prebid/prebid-server/v3/openrtb_ext" + "github.com/stretchr/testify/assert" +) + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderFlatads, config.Adapter{ + Endpoint: "http://localhost:7826/adx/rtb?x-net-id={{.PublisherID}}&x-net-token={{.TokenID}}"}, + config.Server{}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "flatadstest", bidder) +} + +func TestEndpointTemplateMalformed(t *testing.T) { + _, buildErr := Builder(openrtb_ext.BidderFlatads, config.Adapter{ + Endpoint: "x-net-id={{PublisherID}}&x-net-token={{TokenID}}"}, config.Server{}) + + assert.Error(t, buildErr) +} diff --git a/adapters/flatads/flatadstest/exemplary/banner.json b/adapters/flatads/flatadstest/exemplary/banner.json new file mode 100644 index 00000000000..c200f44aa5b --- /dev/null +++ b/adapters/flatads/flatadstest/exemplary/banner.json @@ -0,0 +1,122 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": ["test-imp-id-banner"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "flatads", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/flatads/flatadstest/exemplary/headers_ipv4.json b/adapters/flatads/flatadstest/exemplary/headers_ipv4.json new file mode 100644 index 00000000000..53d194bf02e --- /dev/null +++ b/adapters/flatads/flatadstest/exemplary/headers_ipv4.json @@ -0,0 +1,124 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": [ + "test-imp-id-banner" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "flatads", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/flatads/flatadstest/exemplary/headers_ipv6.json b/adapters/flatads/flatadstest/exemplary/headers_ipv6.json new file mode 100644 index 00000000000..1a40dd656b3 --- /dev/null +++ b/adapters/flatads/flatadstest/exemplary/headers_ipv6.json @@ -0,0 +1,123 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ipv6": "2607:fb90:f27:4512:d800:cb23:a603:e245", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "2607:fb90:f27:4512:d800:cb23:a603:e245" + ] + }, + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ipv6": "2607:fb90:f27:4512:d800:cb23:a603:e245", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": ["test-imp-id-banner"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "flatads", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + } + ] + } + \ No newline at end of file diff --git a/adapters/flatads/flatadstest/exemplary/multiple-imps.json b/adapters/flatads/flatadstest/exemplary/multiple-imps.json new file mode 100644 index 00000000000..800531a754f --- /dev/null +++ b/adapters/flatads/flatadstest/exemplary/multiple-imps.json @@ -0,0 +1,213 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + }, + { + "id": "test-imp-id-banner2", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": ["test-imp-id-banner"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "flatads", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + }, + { + "expectedRequest": { + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner2", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": ["test-imp-id-banner2"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "flatads", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e801", + "impid": "test-imp-id-banner2", + "price": 0.5, + "adm": "some-test-ad-banner2", + "crid": "crid_11", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + }, + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e801", + "impid": "test-imp-id-banner2", + "price": 0.5, + "adm": "some-test-ad-banner2", + "crid": "crid_11", + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/flatads/flatadstest/exemplary/native.json b/adapters/flatads/flatadstest/exemplary/native.json new file mode 100644 index 00000000000..55faa601cad --- /dev/null +++ b/adapters/flatads/flatadstest/exemplary/native.json @@ -0,0 +1,114 @@ +{ + "mockBidRequest": { + "id": "test-request-id-native", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-native", + "native": { + "request": "" + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id-native", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-native", + "native": { + "request": "" + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": [ + "test-imp-id-native" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-native", + "seatbid": [ + { + "seat": "flatads", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-native", + "price": 0.5, + "adm": "some-test-ad-native", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-native", + "price": 0.5, + "adm": "some-test-ad-native", + "crid": "crid_10", + "w": 728, + "h": 90 + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/flatads/flatadstest/exemplary/optional-params.json b/adapters/flatads/flatadstest/exemplary/optional-params.json new file mode 100644 index 00000000000..b5318bbd286 --- /dev/null +++ b/adapters/flatads/flatadstest/exemplary/optional-params.json @@ -0,0 +1,126 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111", + "bidFloor": 0.1, + "isTest": false + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111", + "bidFloor": 0.1, + "isTest": false + } + } + } + ] + }, + "impIDs": ["test-imp-id-banner"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "flatads", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/flatads/flatadstest/exemplary/video.json b/adapters/flatads/flatadstest/exemplary/video.json new file mode 100644 index 00000000000..7f59cf57f49 --- /dev/null +++ b/adapters/flatads/flatadstest/exemplary/video.json @@ -0,0 +1,120 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-video-id", + "video": { + "mimes": ["video/mp4"], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-video-id", + "video": { + "mimes": ["video/mp4"], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": ["test-video-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-test-video-id", + "seatbid": [ + { + "seat": "test-seat", + "bid": [ + { + "id": "5dce6055-a93c-1fd0-8c29-14afc3e510fd", + "impid": "test-video-id", + "price": 0.1529, + "nurl": "test-win", + "adm": "test-video", + "adid": "92-288", + "adomain": ["advertiserdomain.com"], + "crid": "288", + "w": 300, + "h": 250 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "5dce6055-a93c-1fd0-8c29-14afc3e510fd", + "impid": "test-video-id", + "price": 0.1529, + "nurl": "test-win", + "adm": "test-video", + "adid": "92-288", + "adomain": ["advertiserdomain.com"], + "crid": "288", + "w": 300, + "h": 250 + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/flatads/flatadstest/supplemental/bad-request.json b/adapters/flatads/flatadstest/supplemental/bad-request.json new file mode 100644 index 00000000000..c643ef43c24 --- /dev/null +++ b/adapters/flatads/flatadstest/supplemental/bad-request.json @@ -0,0 +1,92 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 400, + "headers": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] + } + \ No newline at end of file diff --git a/adapters/flatads/flatadstest/supplemental/multiple-imps-with-error.json b/adapters/flatads/flatadstest/supplemental/multiple-imps-with-error.json new file mode 100644 index 00000000000..eebed40c21c --- /dev/null +++ b/adapters/flatads/flatadstest/supplemental/multiple-imps-with-error.json @@ -0,0 +1,145 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + }, + { + "id": "test-imp-id-banner2", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": {}, + "publisherId": "1111" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": ["test-imp-id-banner"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "flatads", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedMakeRequestsErrors": [ + { + "value": "Failed to deserialize Flatads extension: cannot unmarshal openrtb_ext.ImpExtFlatads.Token: expects \" or n, but found {", + "comparison": "literal" + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-banner", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/flatads/flatadstest/supplemental/response-200-without-body.json b/adapters/flatads/flatadstest/supplemental/response-200-without-body.json new file mode 100644 index 00000000000..68a61953964 --- /dev/null +++ b/adapters/flatads/flatadstest/supplemental/response-200-without-body.json @@ -0,0 +1,90 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200 + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "expect { or n, but found", + "comparison": "startswith" + } + ] +} \ No newline at end of file diff --git a/adapters/flatads/flatadstest/supplemental/response-204.json b/adapters/flatads/flatadstest/supplemental/response-204.json new file mode 100644 index 00000000000..65e798be13b --- /dev/null +++ b/adapters/flatads/flatadstest/supplemental/response-204.json @@ -0,0 +1,85 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/flatads/flatadstest/supplemental/server-error.json b/adapters/flatads/flatadstest/supplemental/server-error.json new file mode 100644 index 00000000000..eed274ba045 --- /dev/null +++ b/adapters/flatads/flatadstest/supplemental/server-error.json @@ -0,0 +1,73 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 500, + "headers": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 500. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/flatads/params_test.go b/adapters/flatads/params_test.go new file mode 100644 index 00000000000..4aeddc2b9d7 --- /dev/null +++ b/adapters/flatads/params_test.go @@ -0,0 +1,56 @@ +package flatads + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v3/openrtb_ext" +) + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json schema. %v", err) + } + + for _, p := range validParams { + if err := validator.Validate(openrtb_ext.BidderFlatads, json.RawMessage(p)); err != nil { + t.Errorf("Schema rejected valid params: %s", p) + } + } +} + +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json schema. %v", err) + } + + for _, p := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderFlatads, json.RawMessage(p)); err == nil { + t.Errorf("Schema allowed invalid params: %s", p) + } + } +} + +var validParams = []string{ + `{ "token": "66668888", + "publisherId": "1111", + "ext": { + "key1": "value1", + "key2": "value2" + } + }`, + `{"token": "66668888", "publisherId": "1111"}`, +} + +var invalidParams = []string{ + `{"ext": { + "key1": "value1", + "key2": "value2" + }`, + `{}`, + `{"token": 66668888, "networkId":1111}`, + `{"token": "66668888"", "networkId":1111}`, + `{"token": 66668888, "networkId":"1111""}`, +} diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index f9f33a18ce3..cb21dfc8775 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -100,6 +100,7 @@ import ( "github.com/prebid/prebid-server/v3/adapters/epom" "github.com/prebid/prebid-server/v3/adapters/escalax" "github.com/prebid/prebid-server/v3/adapters/feedad" + "github.com/prebid/prebid-server/v3/adapters/flatads" "github.com/prebid/prebid-server/v3/adapters/flipp" "github.com/prebid/prebid-server/v3/adapters/freewheelssp" "github.com/prebid/prebid-server/v3/adapters/frvradn" @@ -347,6 +348,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderEscalax: escalax.Builder, openrtb_ext.BidderEVolution: evolution.Builder, openrtb_ext.BidderFeedAd: feedad.Builder, + openrtb_ext.BidderFlatads: flatads.Builder, openrtb_ext.BidderFlipp: flipp.Builder, openrtb_ext.BidderFreewheelSSP: freewheelssp.Builder, openrtb_ext.BidderFRVRAdNetwork: frvradn.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 2d42fdfb694..98c01e6709b 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -117,6 +117,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderEscalax, BidderEVolution, BidderFeedAd, + BidderFlatads, BidderFlipp, BidderFreewheelSSP, BidderFRVRAdNetwork, @@ -470,6 +471,7 @@ const ( BidderEscalax BidderName = "escalax" BidderEVolution BidderName = "e_volution" BidderFeedAd BidderName = "feedad" + BidderFlatads BidderName = "flatads" BidderFlipp BidderName = "flipp" BidderFreewheelSSP BidderName = "freewheelssp" BidderFRVRAdNetwork BidderName = "frvradn" diff --git a/openrtb_ext/imp_flatads.go b/openrtb_ext/imp_flatads.go new file mode 100644 index 00000000000..331190a78cd --- /dev/null +++ b/openrtb_ext/imp_flatads.go @@ -0,0 +1,6 @@ +package openrtb_ext + +type ImpExtFlatads struct { + Token string `json:"token"` + PublisherId string `json:"publisherId"` +} diff --git a/static/bidder-info/flatads.yaml b/static/bidder-info/flatads.yaml new file mode 100644 index 00000000000..2d415b1b793 --- /dev/null +++ b/static/bidder-info/flatads.yaml @@ -0,0 +1,21 @@ +endpoint: "http://localhost:7826/adx/rtb?x-net-id={{.PublisherID}}&x-net-token={{.TokenID}}" +endpointCompression: gzip +maintainer: + email: "tangyang@flat-ads.com" +openrtb: + version: 2.6 +capabilities: + app: + mediaTypes: + - banner + - video + - native + site: + mediaTypes: + - banner + - video + - native +userSync: + redirect: + url: http://localhost:7802/cms/user_sync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}} + userMacro: $UID diff --git a/static/bidder-params/flatads.json b/static/bidder-params/flatads.json new file mode 100644 index 00000000000..aa255f073fe --- /dev/null +++ b/static/bidder-params/flatads.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Flatads Adapter Params", + "description": "A schema which validates params accepted by the Flatads adapter", + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "Token of the publisher" + }, + "publisherId": { + "type": "string", + "description": "Flatads Publisher Id" + } + }, + "required": [ + "token", + "publisherId" + ] +} \ No newline at end of file From ec2ab3048f066c2bb040ece4ad22d295a56b9058 Mon Sep 17 00:00:00 2001 From: wuzhijian Date: Fri, 28 Feb 2025 15:10:44 +0800 Subject: [PATCH 02/11] Flatads request header --- adapters/flatads/flatads.go | 1 + 1 file changed, 1 insertion(+) diff --git a/adapters/flatads/flatads.go b/adapters/flatads/flatads.go index 140b72240f5..858cc471e70 100644 --- a/adapters/flatads/flatads.go +++ b/adapters/flatads/flatads.go @@ -37,6 +37,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") + headers.Add("X-OpenRTB-Version", "2.6") if request.Device != nil { if len(request.Device.UA) > 0 { headers.Add("User-Agent", request.Device.UA) From 899cec72f78829c22fee0dc583d0fc567b11acc8 Mon Sep 17 00:00:00 2001 From: wuzhijian Date: Fri, 28 Feb 2025 15:24:23 +0800 Subject: [PATCH 03/11] Flatads request header --- adapters/flatads/flatads.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/flatads/flatads.go b/adapters/flatads/flatads.go index 858cc471e70..b51747a2c03 100644 --- a/adapters/flatads/flatads.go +++ b/adapters/flatads/flatads.go @@ -37,7 +37,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") - headers.Add("X-OpenRTB-Version", "2.6") + //headers.Add("X-OpenRTB-Version", "2.6") if request.Device != nil { if len(request.Device.UA) > 0 { headers.Add("User-Agent", request.Device.UA) From 1d54edd74885bdce01668ba55ccbaa0edbdb1634 Mon Sep 17 00:00:00 2001 From: wuzhijian Date: Tue, 4 Mar 2025 11:55:05 +0800 Subject: [PATCH 04/11] update endopoint --- adapters/flatads/flatads_test.go | 2 +- adapters/flatads/flatadstest/exemplary/banner.json | 2 +- adapters/flatads/flatadstest/exemplary/headers_ipv4.json | 2 +- adapters/flatads/flatadstest/exemplary/headers_ipv6.json | 2 +- adapters/flatads/flatadstest/exemplary/multiple-imps.json | 4 ++-- adapters/flatads/flatadstest/exemplary/native.json | 2 +- adapters/flatads/flatadstest/exemplary/optional-params.json | 2 +- adapters/flatads/flatadstest/exemplary/video.json | 2 +- adapters/flatads/flatadstest/supplemental/bad-request.json | 2 +- .../flatadstest/supplemental/multiple-imps-with-error.json | 2 +- .../flatadstest/supplemental/response-200-without-body.json | 2 +- adapters/flatads/flatadstest/supplemental/response-204.json | 2 +- adapters/flatads/flatadstest/supplemental/server-error.json | 2 +- static/bidder-info/flatads.yaml | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/adapters/flatads/flatads_test.go b/adapters/flatads/flatads_test.go index 7899c26f7bc..a0520746886 100644 --- a/adapters/flatads/flatads_test.go +++ b/adapters/flatads/flatads_test.go @@ -11,7 +11,7 @@ import ( func TestJsonSamples(t *testing.T) { bidder, buildErr := Builder(openrtb_ext.BidderFlatads, config.Adapter{ - Endpoint: "http://localhost:7826/adx/rtb?x-net-id={{.PublisherID}}&x-net-token={{.TokenID}}"}, + Endpoint: "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id={{.PublisherID}}&x-net-token={{.TokenID}}"}, config.Server{}) if buildErr != nil { diff --git a/adapters/flatads/flatadstest/exemplary/banner.json b/adapters/flatads/flatadstest/exemplary/banner.json index c200f44aa5b..af31149f182 100644 --- a/adapters/flatads/flatadstest/exemplary/banner.json +++ b/adapters/flatads/flatadstest/exemplary/banner.json @@ -44,7 +44,7 @@ "123.123.123.123" ] }, - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/exemplary/headers_ipv4.json b/adapters/flatads/flatadstest/exemplary/headers_ipv4.json index 53d194bf02e..c67ebf5bb19 100644 --- a/adapters/flatads/flatadstest/exemplary/headers_ipv4.json +++ b/adapters/flatads/flatadstest/exemplary/headers_ipv4.json @@ -44,7 +44,7 @@ "123.123.123.123" ] }, - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/exemplary/headers_ipv6.json b/adapters/flatads/flatadstest/exemplary/headers_ipv6.json index 1a40dd656b3..7a31c553ffe 100644 --- a/adapters/flatads/flatadstest/exemplary/headers_ipv6.json +++ b/adapters/flatads/flatadstest/exemplary/headers_ipv6.json @@ -44,7 +44,7 @@ "2607:fb90:f27:4512:d800:cb23:a603:e245" ] }, - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/exemplary/multiple-imps.json b/adapters/flatads/flatadstest/exemplary/multiple-imps.json index 800531a754f..9c8b1280cdc 100644 --- a/adapters/flatads/flatadstest/exemplary/multiple-imps.json +++ b/adapters/flatads/flatadstest/exemplary/multiple-imps.json @@ -61,7 +61,7 @@ "123.123.123.123" ] }, - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { @@ -118,7 +118,7 @@ }, { "expectedRequest": { - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/exemplary/native.json b/adapters/flatads/flatadstest/exemplary/native.json index 55faa601cad..941722f0671 100644 --- a/adapters/flatads/flatadstest/exemplary/native.json +++ b/adapters/flatads/flatadstest/exemplary/native.json @@ -39,7 +39,7 @@ "123.123.123.123" ] }, - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-native", "device": { diff --git a/adapters/flatads/flatadstest/exemplary/optional-params.json b/adapters/flatads/flatadstest/exemplary/optional-params.json index b5318bbd286..475c9210640 100644 --- a/adapters/flatads/flatadstest/exemplary/optional-params.json +++ b/adapters/flatads/flatadstest/exemplary/optional-params.json @@ -46,7 +46,7 @@ "123.123.123.123" ] }, - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/exemplary/video.json b/adapters/flatads/flatadstest/exemplary/video.json index 7f59cf57f49..e9db57f016e 100644 --- a/adapters/flatads/flatadstest/exemplary/video.json +++ b/adapters/flatads/flatadstest/exemplary/video.json @@ -41,7 +41,7 @@ "123.123.123.123" ] }, - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id", "device": { diff --git a/adapters/flatads/flatadstest/supplemental/bad-request.json b/adapters/flatads/flatadstest/supplemental/bad-request.json index c643ef43c24..2d07c5ba082 100644 --- a/adapters/flatads/flatadstest/supplemental/bad-request.json +++ b/adapters/flatads/flatadstest/supplemental/bad-request.json @@ -45,7 +45,7 @@ "123.123.123.123" ] }, - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id", "device": { diff --git a/adapters/flatads/flatadstest/supplemental/multiple-imps-with-error.json b/adapters/flatads/flatadstest/supplemental/multiple-imps-with-error.json index eebed40c21c..382fad0721d 100644 --- a/adapters/flatads/flatadstest/supplemental/multiple-imps-with-error.json +++ b/adapters/flatads/flatadstest/supplemental/multiple-imps-with-error.json @@ -61,7 +61,7 @@ "123.123.123.123" ] }, - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/supplemental/response-200-without-body.json b/adapters/flatads/flatadstest/supplemental/response-200-without-body.json index 68a61953964..10e5dd4c7ea 100644 --- a/adapters/flatads/flatadstest/supplemental/response-200-without-body.json +++ b/adapters/flatads/flatadstest/supplemental/response-200-without-body.json @@ -45,7 +45,7 @@ "123.123.123.123" ] }, - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id", "device": { diff --git a/adapters/flatads/flatadstest/supplemental/response-204.json b/adapters/flatads/flatadstest/supplemental/response-204.json index 65e798be13b..ea5d61bef53 100644 --- a/adapters/flatads/flatadstest/supplemental/response-204.json +++ b/adapters/flatads/flatadstest/supplemental/response-204.json @@ -45,7 +45,7 @@ "123.123.123.123" ] }, - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id", "device": { diff --git a/adapters/flatads/flatadstest/supplemental/server-error.json b/adapters/flatads/flatadstest/supplemental/server-error.json index eed274ba045..4c198b68804 100644 --- a/adapters/flatads/flatadstest/supplemental/server-error.json +++ b/adapters/flatads/flatadstest/supplemental/server-error.json @@ -33,7 +33,7 @@ "application/json" ] }, - "uri": "http://localhost:7826/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id", "imp": [ diff --git a/static/bidder-info/flatads.yaml b/static/bidder-info/flatads.yaml index 2d415b1b793..09d8c58b85a 100644 --- a/static/bidder-info/flatads.yaml +++ b/static/bidder-info/flatads.yaml @@ -1,4 +1,4 @@ -endpoint: "http://localhost:7826/adx/rtb?x-net-id={{.PublisherID}}&x-net-token={{.TokenID}}" +endpoint: "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id={{.PublisherID}}&x-net-token={{.TokenID}}" endpointCompression: gzip maintainer: email: "tangyang@flat-ads.com" From 16888dcc6d01ba61013f2c30bfc7519b8d1918f0 Mon Sep 17 00:00:00 2001 From: wuzhijian Date: Tue, 4 Mar 2025 11:59:54 +0800 Subject: [PATCH 05/11] update user sync url --- static/bidder-info/flatads.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/bidder-info/flatads.yaml b/static/bidder-info/flatads.yaml index 09d8c58b85a..ddedbac35d5 100644 --- a/static/bidder-info/flatads.yaml +++ b/static/bidder-info/flatads.yaml @@ -17,5 +17,5 @@ capabilities: - native userSync: redirect: - url: http://localhost:7802/cms/user_sync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}} + url: https://api.flowsixteen.com/api/tracker/cms/user_sync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}} userMacro: $UID From 2df21b2c90b0cf3275fa25c964bf6636b8d5ab99 Mon Sep 17 00:00:00 2001 From: wuzhijian Date: Wed, 5 Mar 2025 11:05:33 +0800 Subject: [PATCH 06/11] Flatads Adapter: update email address --- static/bidder-info/flatads.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/bidder-info/flatads.yaml b/static/bidder-info/flatads.yaml index ddedbac35d5..1a175da48f8 100644 --- a/static/bidder-info/flatads.yaml +++ b/static/bidder-info/flatads.yaml @@ -1,7 +1,7 @@ endpoint: "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id={{.PublisherID}}&x-net-token={{.TokenID}}" endpointCompression: gzip maintainer: - email: "tangyang@flat-ads.com" + email: "business@flat-ads.com" openrtb: version: 2.6 capabilities: From 074a59ec5a745abfaf6589f52495b1d269578def Mon Sep 17 00:00:00 2001 From: wuzhijian Date: Wed, 5 Mar 2025 11:49:42 +0800 Subject: [PATCH 07/11] Flatads Adapter: update email address --- static/bidder-info/flatads.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/bidder-info/flatads.yaml b/static/bidder-info/flatads.yaml index 1a175da48f8..9c6b3806b83 100644 --- a/static/bidder-info/flatads.yaml +++ b/static/bidder-info/flatads.yaml @@ -1,7 +1,7 @@ endpoint: "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id={{.PublisherID}}&x-net-token={{.TokenID}}" endpointCompression: gzip maintainer: - email: "business@flat-ads.com" + email: "adxbusiness@flat-ads.com" openrtb: version: 2.6 capabilities: From d3d0bfa1a38e3bd005ff72e93e655625916d673f Mon Sep 17 00:00:00 2001 From: wuzhijian Date: Wed, 12 Mar 2025 14:04:48 +0800 Subject: [PATCH 08/11] Flatads Adapter: delete the comments --- adapters/flatads/flatads.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/adapters/flatads/flatads.go b/adapters/flatads/flatads.go index b51747a2c03..13f99aeaf6a 100644 --- a/adapters/flatads/flatads.go +++ b/adapters/flatads/flatads.go @@ -37,7 +37,6 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") - //headers.Add("X-OpenRTB-Version", "2.6") if request.Device != nil { if len(request.Device.UA) > 0 { headers.Add("User-Agent", request.Device.UA) @@ -125,7 +124,6 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R for _, seatBid := range response.SeatBid { for i := range seatBid.Bid { - bidMediaType, err := getMediaTypeForBid(seatBid.Bid[i].ImpID, request.Imp) if err != nil { return nil, []error{err} From 46e614c973c9f55ca6f55536f066ce45cf6abf77 Mon Sep 17 00:00:00 2001 From: wuzhijian Date: Wed, 12 Mar 2025 16:59:37 +0800 Subject: [PATCH 09/11] Flatads Adapter: add unit test --- adapters/flatads/flatads.go | 6 +- .../supplemental/invalid-bid-type.json | 117 ++++++++++++++++++ .../supplemental/invalid-imp-ext-bidder.json | 33 +++++ .../supplemental/invalid-imp-ext.json | 31 +++++ 4 files changed, 185 insertions(+), 2 deletions(-) create mode 100644 adapters/flatads/flatadstest/supplemental/invalid-bid-type.json create mode 100644 adapters/flatads/flatadstest/supplemental/invalid-imp-ext-bidder.json create mode 100644 adapters/flatads/flatadstest/supplemental/invalid-imp-ext.json diff --git a/adapters/flatads/flatads.go b/adapters/flatads/flatads.go index 13f99aeaf6a..5f1358c1d1d 100644 --- a/adapters/flatads/flatads.go +++ b/adapters/flatads/flatads.go @@ -122,11 +122,13 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R bidResponse.Currency = response.Cur } + var errors []error for _, seatBid := range response.SeatBid { for i := range seatBid.Bid { bidMediaType, err := getMediaTypeForBid(seatBid.Bid[i].ImpID, request.Imp) if err != nil { - return nil, []error{err} + errors = append(errors, err) + continue } bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ Bid: &seatBid.Bid[i], @@ -134,7 +136,7 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R }) } } - return bidResponse, nil + return bidResponse, errors } func getMediaTypeForBid(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { diff --git a/adapters/flatads/flatadstest/supplemental/invalid-bid-type.json b/adapters/flatads/flatadstest/supplemental/invalid-bid-type.json new file mode 100644 index 00000000000..64a12b670cb --- /dev/null +++ b/adapters/flatads/flatadstest/supplemental/invalid-bid-type.json @@ -0,0 +1,117 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "body": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "token": "66668888", + "publisherId": "1111" + } + } + } + ] + }, + "impIDs": [ + "test-imp-id-banner" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id-banner", + "seatbid": [ + { + "seat": "flatads", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id-invalid", + "price": 0.5, + "adm": "some-test-ad-banner", + "crid": "crid_10", + "w": 728, + "h": 90 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [] + } + ], + "expectedMakeBidsErrors": [ + { + "value": "The impression with ID test-imp-id-invalid is not present into the request", + "comparison": "literal" + } + ] +} diff --git a/adapters/flatads/flatadstest/supplemental/invalid-imp-ext-bidder.json b/adapters/flatads/flatadstest/supplemental/invalid-imp-ext-bidder.json new file mode 100644 index 00000000000..3d210a34527 --- /dev/null +++ b/adapters/flatads/flatadstest/supplemental/invalid-imp-ext-bidder.json @@ -0,0 +1,33 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": "" + } + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "Failed to deserialize Flatads extension: expect { or n, but found \"", + "comparison": "literal" + } + ] +} diff --git a/adapters/flatads/flatadstest/supplemental/invalid-imp-ext.json b/adapters/flatads/flatadstest/supplemental/invalid-imp-ext.json new file mode 100644 index 00000000000..4790fc34d13 --- /dev/null +++ b/adapters/flatads/flatadstest/supplemental/invalid-imp-ext.json @@ -0,0 +1,31 @@ +{ + "mockBidRequest": { + "id": "test-request-id-banner", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "test-imp-id-banner", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": "" + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "Failed to deserialize bidder impression extension: expect { or n, but found \"", + "comparison": "literal" + } + ] +} From 7238724aedfabb946c7f54b975c47a5a52941974 Mon Sep 17 00:00:00 2001 From: wuzhijian Date: Tue, 13 May 2025 10:40:45 +0800 Subject: [PATCH 10/11] Flatads Adapter: optimized code --- adapters/flatads/flatads.go | 6 +++--- .../flatads/flatadstest/exemplary/multiple-imps.json | 10 +++++----- static/bidder-params/flatads.json | 6 ++++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/adapters/flatads/flatads.go b/adapters/flatads/flatads.go index 5f1358c1d1d..0bf0b979e7a 100644 --- a/adapters/flatads/flatads.go +++ b/adapters/flatads/flatads.go @@ -50,8 +50,8 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte headers.Add("X-Forwarded-For", request.Device.IP) } } - requestCopy := *request for _, imp := range request.Imp { + requestCopy := *request requestCopy.Imp = []openrtb2.Imp{imp} endpoint, err := a.buildEndpointFromRequest(&imp) @@ -66,7 +66,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte continue } - request := &adapters.RequestData{ + r := &adapters.RequestData{ Method: http.MethodPost, Body: requestJSON, Uri: endpoint, @@ -74,7 +74,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte ImpIDs: openrtb_ext.GetImpIDs(requestCopy.Imp), } - requests = append(requests, request) + requests = append(requests, r) } return requests, errs diff --git a/adapters/flatads/flatadstest/exemplary/multiple-imps.json b/adapters/flatads/flatadstest/exemplary/multiple-imps.json index 9c8b1280cdc..3f19c631b7b 100644 --- a/adapters/flatads/flatadstest/exemplary/multiple-imps.json +++ b/adapters/flatads/flatadstest/exemplary/multiple-imps.json @@ -37,8 +37,8 @@ }, "ext": { "bidder": { - "token": "66668888", - "publisherId": "1111" + "token": "22223333", + "publisherId": "2222" } } } @@ -118,7 +118,7 @@ }, { "expectedRequest": { - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=2222&x-net-token=22223333", "body": { "id": "test-request-id-banner", "device": { @@ -140,8 +140,8 @@ }, "ext": { "bidder": { - "token": "66668888", - "publisherId": "1111" + "token": "22223333", + "publisherId": "2222" } } } diff --git a/static/bidder-params/flatads.json b/static/bidder-params/flatads.json index aa255f073fe..5f3eb8738a5 100644 --- a/static/bidder-params/flatads.json +++ b/static/bidder-params/flatads.json @@ -6,11 +6,13 @@ "properties": { "token": { "type": "string", - "description": "Token of the publisher" + "description": "Token of the publisher", + "minLength": 1 }, "publisherId": { "type": "string", - "description": "Flatads Publisher Id" + "description": "Flatads Publisher Id", + "minLength": 1 } }, "required": [ From 0d6a35c6d71c35cc7c684bc6fa5715ad366ee62e Mon Sep 17 00:00:00 2001 From: wuzhijian Date: Fri, 13 Jun 2025 15:57:52 +0800 Subject: [PATCH 11/11] adjust the unit test params and remove user-sync --- adapters/flatads/flatads_test.go | 2 +- adapters/flatads/flatadstest/exemplary/banner.json | 2 +- .../flatads/flatadstest/exemplary/headers_ipv4.json | 2 +- .../flatads/flatadstest/exemplary/headers_ipv6.json | 2 +- .../flatadstest/exemplary/multiple-imps.json | 4 ++-- adapters/flatads/flatadstest/exemplary/native.json | 2 +- .../flatadstest/exemplary/optional-params.json | 2 +- adapters/flatads/flatadstest/exemplary/video.json | 2 +- .../flatadstest/supplemental/bad-request.json | 2 +- .../flatadstest/supplemental/invalid-bid-type.json | 2 +- .../supplemental/multiple-imps-with-error.json | 2 +- .../supplemental/response-200-without-body.json | 2 +- .../flatadstest/supplemental/response-204.json | 2 +- .../flatadstest/supplemental/server-error.json | 2 +- adapters/flatads/params_test.go | 13 ++++--------- static/bidder-info/flatads.yaml | 4 ---- 16 files changed, 19 insertions(+), 28 deletions(-) diff --git a/adapters/flatads/flatads_test.go b/adapters/flatads/flatads_test.go index a0520746886..b3b3cf33f7c 100644 --- a/adapters/flatads/flatads_test.go +++ b/adapters/flatads/flatads_test.go @@ -11,7 +11,7 @@ import ( func TestJsonSamples(t *testing.T) { bidder, buildErr := Builder(openrtb_ext.BidderFlatads, config.Adapter{ - Endpoint: "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id={{.PublisherID}}&x-net-token={{.TokenID}}"}, + Endpoint: "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id={{.PublisherID}}&x-net-token={{.TokenID}}"}, config.Server{}) if buildErr != nil { diff --git a/adapters/flatads/flatadstest/exemplary/banner.json b/adapters/flatads/flatadstest/exemplary/banner.json index af31149f182..5cdf66ac0da 100644 --- a/adapters/flatads/flatadstest/exemplary/banner.json +++ b/adapters/flatads/flatadstest/exemplary/banner.json @@ -44,7 +44,7 @@ "123.123.123.123" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/exemplary/headers_ipv4.json b/adapters/flatads/flatadstest/exemplary/headers_ipv4.json index c67ebf5bb19..ac997f96579 100644 --- a/adapters/flatads/flatadstest/exemplary/headers_ipv4.json +++ b/adapters/flatads/flatadstest/exemplary/headers_ipv4.json @@ -44,7 +44,7 @@ "123.123.123.123" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/exemplary/headers_ipv6.json b/adapters/flatads/flatadstest/exemplary/headers_ipv6.json index 7a31c553ffe..2d12280c73e 100644 --- a/adapters/flatads/flatadstest/exemplary/headers_ipv6.json +++ b/adapters/flatads/flatadstest/exemplary/headers_ipv6.json @@ -44,7 +44,7 @@ "2607:fb90:f27:4512:d800:cb23:a603:e245" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/exemplary/multiple-imps.json b/adapters/flatads/flatadstest/exemplary/multiple-imps.json index 3f19c631b7b..282037b8441 100644 --- a/adapters/flatads/flatadstest/exemplary/multiple-imps.json +++ b/adapters/flatads/flatadstest/exemplary/multiple-imps.json @@ -61,7 +61,7 @@ "123.123.123.123" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { @@ -118,7 +118,7 @@ }, { "expectedRequest": { - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=2222&x-net-token=22223333", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=2222&x-net-token=22223333", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/exemplary/native.json b/adapters/flatads/flatadstest/exemplary/native.json index 941722f0671..c4b67687335 100644 --- a/adapters/flatads/flatadstest/exemplary/native.json +++ b/adapters/flatads/flatadstest/exemplary/native.json @@ -39,7 +39,7 @@ "123.123.123.123" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-native", "device": { diff --git a/adapters/flatads/flatadstest/exemplary/optional-params.json b/adapters/flatads/flatadstest/exemplary/optional-params.json index 475c9210640..20441dadf44 100644 --- a/adapters/flatads/flatadstest/exemplary/optional-params.json +++ b/adapters/flatads/flatadstest/exemplary/optional-params.json @@ -46,7 +46,7 @@ "123.123.123.123" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/exemplary/video.json b/adapters/flatads/flatadstest/exemplary/video.json index e9db57f016e..dc2f1bf5322 100644 --- a/adapters/flatads/flatadstest/exemplary/video.json +++ b/adapters/flatads/flatadstest/exemplary/video.json @@ -41,7 +41,7 @@ "123.123.123.123" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id", "device": { diff --git a/adapters/flatads/flatadstest/supplemental/bad-request.json b/adapters/flatads/flatadstest/supplemental/bad-request.json index 2d07c5ba082..25be9ed2466 100644 --- a/adapters/flatads/flatadstest/supplemental/bad-request.json +++ b/adapters/flatads/flatadstest/supplemental/bad-request.json @@ -45,7 +45,7 @@ "123.123.123.123" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id", "device": { diff --git a/adapters/flatads/flatadstest/supplemental/invalid-bid-type.json b/adapters/flatads/flatadstest/supplemental/invalid-bid-type.json index 64a12b670cb..87331a1f720 100644 --- a/adapters/flatads/flatadstest/supplemental/invalid-bid-type.json +++ b/adapters/flatads/flatadstest/supplemental/invalid-bid-type.json @@ -44,7 +44,7 @@ "123.123.123.123" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/supplemental/multiple-imps-with-error.json b/adapters/flatads/flatadstest/supplemental/multiple-imps-with-error.json index 382fad0721d..908c06df7cc 100644 --- a/adapters/flatads/flatadstest/supplemental/multiple-imps-with-error.json +++ b/adapters/flatads/flatadstest/supplemental/multiple-imps-with-error.json @@ -61,7 +61,7 @@ "123.123.123.123" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id-banner", "device": { diff --git a/adapters/flatads/flatadstest/supplemental/response-200-without-body.json b/adapters/flatads/flatadstest/supplemental/response-200-without-body.json index 10e5dd4c7ea..2ee9b421d1e 100644 --- a/adapters/flatads/flatadstest/supplemental/response-200-without-body.json +++ b/adapters/flatads/flatadstest/supplemental/response-200-without-body.json @@ -45,7 +45,7 @@ "123.123.123.123" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id", "device": { diff --git a/adapters/flatads/flatadstest/supplemental/response-204.json b/adapters/flatads/flatadstest/supplemental/response-204.json index ea5d61bef53..f93bdeedc6e 100644 --- a/adapters/flatads/flatadstest/supplemental/response-204.json +++ b/adapters/flatads/flatadstest/supplemental/response-204.json @@ -45,7 +45,7 @@ "123.123.123.123" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id", "device": { diff --git a/adapters/flatads/flatadstest/supplemental/server-error.json b/adapters/flatads/flatadstest/supplemental/server-error.json index 4c198b68804..0d9d3cebb01 100644 --- a/adapters/flatads/flatadstest/supplemental/server-error.json +++ b/adapters/flatads/flatadstest/supplemental/server-error.json @@ -33,7 +33,7 @@ "application/json" ] }, - "uri": "https://bid.rtbshark.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", + "uri": "https://test.endpoint.com/api/rtbs/adx/rtb?x-net-id=1111&x-net-token=66668888", "body": { "id": "test-request-id", "imp": [ diff --git a/adapters/flatads/params_test.go b/adapters/flatads/params_test.go index 4aeddc2b9d7..c58546399b9 100644 --- a/adapters/flatads/params_test.go +++ b/adapters/flatads/params_test.go @@ -35,22 +35,17 @@ func TestInvalidParams(t *testing.T) { var validParams = []string{ `{ "token": "66668888", - "publisherId": "1111", - "ext": { - "key1": "value1", - "key2": "value2" - } + "publisherId": "1111" }`, `{"token": "66668888", "publisherId": "1111"}`, } var invalidParams = []string{ - `{"ext": { - "key1": "value1", - "key2": "value2" - }`, `{}`, `{"token": 66668888, "networkId":1111}`, `{"token": "66668888"", "networkId":1111}`, `{"token": 66668888, "networkId":"1111""}`, + `{"token": "", "publisherId": "1111"}`, + `{"token": "66668888", "publisherId": ""}`, + `{"token": "", "publisherId": ""}`, } diff --git a/static/bidder-info/flatads.yaml b/static/bidder-info/flatads.yaml index 9c6b3806b83..5e1e7c47cc7 100644 --- a/static/bidder-info/flatads.yaml +++ b/static/bidder-info/flatads.yaml @@ -15,7 +15,3 @@ capabilities: - banner - video - native -userSync: - redirect: - url: https://api.flowsixteen.com/api/tracker/cms/user_sync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}} - userMacro: $UID