Skip to content

Commit

Permalink
Removed old 2.5 location usages
Browse files Browse the repository at this point in the history
  • Loading branch information
VeronikaSolovei9 committed Sep 16, 2024
1 parent f7caea5 commit 0b2cd1e
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 46 deletions.
10 changes: 3 additions & 7 deletions adapters/algorix/algorix.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,14 @@ func preProcess(request *openrtb2.BidRequest) {
}
}
if request.Imp[i].Video != nil {
var impExt adapters.ExtImpBidder
err := json.Unmarshal(request.Imp[i].Ext, &impExt)
if err != nil {
continue
}
if impExt.Prebid != nil && impExt.Prebid.IsRewardedInventory != nil && *impExt.Prebid.IsRewardedInventory == 1 {
if request.Imp[i].Rwdd == 1 {
videoCopy := *request.Imp[i].Video
videoExt := algorixVideoExt{Rewarded: 1}
videoCopy.Ext, err = json.Marshal(&videoExt)
ext, err := json.Marshal(&videoExt)
if err != nil {
continue
}
videoCopy.Ext = ext
request.Imp[i].Video = &videoCopy
}
}
Expand Down
2 changes: 1 addition & 1 deletion adapters/bidmachine/bidmachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRe
errs = append(errs, err)
continue
}
if bidderExt.Prebid != nil && bidderExt.Prebid.IsRewardedInventory != nil && *bidderExt.Prebid.IsRewardedInventory == 1 {
if impression.Rwdd == 1 {
if impression.Banner != nil && !hasRewardedBattr(impression.Banner.BAttr) {
bannerCopy := *impression.Banner
bannerCopy.BAttr = copyBAttrWithRewardedInventory(bannerCopy.BAttr)
Expand Down
2 changes: 1 addition & 1 deletion adapters/openx/openx.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func preprocess(imp *openrtb2.Imp, reqExt *openxReqExt) error {

if imp.Video != nil {
videoCopy := *imp.Video
if bidderExt.Prebid != nil && bidderExt.Prebid.IsRewardedInventory != nil && *bidderExt.Prebid.IsRewardedInventory == 1 {
if imp.Rwdd == 1 {
videoCopy.Ext = json.RawMessage(`{"rewarded":1}`)
} else {
videoCopy.Ext = nil
Expand Down
6 changes: 3 additions & 3 deletions adapters/pangle/pangle.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co

/* MakeRequests */

func getAdType(imp openrtb2.Imp, parsedImpExt *wrappedExtImpBidder) int {
func getAdType(imp openrtb2.Imp) int {
// video
if imp.Video != nil {
if parsedImpExt != nil && parsedImpExt.Prebid != nil && parsedImpExt.Prebid.IsRewardedInventory != nil && *parsedImpExt.Prebid.IsRewardedInventory == 1 {
if imp.Rwdd == 1 {
return 7
}
if imp.Instl == 1 {
Expand Down Expand Up @@ -92,7 +92,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte
continue
}
// detect and fill adtype
adType := getAdType(imp, &impExt)
adType := getAdType(imp)
if adType == -1 {
errs = append(errs, &errortypes.BadInput{Message: "not a supported adtype"})
continue
Expand Down
10 changes: 3 additions & 7 deletions analytics/agma/agma_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,11 @@ func (l *AgmaLogger) extractPublisherAndSite(requestWrapper *openrtb_ext.Request
}

func (l *AgmaLogger) shouldTrackEvent(requestWrapper *openrtb_ext.RequestWrapper) (bool, string) {
userExt, err := requestWrapper.GetUserExt()
if err != nil || userExt == nil {
if requestWrapper.User == nil {
return false, ""
}
consent := userExt.GetConsent()
if consent == nil {
return false, ""
}
consentStr := *consent
consentStr := requestWrapper.User.Consent

parsedConsent, err := vendorconsent.ParseString(consentStr)
if err != nil {
return false, ""
Expand Down
6 changes: 3 additions & 3 deletions macros/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ func (b *MacroProvider) populateRequestMacros(reqWrapper *openrtb_ext.RequestWra
}
}

userExt, err := reqWrapper.GetUserExt()
if err == nil && userExt != nil && userExt.GetConsent() != nil {
b.macros[MacroKeyConsent] = *userExt.GetConsent()
//is this happening after upconvert?
if reqWrapper.User != nil && len(reqWrapper.User.Consent) > 0 {
b.macros[MacroKeyConsent] = reqWrapper.User.Consent
}
if reqWrapper.Device != nil && reqWrapper.Device.Lmt != nil {
b.macros[MacroKeyLmtTracking] = strconv.Itoa(int(*reqWrapper.Device.Lmt))
Expand Down
11 changes: 8 additions & 3 deletions privacy/ccpa/consentwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ func (c ConsentWriter) Write(req *openrtb2.BidRequest) error {

// Set consent string in USPrivacy
if c.Consent != "" {
if regsExt, err := reqWrap.GetRegExt(); err == nil {
regsExt.SetUSPrivacy(c.Consent)
if reqWrap.User != nil {
// this is executed before upconvert to 2.6, we probably don't need this here
reqWrap.User.Consent = c.Consent
} else {
return err
if regsExt, err := reqWrap.GetRegExt(); err == nil {
regsExt.SetUSPrivacy(c.Consent)
} else {
return err
}
}
}

Expand Down
21 changes: 6 additions & 15 deletions privacy/ccpa/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,8 @@ func ReadFromRequestWrapper(req *openrtb_ext.RequestWrapper, gpp gpplib.GppConta
WarningCode: errortypes.InvalidPrivacyConsentWarningCode}
}

if consent == "" {
// Read consent from request.regs.ext
regsExt, err := req.GetRegExt()
if err != nil {
return Policy{}, fmt.Errorf("error reading request.regs.ext: %s", err)
}
if regsExt != nil {
consent = regsExt.GetUSPrivacy()
}
if consent == "" && req.Regs != nil {
consent = req.Regs.USPrivacy
}
// Read no sale bidders from request.ext.prebid
reqExt, err := req.GetRequestExt()
Expand Down Expand Up @@ -79,17 +72,15 @@ func (p Policy) Write(req *openrtb_ext.RequestWrapper) error {
return nil
}

regsExt, err := req.GetRegExt()
if err != nil {
return err
}

reqExt, err := req.GetRequestExt()
if err != nil {
return err
}

regsExt.SetUSPrivacy(p.Consent)
if req.Regs == nil {
req.Regs = &openrtb2.Regs{}
}
req.Regs.USPrivacy = p.Consent
setPrebidNoSale(p.NoSaleBidders, reqExt)
return nil
}
Expand Down
22 changes: 16 additions & 6 deletions privacy/gdpr/consentwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,28 @@ func (c ConsentWriter) Write(req *openrtb2.BidRequest) error {
reqWrap := &openrtb_ext.RequestWrapper{BidRequest: req}

if c.RegExtGDPR != nil {
if regsExt, err := reqWrap.GetRegExt(); err == nil {
regsExt.SetGDPR(c.RegExtGDPR)
if reqWrap.Regs != nil {
// this is executed before upconvert to 2.6, we probably don't need this here
reqWrap.Regs.GDPR = c.RegExtGDPR
} else {
return err
if regsExt, err := reqWrap.GetRegExt(); err == nil {
regsExt.SetGDPR(c.RegExtGDPR)
} else {
return err
}
}
}

if c.Consent != "" {
if userExt, err := reqWrap.GetUserExt(); err == nil {
userExt.SetConsent(&c.Consent)
if reqWrap.User != nil {
// this is executed before upconvert to 2.6, we probably don't need this here
reqWrap.User.Consent = c.Consent
} else {
return err
if userExt, err := reqWrap.GetUserExt(); err == nil {
userExt.SetConsent(&c.Consent)
} else {
return err
}
}
}

Expand Down

0 comments on commit 0b2cd1e

Please sign in to comment.