Class: Omnipay::RequestPhase
- Inherits:
-
Object
- Object
- Omnipay::RequestPhase
- Defined in:
- lib/omnipay/request_phase.rb
Overview
Class responsible for formatting the redirection in the request phase
Instance Method Summary collapse
- #initialize(request, adapter) ⇒ RequestPhase constructor
-
#response ⇒ Rack::Response
Returns the rack response for redirecting the user to the payment page.
Constructor Details
#initialize(request, adapter) ⇒ RequestPhase
9 10 11 12 |
# File 'lib/omnipay/request_phase.rb', line 9 def initialize(request, adapter) @request = request @adapter = adapter end |
Instance Method Details
#response ⇒ Rack::Response
Returns the rack response for redirecting the user to the payment page. Can be a 302 redirect if a GET redirection, or an AutosubmittedForm for POST redirections
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/omnipay/request_phase.rb', line 16 def response method, url, params, transaction_id = @adapter.request_phase(amount, adapter_params) context = store_context! signature = Signer.new(transaction_id, amount, context).signature store_signature!(signature) if method == 'GET' get_redirect_response(url, params) elsif method == 'POST' post_redirect_response(url, params) else raise TypeError.new('request_phase returned http method must be \'GET\' or \'POST\'') end end |