Class: Spree::Api::V2::Storefront::CheckoutController
- Inherits:
-
BaseController
- Object
- ActionController::API
- BaseController
- Spree::Api::V2::Storefront::CheckoutController
- Includes:
- OrderConcern
- Defined in:
- app/controllers/spree/api/v2/storefront/checkout_controller.rb
Instance Method Summary collapse
- #add_store_credit ⇒ Object
- #advance ⇒ Object
- #complete ⇒ Object
- #next ⇒ Object
- #payment_methods ⇒ Object
- #remove_store_credit ⇒ Object
- #shipping_rates ⇒ Object
- #update ⇒ Object
Methods inherited from BaseController
Instance Method Details
#add_store_credit ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/spree/api/v2/storefront/checkout_controller.rb', line 47 def add_store_credit :update, spree_current_order, order_token result = add_store_credit_service.call( order: spree_current_order, amount: params[:amount].try(:to_f) ) render_order(result) end |
#advance ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/controllers/spree/api/v2/storefront/checkout_controller.rb', line 17 def advance :update, spree_current_order, order_token result = advance_service.call(order: spree_current_order) render_order(result) end |
#complete ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/controllers/spree/api/v2/storefront/checkout_controller.rb', line 25 def complete :update, spree_current_order, order_token result = complete_service.call(order: spree_current_order) render_order(result) end |
#next ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/controllers/spree/api/v2/storefront/checkout_controller.rb', line 9 def next :update, spree_current_order, order_token result = next_service.call(order: spree_current_order) render_order(result) end |
#payment_methods ⇒ Object
71 72 73 |
# File 'app/controllers/spree/api/v2/storefront/checkout_controller.rb', line 71 def payment_methods render_serialized_payload { serialize_payment_methods(spree_current_order.available_payment_methods) } end |
#remove_store_credit ⇒ Object
58 59 60 61 62 63 |
# File 'app/controllers/spree/api/v2/storefront/checkout_controller.rb', line 58 def remove_store_credit :update, spree_current_order, order_token result = remove_store_credit_service.call(order: spree_current_order) render_order(result) end |
#shipping_rates ⇒ Object
65 66 67 68 69 |
# File 'app/controllers/spree/api/v2/storefront/checkout_controller.rb', line 65 def shipping_rates result = shipping_rates_service.call(order: spree_current_order) render_serialized_payload { serialize_shipping_rates(result.value) } end |
#update ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/spree/api/v2/storefront/checkout_controller.rb', line 33 def update :update, spree_current_order, order_token result = update_service.call( order: spree_current_order, params: params, # defined in https://github.com/spree/spree/blob/master/core/lib/spree/core/controller_helpers/strong_parameters.rb#L19 permitted_attributes: permitted_checkout_attributes, request_env: request.headers.env ) render_order(result) end |