Since it is a requirement that users must be able to specify a po_number, we need a way to verify that the value they specify is both valid and unique.
A valid po_number matches the following regular expression:
Checking for uniqueness requires making a request to mod-orders-storage. This code will likely be called from elsewhere in mod-orders, so must be visible.
- POST /orders/po_number/validate is defined (e.g. in RAML/ModuleDescriptor) and implemented (code and schemas)
- takes an application/json request with a single field "po_number"
- returns a 204 if valid
- returns a text/plain response indicating the reason it's not valid (e.g. malformed or not unique) with status 400.
- returns a 500 if the call to mod-orders-storage failed, along with a text/plain "internal server error" response body.
- Unit tests
- Api Tests (positive and negative test cases)