Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Commit

Permalink
Change placement of cpmoverride for Rubicon (prebid#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
DGarbar authored May 28, 2020
1 parent 199b7c9 commit d31b097
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
20 changes: 14 additions & 6 deletions adapters/rubicon/rubicon.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,23 @@ type rubiconParams struct {
}

type bidRequestExt struct {
Rubicon bidRequestExtRubicon `json:"rubicon,omitempty"`
Prebid bidRequestExtPrebid `json:"prebid"`
}

type bidRequestExtRubicon struct {
Debug bidRequestExtRubiconDebug `json:"debug,omitempty"`
type bidRequestExtPrebid struct {
Bidders bidRequestExtPrebidBidders `json:"bidders"`
}

type bidRequestExtRubiconDebug struct {
CpmOverride float64 `json:"cpmOverride,omitempty"`
type bidRequestExtPrebidBidders struct {
Rubicon prebidBiddersRubicon `json:"rubicon,omitempty"`
}

type prebidBiddersRubicon struct {
Debug prebidBiddersRubiconDebug `json:"debug,omitempty"`
}

type prebidBiddersRubiconDebug struct {
CpmOverride float64 `json:"cpmoverride,omitempty"`
}

type rubiconImpExtRPTrack struct {
Expand Down Expand Up @@ -952,7 +960,7 @@ func cmpOverrideFromBidRequest(bidRequest *openrtb.BidRequest) float64 {
return 0
}

return bidRequestExt.Rubicon.Debug.CpmOverride
return bidRequestExt.Prebid.Bidders.Rubicon.Debug.CpmOverride
}

func mapImpIdToCpmOverride(imps []openrtb.Imp) map[string]float64 {
Expand Down
22 changes: 13 additions & 9 deletions adapters/rubicon/rubicon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1442,10 +1442,12 @@ func TestOpenRTBResponseOverridePriceFromBidRequest(t *testing.T) {
"zoneId": 327642
}}`),
}},
Ext: json.RawMessage(`{"rubicon": {
"debug": {
"cpmOverride" : 10
}}}`),
Ext: json.RawMessage(`{"prebid": {
"bidders": {
"rubicon": {
"debug": {
"cpmoverride": 10
}}}}}`),
}

requestJson, _ := json.Marshal(request)
Expand Down Expand Up @@ -1486,14 +1488,16 @@ func TestOpenRTBResponseOverridePriceFromCorrespondingImp(t *testing.T) {
"siteId": 68780,
"zoneId": 327642,
"debug": {
"cpmOverride" : 20
"cpmoverride" : 20
}
}}`),
}},
Ext: json.RawMessage(`{"rubicon": {
"debug": {
"cpmOverride" : 10
}}}`),
Ext: json.RawMessage(`{"prebid": {
"bidders": {
"rubicon": {
"debug": {
"cpmoverride": 10
}}}}}`),
}

requestJson, _ := json.Marshal(request)
Expand Down
2 changes: 1 addition & 1 deletion openrtb_ext/imp_rubicon.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ type rubiconVideoParams struct {

// rubiconVideoParams defines the contract for bidrequest.imp[i].ext.rubicon.debug
type impExtRubiconDebug struct {
CpmOverride float64 `json:"cpmOverride,omitempty"`
CpmOverride float64 `json:"cpmoverride,omitempty"`
}

0 comments on commit d31b097

Please sign in to comment.