Class: Paypal::Express::Request
- Inherits:
-
NVP::Request
show all
- Defined in:
- lib/paypal/express/request.rb
Constant Summary
Constant Summary
Constants inherited
from NVP::Request
NVP::Request::ENDPOINT
Instance Attribute Summary
Attributes inherited from NVP::Request
#version
Instance Method Summary
(collapse)
-
- (Object) cancel!(profile_id, options = {})
-
- (Object) checkout!(token, payer_id, payment_requests)
-
- (Object) details(token)
-
- (Object) reactivate!(profile_id, options = {})
-
- (Object) refund!(transaction_id, options = {})
-
- (Object) renew!(profile_id, action, options = {})
-
- (Object) setup(payment_requests, return_url, cancel_url, options = {})
-
- (Object) subscribe!(token, recurring_profile)
-
- (Object) subscription(profile_id)
-
- (Object) suspend!(profile_id, options = {})
#common_params, endpoint, #initialize, #request
Methods inherited from Base
#initialize
Methods included from Util
#==, formatted_amount, #numeric_attribute?, to_numeric
Instance Method Details
- (Object) cancel!(profile_id, options = {})
71
72
73
|
# File 'lib/paypal/express/request.rb', line 71
def cancel!(profile_id, options = {})
renew!(profile_id, :Cancel, options)
end
|
- (Object) checkout!(token, payer_id, payment_requests)
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/paypal/express/request.rb', line 26
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
|
- (Object) details(token)
21
22
23
24
|
# File 'lib/paypal/express/request.rb', line 21
def details(token)
response = self.request :GetExpressCheckoutDetails, {:TOKEN => token}
Response.new response
end
|
- (Object) reactivate!(profile_id, options = {})
75
76
77
|
# File 'lib/paypal/express/request.rb', line 75
def reactivate!(profile_id, options = {})
renew!(profile_id, :Reactivate, options)
end
|
- (Object) refund!(transaction_id, options = {})
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/paypal/express/request.rb', line 79
def refund!(transaction_id, options = {})
params = {
:TRANSACTIONID => transaction_id,
:REFUNDTYPE => :Full
}
if options[:invoice_id]
params[:INVOICEID] = options[:invoice_id]
end
if options[:type]
params[:REFUNDTYPE] = options[:type]
params[:AMT] = options[:amount]
params[:CURRENCYCODE] = options[:currency_code]
end
if options[:note]
params[:NOTE] = options[:note]
end
response = self.request :RefundTransaction, params
Response.new response
end
|
- (Object) renew!(profile_id, action, options = {})
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/paypal/express/request.rb', line 55
def renew!(profile_id, action, options = {})
params = {
:PROFILEID => profile_id,
:ACTION => action
}
if options[:note]
params[:NOTE] = options[:note]
end
response = self.request :ManageRecurringPaymentsProfileStatus, params
Response.new response
end
|
- (Object) setup(payment_requests, return_url, cancel_url, options = {})
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/paypal/express/request.rb', line 5
def setup(payment_requests, return_url, cancel_url, options = {})
params = {
:RETURNURL => return_url,
:CANCELURL => 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
|
- (Object) subscribe!(token, recurring_profile)
38
39
40
41
42
43
44
45
|
# File 'lib/paypal/express/request.rb', line 38
def subscribe!(token, recurring_profile)
params = {
:TOKEN => token
}
params.merge! recurring_profile.to_params
response = self.request :CreateRecurringPaymentsProfile, params
Response.new response
end
|
- (Object) subscription(profile_id)
47
48
49
50
51
52
53
|
# File 'lib/paypal/express/request.rb', line 47
def subscription(profile_id)
params = {
:PROFILEID => profile_id
}
response = self.request :GetRecurringPaymentsProfileDetails, params
Response.new response
end
|
- (Object) suspend!(profile_id, options = {})
67
68
69
|
# File 'lib/paypal/express/request.rb', line 67
def suspend!(profile_id, options = {})
renew!(profile_id, :Suspend, options)
end
|