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

It is difficult to trigger actions when an order is "really" complete. #387

Closed
Senjai opened this issue Sep 22, 2015 · 2 comments
Closed

Comments

@Senjai
Copy link
Contributor

Senjai commented Sep 22, 2015

As far as I know, if you have to perform an action when a orders' state, shipment_state, and payment_state is "complete", "shipped", and "paid" respectively at the time that the order satisfies those conditions, you're pretty much out of luck.

I would consider an order in those three states to be a "fulfilled" order where all obligations of the merchant to the customer are complete.

I've tried the below before I tried to implement some other custom solution on top of this, or inject behaviour into every state machine.

  1. Using an after save hook on the order
  2. Registering an update hook with Spree::Order.register_update_hook

The first doesn't work because the order updater uses update_columns

The second doesn't work because the several modules, like OrderShipping, uses the updater to calculate the new state, and then persists the state itself. run_hooks only ever being called in OrderUpdater#update!

Does anyone have any suggestions on making this a more fluid and robust process?

@magnusvk
Copy link
Contributor

Is this solved by #389?

@Senjai
Copy link
Contributor Author

Senjai commented Sep 29, 2015

Yep! People can add their own logic with Spree::Order#register_update_hook which will now properly get triggered on every solidus supported state change.

@Senjai Senjai closed this as completed Sep 29, 2015
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

2 participants