Skip to content

Commit

Permalink
Merge pull request #720 from PubMatic-OpenWrap/ci
Browse files Browse the repository at this point in the history
OpenWrap_Release_27th_Feb_2024
  • Loading branch information
pm-nilesh-chate authored Feb 23, 2024
2 parents b511f9f + e04a8f4 commit db5e57b
Show file tree
Hide file tree
Showing 39 changed files with 1,776 additions and 353 deletions.
8 changes: 4 additions & 4 deletions analytics/pubmatic/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@ func getPartnerRecordsByImp(ao analytics.AuctionObject, rCtx *models.RequestCtx)

price := bid.Price
if ao.Response.Cur != models.USD {
if bidCtx.EG != 0 { // valid-bids + dropped-bids+ default-bids
price = bidCtx.EG
if bidCtx.EN != 0 { // valid-bids + dropped-bids+ default-bids
price = bidCtx.EN
} else if bidExt.OriginalBidCPMUSD != 0 { // valid non-bids
price = bidExt.OriginalBidCPMUSD
}
Expand Down Expand Up @@ -403,11 +403,11 @@ func getPartnerRecordsByImp(ao analytics.AuctionObject, rCtx *models.RequestCtx)
}

if pr.NetECPM == 0 {
pr.NetECPM = models.GetNetEcpm(price, revShare)
pr.NetECPM = models.ToFixed(price, models.BID_PRECISION)
}

if pr.GrossECPM == 0 {
pr.GrossECPM = models.GetGrossEcpm(price)
pr.GrossECPM = models.GetGrossEcpmFromNetEcpm(price, revShare)
}

if pr.PartnerSize == "" {
Expand Down
18 changes: 9 additions & 9 deletions analytics/pubmatic/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3024,8 +3024,8 @@ func TestGetPartnerRecordsByImpForRevShareAndBidCPM(t *testing.T) {
partners: map[string][]PartnerRecord{
"imp1": {
{
NetECPM: 90,
GrossECPM: 100,
NetECPM: 100,
GrossECPM: 111.11,
OriginalCPM: 100,
OriginalCur: "USD",
PartnerID: "pubmatic",
Expand Down Expand Up @@ -3198,8 +3198,8 @@ func TestGetPartnerRecordsByImpForRevShareAndBidCPM(t *testing.T) {
partners: map[string][]PartnerRecord{
"imp1": {
{
NetECPM: 90,
GrossECPM: 100,
NetECPM: 100,
GrossECPM: 111.11,
OriginalCPM: 200,
OriginalCur: "INR",
PartnerID: "pubmatic",
Expand Down Expand Up @@ -3568,11 +3568,11 @@ func TestGetLogAuctionObjectAsURL(t *testing.T) {
rCtx: &models.RequestCtx{
PubID: 5890,
DeviceCtx: models.DeviceCtx{
Ext: &models.ExtDevice{
ExtDevice: openrtb_ext.ExtDevice{
ATTS: ptrutil.ToPtr(openrtb_ext.IOSAppTrackingStatusRestricted),
},
},
Ext: func() *models.ExtDevice {
extDevice := models.ExtDevice{}
extDevice.UnmarshalJSON([]byte(`{"atts":1}`))
return &extDevice
}(),
},
},
logInfo: true,
Expand Down
8 changes: 4 additions & 4 deletions analytics/pubmatic/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ type record struct {

// Device struct for storing device information
type Device struct {
Platform models.DevicePlatform `json:"plt,omitempty"`
IFAType *models.DeviceIFAType `json:"ifty,omitempty"` //OTT-416, adding device.ext.ifa_type
ATTS *openrtb_ext.IOSAppTrackingStatus `json:"atts,omitempty"` //device.ext.atts
Platform models.DevicePlatform `json:"plt,omitempty"`
IFAType *models.DeviceIFAType `json:"ifty,omitempty"` //OTT-416, adding device.ext.ifa_type
ATTS *float64 `json:"atts,omitempty"` //device.ext.atts
}

/*
Expand Down Expand Up @@ -199,7 +199,7 @@ func (wlog *WloggerRecord) logDeviceObject(dvc *models.DeviceCtx) {
wlog.Device.Platform = dvc.Platform
wlog.Device.IFAType = dvc.IFATypeID
if dvc.Ext != nil {
wlog.record.Device.ATTS = dvc.Ext.ATTS
wlog.record.Device.ATTS, _ = dvc.Ext.GetAtts()
}
}

Expand Down
16 changes: 7 additions & 9 deletions analytics/pubmatic/record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,7 @@ func TestLogDeviceObject(t *testing.T) {
dvc: &models.DeviceCtx{
Platform: models.DevicePlatformDesktop,
IFATypeID: ptrutil.ToPtr(models.DeviceIFATypeID[models.DeviceIFATypeDPID]),
Ext: &models.ExtDevice{
ExtDevice: openrtb_ext.ExtDevice{},
},
Ext: &models.ExtDevice{},
},
},
want: Device{
Expand All @@ -431,17 +429,17 @@ func TestLogDeviceObject(t *testing.T) {
dvc: &models.DeviceCtx{
Platform: models.DevicePlatformDesktop,
IFATypeID: ptrutil.ToPtr(models.DeviceIFATypeID[models.DeviceIFATypeDPID]),
Ext: &models.ExtDevice{
ExtDevice: openrtb_ext.ExtDevice{
ATTS: ptrutil.ToPtr(openrtb_ext.IOSAppTrackingStatusNotDetermined),
},
},
Ext: func() *models.ExtDevice {
extDevice := models.ExtDevice{}
extDevice.UnmarshalJSON([]byte(`{"atts":0}`))
return &extDevice
}(),
},
},
want: Device{
Platform: models.DevicePlatformDesktop,
IFAType: ptrutil.ToPtr(models.DeviceIFATypeID[models.DeviceIFATypeDPID]),
ATTS: ptrutil.ToPtr(openrtb_ext.IOSAppTrackingStatusNotDetermined),
ATTS: ptrutil.ToPtr(float64(openrtb_ext.IOSAppTrackingStatusNotDetermined)),
},
},
}
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/PubMatic-OpenWrap/prebid-server

go 1.20

replace git.pubmatic.com/vastunwrap => git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20231102070946-3c5a3bc1dff5
replace git.pubmatic.com/vastunwrap => git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20240215114830-026b72bf5a2f

require (
github.com/DATA-DOG/go-sqlmock v1.5.0
Expand Down Expand Up @@ -79,7 +79,6 @@ require (
github.com/subosito/gotenv v1.3.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/yudai/pp v2.0.1+incompatible // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/sys v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20231102070946-3c5a3bc1dff5 h1:nK2YP3aS8+5dwc5cMJ8IxI0Sh7yfd858LKmcvwfkOUo=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20231102070946-3c5a3bc1dff5/go.mod h1:dgTumQ6/KYeLbpWq3HVOaqkZos6Q0QGwZmQmEIhQ3To=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20240215114830-026b72bf5a2f h1:nCrSziQxM2ITd9w71lhqAhIyZthZvvBn78aYvdQmt8s=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20240215114830-026b72bf5a2f/go.mod h1:dgTumQ6/KYeLbpWq3HVOaqkZos6Q0QGwZmQmEIhQ3To=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
Expand Down Expand Up @@ -503,7 +503,6 @@ github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FB
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M=
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI=
github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
8 changes: 4 additions & 4 deletions modules/pubmatic/openwrap/auctionresponsehook.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ func (m OpenWrap) handleAuctionResponseHook(

// set response netecpm and logger/tracker en
revShare := models.GetRevenueShare(rctx.PartnerConfigMap[partnerID])
bidExt.NetECPM = models.GetNetEcpm(bid.Price, revShare)
eg = bid.Price
bidExt.NetECPM = models.ToFixed(bid.Price, models.BID_PRECISION)
eg = models.GetGrossEcpmFromNetEcpm(bid.Price, revShare)
en = bidExt.NetECPM
if payload.BidResponse.Cur != "USD" {
eg = bidExt.OriginalBidCPMUSD
en = models.GetNetEcpm(bidExt.OriginalBidCPMUSD, revShare)
eg = models.GetGrossEcpmFromNetEcpm(bidExt.OriginalBidCPMUSD, revShare)
en = bidExt.OriginalBidCPMUSD
bidExt.OriginalBidCPMUSD = 0
}

Expand Down
Loading

0 comments on commit db5e57b

Please sign in to comment.