From 48da8c9f601cb4ec294f36dfc7d3da469c9b0636 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 17 Aug 2021 13:27:38 +0000 Subject: [PATCH 1/5] Added Video(VAST) Support --- adapters/vrtcal/vrtcal.go | 30 +++++- .../vrtcaltest/exemplary/simple-video.json | 96 +++++++++++++++++++ static/bidder-info/vrtcal.yaml | 1 + 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 adapters/vrtcal/vrtcaltest/exemplary/simple-video.json diff --git a/adapters/vrtcal/vrtcal.go b/adapters/vrtcal/vrtcal.go index e4986b2f6fb..3509d0e961b 100644 --- a/adapters/vrtcal/vrtcal.go +++ b/adapters/vrtcal/vrtcal.go @@ -70,9 +70,14 @@ func (a *VrtcalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalR for _, sb := range bidResp.SeatBid { for i := range sb.Bid { + bidType, err := getReturnTypeForImp(sb.Bid[i].ImpID, internalRequest.Imp) + if err != nil { + return nil, []error{err} + } + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ Bid: &sb.Bid[i], - BidType: "banner", + BidType: bidType, }) } } @@ -87,3 +92,26 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } return bidder, nil } + +func getReturnTypeForImp(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 + } + + if imp.Video != nil { + return openrtb_ext.BidTypeVideo, nil + } + + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unsupported return type for ID: \"%s\"", impID), + } + } + } + + //Failsafe default in case impression ID is not found + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Failed to find impression for ID: \"%s\"", impID), + } +} diff --git a/adapters/vrtcal/vrtcaltest/exemplary/simple-video.json b/adapters/vrtcal/vrtcaltest/exemplary/simple-video.json new file mode 100644 index 00000000000..365c892b87f --- /dev/null +++ b/adapters/vrtcal/vrtcaltest/exemplary/simple-video.json @@ -0,0 +1,96 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "protocols": [2, 5], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "Just_an_unused_vrtcal_param": "unused_data_for_this" + } + } + } + ], + "app": { + "id": "fake-app-id" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://rtb.vrtcal.com/bidder_prebid.vap?ssp=1804", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "protocols": [2, 5], + "w": 300, + "h": 250 + }, + + "ext": { + "bidder": { + "Just_an_unused_vrtcal_param": "unused_data_for_this" + } + } + } + ], + "app": { + "id": "fake-app-id" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "vrtcal", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-video-ad", + "crid": "crid_10", + "h": 250, + "w": 300 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-video-ad", + "crid": "crid_10", + "w": 300, + "h": 250 + }, + "type": "video" + } + ] + } + ] +} diff --git a/static/bidder-info/vrtcal.yaml b/static/bidder-info/vrtcal.yaml index fcf9294adcb..4143f4ff9d1 100644 --- a/static/bidder-info/vrtcal.yaml +++ b/static/bidder-info/vrtcal.yaml @@ -4,3 +4,4 @@ capabilities: app: mediaTypes: - banner + - video From fc72d74f1df604266d543c9ce407dad438d1383f Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 18 Aug 2021 15:48:38 +0000 Subject: [PATCH 2/5] Added supplemental unmatched impression ID test coverage --- .../unmatched_response_impression_id.json | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 adapters/vrtcal/vrtcaltest/supplemental/unmatched_response_impression_id.json diff --git a/adapters/vrtcal/vrtcaltest/supplemental/unmatched_response_impression_id.json b/adapters/vrtcal/vrtcaltest/supplemental/unmatched_response_impression_id.json new file mode 100644 index 00000000000..a2af09659ee --- /dev/null +++ b/adapters/vrtcal/vrtcaltest/supplemental/unmatched_response_impression_id.json @@ -0,0 +1,87 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "Just_an_unused_vrtcal_param": "unused_data_for_this" + } + } + } + ], + "app": { + "id": "fake-app-id" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://rtb.vrtcal.com/bidder_prebid.vap?ssp=1804", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + + "ext": { + "bidder": { + "Just_an_unused_vrtcal_param": "unused_data_for_this" + } + } + } + ], + "app": { + "id": "fake-app-id" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "vrtcal", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "WRONG-IMPRESSION_ID", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 250, + "w": 300 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Failed to find impression for ID: \"WRONG-IMPRESSION_ID\"", + "comparison": "literal" + } + ] +} From dda79e42e06587c22d9f8424ceeef58f2046e849 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 19 Aug 2021 19:47:59 +0000 Subject: [PATCH 3/5] Update allowing successive bid use after those with unmatched imp IDs --- adapters/vrtcal/vrtcal.go | 12 +++++------- .../unmatched_response_impression_id.json | 4 +--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/adapters/vrtcal/vrtcal.go b/adapters/vrtcal/vrtcal.go index 3509d0e961b..f4a0392f62b 100644 --- a/adapters/vrtcal/vrtcal.go +++ b/adapters/vrtcal/vrtcal.go @@ -71,14 +71,12 @@ func (a *VrtcalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalR for _, sb := range bidResp.SeatBid { for i := range sb.Bid { bidType, err := getReturnTypeForImp(sb.Bid[i].ImpID, internalRequest.Imp) - if err != nil { - return nil, []error{err} + if err == nil { + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &sb.Bid[i], + BidType: bidType, + }) } - - bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ - Bid: &sb.Bid[i], - BidType: bidType, - }) } } return bidResponse, nil diff --git a/adapters/vrtcal/vrtcaltest/supplemental/unmatched_response_impression_id.json b/adapters/vrtcal/vrtcaltest/supplemental/unmatched_response_impression_id.json index a2af09659ee..812d51497f8 100644 --- a/adapters/vrtcal/vrtcaltest/supplemental/unmatched_response_impression_id.json +++ b/adapters/vrtcal/vrtcaltest/supplemental/unmatched_response_impression_id.json @@ -78,10 +78,8 @@ } } ], - "expectedMakeBidsErrors": [ + "expectedBidResponses": [ { - "value": "Failed to find impression for ID: \"WRONG-IMPRESSION_ID\"", - "comparison": "literal" } ] } From 40a71fe49d569cbdccd09f0e3ec451d7e81a00b0 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 20 Aug 2021 15:44:15 +0000 Subject: [PATCH 4/5] Fix for PR #1879 Conflict --- static/bidder-info/vrtcal.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/static/bidder-info/vrtcal.yaml b/static/bidder-info/vrtcal.yaml index 4143f4ff9d1..397d0c5e6f8 100644 --- a/static/bidder-info/vrtcal.yaml +++ b/static/bidder-info/vrtcal.yaml @@ -5,3 +5,8 @@ capabilities: mediaTypes: - banner - video +userSync: + # vrtcal supports user syncing, but requires configuration by the host. contact this + # bidder directly at the email address in this file to ask about enabling user sync. + supports: + - redirect From 25a44da96f945055bec974e1b22e75b3b085d8d4 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 24 Aug 2021 13:47:42 +0000 Subject: [PATCH 5/5] Update to fix unreporting errored bids with unmatched imp IDs. Also related test case update. --- adapters/vrtcal/vrtcal.go | 5 ++++- .../supplemental/unmatched_response_impression_id.json | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/adapters/vrtcal/vrtcal.go b/adapters/vrtcal/vrtcal.go index f4a0392f62b..ce8392a3bbd 100644 --- a/adapters/vrtcal/vrtcal.go +++ b/adapters/vrtcal/vrtcal.go @@ -68,6 +68,7 @@ func (a *VrtcalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalR bidResponse := adapters.NewBidderResponseWithBidsCapacity(1) + var errs []error for _, sb := range bidResp.SeatBid { for i := range sb.Bid { bidType, err := getReturnTypeForImp(sb.Bid[i].ImpID, internalRequest.Imp) @@ -76,10 +77,12 @@ func (a *VrtcalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalR Bid: &sb.Bid[i], BidType: bidType, }) + } else { + errs = append(errs, err) } } } - return bidResponse, nil + return bidResponse, errs } diff --git a/adapters/vrtcal/vrtcaltest/supplemental/unmatched_response_impression_id.json b/adapters/vrtcal/vrtcaltest/supplemental/unmatched_response_impression_id.json index 812d51497f8..42cf5f1a0f2 100644 --- a/adapters/vrtcal/vrtcaltest/supplemental/unmatched_response_impression_id.json +++ b/adapters/vrtcal/vrtcaltest/supplemental/unmatched_response_impression_id.json @@ -78,8 +78,10 @@ } } ], - "expectedBidResponses": [ - { - } - ] + "expectedMakeBidsErrors": [ + { + "value": "Failed to find impression for ID: \"WRONG-IMPRESSION_ID\"", + "comparison": "literal" + } + ] }