Skip to content

Commit

Permalink
Beachfront: Fix for bid floor issue#1787 (prebid#1878)
Browse files Browse the repository at this point in the history
Co-authored-by: jim naumann <jim@beachfront.com>
  • Loading branch information
2 people authored and sachin-pubmatic committed Aug 2, 2021
1 parent 2a64ed2 commit a65c377
Show file tree
Hide file tree
Showing 8 changed files with 747 additions and 124 deletions.
33 changes: 22 additions & 11 deletions adapters/beachfront/beachfront.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,12 @@ func getBannerRequest(request *openrtb2.BidRequest) (beachfrontBannerRequest, []
continue
}

setBidFloor(&beachfrontExt, &request.Imp[i])

slot := beachfrontSlot{
Id: appid,
Slot: request.Imp[i].ID,
Bidfloor: beachfrontExt.BidFloor,
}

if beachfrontExt.BidFloor <= minBidFloor {
slot.Bidfloor = 0
Bidfloor: request.Imp[i].BidFloor,
}

for j := 0; j < len(request.Imp[i].Banner.Format); j++ {
Expand Down Expand Up @@ -468,12 +466,7 @@ func getVideoRequests(request *openrtb2.BidRequest) ([]beachfrontVideoRequest, [
imp.Banner = nil
imp.Ext = nil
imp.Secure = &secure

if beachfrontExt.BidFloor <= minBidFloor {
imp.BidFloor = 0
} else {
imp.BidFloor = beachfrontExt.BidFloor
}
setBidFloor(&beachfrontExt, &imp)

if imp.Video.H == 0 && imp.Video.W == 0 {
imp.Video.W = defaultVideoWidth
Expand Down Expand Up @@ -564,6 +557,24 @@ func (a *BeachfrontAdapter) MakeBids(internalRequest *openrtb2.BidRequest, exter
return bidResponse, errs
}

func setBidFloor(ext *openrtb_ext.ExtImpBeachfront, imp *openrtb2.Imp) {
var floor float64

if imp.BidFloor > 0 {
floor = imp.BidFloor
} else if ext.BidFloor > 0 {
floor = ext.BidFloor
} else {
floor = minBidFloor
}

if floor <= minBidFloor {
floor = 0
}

imp.BidFloor = floor
}

func (a *BeachfrontAdapter) getBidType(externalRequest *adapters.RequestData) openrtb_ext.BidType {
t := strings.Split(externalRequest.Uri, "=")[0]
if t == a.extraInfo.VideoEndpoint {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{
"slot": "",
"id": "dudAppId",
"bidfloor": 5.02,
"bidfloor": 0.02,
"sizes": [
{
"w": 300,
Expand Down

This file was deleted.

Loading

0 comments on commit a65c377

Please sign in to comment.