-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Move isAllowed method from AccessChangeQuoteControl to separate service #12566
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
Conversation
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.
There is no real use for making any additional methods in a plugin public (apart from the plugin itself):
- Technical Guidelines do not recommend injecting a plugin into any class, it is not supposed to work that way.
- It is not a really good idea to create a plugin for another plugin.
In this case I suggest to introduce a separate service which would provide this logic, thus, it will be available for any third party code and may be used in this plugin at the same time.
|
@ishakhsuvarov For my understanding, why is this feature implemented using a plugin? Is this something you solely want to execute in an API environment? If I create a new Interface/Model which holds only the |
|
@JeroenVanLeusden Unfortunately I do not have information regarding this plugin and its origin at the moment. I assume this relates to the support of B2B extension. New model with this method would be sufficient, form my point of view, as it would allow you to customize it with a plugin for your use case and also it would not violate requirements. |
|
@ishakhsuvarov Logic is moved to separate service. Can you share your thoughts? |
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 description for the interface in the docblock
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 description for the class or inherit it from the interface
|
@JeroenVanLeusden Updated version looks good to me. Thank you! |
|
Also, Functional Tests job on Travis is failing on the Checkout, I've restarted it to make sure, but it is still red, so I think it may have something to do with the changes introduced. |
|
@ishakhsuvarov Will look at the tests somewhere this week and let you know. |
|
@JeroenVanLeusden Thanks |
|
@ishakhsuvarov Unit tests are now passing. Are you able to check the functional tests? I haven't had time yet to figure out how they work. |
|
@JeroenVanLeusden Sure. I will check it and let you know what is wrong |
|
@ishakhsuvarov Any update on this PR? If you need something from me please let me know. |
|
@ishakhsuvarov I've updated the code and all tests are now green. |
|
Hi @JeroenVanLeusden. Thank you for your contribution. |
Description
We are using recurring payments in combination with pre-order products. A small amount of the final price is payed and with the shipment, the remaining amount. In order to do this we always need a customer. We therefore automatically convert guest to shadow customers. This isn't an account the customer can use but we need it for the recurring payment.
In Magento v2.2 a plugin of
QuoteManagement::submit()is introduced,AccessChangeQuoteControlwhich now prevents guests from placing orders since$quote->getCustomerId()isn'tnullanymore.Moved logic to separate service so we can create a plugin.
Fixed Issues (if relevant)
Manual testing scenarios
QuoteManagement::submit()Invalid state change requestedContribution checklist
2.3 Port: #13776