Class: Paypal::Express::Request

Inherits:
NVP::Request show all
Defined in:
lib/paypal/express/request.rb

Constant Summary

Constants inherited from NVP::Request

NVP::Request::ENDPOINT

Instance Attribute Summary

Attributes inherited from NVP::Request

#version

Instance Method Summary collapse

Methods inherited from NVP::Request

#common_params, endpoint, #initialize, #request

Methods inherited from Base

#initialize

Methods included from Util

#==, formatted_amount, #numeric_attribute?, to_numeric

Constructor Details

This class inherits a constructor from Paypal::NVP::Request

Instance Method Details

#checkout!(token, payer_id, payment_requests) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/paypal/express/request.rb', line 27

def checkout!(token, payer_id, payment_requests)
  params = {
    :TOKEN => token,
    :PAYERID => payer_id
  }
  Array(payment_requests).each_with_index do |payment_request, index|
    params.merge! payment_request.to_params(index)
  end
  response = self.request :DoExpressCheckoutPayment, params
  Response.new response
end

#details(token) ⇒ Object



22
23
24
25
# File 'lib/paypal/express/request.rb', line 22

def details(token)
  response = self.request :GetExpressCheckoutDetails, {:TOKEN => token}
  Response.new response
end

#renew!(profile_id, action, note = '') ⇒ Object



56
57
58
59
60
61
62
63
64
# File 'lib/paypal/express/request.rb', line 56

def renew!(profile_id, action, note = '')
  params = {
    :PROFILEID => profile_id,
    :ACTION => action,
    :NOTE => note
  }
  response = self.request :ManageRecurringPaymentsProfileStatus, params
  Response.new response
end

#setup(payment_requests, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/paypal/express/request.rb', line 6

def setup(payment_requests, options = {})
  params = {
    :RETURNURL => self.return_url,
    :CANCELURL => self.cancel_url
  }
  if options[:no_shipping]
    params[:REQCONFIRMSHIPPING] = 0
    params[:NOSHIPPING] = 1
  end
  Array(payment_requests).each_with_index do |payment_request, index|
    params.merge! payment_request.to_params(index)
  end
  response = self.request :SetExpressCheckout, params
  Response.new response, options
end

#subscribe!(token, recurring_profile) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/paypal/express/request.rb', line 39

def subscribe!(token, recurring_profile)
  params = {
    :TOKEN => token
  }
  params.merge! recurring_profile.to_params
  response = self.request :CreateRecurringPaymentsProfile, params
  Response.new response
end

#subscription(profile_id) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/paypal/express/request.rb', line 48

def subscription(profile_id)
  params = {
    :PROFILEID => profile_id
  }
  response = self.request :GetRecurringPaymentsProfileDetails, params
  Response.new response
end