Closed (fixed)
Project:
Commerce Core
Version:
8.x-2.x-dev
Component:
Cart
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Oct 2016 at 01:48 UTC
Updated:
14 Nov 2016 at 12:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mglamanPatch
Comment #3
mglamanPR: https://github.com/drupalcommerce/commerce/pull/526
Comment #4
mglamanFixing attribution.
Comment #5
bojanz commentedI think our code is going to become messy if we start injecting the order refresh service to every place that modifies an order.
Instead, we can introduce $order->needsRefresh() that sets $order->data['needs_refresh'], and listen for that in a presave callback?
Comment #6
mglamanWe need a way to let an order know it should refresh the next time it saves.
Comment #7
bojanz commentedWe need:
1) A needs_refresh flag for $order->data that always triggers a refresh
2) An order method for requesting a refresh
3) Logic that triggers a refresh despite the order frequency if the day has changed
4) To increase the default order frequency (to 5min)
5) To add a docblock for refreshingOrders, and make it non-static (the container always gives us a single class instance)
Tests.
Might be time to introduce and inject a Time object (with a now()) method, to be able to efficiently test #3.
Would also be super convenient for recurring.
Comment #8
bojanz commentedIn progress at https://github.com/drupalcommerce/commerce/pull/540
Comment #10
bojanz commentedRefresh now happens on presave, with the option of postponing it to the next load, or skipping it altogether.
Unless skipped, refresh is always triggered automatically for draft orders.
Changed the default order type's refresh mode to "customer" (to match Commerce 1.x), increased refresh frequency to 5min.
API changes:
- Added getRefreshState() and setRefreshState() to orders.
- Added a guarantee that order refresh frequency is always at least 1s, used it to remove the static from OrderRefresh
- Improved the order refresh frequency form element (OrderTypeForm)
- Added logic that always refreshes if the day has changed.
- Split needsRefresh into needsRefresh and shouldRefresh. Allows us to show a message to the admin saying "looks like this order needs to be refreshed, would you like to do that?"
- Rewrote the order refresh tests.
- Fixed bug where order items were saved before the processors had a chance to modify them.
- Fixed wrong typehint for $current_user.
- Copied the Drupal 8.3.x Time object into Commerce, added it to the refresh process.