The GovPay API is being interacted with whilst the account in question (Barnet) is not yet configured - I've reached out to explain this to Barnet
GovPay is returning the following message - Account is not fully configured. Please refer to documentation to setup your account or contact support with your error code - https://www.payments.service.gov.uk/support/
We're not accounting for GovPay errors of this type (no paymentId created), which causes are logging to fail
Add a handler for these errors which returns early if there's an issue
The frontend already handles these errors
Also...
The pattern of proxies and nested callbacks within the Pay module is a little tricky to get around at times. I think a wider refactor here to follow a more linear middleware pattern here would make this code easier to understand and work with. It would also mean that we could ensure that logging and error handling were carried out as standard on pay endpoints. This work is outside the scope of this bug fix, but wanted to flag it!
What's the problem?
Account is not fully configured. Please refer to documentation to setup your account or contact support with your error code - https://www.payments.service.gov.uk/support/
What's the solution?
Also...
The pattern of proxies and nested callbacks within the Pay module is a little tricky to get around at times. I think a wider refactor here to follow a more linear middleware pattern here would make this code easier to understand and work with. It would also mean that we could ensure that logging and error handling were carried out as standard on pay endpoints. This work is outside the scope of this bug fix, but wanted to flag it!