diff --git a/adapters/amx/amx.go b/adapters/amx/amx.go index a738efe11f3..5aaa00694c0 100644 --- a/adapters/amx/amx.go +++ b/adapters/amx/amx.go @@ -112,8 +112,10 @@ func (adapter *AMXAdapter) MakeRequests(request *openrtb2.BidRequest, req *adapt } type amxBidExt struct { - StartDelay *int `json:"startdelay,omitempty"` - CreativeType *int `json:"ct,omitempty"` + StartDelay *int `json:"startdelay,omitempty"` + CreativeType *int `json:"ct,omitempty"` + DemandSource *string `json:"ds,omitempty"` + BidderCode *string `json:"bc,omitempty"` } // MakeBids will parse the bids from the AMX server @@ -154,12 +156,25 @@ func (adapter *AMXAdapter) MakeBids(request *openrtb2.BidRequest, externalReques continue } + demandSource := "" + if bidExt.DemandSource != nil { + demandSource = *bidExt.DemandSource + } + bidType := getMediaTypeForBid(bidExt) b := &adapters.TypedBid{ - Bid: &bid, + Bid: &bid, + BidMeta: &openrtb_ext.ExtBidPrebidMeta{ + AdvertiserDomains: bid.ADomain, + DemandSource: demandSource, + }, BidType: bidType, } + if bidExt.BidderCode != nil { + b.Seat = openrtb_ext.BidderName(*bidExt.BidderCode) + } + bidResponse.Bids = append(bidResponse.Bids, b) } } diff --git a/adapters/amx/amx_test.go b/adapters/amx/amx_test.go index d8c73a6141f..c03df334359 100644 --- a/adapters/amx/amx_test.go +++ b/adapters/amx/amx_test.go @@ -182,19 +182,24 @@ func TestMakeBids(t *testing.T) { } type testCase struct { - bidType openrtb_ext.BidType - adm string - extRaw string - valid bool + bidType openrtb_ext.BidType + adm string + extRaw string + seatName string + demandSource string + valid bool } tests := []testCase{ - {openrtb_ext.BidTypeNative, `{"assets":[]}`, `{"ct":10}`, true}, - {openrtb_ext.BidTypeBanner, sampleDisplayADM, `{"ct": 1}`, true}, - {openrtb_ext.BidTypeBanner, sampleDisplayADM, `{"ct": "invalid"}`, false}, - {openrtb_ext.BidTypeBanner, sampleDisplayADM, `{}`, true}, - {openrtb_ext.BidTypeVideo, sampleVastADM, `{"startdelay": 1}`, true}, - {openrtb_ext.BidTypeBanner, sampleVastADM, `{"ct": 1}`, true}, // the server shouldn't do this + {openrtb_ext.BidTypeNative, `{"assets":[]}`, `{"ct":10}`, "", "", true}, + {openrtb_ext.BidTypeBanner, sampleDisplayADM, `{"ct": 1}`, "", "", true}, + {openrtb_ext.BidTypeBanner, sampleDisplayADM, `{"ct": "invalid"}`, "", "", false}, + {openrtb_ext.BidTypeBanner, sampleDisplayADM, `{}`, "", "", true}, + {openrtb_ext.BidTypeBanner, sampleDisplayADM, `{"bc": "amx-pmp"}`, "amx-pmp", "", true}, + {openrtb_ext.BidTypeBanner, sampleDisplayADM, `{"ds": "pmp-1"}`, "", "pmp-1", true}, + {openrtb_ext.BidTypeBanner, sampleDisplayADM, `{"bc": "amx-pmp", "ds": "pmp-1"}`, "amx-pmp", "pmp-1", true}, + {openrtb_ext.BidTypeVideo, sampleVastADM, `{"startdelay": 1}`, "", "", true}, + {openrtb_ext.BidTypeBanner, sampleVastADM, `{"ct": 1}`, "", "", true}, // the server shouldn't do this } for _, test := range tests { @@ -233,6 +238,10 @@ func TestMakeBids(t *testing.T) { assert.Len(t, bids.Bids, 1) assert.Equal(t, test.bidType, bids.Bids[0].BidType) + + br := bids.Bids[0] + assert.Equal(t, openrtb_ext.BidderName(test.seatName), br.Seat) + assert.Equal(t, test.demandSource, br.BidMeta.DemandSource) } } diff --git a/adapters/amx/amxtest/exemplary/display-multiple.json b/adapters/amx/amxtest/exemplary/display-multiple.json index 330bc00d77b..76d97b17042 100644 --- a/adapters/amx/amxtest/exemplary/display-multiple.json +++ b/adapters/amx/amxtest/exemplary/display-multiple.json @@ -214,6 +214,7 @@ "cid": "668", "crid": "253510977", "ext": { + "bc": "amx-pmp" }, "h": 250, "id": "8911104898220857797", @@ -258,7 +259,9 @@ ], "cid": "668", "crid": "253510977", - "ext": {}, + "ext": { + "bc": "amx-pmp" + }, "h": 250, "id": "8911104898220857797", "impid": "6a362d3a9db4eba300x250", @@ -266,6 +269,7 @@ "price": 0.50, "w": 300 }, + "seat": "amx-pmp", "type": "banner" }, {