Class: Stall::Checkout::InformationsCheckoutStep

Inherits:
Step
  • Object
show all
Defined in:
lib/stall/checkout/informations_checkout_step.rb

Instance Attribute Summary

Attributes inherited from Step

#cart

Instance Method Summary collapse

Methods inherited from Step

#allow_inactive_carts?, #identifier, #initialize, #inject, #is?, #save, #skip?, #valid?

Constructor Details

This class inherits a constructor from Stall::Checkout::Step

Instance Method Details

#prepareObject



22
23
24
25
26
27
# File 'lib/stall/checkout/informations_checkout_step.rb', line 22

def prepare
  ensure_customer
  prefill_addresses_from_customer
  ensure_shipment
  ensure_payment
end

#processObject



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/stall/checkout/informations_checkout_step.rb', line 29

def process
  prepare_user_attributes
  prepare_addresses_attributes
  cart.assign_attributes(cart_params)

  return false unless valid?

  cart.save.tap do |valid|
    assign_addresses_to_customer!
    calculate_shipping_fee!
  end
end