Class: Spree::Api::CheckoutsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Spree::Api::CheckoutsController
- Includes:
- Core::ControllerHelpers::Order, Core::ControllerHelpers::PaymentParameters
- Defined in:
- app/controllers/spree/api/checkouts_controller.rb
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
Instance Method Details
#advance ⇒ Object
26 27 28 29 30 |
# File 'app/controllers/spree/api/checkouts_controller.rb', line 26 def advance :update, @order, order_token @order.contents.advance respond_with(@order, default_template: 'spree/api/orders/show', status: 200) end |
#complete ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/spree/api/checkouts_controller.rb', line 32 def complete :update, @order, order_token if !expected_total_ok?(params[:expected_total]) respond_with(@order, default_template: 'spree/api/orders/expected_total_mismatch', status: 400) else @order.complete! respond_with(@order, default_template: 'spree/api/orders/show', status: 200) end end |
#next ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/spree/api/checkouts_controller.rb', line 16 def next :update, @order, order_token if !expected_total_ok?(params[:expected_total]) respond_with(@order, default_template: 'spree/api/orders/expected_total_mismatch', status: 400) return end @order.next! respond_with(@order, default_template: 'spree/api/orders/show', status: 200) end |
#update ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/spree/api/checkouts_controller.rb', line 42 def update :update, @order, order_token if Spree::Config.order_update_attributes_class.new(@order, update_params, request_env: request.headers.env).call if can?(:admin, @order) && user_id.present? @order.associate_user!(Spree.user_class.find(user_id)) end return if after_update_attributes if @order.completed? || @order.next! state_callback(:after) respond_with(@order, default_template: 'spree/api/orders/show') end else invalid_resource!(@order) end end |