Skip to content

Commit

Permalink
AppNexus: reform bid floor handling (#1814)
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhjort authored Apr 26, 2021
1 parent 7739f10 commit 6be1b08
Show file tree
Hide file tree
Showing 3 changed files with 288 additions and 1 deletion.
2 changes: 1 addition & 1 deletion adapters/appnexus/appnexus.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ func preprocess(imp *openrtb2.Imp, defaultDisplayManagerVer string) (string, err
if appnexusExt.InvCode != "" {
imp.TagID = appnexusExt.InvCode
}
if appnexusExt.Reserve > 0 {
if imp.BidFloor <= 0 && appnexusExt.Reserve > 0 {
imp.BidFloor = appnexusExt.Reserve // This will be broken for non-USD currency.
}
if imp.Banner != nil {
Expand Down
144 changes: 144 additions & 0 deletions adapters/appnexus/appnexustest/supplemental/reserve-ignored.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
},
{
"w": 300,
"h": 600
}
]
},
"bidfloor": 0.3,
"ext": {
"bidder": {
"placement_id": 1,
"reserve": 0.4
}
}
}
]
},

"httpCalls": [
{
"expectedRequest": {
"uri": "http://ib.adnxs.com/openrtb2",
"body": {
"id": "test-request-id",
"ext": {
"appnexus": {
"hb_source": 5
},
"prebid": {}
},
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
},
{
"w": 300,
"h": 600
}
],
"w": 300,
"h": 250
},
"bidfloor": 0.3,
"ext": {
"appnexus": {
"placement_id": 1
}
}
}
]
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "958",
"bid": [{
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 0.500000,
"adid": "29681110",
"adm": "some-test-ad",
"adomain": ["appnexus.com"],
"iurl": "http://nym1-ib.adnxs.com/cr?id=29681110",
"cid": "958",
"crid": "29681110",
"h": 250,
"w": 300,
"ext": {
"appnexus": {
"brand_id": 1,
"brand_category_id": 1,
"auction_id": 8189378542222915032,
"bid_ad_type": 0,
"bidder_id": 2,
"ranking_price": 0.000000,
"deal_priority": 5
}
}
}]
}
],
"bidid": "5778926625248726496",
"cur": "USD"
}
}
}
],

"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 0.5,
"adm": "some-test-ad",
"adid": "29681110",
"adomain": ["appnexus.com"],
"iurl": "http://nym1-ib.adnxs.com/cr?id=29681110",
"cid": "958",
"crid": "29681110",
"w": 300,
"h": 250,
"cat": ["IAB20-3"],
"ext": {
"appnexus": {
"brand_id": 1,
"brand_category_id": 1,
"auction_id": 8189378542222915032,
"bid_ad_type": 0,
"bidder_id": 2,
"ranking_price": 0.000000,
"deal_priority": 5
}
}
},
"type": "banner"
}
]
}
]
}
143 changes: 143 additions & 0 deletions adapters/appnexus/appnexustest/supplemental/reserve-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
},
{
"w": 300,
"h": 600
}
]
},
"ext": {
"bidder": {
"placement_id": 1,
"reserve": 0.4
}
}
}
]
},

"httpCalls": [
{
"expectedRequest": {
"uri": "http://ib.adnxs.com/openrtb2",
"body": {
"id": "test-request-id",
"ext": {
"appnexus": {
"hb_source": 5
},
"prebid": {}
},
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
},
{
"w": 300,
"h": 600
}
],
"w": 300,
"h": 250
},
"bidfloor": 0.4,
"ext": {
"appnexus": {
"placement_id": 1
}
}
}
]
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "958",
"bid": [{
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 0.500000,
"adid": "29681110",
"adm": "some-test-ad",
"adomain": ["appnexus.com"],
"iurl": "http://nym1-ib.adnxs.com/cr?id=29681110",
"cid": "958",
"crid": "29681110",
"h": 250,
"w": 300,
"ext": {
"appnexus": {
"brand_id": 1,
"brand_category_id": 1,
"auction_id": 8189378542222915032,
"bid_ad_type": 0,
"bidder_id": 2,
"ranking_price": 0.000000,
"deal_priority": 5
}
}
}]
}
],
"bidid": "5778926625248726496",
"cur": "USD"
}
}
}
],

"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 0.5,
"adm": "some-test-ad",
"adid": "29681110",
"adomain": ["appnexus.com"],
"iurl": "http://nym1-ib.adnxs.com/cr?id=29681110",
"cid": "958",
"crid": "29681110",
"w": 300,
"h": 250,
"cat": ["IAB20-3"],
"ext": {
"appnexus": {
"brand_id": 1,
"brand_category_id": 1,
"auction_id": 8189378542222915032,
"bid_ad_type": 0,
"bidder_id": 2,
"ranking_price": 0.000000,
"deal_priority": 5
}
}
},
"type": "banner"
}
]
}
]
}

0 comments on commit 6be1b08

Please sign in to comment.