Class: Workarea::Checkout::Steps::Addresses
- Defined in:
- app/models/workarea/checkout/steps/addresses.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#complete? ⇒ Boolean
Whether this checkout step is finished.
-
#default_shipping_option ⇒ Shipping::Option
The default shipping option that will be assigned to this checkout when updating.
-
#update(params = {}) ⇒ Boolean
Update the addresses step of checkout.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Workarea::Checkout::Steps::Base
Instance Method Details
#complete? ⇒ Boolean
Whether this checkout step is finished. Requires:
-
order to be valid
-
payment address to be valid
-
shipping address to be valid if requires shipping
Used for redirecting and summary display in checkout.
46 47 48 |
# File 'app/models/workarea/checkout/steps/addresses.rb', line 46 def complete? order.valid? && billing_complete? && shipping_complete? end |
#default_shipping_option ⇒ Shipping::Option
The default shipping option that will be assigned to this checkout when updating. Retrieved from Workarea::Checkout::ShippingOptions
11 12 13 |
# File 'app/models/workarea/checkout/steps/addresses.rb', line 11 def default_shipping_option .first end |
#update(params = {}) ⇒ Boolean
Update the addresses step of checkout. Includes:
-
email address (from params or user)
-
shipping address (if shippable)
-
shipping service (assigning a default if none exists and shippable)
-
billing address
28 29 30 31 32 33 34 |
# File 'app/models/workarea/checkout/steps/addresses.rb', line 28 def update(params = {}) set_order_email(params) set_shipping_address(params) set_payment_address(params) persist_update end |