Order cancel api "/V1/orders/{order_id}/cancel" doesn't fail for completely invoiced order
Hi there, As per observation on Magento2.0 on back-end there is no "Cancel" option for the order which is invoiced completely, which goes as per logic. But If I make cancel call via api "/V1/orders/{order_id}/cancel" in response I am getting "true" ,which is not correct. According to my understanding we should not be allowed to make cancel call for such orders. Also , On making cancel call for already "cancelled" orders , we get "true" in response, instead of some error message.
It seems the API call always return true, even if the order is already cancelled or invoiced. Instead it should returning some error code.
Hi
I think this function in OrderService.php this function `public function cancel($id) { $order = $this->orderRepository->get($id); if ((bool)$order->cancel()) { $this->orderRepository->save($order); return true; }
return false;
}`
was using Order.php cancel which is always return order information even though canCancel() returns false. ` public function cancel() { if ($this->canCancel()) { $this->getPayment()->cancel(); $this->registerCancellation();
$this->_eventManager->dispatch('order_cancel_after', ['order' => $this]);
}
return $this;
}`
I think this is the issue
@vzabaznov , @NadiyaS any update on it??
@ruby10 Hi, thank you for your report. Internal ticket was created MAGETWO-70442.
@ruby10, thank you for your report. The issue is already fixed in develop branch But we will consider to backport the fix to patch releases
Hi @ruby10
This ticket has been marked as "Triage Wanted" due to low user involvement over time. Over the next 2 weeks we are looking for additional community feedback to decide if it should be archived or not. More information on this is available on the GitHub wiki.
Thank you for collaboration.
@ruby10 thank you for your report.
Unfortunately, we are archiving this ticket now as it did not get much attention from both Magento Community and Core developers for an extended period. This is done in an effort to create a quality, community-driven backlog which will allow us to allocate the required attention more easily.
You may learn more about this initiative following this link.
Please feel free to comment or reopen the ticket if you think it should be reviewed once more. Thank you for collaboration.