Class: Newebpay::PeriodicalCallbacksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/newebpay/periodical_callbacks_controller.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Newebpay::ApplicationController

Instance Method Details

#newebpay_responseObject



9
10
11
# File 'app/controllers/newebpay/periodical_callbacks_controller.rb', line 9

def newebpay_response
  @newebpay_response ||= Newebpay::MPG::Response.new(params['Period'])
end

#proceedObject



13
14
15
16
17
18
19
20
21
# File 'app/controllers/newebpay/periodical_callbacks_controller.rb', line 13

def proceed
  unless Newebpay.config.periodical_callback.is_a? Proc
    raise NotImplementedError, 'Newebpay.config.periodical_callback is not a proc.'
  end
  raise InvalidResponseError if params['Period'].blank?

  instance_exec(Newebpay::Periodical::Response.new(params['Period']), self, ::Rails.application.routes.url_helpers, &Newebpay.config.periodical_callback)
  redirect_to '/' unless performed?
end