From 814a1bed9496ac05f6eb280843b530b1e15e3b91 Mon Sep 17 00:00:00 2001 From: Joel Jackson Date: Thu, 8 Jun 2017 23:39:56 -0700 Subject: Allows for subscription chekout to accommodate a more flexible checkout flow. --- app/models/solidus_subscriptions/checkout.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'app/models/solidus_subscriptions') 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 -- cgit v1.2.3