Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POST api/order/ cancel returns error 400 bad_request when successful #1245

Open
jerryfletcher21 opened this issue Apr 25, 2024 · 1 comment · May be fixed by #1612
Open

POST api/order/ cancel returns error 400 bad_request when successful #1245

jerryfletcher21 opened this issue Apr 25, 2024 · 1 comment · May be fixed by #1612
Labels
bug 🐛 Something isn't working

Comments

@jerryfletcher21
Copy link
Contributor

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.

@Reckless-Satoshi Reckless-Satoshi added the bug 🐛 Something isn't working label Apr 29, 2024
@Reckless-Satoshi
Copy link
Collaborator

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.

@femelo femelo linked a pull request Nov 11, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants