fix(payment): synthesise empty payload on paymentComplete auto-submit (DF-832)#374
Closed
fix(payment): synthesise empty payload on paymentComplete auto-submit (DF-832)#374
Conversation
… (DF-832)
GOV.UK Pay's return URL hits /summary as a GET, but
makeGetRouteHandler's auto-submit branch was casting that GET request
to FormRequestPayload and calling handleFormSubmit. Downstream
outputService.submit reads request.payload.userConfirmationEmailAddress,
which crashes on undefined since GETs have no payload, and the user
sees "Sorry, there is a problem with the service" after a successful
GOV.UK Pay capture.
Fix by setting request.payload to {} before handing off to
handleFormSubmit. The downstream code already treats unset
userConfirmationEmailAddress as "no value" rather than an error.
Also strengthen the existing test so it asserts payload is defined on
the request handed to handleFormSubmit; the previous test mocked
handleFormSubmit and so missed this.
DF-832
9f74203 to
3696e3b
Compare
|
Contributor
Author
|
Closing — the underlying issue (undefined payload on auto-submit GET) is a symptom of email prepop being sourced from request.payload rather than state. Will be addressed by the email prepop redesign instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Proposed change
Fix a post-merge bug in DF-832 where the GOV.UK Pay return hit `/summary?paymentComplete=true` (a GET) and we cast that to `FormRequestPayload` and called `handleFormSubmit`. `outputService.submit` then reads `request.payload.userConfirmationEmailAddress` and crashes on undefined, so the user sees the generic error page after a successful payment capture. Synthesising an empty payload before handing off fixes it; the test that previously mocked `handleFormSubmit` has been tightened to assert payload is defined at the call site.
Jira ticket: DF-832
Type of change
Checklist