-
Notifications
You must be signed in to change notification settings - Fork 9.4k
ISSUE-20004: Refactoring minimum order amount including tax value in the calculate #33327
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.4-develop
Are you sure you want to change the base?
ISSUE-20004: Refactoring minimum order amount including tax value in the calculate #33327
Conversation
Hi @viniciusbord9. 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 |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run Unit Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run Functional Tests EE |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
Part of the tests that not pass are not related to my changes:
But the Semantic Version checker really gets some changes that I did on the interface, but I do not now what I should do in that case to pass that test. Please let me know if you have any questions. |
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.
@viniciusbord9 Thanks for your work.
But the Semantic Version checker really gets some changes that I did on the interface, but I do not now what I should do in that case to pass that test.
You may find answer to this question in Backward Compatibility Policy
Introduction of a method to a class or interface
Create a new interface with a new method instead of introducing a method to a class or interface.
The new interface may take over existing methods from the class if it makes sense to group them together. In this case, you must deprecate corresponding methods in the old interface/class with the @see annotation. The old methods should proxy the calls to the new interface instead of duplicating the logic.
@Den4ik thank you for the clarification. I am going to do it soon. |
…use change the interface
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run Functional Tests CE |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
…shipping does not influence the minimum amount
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run Functional Tests EE, Functional Tests CE, Functional Tests B2B |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@Den4ik I have created a new functional test for the order minimum amount, it is working smoothly on my local, but it is broken during the automated tests. Basically the button 'proceed to checkout' should be disabled when accessing the cart page but it is not. I saw the screenshot of the test and I am wonder why it is rendering the multiple addresses option right below the proceed checkout button even when the minimum amount is enabled and active on the checkout. Can you help me to understand what is wrong with the test? |
… amount is set up.
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@Den4ik I've pushed a new update that fix the issue that I mentioned previously, therefore, you can ignore my last comment asking for help. Now the functional tests are working well. Those two tests that have broken (Functional Tests EE, Functional Tests B2B) are not related to my changes and they seem be another issue. Please let me know if anything is not like you expected. |
@magento create issue |
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.
@viniciusbord9 Could you check my comments
@@ -475,7 +475,7 @@ public function getTotalSegments(); | |||
* @return $this | |||
*/ | |||
public function setTotalSegments($totals = []); | |||
|
|||
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 rollback
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.
Done.
<click selector="{{CheckoutCartSummarySection.shippingMethodElementId('freeshipping', 'freeshipping')}}" stepKey="selectShippingMethod"/> | ||
<scrollTo selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="scrollToProceedToCheckout" /> | ||
<actionGroup ref="StorefrontClickProceedToCheckoutActionGroup" stepKey="goToCheckout"/> | ||
<comment userInput="Adding the comment to replace waitForPageToLoad action for preserving Backward Compatibility" stepKey="waitForPageToLoad"/> |
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.
Comment block used on refactored mftf tests to preserve backward compatibility and don't needed in new mftf 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.
Done. Please review again when you have a chance.
@@ -2298,6 +2298,8 @@ public function validateMinimumAmount($multishipping = false) | |||
$storeId | |||
); | |||
|
|||
$this->collectTotals()->save(); |
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.
I'm not sure that triggering recollect totals in this method is good solution.
I believe that we can extend QuoteRepository
with additional param triggerRecollect
that will set triggerRecollect
data at Quote
object.
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Quote/Model/Quote.php#L2461-L2470
@ihor-sviziev what do you think?
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.
@viniciusbord9 Could you pay attention to this comment? Extending of QuoteRepository
allow to reuse recollect functional in a future.
Or may be you have another points for this case?
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.
I was waiting for an answer from @ihor-sviziev to whom you asked for sooner. I am going to try to implement your idea and check if it is viable.
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.
@Den4ik I think it's a good idea
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.
I was developing the new repository extending the QuoteRepository
as suggested and due to a necessity of injecting the repository for two classes(TotalsInformationManagement
, CartTotalRepository
) , I have realized that maybe the current flow was not working well.
The class TotalsInformationManagement
depends on the CartTotalRepository
and apply changes to the quote but do not save the data
I have only change the line 61 from $quote->collectTotals();
to $quote->collectTotals()->save();
and then my changes worked as expected.
I have finished the implementation of the QuoteRepository
supporting an additional parameter $triggerRecollect
with default value 0. If you still think that change is the best one I will proceed, but to be honest I think it is too big that fix.
…ting the MTFT test.
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
Description (*)
It fixes the issue reported when the tax value was not taking account when the minimum order amount was blocking the customer proceed to checkout even when the grant total of the cart was bigger than the minimum order amount value.
Related Pull Requests
#33316
That PR has been closing by me due to some confusion author for the commits.
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
I have created a new boolean field (is_minimum_order_amount) on the Magento/Quote/Api/Data/TotalsInterface.php that can impact positively the APIs that returns that entity. It will include a flag that indicates if the quote's total value is bigger than the minimum order amount.
Contribution checklist (*)
Resolved issues: