notifications-api icon indicating copy to clipboard operation
notifications-api copied to clipboard

Handle dvla REJECTED letter callback payload

Open spatel033 opened this issue 5 months ago • 0 comments

When receiving a letter callback from the DVLA about the status of a letter, there are two possible values for jobStatus that we allow - DESPATCHED or REJECTED. Their documentation can be found here. The JSON schema we made to validate this data is defined here. This works for letters which are DESPATCHED, but we’ve found that for letters that are REJECTED, the data received does not validate according to the data in the schema and instead looks like this

{
    comment: Unable to download PDF  - Connection reset,
    jobId: 1efee8ae-93a8-789b-7f58-2946d0ee4a76,
    jobStatus: REJECTED,
    jobType: NOTIFY,
    templateReference: NOTIFY,
    transitionDate: 2025-06-23T17:17:04Z
}

This means that because the callback fails validation, we don’t give a validation error and don’t update the letter to technical-failure status as intended. It looks like we’ll need to change how we validate letters which have the REJECTED status so that the error we get is the one we intend to raise. Fix for this card.

spatel033 avatar Jul 17 '25 13:07 spatel033