Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Digital adapter: Set currency in bid response #2886

Merged
merged 2 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions adapters/improvedigital/improvedigital.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func (a *ImprovedigitalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, e
}

bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(seatBid.Bid))
bidResponse.Currency = bidResp.Cur
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a json test case for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The global code that compares the test bid responses actually doesn't check the currency. Can I add it there? Otherwise, test for responses with different currencies will succeed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gargcreation1992 Test submitted. As I said above, it would pass also without the adapter fix because the global test logic doesn't check currency in the bid. I propose this fix: 84deddf
However, fixing the testing logic is out of scope of this PR as it breaks quite a few adapter tests with missing currency and also potentially revealing bugs in some other adapters similar to the one fixed in this PR for Improve Digital adapter.


for i := range seatBid.Bid {
bid := seatBid.Bid[i]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"mockBidRequest": {
"id": "test-request-id",
"cur": ["EUR"],
"site": {
"page": "https://good.site/url"
},
"imp": [{
"id": "test-imp-id",
"banner": {
"format": [{
"w": 300,
"h": 250
}]
},
"ext": {
"bidder": {
"placementId": 13245
}
}
}]
},

"httpCalls": [{
"expectedRequest": {
"uri": "http://localhost/pbs",
"body": {
"id": "test-request-id",
"cur": ["EUR"],
"site": {
"page": "https://good.site/url"
},
"imp": [{
"id": "test-imp-id",
"banner": {
"format": [{
"w": 300,
"h": 250
}]
},
"ext": {
"bidder": {
"placementId": 13245
}
}
}]
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"cur": "EUR",
"seatbid": [{
"seat": "improvedigital",
"bid": [{
"id": "randomid",
"impid": "test-imp-id",
"price": 0.500000,
"adid": "12345678",
"adm": "some-test-ad",
"cid": "987",
"crid": "12345678",
"h": 250,
"w": 300
}]
}]
}
}
}],

"expectedBidResponses": [{
"currency": "EUR",
"bids": [{
"bid": {
"id": "randomid",
"impid": "test-imp-id",
"price": 0.5,
"adm": "some-test-ad",
"adid": "12345678",
"cid": "987",
"crid": "12345678",
"w": 300,
"h": 250
},
"type": "banner"
}]
}]
}