Module: PaypalHelper

Included in:
IabBaseController
Defined in:
lib/hooks/helpers/paypal_helper.rb

Constant Summary collapse

PAYMENT_AMOUNT_SESSION_KEY =
:payment_amount

Instance Method Summary collapse

Instance Method Details

#checkoutObject

the following methods are automatically called from the iab_controller actions that are created at runtime the rule is that if a method whose name is the lowercase equivalent of the process ‘do’ step then it will get fired prior to calling communicator which controls access to the server logic



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/hooks/helpers/paypal_helper.rb', line 11

def checkout
  session[PAYMENT_AMOUNT_SESSION_KEY] = "3000"
  params =       {
      :payment_amount     => payment_amount,
      :ip                 => request.remote_ip,
      :return_url         => url_for(:action => 'PaymentConfirm', :only_path => false),
      #TODO where do we go if the user cancels from making payment?
      :cancel_return_url  => url_for(:action => 'ProductSelection', :only_path => false)
    }
  params
end

#completedpaymentObject



28
29
30
31
32
33
34
35
# File 'lib/hooks/helpers/paypal_helper.rb', line 28

def completedpayment
  params = {
    :payment_amount => payment_amount,
    :ip       => request.remote_ip,
    :payer_id => @_params[:payer_id],
    :token    => @_params[:token] }
  params
end

#confirmpaymentObject



23
24
25
26
# File 'lib/hooks/helpers/paypal_helper.rb', line 23

def confirmpayment
  params = { :token => @_params[:token] }
  params
end

#payment_amountObject



4
5
6
# File 'lib/hooks/helpers/paypal_helper.rb', line 4

def payment_amount
  session[PAYMENT_AMOUNT_SESSION_KEY]
end