-
Notifications
You must be signed in to change notification settings - Fork 209
Labels
bug 🐛Something isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is neededpythonPull requests that update Python codePull requests that update Python code
Description
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 action cancel.
Expected behavior
Not to be returned an error when then cancel is successful.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug 🐛Something isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is neededpythonPull requests that update Python codePull requests that update Python code