-
Notifications
You must be signed in to change notification settings - Fork 34
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
MB-2737 Ignore service item params in CreatePaymentRequestPayload #4313
Conversation
…aymentRequestPayload
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.
Looks like we should also return an error if params are sent in since they are now readOnly
. See this thread. Also in trying it I get an error when running the steps in the setup, not sure if I've missed something or not.
2020/06/30 02:48:13 File decode failed: json: unknown field "params"
response := handler.Handle(params) | ||
typedResponse := response.(*paymentrequestop.CreatePaymentRequestCreated) | ||
|
||
paymentServiceItemParams := typedResponse.Payload.PaymentServiceItems[0].PaymentServiceItemParams |
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.
Is there a way to also verify that the call to CreatePaymentRequest
isn't given any ServiceItemParams
? I think that this will just be checking the mock return value that you defined above.
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.
@gidjin looks like this as addressed already.
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.
Is there a way to test the error message that would be returned if someone were to pass in params?
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.
@gidjin yes, I expect when the params are sent, there will be an error message. Or do you mean to test this in unit test? I think there is test for this but not on this function... let me see
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.
Unit test or integration test. Just some sort of test, if possible would be nice. If not no worries
I'm getting a |
@pearl-truss here's what I usually do before reviewing a pull request:
Maybe that will solve the problem. Also, every once in a while, I run |
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.
This all looks great, and I'm getting the proper error when trying to send in service item params. I do agree with @gidjin that it might be good to test the actual error message that is returned if you have time to add that.
Description
The Prime may attempt to send Service Item Params through the Create Payment Request payload, but we want the source of truth to be the MTO. This PR achieves ignoring the input of service item params by converting this part of the payload to readOnly, and removing the handler function that assigns serviceItemParams to serviceItems. At this time there can be a CreatePaymentRequest success when serviceItemParams are passed, without throwing an error.
Reviewer Notes
Is there anything you would like reviewers to give additional scrutiny?
Setup
make db_dev_e2e_populate
make server_run
pr_payload.json
file containing the following (which references E2E data) running with this payload should produce an error, to make it successful, then remove the params part of the payload:go run ./cmd/prime-api-client --insecure create-payment-request --filename pr_payload.json | jq
Code Review Verification Steps
Querying the Database Safely
have been satisfied.
References
Screenshots
If this PR makes visible UI changes, an image of the finished UI can help reviewers and casual
observers understand the context of the changes. A before image is optional and
can be included at the submitter's discretion.
Consider using an animated image to show an entire workflow instead of using multiple images. You may want to use GIPHY CAPTURE for this! 📸
Please frame screenshots to show enough useful context but also highlight the affected regions.