Skip to content

Commit

Permalink
UOE-11332: Addressed Review Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Pubmatic-Supriya-Patil committed Nov 20, 2024
1 parent b90eaed commit 7c9c306
Show file tree
Hide file tree
Showing 8 changed files with 416 additions and 36 deletions.
2 changes: 1 addition & 1 deletion exchange/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ func (e *exchange) HoldAuction(ctx context.Context, r *AuctionRequest, debugLog

if requestExtPrebid.StrictVastMode {
var validationErrs []error
adapterBids, validationErrs = filterBidsByVastVersion(adapterBids, seatNonBids)
validationErrs = filterBidsByVastVersion(adapterBids, seatNonBids)
errs = append(errs, validationErrs...)
}

Expand Down
12 changes: 6 additions & 6 deletions exchange/exchange_ow.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@ func updateSeatNonBidsInvalidVastVersion(seatNonBids *openrtb_ext.NonBidCollecti
}
}

func filterBidsByVastVersion(adapterBids map[openrtb_ext.BidderName]*entities.PbsOrtbSeatBid, seatNonBid *openrtb_ext.NonBidCollection) (map[openrtb_ext.BidderName]*entities.PbsOrtbSeatBid, []error) {
func filterBidsByVastVersion(adapterBids map[openrtb_ext.BidderName]*entities.PbsOrtbSeatBid, seatNonBid *openrtb_ext.NonBidCollection) []error {
errs := []error{}

rejectedBid := []*entities.PbsOrtbSeatBid{}
for _, seatBid := range adapterBids {
validBids := make([]*entities.PbsOrtbBid, 0, len(seatBid.Bids))
for _, pbsBid := range seatBid.Bids {
Expand All @@ -410,15 +410,16 @@ func filterBidsByVastVersion(adapterBids map[openrtb_ext.BidderName]*entities.Pb
Message: fmt.Sprintf("%s Bid %s was filtered for Imp %s with Vast Version %s: Incompatible with GAM unwinding requirements", seatBid.Seat, pbsBid.Bid.ID, pbsBid.Bid.ImpID, vastVersion),
WarningCode: errortypes.InvalidVastVersionWarningCode,
})
updateSeatNonBidsInvalidVastVersion(seatNonBid, []*entities.PbsOrtbSeatBid{seatBid})
rejectedBid = append(rejectedBid, seatBid)
continue
}
}
updateSeatNonBidsInvalidVastVersion(seatNonBid, rejectedBid)
validBids = append(validBids, pbsBid)
}
seatBid.Bids = validBids
}
return adapterBids, errs
return errs
}

func validateVastVersion(adM string) (bool, string) {
Expand All @@ -430,6 +431,5 @@ func validateVastVersion(adM string) (bool, string) {
if err != nil {
return false, matches[1]
}
vastVersionInt := int(vastVersionFloat)
return validVastVersions[vastVersionInt], matches[1]
return validVastVersions[int(vastVersionFloat)], matches[1]
}
Loading

0 comments on commit 7c9c306

Please sign in to comment.