Class: SolidusNexio::AlternativePaymentsController

Inherits:
Spree::CheckoutController
  • Object
show all
Defined in:
app/controllers/solidus_nexio/alternative_payments_controller.rb

Instance Method Summary collapse

Instance Method Details

#captureObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/solidus_nexio/alternative_payments_controller.rb', line 5

def capture
  prepare_params_and_validate_order(@order)
  # The code below is taken from Spree::CheckoutController#update method
  if @order.errors.empty? && update_order
    unless transition_forward
      redirect_on_failure
      return
    end

    if @order.completed?
      finalize_order
    else
      send_to_next_state
    end
  else
    redirect_on_failure
  end
end