paypal-sdk-rest 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +12 -12
- data/README.md +180 -179
- data/Rakefile +9 -9
- data/lib/paypal-sdk/rest/api.rb +23 -23
- data/lib/paypal-sdk/rest/data_types.rb +459 -420
- data/lib/paypal-sdk/rest/error_hash.rb +39 -39
- data/lib/paypal-sdk/rest/get_api.rb +20 -20
- data/lib/paypal-sdk/rest/request_data_type.rb +56 -56
- data/lib/paypal-sdk/rest/set_api.rb +42 -42
- data/lib/paypal-sdk/rest/version.rb +7 -7
- data/lib/paypal-sdk/rest.rb +38 -38
- data/lib/paypal-sdk-rest.rb +2 -2
- data/spec/config/cacert.pem +171 -171
- data/spec/config/paypal.yml +8 -8
- data/spec/payments_examples_spec.rb +272 -214
- data/spec/spec_helper.rb +24 -24
- metadata +25 -19
- checksums.yaml +0 -15
@@ -1,420 +1,459 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
object_of :
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
class
|
93
|
-
|
94
|
-
|
95
|
-
object_of :
|
96
|
-
object_of :
|
97
|
-
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
object_of :
|
106
|
-
object_of :
|
107
|
-
object_of :
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
object_of :
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
object_of :
|
196
|
-
object_of :
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
object_of :
|
220
|
-
object_of :
|
221
|
-
object_of :
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
object_of :
|
252
|
-
|
253
|
-
|
254
|
-
end
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
class
|
271
|
-
|
272
|
-
|
273
|
-
object_of :
|
274
|
-
object_of :
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
class
|
281
|
-
|
282
|
-
|
283
|
-
object_of :
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
def
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
object_of :
|
314
|
-
object_of :
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
object_of :
|
359
|
-
object_of :
|
360
|
-
object_of :
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
object_of :
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
1
|
+
require 'paypal-sdk-core'
|
2
|
+
require 'uuidtools'
|
3
|
+
|
4
|
+
module PayPal::SDK
|
5
|
+
module REST
|
6
|
+
module DataTypes
|
7
|
+
class Base < Core::API::DataTypes::Base
|
8
|
+
attr_accessor :error
|
9
|
+
attr_writer :header, :request_id
|
10
|
+
|
11
|
+
def header
|
12
|
+
@header ||= {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def request_id
|
16
|
+
@request_id ||= UUIDTools::UUID.random_create.to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
def http_header
|
20
|
+
{ "PayPal-Request-Id" => request_id.to_s }.merge(header)
|
21
|
+
end
|
22
|
+
|
23
|
+
def success?
|
24
|
+
@error.nil?
|
25
|
+
end
|
26
|
+
|
27
|
+
def merge!(values)
|
28
|
+
@error = nil
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.load_members
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Payment < Base
|
37
|
+
|
38
|
+
def self.load_members
|
39
|
+
object_of :id, String
|
40
|
+
object_of :create_time, DateTime
|
41
|
+
object_of :update_time, DateTime
|
42
|
+
object_of :intent, String
|
43
|
+
object_of :payer, Payer
|
44
|
+
array_of :transactions, Transaction
|
45
|
+
object_of :state, String
|
46
|
+
object_of :redirect_urls, RedirectUrls
|
47
|
+
array_of :links, Links
|
48
|
+
end
|
49
|
+
|
50
|
+
include RequestDataType
|
51
|
+
|
52
|
+
def create()
|
53
|
+
path = "v1/payments/payment"
|
54
|
+
response = api.post(path, self.to_hash, http_header)
|
55
|
+
self.merge!(response)
|
56
|
+
success?
|
57
|
+
end
|
58
|
+
|
59
|
+
class << self
|
60
|
+
def find(resource_id)
|
61
|
+
raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
|
62
|
+
path = "v1/payments/payment/#{resource_id}"
|
63
|
+
self.new(api.get(path))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def execute(payment_execution)
|
68
|
+
payment_execution = PaymentExecution.new(payment_execution) unless payment_execution.is_a? PaymentExecution
|
69
|
+
path = "v1/payments/payment/#{self.id}/execute"
|
70
|
+
response = api.post(path, payment_execution.to_hash, http_header)
|
71
|
+
self.merge!(response)
|
72
|
+
success?
|
73
|
+
end
|
74
|
+
|
75
|
+
class << self
|
76
|
+
def all(options = {})
|
77
|
+
path = "v1/payments/payment"
|
78
|
+
PaymentHistory.new(api.get(path, options))
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
class Payer < Base
|
84
|
+
|
85
|
+
def self.load_members
|
86
|
+
object_of :payment_method, String
|
87
|
+
array_of :funding_instruments, FundingInstrument
|
88
|
+
object_of :payer_info, PayerInfo
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
class FundingInstrument < Base
|
93
|
+
|
94
|
+
def self.load_members
|
95
|
+
object_of :credit_card, CreditCard
|
96
|
+
object_of :credit_card_token, CreditCardToken
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
class CreditCard < Base
|
101
|
+
|
102
|
+
def self.load_members
|
103
|
+
object_of :id, String
|
104
|
+
object_of :number, String
|
105
|
+
object_of :type, String
|
106
|
+
object_of :expire_month, Integer
|
107
|
+
object_of :expire_year, Integer
|
108
|
+
object_of :cvv2, String
|
109
|
+
object_of :first_name, String
|
110
|
+
object_of :last_name, String
|
111
|
+
object_of :billing_address, Address
|
112
|
+
object_of :payer_id, String
|
113
|
+
object_of :state, String
|
114
|
+
object_of :valid_until, String
|
115
|
+
array_of :links, Links
|
116
|
+
end
|
117
|
+
|
118
|
+
include RequestDataType
|
119
|
+
|
120
|
+
def create()
|
121
|
+
path = "v1/vault/credit-card"
|
122
|
+
response = api.post(path, self.to_hash, http_header)
|
123
|
+
self.merge!(response)
|
124
|
+
success?
|
125
|
+
end
|
126
|
+
|
127
|
+
class << self
|
128
|
+
def find(resource_id)
|
129
|
+
raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
|
130
|
+
path = "v1/vault/credit-card/#{resource_id}"
|
131
|
+
self.new(api.get(path))
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def delete()
|
136
|
+
path = "v1/vault/credit-card/#{self.id}"
|
137
|
+
response = api.delete(path, {})
|
138
|
+
self.merge!(response)
|
139
|
+
success?
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
143
|
+
class Address < Base
|
144
|
+
|
145
|
+
def self.load_members
|
146
|
+
object_of :line1, String
|
147
|
+
object_of :line2, String
|
148
|
+
object_of :city, String
|
149
|
+
object_of :country_code, String
|
150
|
+
object_of :postal_code, String
|
151
|
+
object_of :state, String
|
152
|
+
object_of :phone, String
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
class Links < Base
|
157
|
+
|
158
|
+
def self.load_members
|
159
|
+
object_of :href, String
|
160
|
+
object_of :rel, String
|
161
|
+
object_of :targetSchema, HyperSchema
|
162
|
+
object_of :method, String
|
163
|
+
object_of :enctype, String
|
164
|
+
object_of :schema, HyperSchema
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
class HyperSchema < Base
|
169
|
+
|
170
|
+
def self.load_members
|
171
|
+
array_of :links, Links
|
172
|
+
object_of :fragmentResolution, String
|
173
|
+
object_of :readonly, Boolean
|
174
|
+
object_of :contentEncoding, String
|
175
|
+
object_of :pathStart, String
|
176
|
+
object_of :mediaType, String
|
177
|
+
end
|
178
|
+
|
179
|
+
end
|
180
|
+
class CreditCardToken < Base
|
181
|
+
|
182
|
+
def self.load_members
|
183
|
+
object_of :credit_card_id, String
|
184
|
+
object_of :payer_id, String
|
185
|
+
object_of :last4, String
|
186
|
+
object_of :type, String
|
187
|
+
object_of :expire_month, Integer
|
188
|
+
object_of :expire_year, Integer
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
192
|
+
class PayerInfo < Base
|
193
|
+
|
194
|
+
def self.load_members
|
195
|
+
object_of :email, String
|
196
|
+
object_of :first_name, String
|
197
|
+
object_of :last_name, String
|
198
|
+
object_of :payer_id, String
|
199
|
+
object_of :phone, String
|
200
|
+
object_of :shipping_address, Address
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
204
|
+
class Transaction < Base
|
205
|
+
|
206
|
+
def self.load_members
|
207
|
+
object_of :amount, Amount
|
208
|
+
object_of :payee, Payee
|
209
|
+
object_of :description, String
|
210
|
+
object_of :item_list, ItemList
|
211
|
+
array_of :related_resources, RelatedResources
|
212
|
+
array_of :transactions, Transaction
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
216
|
+
class Amount < Base
|
217
|
+
|
218
|
+
def self.load_members
|
219
|
+
object_of :currency, String
|
220
|
+
object_of :total, String
|
221
|
+
object_of :details, Details
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|
225
|
+
class Details < Base
|
226
|
+
|
227
|
+
def self.load_members
|
228
|
+
object_of :shipping, String
|
229
|
+
object_of :subtotal, String
|
230
|
+
object_of :tax, String
|
231
|
+
object_of :fee, String
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
235
|
+
class Payee < Base
|
236
|
+
|
237
|
+
def self.load_members
|
238
|
+
object_of :email, String
|
239
|
+
object_of :merchant_id, String
|
240
|
+
object_of :phone, String
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
class Item < Base
|
245
|
+
|
246
|
+
def self.load_members
|
247
|
+
object_of :quantity, String
|
248
|
+
object_of :name, String
|
249
|
+
object_of :price, String
|
250
|
+
object_of :currency, String
|
251
|
+
object_of :sku, String
|
252
|
+
end
|
253
|
+
|
254
|
+
end
|
255
|
+
class ShippingAddress < Address
|
256
|
+
|
257
|
+
def self.load_members
|
258
|
+
object_of :recipient_name, String
|
259
|
+
end
|
260
|
+
|
261
|
+
end
|
262
|
+
class ItemList < Base
|
263
|
+
|
264
|
+
def self.load_members
|
265
|
+
array_of :items, Item
|
266
|
+
object_of :shipping_address, ShippingAddress
|
267
|
+
end
|
268
|
+
|
269
|
+
end
|
270
|
+
class RelatedResources < Base
|
271
|
+
|
272
|
+
def self.load_members
|
273
|
+
object_of :sale, Sale
|
274
|
+
object_of :authorization, Authorization
|
275
|
+
object_of :capture, Capture
|
276
|
+
object_of :refund, Refund
|
277
|
+
end
|
278
|
+
|
279
|
+
end
|
280
|
+
class Sale < Base
|
281
|
+
|
282
|
+
def self.load_members
|
283
|
+
object_of :id, String
|
284
|
+
object_of :create_time, DateTime
|
285
|
+
object_of :update_time, DateTime
|
286
|
+
object_of :amount, Amount
|
287
|
+
object_of :state, String
|
288
|
+
object_of :parent_payment, String
|
289
|
+
array_of :links, Links
|
290
|
+
end
|
291
|
+
|
292
|
+
include RequestDataType
|
293
|
+
|
294
|
+
class << self
|
295
|
+
def find(resource_id)
|
296
|
+
raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
|
297
|
+
path = "v1/payments/sale/#{resource_id}"
|
298
|
+
self.new(api.get(path))
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
def refund(refund)
|
303
|
+
refund = Refund.new(refund) unless refund.is_a? Refund
|
304
|
+
path = "v1/payments/sale/#{self.id}/refund"
|
305
|
+
response = api.post(path, refund.to_hash, http_header)
|
306
|
+
Refund.new(response)
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
310
|
+
class Authorization < Base
|
311
|
+
|
312
|
+
def self.load_members
|
313
|
+
object_of :id, String
|
314
|
+
object_of :create_time, DateTime
|
315
|
+
object_of :update_time, DateTime
|
316
|
+
object_of :amount, Amount
|
317
|
+
object_of :state, String
|
318
|
+
object_of :parent_payment, String
|
319
|
+
object_of :valid_until, String
|
320
|
+
array_of :links, Links
|
321
|
+
end
|
322
|
+
|
323
|
+
include RequestDataType
|
324
|
+
|
325
|
+
class << self
|
326
|
+
def find(resource_id)
|
327
|
+
raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
|
328
|
+
path = "v1/payments/authorization/#{resource_id}"
|
329
|
+
self.new(api.get(path))
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
def capture(capture)
|
334
|
+
capture = Capture.new(capture) unless capture.is_a? Capture
|
335
|
+
path = "v1/payments/authorization/#{self.id}/capture"
|
336
|
+
response = api.post(path, capture.to_hash, http_header)
|
337
|
+
Capture.new(response)
|
338
|
+
end
|
339
|
+
|
340
|
+
def void()
|
341
|
+
path = "v1/payments/authorization/#{self.id}/void"
|
342
|
+
response = api.post(path, {}, http_header)
|
343
|
+
self.merge!(response)
|
344
|
+
success?
|
345
|
+
end
|
346
|
+
|
347
|
+
def reauthorize()
|
348
|
+
path = "v1/payments/authorization/#{self.id}/reauthorize"
|
349
|
+
response = api.post(path, self.to_hash, http_header)
|
350
|
+
self.merge!(response)
|
351
|
+
success?
|
352
|
+
end
|
353
|
+
|
354
|
+
end
|
355
|
+
class Capture < Base
|
356
|
+
|
357
|
+
def self.load_members
|
358
|
+
object_of :id, String
|
359
|
+
object_of :create_time, DateTime
|
360
|
+
object_of :update_time, DateTime
|
361
|
+
object_of :amount, Amount
|
362
|
+
object_of :is_final_capture, Boolean
|
363
|
+
object_of :state, String
|
364
|
+
object_of :parent_payment, String
|
365
|
+
array_of :links, Links
|
366
|
+
end
|
367
|
+
|
368
|
+
include RequestDataType
|
369
|
+
|
370
|
+
class << self
|
371
|
+
def find(resource_id)
|
372
|
+
raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
|
373
|
+
path = "v1/payments/capture/#{resource_id}"
|
374
|
+
self.new(api.get(path))
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
def refund(refund)
|
379
|
+
refund = Refund.new(refund) unless refund.is_a? Refund
|
380
|
+
path = "v1/payments/capture/#{self.id}/refund"
|
381
|
+
response = api.post(path, refund.to_hash, http_header)
|
382
|
+
Refund.new(response)
|
383
|
+
end
|
384
|
+
|
385
|
+
end
|
386
|
+
class Refund < Base
|
387
|
+
|
388
|
+
def self.load_members
|
389
|
+
object_of :id, String
|
390
|
+
object_of :create_time, DateTime
|
391
|
+
object_of :amount, Amount
|
392
|
+
object_of :state, String
|
393
|
+
object_of :sale_id, String
|
394
|
+
object_of :capture_id, String
|
395
|
+
object_of :parent_payment, String
|
396
|
+
array_of :links, Links
|
397
|
+
end
|
398
|
+
|
399
|
+
include RequestDataType
|
400
|
+
|
401
|
+
class << self
|
402
|
+
def find(resource_id)
|
403
|
+
raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
|
404
|
+
path = "v1/payments/refund/#{resource_id}"
|
405
|
+
self.new(api.get(path))
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
end
|
410
|
+
class RedirectUrls < Base
|
411
|
+
|
412
|
+
def self.load_members
|
413
|
+
object_of :return_url, String
|
414
|
+
object_of :cancel_url, String
|
415
|
+
end
|
416
|
+
|
417
|
+
end
|
418
|
+
class PaymentHistory < Base
|
419
|
+
|
420
|
+
def self.load_members
|
421
|
+
array_of :payments, Payment
|
422
|
+
object_of :count, Integer
|
423
|
+
object_of :next_id, String
|
424
|
+
end
|
425
|
+
|
426
|
+
end
|
427
|
+
class PaymentExecution < Base
|
428
|
+
|
429
|
+
def self.load_members
|
430
|
+
object_of :payer_id, String
|
431
|
+
array_of :transactions, Transactions
|
432
|
+
end
|
433
|
+
|
434
|
+
end
|
435
|
+
class Transactions < Base
|
436
|
+
|
437
|
+
def self.load_members
|
438
|
+
object_of :amount, Amount
|
439
|
+
end
|
440
|
+
|
441
|
+
end
|
442
|
+
class CreditCardHistory < Base
|
443
|
+
|
444
|
+
def self.load_members
|
445
|
+
array_of :"credit-cards", CreditCard
|
446
|
+
object_of :count, Integer
|
447
|
+
object_of :next_id, String
|
448
|
+
end
|
449
|
+
|
450
|
+
end
|
451
|
+
|
452
|
+
constants.each do |data_type_klass|
|
453
|
+
data_type_klass = const_get(data_type_klass)
|
454
|
+
data_type_klass.load_members if defined? data_type_klass.load_members
|
455
|
+
end
|
456
|
+
|
457
|
+
end
|
458
|
+
end
|
459
|
+
end
|