Skip to content

Commit

Permalink
remove unmarshalling
Browse files Browse the repository at this point in the history
  • Loading branch information
ikagotso committed Nov 21, 2024
1 parent 55c0b16 commit 8069767
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
8 changes: 1 addition & 7 deletions adapters/sovrn/sovrn.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,14 @@ func (s *SovrnAdapter) MakeBids(request *openrtb2.BidRequest, bidderRequest *ada
}

func getExtBidFloor(sovrnExt openrtb_ext.ExtImpSovrn) float64 {
var bidFloor interface{}
if err := json.Unmarshal(sovrnExt.BidFloor, &bidFloor); err != nil {
return 0
}

switch v := bidFloor.(type) {
switch v := sovrnExt.BidFloor.(type) {
case string:
if numValue, err := strconv.ParseFloat(v, 64); err == nil {
return numValue
}
case float64:
return v
}

return 0
}

Expand Down
10 changes: 4 additions & 6 deletions openrtb_ext/imp_sovrn.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package openrtb_ext

import "encoding/json"

type ExtImpSovrn struct {
TagId string `json:"tagId,omitempty"`
Tagid string `json:"tagid,omitempty"`
BidFloor json.RawMessage `json:"bidfloor,omitempty"`
AdUnitCode string `json:"adunitcode,omitempty"`
TagId string `json:"tagId,omitempty"`
Tagid string `json:"tagid,omitempty"`
BidFloor interface{} `json:"bidfloor,omitempty"`
AdUnitCode string `json:"adunitcode,omitempty"`
}

0 comments on commit 8069767

Please sign in to comment.