Module: Samurai::Rails::Helpers

Defined in:
lib/samurai/rails/helpers.rb

Instance Method Summary collapse

Instance Method Details

#load_and_verify_payment_method(params) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/samurai/rails/helpers.rb', line 11

def load_and_verify_payment_method(params)
  if params[:payment_method_token].blank?
    @payment_method = Samurai::PaymentMethod.new :is_sensitive_data_valid=>false
  else
    @payment_method = Samurai::PaymentMethod.find params[:payment_method_token]
    @payment_method = nil if @payment_method && !@payment_method.is_sensitive_data_valid?
  end
  @payment_method
end

#payment_method_paramsObject



21
22
23
24
25
# File 'lib/samurai/rails/helpers.rb', line 21

def payment_method_params
  { :payment_method_token => params[:payment_method_token] }.tap do |_params|
    _params[:reference_id] = @transaction.reference_id if @transaction
  end
end

#setup_for_transparent_redirect(params) ⇒ Object



6
7
8
9
# File 'lib/samurai/rails/helpers.rb', line 6

def setup_for_transparent_redirect(params)
  @transaction = Samurai::Transaction.find params[:reference_id] unless params[:reference_id].blank?
  @payment_method = Samurai::PaymentMethod.for_transparent_redirect(params)
end