Describe the bug
Other POST api/order/ action do not return error when successful, but cancel returns error 400 "bad_request": "This order has been cancelled by the maker". I think this is because when requesting an order that is canceled this is what is returned, but while doing the cancelling action is weird to be returned an error when successful.
Maybe to fix, when requesting an order that is cancelled, it can be returned a json without error, something like "status": "This order has been cancelled by the maker".
in api/views.py:
# 2) If order has been cancelled
if order.status == Order.Status.UCA:
return Response(
{"bad_request": "This order has been cancelled by the maker"},
status.HTTP_400_BAD_REQUEST,
)
if order.status == Order.Status.CCA:
return Response(
{"bad_request": "This order has been cancelled collaborativelly"},
status.HTTP_400_BAD_REQUEST,
)
To Reproduce
Make a POST request at api/order/ with the actioncancel.
Expected behavior
Not to be returned an error when then cancel is successful.
Indeed, cancel_order action will give you the same response as a GET /order, which will be a bad request because of cancelled order. This should be improved.
Describe the bug Other POST api/order/
action
do not return error when successful, butcancel
returns error 400 "bad_request": "This order has been cancelled by the maker". I think this is because when requesting an order that is canceled this is what is returned, but while doing the cancelling action is weird to be returned an error when successful. Maybe to fix, when requesting an order that is cancelled, it can be returned a json without error, something like "status": "This order has been cancelled by the maker".in api/views.py:
To Reproduce Make a POST request at api/order/ with the
action
cancel
.Expected behavior Not to be returned an error when then cancel is successful.