Skip to content

Commit

Permalink
Between: Fix for bid floor issue#1787 (prebid#1870)
Browse files Browse the repository at this point in the history
Co-authored-by: Egor Skorokhodov <skorokhodov@betweenx.com>
  • Loading branch information
2 people authored and sachin-pubmatic committed Aug 2, 2021
1 parent 28025d4 commit 2a64ed2
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 45 deletions.
12 changes: 0 additions & 12 deletions adapters/between/between.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ type BetweenAdapter struct {
EndpointTemplate template.Template
}

// BetweenSSP requires bidfloor > 0.
// If BidFloor of openrtb_ext.ExtImpBetween is zero, set it to defaultBidFloor value, see addImpProps
const defaultBidfloor = 0.00001

func (a *BetweenAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
var errors []error
if len(request.Imp) == 0 {
Expand Down Expand Up @@ -129,14 +125,6 @@ func buildImpBanner(imp *openrtb2.Imp) error {
// Add Between required properties to Imp object
func addImpProps(imp *openrtb2.Imp, secure *int8, betweenExt *openrtb_ext.ExtImpBetween) {
imp.Secure = secure
if betweenExt.BidFloor <= 0 {
imp.BidFloor = defaultBidfloor
} else {
imp.BidFloor = betweenExt.BidFloor
}
if betweenExt.BidFloorCur != "" {
imp.BidFloorCur = betweenExt.BidFloorCur
}
}

// Adding header fields to request header
Expand Down
2 changes: 0 additions & 2 deletions adapters/between/betweentest/exemplary/multi-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"publisher_id": "1"
}
},
"bidfloor": 1e-05,
"secure": 0
},
{
Expand All @@ -92,7 +91,6 @@
"publisher_id": "1"
}
},
"bidfloor": 1e-05,
"secure": 0
}
],
Expand Down
1 change: 0 additions & 1 deletion adapters/between/betweentest/exemplary/secure-detect.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"w": 728,
"h": 90
},
"bidfloor": 1e-05,
"secure": 1,
"ext": {
"bidder": {
Expand Down
10 changes: 2 additions & 8 deletions adapters/between/betweentest/exemplary/simple-site-banner.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
"ext": {
"bidder": {
"host": "127.0.0.1",
"publisher_id": "1",
"bid_floor_cur": "RUB",
"bid_floor": 1000
"publisher_id": "1"
}
}
}
Expand All @@ -48,15 +46,11 @@
"w": 728,
"h": 90
},
"bidfloor": 1000,
"bidfloorcur": "RUB",
"secure": 0,
"ext": {
"bidder": {
"host": "127.0.0.1",
"publisher_id": "1",
"bid_floor_cur": "RUB",
"bid_floor": 1000
"publisher_id": "1"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"w": 728,
"h": 90
},
"bidfloor": 1e-05,
"secure": 0,
"ext": {
"bidder": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"w": 300,
"h": 250
},
"bidfloor": 1e-05,
"secure": 0,
"ext": {
"bidder": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"w": 728,
"h": 90
},
"bidfloor": 1e-05,
"secure": 0,
"ext": {
"bidder": {
Expand Down
1 change: 0 additions & 1 deletion adapters/between/betweentest/supplemental/no-bids.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"w": 728,
"h": 90
},
"bidfloor": 1e-05,
"secure": 0,
"ext": {
"bidder": {
Expand Down
9 changes: 4 additions & 5 deletions adapters/between/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,15 @@ func TestInvalidParams(t *testing.T) {

var validParams = []string{
`{"host":"lbs-eu1.ads", "publisher_id": "1"}`,
`{"host":"lbs-eu1.ads", "publisher_id": "1", "bid_floor": 5.5}`,
`{"host":"lbs-eu1.ads", "publisher_id": "1", "bid_floor": 1, "bid_floor_cur": "RUB"}`,
`{"host":"lbs-ru1.ads", "publisher_id": "2"}`,
`{"host":"lbs-us-east1.ads", "publisher_id": "3"}`,
`{"host":"lbs-asia1.ads", "publisher_id": "4"}`,
}

var invalidParams = []string{
`{"host":"badhost.ads", "publisher_id": "1"}`,
`{"host":"lbs-eu1.ads", "publisher_id": 1}`,
`{"host":"lbs-eu1.ads", "publisher_id": "1"", "bid_floor": 5.5}`,
`{"host":"lbs-eu1.ads", "publisher_id": "1", "bid_floor": "5.5"}`,
`{"host":"lbs-eu1.ads", "publisher_id": "1", "bid_floor": 5.5, "bid_floor_cur": "cur"}`,
`{"host":"lbs-eu1.ads", "publisher_id": "1""}`,
``,
`null`,
`true`,
Expand Down
6 changes: 2 additions & 4 deletions openrtb_ext/imp_between.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package openrtb_ext

type ExtImpBetween struct {
Host string `json:"host"`
PublisherID string `json:"publisher_id"`
BidFloor float64 `json:"bid_floor"`
BidFloorCur string `json:"bid_floor_cur"`
Host string `json:"host"`
PublisherID string `json:"publisher_id"`
}
9 changes: 0 additions & 9 deletions static/bidder-params/between.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@
"publisher_id": {
"type": "string",
"description": "Publisher ID from Between Exchange control panel"
},
"bid_floor": {
"type": "number",
"description": "The minimum price acceptable for a bid"
},
"bid_floor_cur": {
"type": "string",
"description": "Currency of bid floor",
"enum": ["USD", "EUR", "RUB"]
}
},
"required": ["host", "publisher_id"]
Expand Down

0 comments on commit 2a64ed2

Please sign in to comment.