Skip to content

Commit

Permalink
UOE-9681: fix pubmatic2 params (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-nilesh-chate authored Nov 9, 2023
1 parent 32c62e1 commit 7afb162
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions modules/pubmatic/openwrap/bidderparams/pubmatic.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ import (

func PreparePubMaticParamsV25(rctx models.RequestCtx, cache cache.Cache, bidRequest openrtb2.BidRequest, imp openrtb2.Imp, impExt models.ImpExtension, partnerID int) (string, string, bool, []byte, error) {
wrapExt := fmt.Sprintf(`{"%s":%d,"%s":%d}`, models.SS_PM_VERSION_ID, rctx.DisplayID, models.SS_PM_PROFILE_ID, rctx.ProfileID)

// change profile id for pubmatic2
if secondaryProfileID, ok := rctx.PartnerConfigMap[partnerID][models.KEY_PROFILE_ID]; ok {
wrapExt = fmt.Sprintf(`{"%s":0,"%s":%s}`, models.SS_PM_VERSION_ID, models.SS_PM_PROFILE_ID, secondaryProfileID)
}

extImpPubMatic := openrtb_ext.ExtImpPubmatic{
PublisherId: strconv.Itoa(rctx.PubID),
WrapExt: json.RawMessage(wrapExt),
Expand Down
3 changes: 2 additions & 1 deletion modules/pubmatic/openwrap/bidderparams/pubmatic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ func TestPreparePubMaticParamsV25(t *testing.T) {
models.TIMEOUT: "200",
models.KEY_GEN_PATTERN: "_AU_@_DIV_@_W_x_H_",
models.SERVER_SIDE_FLAG: "1",
models.KEY_PROFILE_ID: "1323",
},
},
},
Expand Down Expand Up @@ -369,7 +370,7 @@ func TestPreparePubMaticParamsV25(t *testing.T) {
matchedSlot: "/Test_Adunit1234@Div1@200x300",
matchedPattern: "",
isRegexSlot: false,
params: []byte(`{"publisherId":"5890","adSlot":"/Test_Adunit1234@DIV1@200x300","wrapper":{"version":1,"profile":123},"keywords":[{"key":"test_key1","value":["test_value1","test_value2"]},{"key":"test_key2","value":["test_value1","test_value2"]}]}`),
params: []byte(`{"publisherId":"5890","adSlot":"/Test_Adunit1234@DIV1@200x300","wrapper":{"version":0,"profile":1323},"keywords":[{"key":"test_key1","value":["test_value1","test_value2"]},{"key":"test_key2","value":["test_value1","test_value2"]}]}`),
wantErr: false,
},
},
Expand Down

0 comments on commit 7afb162

Please sign in to comment.