Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Commit

Permalink
publisher.ext.parentAccount to publisher.ext.prebid.parentAccount (pr…
Browse files Browse the repository at this point in the history
  • Loading branch information
guscarreon authored and mansinahar committed Oct 3, 2019
1 parent c1ffa28 commit dcabefa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions endpoints/openrtb2/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -1175,8 +1175,8 @@ func effectivePubID(pub *openrtb.Publisher) string {
if pub.Ext != nil {
var pubExt openrtb_ext.ExtPublisher
err := json.Unmarshal(pub.Ext, &pubExt)
if err == nil && pubExt.ParentAccount != nil && *pubExt.ParentAccount != "" {
return *pubExt.ParentAccount
if err == nil && pubExt.Prebid != nil && pubExt.Prebid.ParentAccount != nil && *pubExt.Prebid.ParentAccount != "" {
return *pubExt.Prebid.ParentAccount
}
}
if pub.ID != "" {
Expand Down
2 changes: 1 addition & 1 deletion endpoints/openrtb2/auction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ func TestEffectivePubID(t *testing.T) {
assert.Equal(t, pbsmetrics.PublisherUnknown, effectivePubID(&pub), "effectivePubID failed for empty Publisher.")
pub.ID = "123"
assert.Equal(t, "123", effectivePubID(&pub), "effectivePubID failed for standard Publisher.")
pub.Ext = json.RawMessage(`{"parentAccount": "abc"}`)
pub.Ext = json.RawMessage(`{"prebid": {"parentAccount": "abc"} }`)
assert.Equal(t, "abc", effectivePubID(&pub), "effectivePubID failed for parentAccount.")
}

Expand Down
4 changes: 4 additions & 0 deletions openrtb_ext/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ package openrtb_ext

// ExtPublisher defines the contract for ...publisher.ext (found in both bidrequest.site and bidrequest.app)
type ExtPublisher struct {
Prebid *ExtPublisherPrebid `json:"prebid"`
}

// ExtPublisherPrebid defines the contract for publisher.ext.prebid
type ExtPublisherPrebid struct {
// parentAccount would define the legal entity (publisher owner or network) that has the direct relationship with the PBS
// host. As such, the definition depends on the PBS hosting entity.
ParentAccount *string `json:"parentAccount,omitempty"`
Expand Down

0 comments on commit dcabefa

Please sign in to comment.