-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Fixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for development
Description
I'm assuming the cancel method in OrderService is supposed to return true only if the cancellation was a success.
public function cancel($id) |
But, since the cancel method in Order always returns the order itself, the service method ends up always saving and returning true as if the order was cancelled.
magento2/app/code/Magento/Sales/Model/Order.php
Line 1112 in 5973d67
public function cancel() |
This is confusing if not broken. The meaning of the boolean return value should be documented and if it is indeed meant as an indicator of successful cancelation, the service method should be fixed.
I'll include the boilerplate below to prevent this issue from getting auto-marked as not helpful.
Preconditions
- Fresh Magento 2 version (see links to functions in develop branch above)
Steps to reproduce
- Look at phpdoc in OrderService's cancel method and try to understand it's return value.
Expected result
- A clear understanding of the return value AND
- Return value corresponding to reality, for example, true only if order was canceled.
Actual result
- Confusion. Looks like the return value might indicate cancelation success, but it does not.
Metadata
Metadata
Assignees
Labels
Fixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for development