app/models/solidus_subscriptions/checkout.rb in solidus_subscriptions-alpha-0.0.2 vs app/models/solidus_subscriptions/checkout.rb in solidus_subscriptions-alpha-0.0.3
- old
+ new
@@ -66,14 +66,14 @@
def checkout
order.update!
apply_promotions
- order.checkout_steps[0...-1].each do
+ order.checkout_steps.count.times do
order.ship_address = ship_address if order.state == "address"
create_payment if order.state == "payment"
- order.next!
+ order.next! if order.next_transition.present?
end
# Do this as a separate "quiet" transition so that it returns true or
# false rather than raising a failed transition error
order.complete
@@ -112,10 +112,14 @@
def ship_address
subscription.shipping_address || user.ship_address
end
def active_card
- user.wallet.default_wallet_payment_source
+ if SolidusSupport.solidus_gem_version < Gem::Version.new("2.2.0")
+ user.credit_cards.default.last
+ else
+ user.wallet.default_wallet_payment_source.payment_source
+ end
end
def create_payment
order.payments.create(
source: active_card,