Set cancel_status if it's not None

This commit is contained in:
aftermath2
2024-07-07 10:40:57 -03:00
parent f80f1dfb0c
commit 0d932feedb
4 changed files with 14 additions and 2 deletions

View File

@ -203,7 +203,7 @@ const TradeBox = ({ currentOrder, onStartAgain }: TradeBoxProps): JSX.Element =>
mining_fee_rate,
statement,
rating,
cancel_status
cancel_status
})
.then((data: Order) => {
setOpen(closeAll);

View File

@ -21,6 +21,7 @@ export interface SubmitActionProps {
statement?: string;
rating?: number;
amount?: number;
cancel_status?: number;
}
export interface TradeRobotSummary {

View File

@ -1085,6 +1085,9 @@ class TradeTest(BaseAPITestCase):
trade.cancel_order(trade.maker_index)
data = trade.response.json()
self.assertEqual(
data["bad_request"], "This order has been cancelled by the maker"
)
trade.get_order(trade.taker_index)
data = trade.response.json()
@ -1092,6 +1095,12 @@ class TradeTest(BaseAPITestCase):
data["bad_request"], "This order has been cancelled by the maker"
)
trade.get_order(trade.third_index)
data = trade.response.json()
self.assertEqual(
data["bad_request"], "This order has been cancelled by the maker"
)
def test_cancel_order_cancel_status(self):
"""
Tests the cancellation of a public order using cancel_status.

View File

@ -118,7 +118,9 @@ class Trade:
path = reverse("order")
params = f"?order_id={self.order_id}"
headers = self.get_robot_auth(robot_index)
body = {"action": "cancel", "cancel_status": cancel_status}
body = {"action": "cancel"}
if cancel_status is not None:
body.update({"cancel_status": cancel_status})
self.response = self.client.post(path + params, body, **headers)
@patch("api.tasks.send_notification.delay", send_notification)