Service URL: DELETE /orders/{orderId}/items/{lineNumber}
Tokens:
orderId – The id of the order that holds the line to be cancelled
lineNumber – The line number of the item to be cancelled.
Request Body:
Quantity – The number of items to be cancelled (optional). Defaults to the ordered quantity.
ReasonKey – The key for the cancellation reason
Remarks:
Request cancellation of an order item. If the item cannot be cancelled at this time, the service should respond with a 405 (Method Not Allowed) status code. Otherwise the cancellation request will be recorded and processed later, the service should respond with a 202 (Accepted) status code – this does not guarantee that cancellation will be possible. Note that the Order Item Status and Order Status, returned on the Get Order Details service, will provide a hint to the client if a cancellation is possible.
Scenarios
Scenario | Outcome | Expected behaviour | Status Code | Response | |
---|---|---|---|---|---|
1 | The orders service receives a valid order id, a valid line number and the order belongs to the customer | Success | The customer’s order item has been requested to be cancelled by the order manager | 202 | Response: 202 Accepted |
2 | The orders service receives a valid order id, a valid line number and but the order does not belong to the customer. | NotAllowed | The customer’s order item is not cancelled. A NotAllowed error message is returned. | 405 | ErrorMessage: 405, Not allowed to cancel order item, outcome: NotAllowed. |
3 | The orders service receives a valid order id, an invalid line number and but the order does not belong to the customer. | NotAllowed | The customers order item is not cancelled. A NotAllowed error message is returned. | 405 | ErrorMessage: 405, Not allowed to cancel order item, outcome: NotAllowed. |
4 | The orders service recieves a invalid order id | Fail | The customer order is not cancelled .A Internal server error message is returned | 500 | ErrorMessage: 500, Failed to cancel order item, outcome: Fail |
Example Request:
DELETE http: //localhost:8080/WebRestApi/rest/orders/00002905 |
Example Response:
Status: 202 Accepted