-
Notifications
You must be signed in to change notification settings - Fork 769
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
Conversant: Make requests in USD #3611
Conversation
Code coverage summaryNote:
conversantRefer here for heat map coverage report
|
//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"} | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 | ||
} | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
adapters/conversant/conversant.go
Outdated
@@ -18,6 +19,11 @@ type ConversantAdapter struct { | |||
} | |||
|
|||
func (c *ConversantAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { | |||
cnvrRequest := *request |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
adapters/conversant/conversant.go
Outdated
@@ -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" { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Code coverage summaryNote:
conversantRefer here for heat map coverage report
|
8aea4d1
to
29de66f
Compare
Code coverage summaryNote:
conversantRefer here for heat map coverage report
|
Code coverage summaryNote:
conversantRefer here for heat map coverage report
|
2beec19
to
922c620
Compare
Code coverage summaryNote:
conversantRefer here for heat map coverage report
|
Code coverage summaryNote:
conversantRefer here for heat map coverage report
|
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