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

Conversant: Make requests in USD #3611

Merged

Conversation

johnwier
Copy link
Contributor

@johnwier johnwier commented Apr 4, 2024

The backend server rejects any requests that don't have request.cur set to USD. For now, make the Conversant request, and floors in USD

Copy link

github-actions bot commented Apr 4, 2024

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 8a4168b

conversant

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:21:	MakeRequests	90.3%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:84:	parseCnvrParams	85.0%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:156:	MakeBids	92.9%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:191:	getBidType	100.0%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:205:	Builder		100.0%
total:										(statements)	89.4%

//Backend needs USD or it will reject the request
if cnvrRequest.Cur != nil && len(cnvrRequest.Cur) > 0 && cnvrRequest.Cur[0] != "USD" {
cnvrRequest.Cur = []string{"USD"}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add the json test cases 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.

I have added this to one of the test cases

imp.BidFloorCur = "USD"
imp.BidFloor = floor
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add the 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.

I have added this to one of the test cases

@@ -18,6 +19,11 @@ type ConversantAdapter struct {
}

func (c *ConversantAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
cnvrRequest := *request
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are making a shallow copy of the request?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't want to affect any of the other adapters when I changed the top level currency field for my request

Copy link
Contributor

Choose a reason for hiding this comment

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

At this point in code, the request is already exclusive for ConversantAdapter. You will not be affecting any other adapters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I removed the shallow copy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just checking in. Are there any further changes needed?

@@ -18,6 +19,11 @@ type ConversantAdapter struct {
}

func (c *ConversantAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
cnvrRequest := *request
//Backend needs USD or it will reject the request
if cnvrRequest.Cur != nil && len(cnvrRequest.Cur) > 0 && cnvrRequest.Cur[0] != "USD" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: There is no need for cnvrRequest.Cur != nil since that check is implicit with len(cnvrRequest.Cur) > 0. In Go, it's ok to take the length of a nil slice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's easy enough I'll fix that

} else if floor > 0 {
imp.BidFloorCur = "USD"
imp.BidFloor = floor
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would the floor not be greater than 0 after a currency conversion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking I didn't want a negative floor, but now I think better to pass it through than mysteriously dropping it. fixed

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 8aea4d1

conversant

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:22:	MakeRequests	93.5%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:85:	parseCnvrParams	97.4%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:156:	MakeBids	92.9%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:191:	getBidType	100.0%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:205:	Builder		100.0%
total:										(statements)	95.7%

@johnwier johnwier force-pushed the cnvr_handleforeigncurrency branch from 8aea4d1 to 29de66f Compare April 10, 2024 01:40
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 29de66f

conversant

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:22:	MakeRequests	93.5%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:85:	parseCnvrParams	97.4%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:156:	MakeBids	92.9%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:191:	getBidType	100.0%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:205:	Builder		100.0%
total:										(statements)	95.7%

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 2beec19

conversant

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:21:	MakeRequests	93.5%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:84:	parseCnvrParams	97.4%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:155:	MakeBids	92.9%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:190:	getBidType	100.0%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:204:	Builder		100.0%
total:										(statements)	95.7%

@johnwier johnwier force-pushed the cnvr_handleforeigncurrency branch from 2beec19 to 922c620 Compare April 10, 2024 02:52
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 922c620

conversant

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:21:	MakeRequests	93.5%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:84:	parseCnvrParams	97.4%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:155:	MakeBids	92.9%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:190:	getBidType	100.0%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:204:	Builder		100.0%
total:										(statements)	95.7%

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, c98be34

conversant

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:21:	MakeRequests	93.3%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:83:	parseCnvrParams	97.4%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:154:	MakeBids	92.9%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:189:	getBidType	100.0%
github.com/prebid/prebid-server/v2/adapters/conversant/conversant.go:203:	Builder		100.0%
total:										(statements)	95.7%

@SyntaxNode SyntaxNode changed the title Cnvr Adapter: make requests in USD Conversant Adapter: make requests in USD Apr 22, 2024
@bsardo bsardo changed the title Conversant Adapter: make requests in USD Conversant: Make requests in USD Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants