Description
User Story - Business Need
To achieve parity with the notification-api, the ENP error response messages need to match the format of the notification-api, which they currently do not. This ticket aims to resolve that discrepancy for the POST /v2/notifications/sms
and /legacy/v2/notifications/sms
routes (note that email and push are also affected, however).
Note: the QA regression cannot be used against ENP without this work.
- Ticket is understood, and QA has been contacted (if the ticket has a QA label).
User Story(ies)
As a client of VANotify ( a business user)
I want the same format of error messages from ENP that NAPI provides
So that I do not need to modify my client application to be able to process errors.
Additional Info and Resources
This is just one example of many.
When posting a payload that includes a phone_number with an invalid value to ENP, the response is
{
"detail": "Bad request - [{'type': 'value_error', 'loc': ('body', 'phone_number'), 'msg': 'value is not a valid phone number', 'input': '18001231234'}]"
}
When posting the same payload to notification-api, the response is
{
"errors": [
{
"error": "ValidationError",
"message": "phone_number Field contains an invalid number due to either formatting or an impossible combination of area code and/or telephone prefix."
}
],
"status_code": 400
}
Clients and the QA regression expect an object with the top level property errors
, whose value is a list of objects, each object including the properties error
and message
, and the top level property status_code
, which includes the numeric http status code returned by the route.
Note that this list of errors is fairly extensive and needs to cover all POST payload property 400 errors. 404 errors should also be checked for the route. There are a lot of negative tests in the QA repo under tests/test_v2_notifications_sms.py
and their associated response models in resources/expect_data
that demonstrate the various formats of 400 and 404 error messages that can be used as a starting point.
Acceptance Criteria
- This work is added to the sprint review slide deck (key win bullet point and demo slide)
QA Considerations
Ideally, the exact same messages are produced and the QA suite can just be run against ENP but for now the tests should be modified to have the json model without any specific messages, except for status_code
. A new QA ticket may need to be created to handle this extensive change.
Activity