Class: ShoppingCart::AddCheckoutAddresses
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- ShoppingCart::AddCheckoutAddresses
- Defined in:
- app/commands/shopping_cart/add_checkout_addresses.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(order, params) ⇒ AddCheckoutAddresses
constructor
A new instance of AddCheckoutAddresses.
Constructor Details
#initialize(order, params) ⇒ AddCheckoutAddresses
Returns a new instance of AddCheckoutAddresses.
3 4 5 6 |
# File 'app/commands/shopping_cart/add_checkout_addresses.rb', line 3 def initialize(order, params) @order = order @params = params end |
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/commands/shopping_cart/add_checkout_addresses.rb', line 8 def call @billing = address :billing @billing.valid? ? save_billing : write_errors(:billing, @billing) @shipping = use_billing? ? address(:billing) : address(:shipping) @shipping.valid? ? save_shipping : write_errors(:shipping, @shipping) end |