Module: ActiveMerchant::Billing::PaypalAdaptivePaymentCommon

Included in:
PaypalAdaptivePayment
Defined in:
lib/active_merchant/billing/gateways/paypal_adaptive_payment_common.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment_common.rb', line 4

def self.included(base)
  base.cattr_accessor :test_redirect_url
  base.cattr_accessor :live_redirect_url
  base.cattr_accessor :test_redirect_pre_approval_url
  base.cattr_accessor :live_redirect_pre_approval_url
  base.live_redirect_url = 'https://www.paypal.com/webscr?cmd=_ap-payment&paykey='
  base.live_redirect_pre_approval_url = 'https://www.paypal.com/webscr?cmd=_ap-preapproval&preapprovalkey='
end

Instance Method Details

#redirect_pre_approval_urlObject



22
23
24
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment_common.rb', line 22

def redirect_pre_approval_url
  test? ? test_redirect_pre_approval_url : live_redirect_pre_approval_url
end

#redirect_pre_approval_url_for(token) ⇒ Object



26
27
28
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment_common.rb', line 26

def redirect_pre_approval_url_for(token)
  "#{redirect_pre_approval_url}#{token}"
end

#redirect_urlObject



13
14
15
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment_common.rb', line 13

def redirect_url
  test? ? test_redirect_url : live_redirect_url
end

#redirect_url_for(token) ⇒ Object

TODO: validate the token presence



18
19
20
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment_common.rb', line 18

def redirect_url_for(token)
  "#{redirect_url}#{token}"
end