Skip to content
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

Separate the checkout flow states from the order states #142

Closed
athal7 opened this issue Jul 6, 2015 · 4 comments
Closed

Separate the checkout flow states from the order states #142

athal7 opened this issue Jul 6, 2015 · 4 comments
Milestone

Comments

@athal7
Copy link
Contributor

athal7 commented Jul 6, 2015

The order state machine is heavily tied to the solidus_frontend checkout states. It would be nice to remove that tie, and allow the order to be handled without those specific states, or maybe without the state_machine gem at all.

@cbrunsdon
Copy link
Contributor

In this episode of Solidus Issue Background History:

Historically Spree::Order.state was a state machine very tightly integrated to the "checkout steps" a user would go through in order to complete a checkout.

A "cart" would enter the "checkout" state when the checkout button was made.
The Spree::Order would progress to the "address" state when "continue" was clicked on the checkout page, prompting the user to enter their address.
"delivery" would be next, prompting the user to select a shipment method.
"payment" would follow, prompting for payment information
"confirm" would (optionally) show up with an order summary
"compete" would follow that, when an order was complete.

An order progresses through these states with the magic ".next" method, which just pushes an order through the states if it meets the criteria of being able to move forward.

As checkout's became more customized (single page API driven, re-ordered flow, etc) and the number of "states" we considered an order in increased (fraud, cancelled) it became clear that state_machine model we have is overly complex and tied to an outdated _frontent checkout flow.

The core team has identified that the checkout flow should not be dictated by an Order's state machine and should be pulled out and supported in a different way, which we hypothesize should improve comprehension and reduce complexity of an order.

Extracting the address/delivery/payment/checkout state from the Spree::Order should be considered a very advanced topic, likely only accomplish-able by someone with a very thorough understanding of the spree order state machine.

@cbrunsdon cbrunsdon added this to the Future milestone Jul 13, 2015
@BenMorganIO
Copy link
Contributor

Dibs. (On cracking the order state machine code.)

@hhff
Copy link

hhff commented Aug 9, 2015

Keen to follow along / help out here where possible - at least from a "chatting things out" perpective. The Spree Ember Checkouts package is a promise aware state machine that wraps the current order. Keen to do what I can to support the new approach!

Related: https://github.com/hhff/spree-ember/blob/master/packages/checkouts/app/services/checkouts.js

@cbrunsdon
Copy link
Contributor

Hawth and I are going to kill this, as while we would love to see it done, it's not actionable with how the codebase is now. We have many more tasks we need to accomplish first before this can be tackled reasonably.

spaghetticode referenced this issue in nebulab/solidus Mar 26, 2021
Recalculate payment total when order total decreases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants