Class: SolidusAfterpay::CallbacksController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/solidus_afterpay/callbacks_controller.rb

Instance Method Summary collapse

Instance Method Details

#cancelObject



21
22
23
# File 'app/controllers/solidus_afterpay/callbacks_controller.rb', line 21

def cancel
  redirect_to checkout_state_path(order.state)
end

#confirmObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/solidus_afterpay/callbacks_controller.rb', line 8

def confirm
  authorize! :update, order, order_token

  if ::Spree::OrderUpdateAttributes.new(order, update_params, request_env: request.headers.env).apply
    order.next
  end

  respond_to do |format|
    format.html { redirect_to checkout_state_path(order.state) }
    format.json { render json: { redirect_url: checkout_state_url(order.state) } }
  end
end