summaryrefslogtreecommitdiff
path: root/app/models/solidus_subscriptions
diff options
context:
space:
mode:
authorJoel Jackson <jackson.joel@gmail.com>2017-06-08 23:39:56 -0700
committerBrendan Deere <brendan@stembolt.com>2017-07-24 10:36:08 -0700
commit814a1bed9496ac05f6eb280843b530b1e15e3b91 (patch)
tree7053e42467e1189d15b7f3931dae0a56e8b6f732 /app/models/solidus_subscriptions
parentb1903f746e6879acb804dece1dfe729f0aa4042d (diff)
Allows for subscription chekout to accommodate a more flexible checkout flow.
Diffstat (limited to 'app/models/solidus_subscriptions')
-rw-r--r--app/models/solidus_subscriptions/checkout.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/app/models/solidus_subscriptions/checkout.rb b/app/models/solidus_subscriptions/checkout.rb
index 22882b7..e5f634c 100644
--- a/app/models/solidus_subscriptions/checkout.rb
+++ b/app/models/solidus_subscriptions/checkout.rb
@@ -68,14 +68,11 @@ module SolidusSubscriptions
order.update!
apply_promotions
- order.next! # cart => address
-
- order.ship_address = ship_address
- order.next! # address => delivery
- order.next! # delivery => payment
-
- create_payment
- order.next! # payment => confirm
+ order.checkout_steps[0...-1].each do |step|
+ order.ship_address = ship_address if order.state == :address
+ create_payment if order.state == :payment
+ order.next!
+ end
# Do this as a separate "quiet" transition so that it returns true or
# false rather than raising a failed transition error