Skip to content

Commit

Permalink
OTT-1800: Exported functions for adding Pricing Model in VAST XML (#799)
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-jaydeep-mohite authored May 22, 2024
1 parent 67b5876 commit c0f3a56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions modules/pubmatic/openwrap/tracker/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ func injectVideoCreativeTrackers(rctx models.RequestCtx, bid openrtb2.Bid, video

if videoParams[i].Price != 0 {
if (version == models.VideoVASTVersion2_0) || (isWrapper && version == models.VideoVASTVersion3_0) {
injectPricingNodeInExtension(element, videoParams[i].Price, videoParams[i].PriceModel, videoParams[i].PriceCurrency)
InjectPricingNodeInExtension(element, videoParams[i].Price, videoParams[i].PriceModel, videoParams[i].PriceCurrency)
} else {
injectPricingNodeInVAST(element, videoParams[i].Price, videoParams[i].PriceModel, videoParams[i].PriceCurrency)
InjectPricingNodeInVAST(element, videoParams[i].Price, videoParams[i].PriceModel, videoParams[i].PriceCurrency)
}
}
}
Expand All @@ -99,7 +99,7 @@ func injectVideoCreativeTrackers(rctx models.RequestCtx, bid openrtb2.Bid, video
return bid.AdM, bid.BURL, nil
}

func injectPricingNodeInExtension(parent *etree.Element, price float64, model string, currency string) {
func InjectPricingNodeInExtension(parent *etree.Element, price float64, model string, currency string) {
extensions := parent.FindElement(models.VideoTagLookupStart + models.VideoExtensionsTag)
if nil == extensions {
extensions = parent.CreateElement(models.VideoExtensionsTag)
Expand All @@ -115,7 +115,7 @@ func injectPricingNodeInExtension(parent *etree.Element, price float64, model st
}
}

func injectPricingNodeInVAST(parent *etree.Element, price float64, model string, currency string) {
func InjectPricingNodeInVAST(parent *etree.Element, price float64, model string, currency string) {
//Insert into Wrapper Elements
pricing := parent.FindElement(models.VideoTagLookupStart + models.VideoPricingTag)
if nil != pricing {
Expand Down
4 changes: 2 additions & 2 deletions modules/pubmatic/openwrap/tracker/video_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ func Test_injectPricingNodeInExtension0(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
injectPricingNodeInExtension(&tt.args.doc.Element, tt.args.price, tt.args.model, tt.args.currency)
InjectPricingNodeInExtension(&tt.args.doc.Element, tt.args.price, tt.args.model, tt.args.currency)
actual, _ := tt.args.doc.WriteToString()
assert.Equal(t, tt.want, actual)
})
Expand Down Expand Up @@ -632,7 +632,7 @@ func Test_injectPricingNodeInVAST(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
injectPricingNodeInVAST(&tt.args.doc.Element, tt.args.price, tt.args.model, tt.args.currency)
InjectPricingNodeInVAST(&tt.args.doc.Element, tt.args.price, tt.args.model, tt.args.currency)
actual, _ := tt.args.doc.WriteToString()
assert.Equal(t, tt.want, actual)
})
Expand Down

0 comments on commit c0f3a56

Please sign in to comment.