OJ-3201: Add retry handling to nino-check lambda#647
Conversation
|
|
||
| if (pdvRes.httpStatus === 401 && "errors" in (pdvRes.parsedBody ?? {})) { | ||
| logger.info(`Failed PDV match received.`); | ||
| const errorText = (pdvRes.parsedBody as PdvApiErrorBody).errors; |
There was a problem hiding this comment.
Appreciate this is existing but I'm finding this parsedBody thing really confusing because I was expecting the pdvRes to be the response that we got from HMRC. I'm also not totally clear why we need it like is it incase the response body isn't JSON? Is fetch not able to handle that for us?
Could we either change the name of pdvRes to indicate that we've added stuff to it or get rid of it?
There was a problem hiding this comment.
Sure I'll take a look to see if I can refactor this pdvRes logic to be clearer, or if a re-name will do.
I believe the handling of the response body got a little bit more fiddly because of this bug, which looks like a bug on HMRCs side that we have to handle. https://govukverify.atlassian.net/browse/OJ-2806
|



Proposed changes
What changed
Add logic to handle retry attempts in the
nino-checklambdaRefactor Pdv Response parsing
Why did it change
Handle the case where the user has previously failed a NINo check and is either retrying (second or final attempt) or reaching the maximum allowed attempts.
Issue tracking