Module: PayPal::SDK::AdaptivePayments::Urls

Included in:
API
Defined in:
lib/paypal-sdk/adaptive_payments/urls.rb

Constant Summary collapse

REDIRECT_ENDPOINTS =
{
:live => "https://www.paypal.com",
:sandbox => "https://www.sandbox.paypal.com" }

Instance Method Summary collapse

Instance Method Details

#payment_url(key) ⇒ Object Also known as: pay_url



14
15
16
17
# File 'lib/paypal-sdk/adaptive_payments/urls.rb', line 14

def payment_url(key)
  key = key.payKey if key.respond_to?(:payKey)
  redirect_url(:cmd => "_ap-payment", :paykey => key.to_s)
end

#preapproval_url(key) ⇒ Object



20
21
22
23
# File 'lib/paypal-sdk/adaptive_payments/urls.rb', line 20

def preapproval_url(key)
  key = key.preapprovalKey if key.respond_to?(:preapprovalKey)
  redirect_url(:cmd => "_ap-preapproval", :preapprovalkey => key.to_s)
end

#redirect_url(params = {}) ⇒ Object



9
10
11
12
# File 'lib/paypal-sdk/adaptive_payments/urls.rb', line 9

def redirect_url(params = {})
  locale = defined?(I18n) && "/#{I18n.locale}"
  "#{REDIRECT_ENDPOINTS[api_mode]}#{locale}/webscr?#{encode_www_form(params)}"
end