From 125e07bfab167111d51c6b7b2e274e1feab7a7d9 Mon Sep 17 00:00:00 2001 From: johnwier <49074029+johnwier@users.noreply.github.com> Date: Tue, 11 May 2021 09:16:13 -0700 Subject: [PATCH] Conversant bid floor handling (#1840) --- adapters/conversant/conversant.go | 10 +- .../supplemental/test_params.json | 306 ++++++++++++++++++ ...data-imp-ext-multiple-prebid-bidders.json} | 0 3 files changed, 314 insertions(+), 2 deletions(-) create mode 100644 adapters/conversant/conversanttest/supplemental/test_params.json rename exchange/exchangetest/{firstpartydata-imp-ext-multiple-prebid-bidders.json => firstpartydata-imp-ext-multiple-prebid-bidders.json} (100%) diff --git a/adapters/conversant/conversant.go b/adapters/conversant/conversant.go index cdcf75665f3..7cf4ab5d04c 100644 --- a/adapters/conversant/conversant.go +++ b/adapters/conversant/conversant.go @@ -74,8 +74,14 @@ func (c ConversantAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *a func parseCnvrParams(imp *openrtb2.Imp, cnvrExt openrtb_ext.ExtImpConversant) { imp.DisplayManager = "prebid-s2s" imp.DisplayManagerVer = "2.0.0" - imp.BidFloor = cnvrExt.BidFloor - imp.TagID = cnvrExt.TagID + + if imp.BidFloor <= 0 && cnvrExt.BidFloor > 0 { + imp.BidFloor = cnvrExt.BidFloor + } + + if len(cnvrExt.TagID) > 0 { + imp.TagID = cnvrExt.TagID + } // Take care not to override the global secure flag if (imp.Secure == nil || *imp.Secure == 0) && cnvrExt.Secure != nil { diff --git a/adapters/conversant/conversanttest/supplemental/test_params.json b/adapters/conversant/conversanttest/supplemental/test_params.json new file mode 100644 index 00000000000..403bcc42226 --- /dev/null +++ b/adapters/conversant/conversanttest/supplemental/test_params.json @@ -0,0 +1,306 @@ +{ + "mockBidRequest": { + "id": "testauction", + "imp": [ + { + "id": "1", + "bidfloor": 7, + "tagid": "mytag", + "secure": 1, + "video": { + "format": [{"w": 300, "h": 250}], + "pos": 1, + "mimes": ["video/mp4"], + "api": [1,2], + "protocols": [2], + "maxduration": 60 + }, + "ext": { + "bidder": { + "site_id": "108060" + } + } + }, + { + "id": "2", + "bidfloor": 1, + "secure": 0, + "tagid": "sometag", + "video": { + "format": [{"w": 300, "h": 250}], + "pos": 0, + "mimes": ["video/wmv"], + "api": [0], + "protocols": [0], + "maxduration": 0 + }, + "ext": { + "bidder": { + "site_id": "108060", + "bidfloor": 7, + "tag_id": "mytag", + "secure": 1, + "position": 1, + "mimes": ["video/mp4"], + "api": [1,2], + "protocols": [2], + "maxduration": 60 + } + } + }, + { + "id": "3", + "video": { + "format": [{"w": 300, "h": 250}] + }, + "ext": { + "bidder": { + "site_id": "108060", + "bidfloor": 7, + "tag_id": "mytag", + "secure": 1, + "position": 1, + "mimes": ["video/mp4"], + "api": [1,2], + "protocols": [2], + "maxduration": 60 + } + } + }, + { + "id": "4", + "bidfloor": -3, + "video": { + "format": [{"w": 300, "h": 250}] + }, + "ext": { + "bidder": { + "site_id": "108060", + "bidfloor": 0, + "tag_id": "mytag", + "secure": 1, + "position": 1, + "mimes": ["video/mp4"], + "api": [1,2], + "protocols": [2], + "maxduration": 60 + } + } + } + ], + "site": { + "domain": "www.mypage.com" + } + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "", + "body": { + "id": "testauction", + "site": { + "id": "108060", + "domain": "www.mypage.com" + }, + "imp": [ + { + "id": "1", + "bidfloor": 7, + "secure": 1, + "tagid": "mytag", + "displaymanager": "prebid-s2s", + "displaymanagerver": "2.0.0", + "video": { + "api": [1,2], + "maxduration": 60, + "mimes": ["video/mp4"], + "protocols": [2] + }, + "ext": { + "bidder": { + "site_id": "108060" + } + } + }, + { + "id": "2", + "bidfloor": 1, + "secure": 1, + "tagid": "mytag", + "displaymanager": "prebid-s2s", + "displaymanagerver": "2.0.0", + "video": { + "api": [1,2], + "maxduration": 60, + "mimes": ["video/mp4"], + "protocols": [2], + "pos": 1 + }, + "ext": { + "bidder": { + "site_id": "108060", + "bidfloor": 7, + "tag_id": "mytag", + "secure": 1, + "position": 1, + "mimes": ["video/mp4"], + "api": [1,2], + "protocols": [2], + "maxduration": 60 + } + } + }, + { + "id": "3", + "bidfloor": 7, + "secure": 1, + "tagid": "mytag", + "displaymanager": "prebid-s2s", + "displaymanagerver": "2.0.0", + "video": { + "api": [1,2], + "maxduration": 60, + "mimes": ["video/mp4"], + "protocols": [2], + "pos": 1 + }, + "ext": { + "bidder": { + "site_id": "108060", + "bidfloor": 7, + "tag_id": "mytag", + "secure": 1, + "position": 1, + "mimes": ["video/mp4"], + "api": [1,2], + "protocols": [2], + "maxduration": 60 + } + } + }, + { + "id": "4", + "bidfloor": -3, + "secure": 1, + "tagid": "mytag", + "displaymanager": "prebid-s2s", + "displaymanagerver": "2.0.0", + "video": { + "api": [1,2], + "maxduration": 60, + "mimes": ["video/mp4"], + "protocols": [2], + "pos": 1 + }, + "ext": { + "bidder": { + "site_id": "108060", + "bidfloor": 0, + "tag_id": "mytag", + "secure": 1, + "position": 1, + "mimes": ["video/mp4"], + "api": [1,2], + "protocols": [2], + "maxduration": 60 + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "testauction", + "bidid": "c8d95f4b-bcbb-4a6c-adbb-4c7f33af3c24", + "cur": "USD", + "seatbid": [ + { + "bid": [ + { + "id": "1", + "impid": "1", + "price": 0.0340, + "nurl": "https:\/\/event.ad.cpe.dotomi.com\/cvx\/event\/imp?enc=eyJ1c2VyaWQiOiI3MTI3MDUzNzM3NTM3MTAzMjIiLCJwYXJ0bmVyVHhpZCI6ImUyZWUzNjZlLWEyMjgtNDI0Mi1hNjJlLTk4ODk3ODhiYzgxNCIsInR4aWQiOiI3MTE1NzQwNDg3NTczODUwMDIiLCJuZXR3b3JrUmVxdWVzdElkIjoiNzExNTc0MDQ4NzU3Mzg1ODc0Iiwic2lkIjoxMTgwOTgsImRpdmlzaW9uSWQiOjgsInRpZCI6OCwibW9iaWxlRGF0YSI6IjU5IiwiYmlkUHJpY2UiOjAuMDY4MCwicHViQ29zdCI6MC4wMzQwLCJwYXJ0bmVyRmVlIjowLjAxMzYsImlwU3RyaW5nIjoiNzMuMTE4LjEzMC4xODYiLCJzdXBwbHlUeXBlIjoxLCJpbnRlZ3JhdGlvblR5cGUiOjQsIm1lZGlhdGlvblR5cGUiOjEyNiwicGxhY2VtZW50SWQiOiIxMTY5ODcwIiwiaGVhZGVyQmlkIjoxLCJpc0RpcmVjdFB1Ymxpc2hlciI6MCwiaGFzQ29uc2VudCI6MSwib3BlcmF0aW9uIjoiQ0xJRU5UX0hFQURFUl8yNSIsImlzQ29yZVNoaWVsZCI6MCwicGFydG5lckNyZWF0aXZlSWQiOiIyNDk2NDRfMzAweDI1MCIsInBhcnRuZXJEb21haW5zIjpbIndhbG1hcnQuY29tIl0sInNlbGxlclJlcXVlc3RJZCI6ImE3ODcyMWQ3LWE2ZmUtNGJiNS1hNjFkLTFhMDg1MzkxZTVlZCIsInNlbGxlckltcElkIjoiMzAwNDIxZDY0NWY2ZjRjOWMifQ&", + "adm": "