-
Notifications
You must be signed in to change notification settings - Fork 9.4k
MC-34298: Introduce separate POST and PUT API for carts/mine/items #31018
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
base: 2.5-develop
Are you sure you want to change the base?
Conversation
Hi @engcom-Echo. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento run all tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @engcom-Echo ,
Your change is definitely backward incompatible in the interface marked with @api
tag that is prohibited in minor releases and will create a lot of issues for upgrade.
Could you do following things:
- create new interface with your suggested changes
- add implements in the repository
- mark old interface as
@deprecated
due to issues listed in the related issue - add to the old interface new tag
@see
with new interface
@engcom-Echo just an idea - can we do it as a plugin to existing "save" method? |
@engcom-Echo could you explain why this PR was moved to on-hold status? |
* @throws \Magento\Framework\Exception\CouldNotSaveException The specified item could not be saved to the cart. | ||
* @throws \Magento\Framework\Exception\InputException The specified item or cart is not valid. | ||
*/ | ||
public function execute(\Magento\Quote\Api\Data\CartItemInterface $cartItem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please declare the return type
* @throws \Magento\Framework\Exception\CouldNotSaveException The specified item could not be saved to the cart. | ||
* @throws \Magento\Framework\Exception\InputException The specified item or cart is not valid. | ||
*/ | ||
public function execute(\Magento\Quote\Api\Data\CartItemInterface $cartItem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please declare return type here
/** | ||
* @inheritDoc | ||
*/ | ||
public function execute(CartItemInterface $cartItem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add return type here
/** | ||
* @inheritDoc | ||
*/ | ||
public function execute(CartItemInterface $cartItem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
Please also check the failing WebApi tests |
@magento run all tests |
@magento run all tests |
@magento run all tests |
@magento run WebAPI Tests |
@magento run WebAPI Tests |
@magento run all tests |
@magento run WebAPI Tests |
@@ -177,13 +177,13 @@ | |||
</resources> | |||
</route> | |||
<route url="/V1/carts/:quoteId/items" method="POST"> | |||
<service class="Magento\Quote\Api\CartItemRepositoryInterface" method="save"/> | |||
<service class="Magento\Quote\Api\AddCartItemInterface" method="execute"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about Guest carts? I suppose should be same logic there
@@ -29,6 +29,11 @@ public function getList($cartId); | |||
* @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist. | |||
* @throws \Magento\Framework\Exception\CouldNotSaveException The specified item could not be saved to the cart. | |||
* @throws \Magento\Framework\Exception\InputException The specified item or cart is not valid. | |||
* | |||
* @deprecated Post and put endpoint should be separated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why its deprecated? It widely used in code (I mean implementation of this method) not only for API
use Magento\Quote\Api\Data\CartItemInterface; | ||
|
||
/** | ||
* Interface UpdateCartItemInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide meaningful description for interface
use Magento\Quote\Api\Data\CartItemInterface; | ||
|
||
/** | ||
* Interface AddCartItemInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide meaningful description for interface
@engcom-Echo will you be able to update your PR? |
Description (*)
Related Pull Requests
https://github.com/magento/partners-magento2ee/pull/458
https://github.com/magento/partners-magento2b2b/pull/541
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)