Open leonhelmus opened 1 year ago
Hi @leonhelmus. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, review the Magento Contributor Assistant documentation.
Add a comment to assign the issue: @magento I am working on this
To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Description
When using the api
/rest/V1/order/:order_id/refund
you are able to add arguments that can be used when creating creditmemos.The only problem is that these extension attributes cannot be added to creditmemo without using a preference. Which is a shame i would suggest changing the method: https://github.com/magento/magento2/blob/8d6519b082be71578561ee0fc2d4eab25b9a6232/app/code/Magento/Sales/Model/Order/CreditmemoFactory.php#L213 To a public function. This way third parties can add a after plugin and do not have to use a preference. Which makes it easier to pass an custom argument with extension attributes from interface Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface to interface Magento\Sales\Api\Data\CreditmemoInterface
This way will than work for both: https://github.com/magento/magento2/blob/8d6519b082be71578561ee0fc2d4eab25b9a6232/app/code/Magento/Sales/Model/Order/CreditmemoFactory.php#L78 as well as for: https://github.com/magento/magento2/blob/8d6519b082be71578561ee0fc2d4eab25b9a6232/app/code/Magento/Sales/Model/Order/CreditmemoFactory.php#L110
Expected behavior
You add a custom extension attribute like this:
After you add a plugin to, since the method is public: https://github.com/magento/magento2/blob/8d6519b082be71578561ee0fc2d4eab25b9a6232/app/code/Magento/Sales/Model/Order/CreditmemoFactory.php#L213
After you use this endpoint: rest/V1/order/:order_id/refund with body:
The extension attribute can be used when calculating the totals if you would like to customize totals.
Benefits
If we make it public multiple vendors can add an after plugin to add the data they need on the creditmemo. Now only one vendor can make a preference on this function, because it's protected.
Additional information
No response
Release note
No response