Skip to content

Commit

Permalink
change partner id to account id and handle empty seatbid
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartyAdsSSP committed Oct 1, 2020
1 parent a490ed3 commit f343bb6
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 1 deletion.
6 changes: 6 additions & 0 deletions adapters/smartyads/smartyads.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ func (a *SmartyAdsAdapter) MakeBids(
}}
}

if len(bidResp.SeatBid) == 0 {
return nil, []error{&errortypes.BadServerResponse{
Message: "Empty SeatBid array",
}}
}

bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(bidResp.SeatBid[0].Bid))
sb := bidResp.SeatBid[0]

Expand Down
144 changes: 144 additions & 0 deletions adapters/smartyads/smartyadstest/supplemental/empty-seatbid-array.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"mockBidRequest": {
"id": "some-request-id",
"device": {
"ua": "test-user-agent",
"ip": "123.123.123.123",
"language": "en",
"dnt": 0
},
"tmax": 1000,
"user": {
"buyeruid": "awesome-user"
},
"app": {
"publisher": {
"id": "123456789"
},
"cat": [
"IAB22-1"
],
"bundle": "com.app.awesome",
"name": "Awesome App",
"domain": "awesomeapp.com",
"id": "123456789"
},
"imp": [
{
"id": "some-impression-id",
"tagid": "ogTAGID",
"video": {
"mimes": [
"video/mp4"
],
"w": 640,
"h": 480,
"minduration": 120,
"maxduration": 150
},
"ext": {
"bidder": {
"host": "ep1",
"sourceid": "partner",
"accountid": "hash"
}
}
}
]
},
"httpCalls": [
{
"expectedRequest": {
"headers": {
"Content-Type": [
"application/json;charset=utf-8"
],
"Accept": [
"application/json"
],
"X-Openrtb-Version": [
"2.5"
],
"User-Agent": [
"test-user-agent"
],
"X-Forwarded-For": [
"123.123.123.123"
],
"Accept-Language": [
"en"
],
"Dnt": [
"0"
]
},
"uri": "http://ep1.example.com/bid?rtb_seat_id=partner&secret_key=hash",
"body": {
"id": "some-request-id",
"device": {
"ua": "test-user-agent",
"ip": "123.123.123.123",
"language": "en",
"dnt": 0
},
"imp": [
{
"id": "some-impression-id",
"video": {
"mimes": [
"video/mp4"
],
"minduration": 120,
"maxduration": 150,
"w": 640,
"h": 480
},
"tagid": "ogTAGID"
}
],
"app": {
"id": "123456789",
"name": "Awesome App",
"bundle": "com.app.awesome",
"domain": "awesomeapp.com",
"cat": [
"IAB22-1"
],
"publisher": {
"id": "123456789"
}
},
"user": {
"buyeruid": "awesome-user"
},
"tmax": 1000
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "awesome-resp-id",
"seatbid": [
],
"cur": "USD",
"ext": {
"responsetimemillis": {
"smartyads": 154
},
"tmaxrequest": 1000
}
}
}
}
],
"mockResponse": {
"status": 200,
"body": "invalid response"
},
"expectedMakeBidsErrors": [
{
"value": "Empty SeatBid array",
"comparison": "literal"
}
]
}
2 changes: 1 addition & 1 deletion static/bidder-params/smartyads.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"accountid": {
"type": "string",
"description": "Partner id"
"description": "Account id"
}
},
"required": ["host", "sourceid", "accountid"]
Expand Down

0 comments on commit f343bb6

Please sign in to comment.