Skip to content

Commit

Permalink
Build test (#945)
Browse files Browse the repository at this point in the history
* UOE-11191: Refactor: consume StoreURL from New portal UI and forward appstoreurl and appsource for applovinmax (#925)

* UOE-11191: Refactor: consume StoreURL from New portal UI and forward appstoreurl and appsource for applovinmax

* review comment

* UOE-11185: Stats for parsing failed for ituneid

* go fmt update

* OTT-1807-P1: discard emptyVAST and invalidVAST bids detected by VAST unwrap module (#933)

Co-authored-by: ashishshinde-pubm <109787960+ashishshinde-pubm@users.noreply.github.com>
Co-authored-by: supriya-patil <supriya.patil@pubmatic.com>
Co-authored-by: dhruv.sonone <dhruv.sonone@pubmatic.com>

* UOE-11098: Pass user.ext.sessionduration and user.ext.impdepth ORTB request to OW partners (#922)

* UOE-11168: Consume then Remove `app.id` from ApplovinMax Request (#931)

* UOE-11322: Forward displaymanager and displaymanagerver from app extension to pubmatic ssp (#935)

* UOE-11322: Forward displaymanager and displaymanagerver from app extension to pubmatic ssp

* test case name update

* comment

* review comment

* UOE-11355: bug fix- AppLovinMax: sendburl is getting passed at imp.ext instead of req.ext (#940)

* UOE-11310: ApplovinMax Signal data not visible in the wakanda logs (#936)

* UOE-11326: Multiimpression request not logger in case one of the bid is rejected because of invalid mapping (#937)

* UOE-11339: Bug fix- Default Bid is not getting formed for Prebid S2S (#941)

* UOE-11339: Bug fix- Default Bid is not getting formed for Prebid S2S

* test cases

* comment

* review comment

* pip install fix

* Fixing semgrp

* Semgrep fix

* Semgrep fix

* Changing ubuntu version

---------

Co-authored-by: PubMatic-OpenWrap <UOEDev@pubmatic.com>
Co-authored-by: pm-avinash-kapre <112699665+AvinashKapre@users.noreply.github.com>
Co-authored-by: Viral Vala <63396712+pm-viral-vala@users.noreply.github.com>
Co-authored-by: ashishshinde-pubm <109787960+ashishshinde-pubm@users.noreply.github.com>
Co-authored-by: supriya-patil <supriya.patil@pubmatic.com>
Co-authored-by: Pubmatic-Supriya-Patil <131644110+Pubmatic-Supriya-Patil@users.noreply.github.com>
Co-authored-by: Saurabh Narkhede <108730956+pm-saurabh-narkhede@users.noreply.github.com>
Co-authored-by: pm-priyanka-bagade <156899734+pm-priyanka-bagade@users.noreply.github.com>
  • Loading branch information
9 people authored Oct 16, 2024
1 parent 4233513 commit f33f473
Show file tree
Hide file tree
Showing 53 changed files with 4,191 additions and 917 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ permissions:
pull-requests: write
jobs:
semgrep-check:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04.5
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Install semgrep
if: contains(steps.should_run_semgrep.outputs.hasChanges, 'true')
run: |
pip3 install semgrep==1.22.0 --break-system-packages
pip3 install semgrep==1.22.0 --break-system-packages.
semgrep --version
- name: Run semgrep tests
Expand Down
39 changes: 33 additions & 6 deletions adapters/pubmatic/pubmatic.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ type extRequestAdServer struct {
Wrapper *pubmaticWrapperExt `json:"wrapper,omitempty"`
Acat []string `json:"acat,omitempty"`
Marketplace *marketplaceReqExt `json:"marketplace,omitempty"`
SendBurl bool `json:"sendburl,omitempty"`
openrtb_ext.ExtRequest
}

Expand All @@ -113,6 +114,11 @@ func (a *PubmaticAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *ad
extractWrapperExtFromImp := true
extractPubIDFromImp := true

displayManager, displayManagerVer := "", ""
if request.App != nil && request.App.Ext != nil {
displayManager, displayManagerVer = getDisplayManagerAndVer(request.App)
}

newReqExt, cookies, err := extractPubmaticExtFromRequest(request)
if err != nil {
return nil, []error{err}
Expand All @@ -125,7 +131,7 @@ func (a *PubmaticAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *ad
impFloorsMap := map[string][]float64{}

for i := 0; i < len(request.Imp); i++ {
wrapperExtFromImp, pubIDFromImp, floors, err := parseImpressionObject(&request.Imp[i], extractWrapperExtFromImp, extractPubIDFromImp)
wrapperExtFromImp, pubIDFromImp, floors, err := parseImpressionObject(&request.Imp[i], extractWrapperExtFromImp, extractPubIDFromImp, displayManager, displayManagerVer)
// If the parsing is failed, remove imp and add the error.
if err != nil {
errs = append(errs, err)
Expand Down Expand Up @@ -383,7 +389,7 @@ func assignBannerWidthAndHeight(banner *openrtb2.Banner, w, h int64) *openrtb2.B
}

// parseImpressionObject parse the imp to get it ready to send to pubmatic
func parseImpressionObject(imp *openrtb2.Imp, extractWrapperExtFromImp, extractPubIDFromImp bool) (*pubmaticWrapperExt, string, []float64, error) {
func parseImpressionObject(imp *openrtb2.Imp, extractWrapperExtFromImp, extractPubIDFromImp bool, displayManager, displayManagerVer string) (*pubmaticWrapperExt, string, []float64, error) {
var wrapExt *pubmaticWrapperExt
var pubID string
var floors []float64
Expand All @@ -397,6 +403,12 @@ func parseImpressionObject(imp *openrtb2.Imp, extractWrapperExtFromImp, extractP
imp.Audio = nil
}

// Populate imp.displaymanager and imp.displaymanagerver if the SDK failed to do it.
if imp.DisplayManager == "" && imp.DisplayManagerVer == "" && displayManager != "" && displayManagerVer != "" {
imp.DisplayManager = displayManager
imp.DisplayManagerVer = displayManagerVer
}

var bidderExt ExtImpBidderPubmatic
if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
return wrapExt, pubID, floors, err
Expand Down Expand Up @@ -451,10 +463,6 @@ func parseImpressionObject(imp *openrtb2.Imp, extractWrapperExtFromImp, extractP
extMap[pmZoneIDKeyName] = pubmaticExt.PmZoneID
}

if pubmaticExt.SendBurl {
extMap[sendBurlKey] = pubmaticExt.SendBurl
}

if bidderExt.SKAdnetwork != nil {
extMap[skAdnetworkKey] = bidderExt.SKAdnetwork
}
Expand Down Expand Up @@ -560,6 +568,9 @@ func extractPubmaticExtFromRequest(request *openrtb2.BidRequest) (extRequestAdSe
if wrapperObj, present := reqExtBidderParams["Cookie"]; present && len(wrapperObj) != 0 {
err = json.Unmarshal(wrapperObj, &cookies)
}
if sendBurl, ok := reqExtBidderParams[sendBurlKey]; ok {
pmReqExt.SendBurl, _ = strconv.ParseBool(string(sendBurl))
}
// OW patch -end-

return pmReqExt, cookies, nil
Expand Down Expand Up @@ -854,3 +865,19 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
}
return bidder, nil
}

// getDisplayManagerAndVer returns the display manager and version from the request.app.ext or request.app.prebid.ext source and version
func getDisplayManagerAndVer(app *openrtb2.App) (string, string) {
if source, err := jsonparser.GetString(app.Ext, openrtb_ext.PrebidExtKey, "source"); err == nil && source != "" {
if version, err := jsonparser.GetString(app.Ext, openrtb_ext.PrebidExtKey, "version"); err == nil && version != "" {
return source, version
}
}

if source, err := jsonparser.GetString(app.Ext, "source"); err == nil && source != "" {
if version, err := jsonparser.GetString(app.Ext, "version"); err == nil && version != "" {
return source, version
}
}
return "", ""
}
Loading

0 comments on commit f33f473

Please sign in to comment.