Skip to content

Commit

Permalink
change bid type to use the openrtb_ext.BidTypeBanner literal
Browse files Browse the repository at this point in the history
  • Loading branch information
yfcr committed Nov 14, 2023
1 parent 4961ac5 commit c1eaced
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions adapters/oms/oms.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,6 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte
return []*adapters.RequestData{requestData}, nil
}

func getMediaTypeForBid(bid openrtb2.Bid) (openrtb_ext.BidType, error) {
if bid.Ext != nil {
var bidExt openrtb_ext.ExtBid
err := json.Unmarshal(bid.Ext, &bidExt)
if err == nil && bidExt.Prebid != nil {
return openrtb_ext.ParseBidType(string(bidExt.Prebid.Type))
}
}

return "", &errortypes.BadServerResponse{
Message: fmt.Sprintf("Failed to parse impression \"%s\" mediatype", bid.ImpID),
}
}

func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) {
if responseData.StatusCode == http.StatusNoContent {
return nil, nil
Expand All @@ -78,17 +64,11 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R

bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp))
bidResponse.Currency = response.Cur
var errors []error
for _, seatBid := range response.SeatBid {
for i, bid := range seatBid.Bid {
bidType, err := getMediaTypeForBid(bid)
if err != nil {
errors = append(errors, err)
continue
}
for i := range seatBid.Bid {
bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
Bid: &seatBid.Bid[i],
BidType: bidType,
BidType: openrtb_ext.BidTypeBanner,
})
}
}
Expand Down

0 comments on commit c1eaced

Please sign in to comment.