From 34cfc4e65dc46b3304560112fcf0891581ce1b73 Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Mon, 25 Sep 2023 11:18:22 -0400 Subject: [PATCH] Remove Adapter: Kubient --- adapters/kubient/kubient.go | 149 ------------------ adapters/kubient/kubient_test.go | 20 --- .../kubient/kubienttest/exemplary/banner.json | 103 ------------ .../kubient/kubienttest/exemplary/video.json | 93 ----------- .../supplemental/bad_response.json | 61 ------- .../supplemental/missing-zoneid.json | 31 ---- .../kubienttest/supplemental/no-imps.json | 12 -- .../kubienttest/supplemental/status_204.json | 58 ------- .../kubienttest/supplemental/status_400.json | 63 -------- exchange/adapter_builders.go | 2 - exchange/adapter_util.go | 1 + openrtb_ext/bidders.go | 2 - openrtb_ext/imp_kubient.go | 6 - static/bidder-info/kubient.yaml | 13 -- static/bidder-params/kubient.json | 13 -- 15 files changed, 1 insertion(+), 626 deletions(-) delete mode 100644 adapters/kubient/kubient.go delete mode 100644 adapters/kubient/kubient_test.go delete mode 100644 adapters/kubient/kubienttest/exemplary/banner.json delete mode 100644 adapters/kubient/kubienttest/exemplary/video.json delete mode 100644 adapters/kubient/kubienttest/supplemental/bad_response.json delete mode 100644 adapters/kubient/kubienttest/supplemental/missing-zoneid.json delete mode 100644 adapters/kubient/kubienttest/supplemental/no-imps.json delete mode 100644 adapters/kubient/kubienttest/supplemental/status_204.json delete mode 100644 adapters/kubient/kubienttest/supplemental/status_400.json delete mode 100644 openrtb_ext/imp_kubient.go delete mode 100644 static/bidder-info/kubient.yaml delete mode 100644 static/bidder-params/kubient.json diff --git a/adapters/kubient/kubient.go b/adapters/kubient/kubient.go deleted file mode 100644 index 8a3a7baa65a..00000000000 --- a/adapters/kubient/kubient.go +++ /dev/null @@ -1,149 +0,0 @@ -package kubient - -import ( - "encoding/json" - "fmt" - "net/http" - - "github.com/prebid/openrtb/v19/openrtb2" - "github.com/prebid/prebid-server/config" - "github.com/prebid/prebid-server/openrtb_ext" - - "github.com/prebid/prebid-server/adapters" - "github.com/prebid/prebid-server/errortypes" -) - -// Builder builds a new instance of the Kubient adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { - bidder := &KubientAdapter{ - endpoint: config.Endpoint, - } - return bidder, nil -} - -// Implements Bidder interface. -type KubientAdapter struct { - endpoint string -} - -// MakeRequests prepares the HTTP requests which should be made to fetch bids. -func (adapter *KubientAdapter) MakeRequests( - openRTBRequest *openrtb2.BidRequest, - reqInfo *adapters.ExtraRequestInfo, -) ([]*adapters.RequestData, []error) { - if len(openRTBRequest.Imp) == 0 { - return nil, []error{&errortypes.BadInput{ - Message: "No impression in the bid request", - }} - } - errs := make([]error, 0, len(openRTBRequest.Imp)) - hasErrors := false - for _, impObj := range openRTBRequest.Imp { - err := checkImpExt(impObj) - if err != nil { - errs = append(errs, err) - hasErrors = true - } - } - if hasErrors { - return nil, errs - } - openRTBRequestJSON, err := json.Marshal(openRTBRequest) - if err != nil { - errs = append(errs, err) - return nil, errs - } - - headers := http.Header{} - headers.Add("Content-Type", "application/json;charset=utf-8") - requestsToBidder := []*adapters.RequestData{{ - Method: "POST", - Uri: adapter.endpoint, - Body: openRTBRequestJSON, - Headers: headers, - }} - return requestsToBidder, errs -} - -func checkImpExt(impObj openrtb2.Imp) error { - var bidderExt adapters.ExtImpBidder - if err := json.Unmarshal(impObj.Ext, &bidderExt); err != nil { - return &errortypes.BadInput{ - Message: "ext.bidder not provided", - } - } - var kubientExt openrtb_ext.ExtImpKubient - if err := json.Unmarshal(bidderExt.Bidder, &kubientExt); err != nil { - return &errortypes.BadInput{ - Message: "ext.bidder.zoneid is not provided", - } - } - if kubientExt.ZoneID == "" { - return &errortypes.BadInput{ - Message: "zoneid is empty", - } - } - return nil -} - -// MakeBids makes the bids -func (adapter *KubientAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { - var errs []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. Run with request.debug = 1 for more info", 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 openrtb2.BidResponse - - if err := json.Unmarshal(response.Body, &bidResp); err != nil { - return nil, []error{err} - } - - bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) - - for _, sb := range bidResp.SeatBid { - for i := range sb.Bid { - bidType, err := getMediaTypeForImp(sb.Bid[i].ImpID, internalRequest.Imp) - if err != nil { - errs = append(errs, err) - } else { - b := &adapters.TypedBid{ - Bid: &sb.Bid[i], - BidType: bidType, - } - bidResponse.Bids = append(bidResponse.Bids, b) - } - } - } - return bidResponse, errs -} - -func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { - mediaType := openrtb_ext.BidTypeBanner - for _, imp := range imps { - if imp.ID == impID { - if imp.Banner == nil && imp.Video != nil { - mediaType = openrtb_ext.BidTypeVideo - } - return mediaType, nil - } - } - - // This shouldnt happen. Lets handle it just incase by returning an error. - return "", &errortypes.BadInput{ - Message: fmt.Sprintf("Failed to find impression \"%s\" ", impID), - } -} diff --git a/adapters/kubient/kubient_test.go b/adapters/kubient/kubient_test.go deleted file mode 100644 index 292bb20641a..00000000000 --- a/adapters/kubient/kubient_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package kubient - -import ( - "testing" - - "github.com/prebid/prebid-server/adapters/adapterstest" - "github.com/prebid/prebid-server/config" - "github.com/prebid/prebid-server/openrtb_ext" -) - -func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderKubient, config.Adapter{ - Endpoint: "http://127.0.0.1:5000/bid"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "kubienttest", bidder) -} diff --git a/adapters/kubient/kubienttest/exemplary/banner.json b/adapters/kubient/kubienttest/exemplary/banner.json deleted file mode 100644 index abcfc05c041..00000000000 --- a/adapters/kubient/kubienttest/exemplary/banner.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-banner-request-id", - "imp": [ - { - "id": "test-imp-banner-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "zoneid": "9042" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://127.0.0.1:5000/bid", - "body": { - "id": "test-banner-request-id", - "imp": [ - { - "id": "test-imp-banner-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "zoneid": "9042" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-banner-request-id", - "seatbid": [ - { - "seat": "772", - "bid": [{ - "id": "7706636740145184841", - "impid": "test-imp-banner-id", - "price": 0.500000, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": ["advertsite.com"], - "cid": "772", - "crid": "29681110", - "h": 576, - "w": 1024 - }] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "bids": [{ - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-banner-id", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": ["advertsite.com"], - "cid": "772", - "crid": "29681110", - "w": 1024, - "h": 576 - }, - "type": "banner" - }] - } - ] -} diff --git a/adapters/kubient/kubienttest/exemplary/video.json b/adapters/kubient/kubienttest/exemplary/video.json deleted file mode 100644 index 69de5935f48..00000000000 --- a/adapters/kubient/kubienttest/exemplary/video.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-video-request-id", - "imp": [ - { - "id": "test-imp-video-id", - "video": { - "mimes": ["video/mp4"], - "protocols": [2, 5], - "w": 1024, - "h": 576 - }, - "ext": { - "bidder": { - "zoneid": "9010" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://127.0.0.1:5000/bid", - "body": { - "id": "test-video-request-id", - "imp": [ - { - "id": "test-imp-video-id", - "video": { - "mimes": ["video/mp4"], - "protocols": [2, 5], - "w": 1024, - "h": 576 - }, - "ext": { - "bidder": { - "zoneid": "9010" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "ssp-response-id", - "seatbid": [ - { - "seat": "83", - "bid": [{ - "id": "7706636740145184841", - "impid": "test-imp-video-id", - "price": 0.500000, - "adid": "29681110", - "adm": "some-video-ad", - "adomain": ["advertsite.com"], - "cid": "958", - "crid": "29681110", - "h": 576, - "w": 1024 - }] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [ - { - "bids": [{ - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-video-id", - "price": 0.5, - "adm": "some-video-ad", - "adid": "29681110", - "adomain": ["advertsite.com"], - "cid": "958", - "crid": "29681110", - "w": 1024, - "h": 576 - }, - "type": "video" - }] - } - ] - -} diff --git a/adapters/kubient/kubienttest/supplemental/bad_response.json b/adapters/kubient/kubienttest/supplemental/bad_response.json deleted file mode 100644 index 832dc975088..00000000000 --- a/adapters/kubient/kubienttest/supplemental/bad_response.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "zoneid": "23" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://127.0.0.1:5000/bid", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "zoneid": "23" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": "{\"id\"data.lost" - } - } - ], - "expectedMakeBidsErrors": [ - { - "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", - "comparison": "literal" - } - ] -} diff --git a/adapters/kubient/kubienttest/supplemental/missing-zoneid.json b/adapters/kubient/kubienttest/supplemental/missing-zoneid.json deleted file mode 100644 index cfd616621e2..00000000000 --- a/adapters/kubient/kubienttest/supplemental/missing-zoneid.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-missing-req-param-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": {} - } - } - ] - }, - "expectedMakeRequestsErrors": [ - { - "value": "zoneid is empty", - "comparison": "literal" - } - ] -} diff --git a/adapters/kubient/kubienttest/supplemental/no-imps.json b/adapters/kubient/kubienttest/supplemental/no-imps.json deleted file mode 100644 index 189adf9a932..00000000000 --- a/adapters/kubient/kubienttest/supplemental/no-imps.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-no-imp-request-id", - "imp": [] - }, - "expectedMakeRequestsErrors": [ - { - "value": "No impression in the bid request", - "comparison": "literal" - } - ] -} \ No newline at end of file diff --git a/adapters/kubient/kubienttest/supplemental/status_204.json b/adapters/kubient/kubienttest/supplemental/status_204.json deleted file mode 100644 index 6794d58be6c..00000000000 --- a/adapters/kubient/kubienttest/supplemental/status_204.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "zoneid": "203" - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://127.0.0.1:5000/bid", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "zoneid": "203" - } - } - } - ] - } - }, - "mockResponse": { - "status": 204, - "body": {} - } - } - ], - - "expectedBidResponses": [] -} diff --git a/adapters/kubient/kubienttest/supplemental/status_400.json b/adapters/kubient/kubienttest/supplemental/status_400.json deleted file mode 100644 index 29438cc3b8b..00000000000 --- a/adapters/kubient/kubienttest/supplemental/status_400.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "zoneid": "102" - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://127.0.0.1:5000/bid", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "zoneid": "102" - } - } - } - ] - } - }, - "mockResponse": { - "status": 400, - "body": {} - } - } - ], - - "expectedMakeBidsErrors": [ - { - "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", - "comparison": "literal" - } - ] -} diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 395e4fbbc39..6433e1d70e9 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -105,7 +105,6 @@ import ( "github.com/prebid/prebid-server/adapters/kidoz" "github.com/prebid/prebid-server/adapters/kiviads" "github.com/prebid/prebid-server/adapters/krushmedia" - "github.com/prebid/prebid-server/adapters/kubient" "github.com/prebid/prebid-server/adapters/liftoff" "github.com/prebid/prebid-server/adapters/limelightDigital" lmkiviads "github.com/prebid/prebid-server/adapters/lm_kiviads" @@ -311,7 +310,6 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderKiviads: kiviads.Builder, openrtb_ext.BidderLmKiviads: lmkiviads.Builder, openrtb_ext.BidderKrushmedia: krushmedia.Builder, - openrtb_ext.BidderKubient: kubient.Builder, openrtb_ext.BidderLiftoff: liftoff.Builder, openrtb_ext.BidderLimelightDigital: limelightDigital.Builder, openrtb_ext.BidderLockerDome: lockerdome.Builder, diff --git a/exchange/adapter_util.go b/exchange/adapter_util.go index ee9a066aa58..71604b1b945 100644 --- a/exchange/adapter_util.go +++ b/exchange/adapter_util.go @@ -118,6 +118,7 @@ func GetDisabledBidderWarningMessages(infos config.BidderInfos) map[string]strin "groupm": `Bidder "groupm" is no longer available in Prebid Server. Please update your configuration.`, "verizonmedia": `Bidder "verizonmedia" is no longer available in Prebid Server. Please update your configuration.`, "brightroll": `Bidder "brightroll" is no longer available in Prebid Server. Please update your configuration.`, + "kubient": `Bidder "kubient" is no longer available in Prebid Server. Please update your configuration.`, } return mergeRemovedAndDisabledBidderWarningMessages(removed, infos) diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index e12316f7e72..2000e6f70a3 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -133,7 +133,6 @@ var coreBidderNames []BidderName = []BidderName{ BidderKiviads, BidderLmKiviads, BidderKrushmedia, - BidderKubient, BidderLiftoff, BidderLimelightDigital, BidderLockerDome, @@ -428,7 +427,6 @@ const ( BidderKiviads BidderName = "kiviads" BidderLmKiviads BidderName = "lm_kiviads" BidderKrushmedia BidderName = "krushmedia" - BidderKubient BidderName = "kubient" BidderLiftoff BidderName = "liftoff" BidderLimelightDigital BidderName = "limelightDigital" BidderLockerDome BidderName = "lockerdome" diff --git a/openrtb_ext/imp_kubient.go b/openrtb_ext/imp_kubient.go deleted file mode 100644 index 59dd3d2aaab..00000000000 --- a/openrtb_ext/imp_kubient.go +++ /dev/null @@ -1,6 +0,0 @@ -package openrtb_ext - -// ExtImpKubient defines the contract for bidrequest.imp[i].ext.prebid.bidder.kubient -type ExtImpKubient struct { - ZoneID string `json:"zoneid"` -} diff --git a/static/bidder-info/kubient.yaml b/static/bidder-info/kubient.yaml deleted file mode 100644 index 15c2708bcb3..00000000000 --- a/static/bidder-info/kubient.yaml +++ /dev/null @@ -1,13 +0,0 @@ -endpoint: "https://kssp.kbntx.ch/prebid" -maintainer: - email: "prebid@kubient.com" -capabilities: - app: - mediaTypes: - - banner - - video - site: - mediaTypes: - - banner - - video - diff --git a/static/bidder-params/kubient.json b/static/bidder-params/kubient.json deleted file mode 100644 index 9b975289a7b..00000000000 --- a/static/bidder-params/kubient.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Kubient Adapter Params", - "description": "A schema which validates params accepted by the Kubient adapter", - "type": "object", - "properties": { - "zoneid": { - "type": "string", - "description": "Zone ID identifies Kubient placement ID.", - "minLength": 1 - } - } -}