Class: Spree::PaybrightController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/paybright_controller.rb

Instance Method Summary collapse

Instance Method Details

#callbackObject

Server2server call that gets parameters about the results of the Paybright transaction.



8
9
10
11
12
# File 'app/controllers/spree/paybright_controller.rb', line 8

def callback
  result, message = handle_callback_params!
  status = result ? :ok : :bad_request
  render plain: message, status: status
end

#cancelObject

The user is redirected here after failing some intermediate step of the Paybright checkout.



23
24
25
26
# File 'app/controllers/spree/paybright_controller.rb', line 23

def cancel
  payment = Spree::Payment.find_by(id: params[:payment_id])
  redirect_to redirect_path(payment.try(:order))
end

#completeObject

The user is redirected here after completing the full Paybright checkout. It also gets the same parameters of #callback.



16
17
18
19
# File 'app/controllers/spree/paybright_controller.rb', line 16

def complete
  handle_callback_params!
  redirect_to redirect_path(@payment.try(:order))
end