paypal-sdk-rest 0.9.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3c3037cfe5603fcc5f6cd67bbb0b57fd22fb5fb
4
- data.tar.gz: bf6ef9f16f08c64e8afb38ca4849e3cc6ffc10a5
3
+ metadata.gz: 00ac164bfad60dba6661fc2974c6894dc9eb1e14
4
+ data.tar.gz: 9218e8c10cbdc08fef6c79ef5be392ac79763b7e
5
5
  SHA512:
6
- metadata.gz: ec8f220361694ed13e8183dd6c2d943cca51c5880049bb4cc7f0c67570fc14e8153324735bb6b21ef0ed133c5721c10146069e7a5586bada9c4d7af7a8d072e6
7
- data.tar.gz: 6268eb70ee2a985b286bdb418812fc8f9c58cbe453e5453659ae7ac31caa0a59b196dc13922b8657bedc6964557f061a97fc9f91b4d631f5f5b6aaa7c1a04018
6
+ metadata.gz: f5d3e5d5f6c676bdfaebf33ad5e0247818401af6e1742a64487041c952d4628fff2fd699a2f98d9799901528ca55ca9c185eb5aa043c858c35274bc9f5d37b89
7
+ data.tar.gz: 91f3ecfeadb88bb0e7d6d3a909c6643ff54e1191a8065997a03630e7c8eb239d87255475d09392779dab3a0faae0cc3c8ee9a5b21360445cfe47f340694dcd2c
@@ -25,6 +25,7 @@ module PayPal
25
25
  def new(*args)
26
26
  API.new(*args)
27
27
  end
28
+
28
29
  include ClassMethods
29
30
 
30
31
  def included(klass)
@@ -15,7 +15,6 @@ module PayPal
15
15
  @user_agent ||= "PayPalSDK/PayPal-Ruby-SDK #{VERSION} (#{sdk_library_details})"
16
16
  end
17
17
  end
18
-
19
18
  end
20
19
  end
21
20
  end
@@ -37,21 +37,20 @@ module PayPal::SDK
37
37
  end
38
38
 
39
39
  class Payment < Base
40
-
41
40
  def self.load_members
42
- object_of :id, String
43
- object_of :intent, String
44
- object_of :payer, Payer
45
- object_of :cart, String
46
- array_of :transactions, Transaction
47
- array_of :failed_transactions, Error
48
- object_of :payment_instruction, PaymentInstruction
49
- object_of :state, String
50
- object_of :experience_profile_id, String
51
- object_of :redirect_urls, RedirectUrls
52
- object_of :create_time, String
53
- object_of :update_time, String
54
- array_of :links, Links
41
+ object_of :id, String
42
+ object_of :intent, String
43
+ object_of :payer, Payer
44
+ object_of :cart, String
45
+ array_of :transactions, Transaction
46
+ array_of :failed_transactions, Error
47
+ object_of :payment_instruction, PaymentInstruction
48
+ object_of :state, String
49
+ object_of :experience_profile_id, String
50
+ object_of :redirect_urls, RedirectUrls
51
+ object_of :create_time, String
52
+ object_of :update_time, String
53
+ array_of :links, Links
55
54
  end
56
55
 
57
56
  include RequestDataType
@@ -63,14 +62,6 @@ module PayPal::SDK
63
62
  success?
64
63
  end
65
64
 
66
- class << self
67
- def find(resource_id)
68
- raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
69
- path = "v1/payments/payment/#{resource_id}"
70
- self.new(api.get(path))
71
- end
72
- end
73
-
74
65
  def update(patch_request)
75
66
  patch_request = PatchRequest.new(patch_request) unless patch_request.is_a? PatchRequest
76
67
  path = "v1/payments/payment/#{self.id}"
@@ -87,52 +78,55 @@ module PayPal::SDK
87
78
  end
88
79
 
89
80
  class << self
81
+ def find(resource_id)
82
+ raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
83
+ path = "v1/payments/payment/#{resource_id}"
84
+ self.new(api.get(path))
85
+ end
86
+
90
87
  def all(options = {})
91
88
  path = "v1/payments/payment"
92
89
  PaymentHistory.new(api.get(path, options))
93
90
  end
94
91
  end
95
-
96
92
  end
97
- class Payer < Base
98
93
 
94
+ class Payer < Base
99
95
  def self.load_members
100
- object_of :payment_method, String
101
- object_of :status, String
102
- array_of :funding_instruments, FundingInstrument
103
- object_of :funding_option_id, String
104
- object_of :funding_option, FundingOption
105
- object_of :related_funding_option, FundingOption
106
- object_of :payer_info, PayerInfo
96
+ object_of :payment_method, String
97
+ object_of :status, String
98
+ array_of :funding_instruments, FundingInstrument
99
+ object_of :funding_option_id, String
100
+ object_of :funding_option, FundingOption
101
+ object_of :related_funding_option, FundingOption
102
+ object_of :payer_info, PayerInfo
107
103
  end
108
-
109
104
  end
110
- class FundingInstrument < Base
111
105
 
106
+ class FundingInstrument < Base
112
107
  def self.load_members
113
- object_of :credit_card, CreditCard
114
- object_of :credit_card_token, CreditCardToken
108
+ object_of :credit_card, CreditCard
109
+ object_of :credit_card_token, CreditCardToken
115
110
  end
116
-
117
111
  end
118
- class CreditCard < Base
119
112
 
113
+ class CreditCard < Base
120
114
  def self.load_members
121
- object_of :id, String
122
- object_of :number, String
123
- object_of :type, String
124
- object_of :expire_month, Integer
125
- object_of :expire_year, Integer
126
- object_of :cvv2, String
127
- object_of :first_name, String
128
- object_of :last_name, String
129
- object_of :billing_address, Address
130
- object_of :external_customer_id, String
131
- object_of :state, String
132
- object_of :valid_until, String
133
- object_of :create_time, String
134
- object_of :update_time, String
135
- array_of :links, Links
115
+ object_of :id, String
116
+ object_of :number, String
117
+ object_of :type, String
118
+ object_of :expire_month, Integer
119
+ object_of :expire_year, Integer
120
+ object_of :cvv2, String
121
+ object_of :first_name, String
122
+ object_of :last_name, String
123
+ object_of :billing_address, Address
124
+ object_of :external_customer_id, String
125
+ object_of :state, String
126
+ object_of :valid_until, String
127
+ object_of :create_time, String
128
+ object_of :update_time, String
129
+ array_of :links, Links
136
130
  end
137
131
 
138
132
  include RequestDataType
@@ -165,88 +159,83 @@ module PayPal::SDK
165
159
  self.merge!(response)
166
160
  success?
167
161
  end
168
-
169
162
  end
170
- class Address < Base
171
163
 
164
+ class Address < Base
172
165
  def self.load_members
173
- object_of :line1, String
174
- object_of :line2, String
175
- object_of :city, String
176
- object_of :country_code, String
177
- object_of :postal_code, String
178
- object_of :state, String
179
- object_of :phone, String
180
- object_of :normalization_status, String
166
+ object_of :line1, String
167
+ object_of :line2, String
168
+ object_of :city, String
169
+ object_of :country_code, String
170
+ object_of :postal_code, String
171
+ object_of :state, String
172
+ object_of :phone, String
173
+ object_of :normalization_status, String
181
174
  end
182
-
183
175
  end
184
- class OneOf < Base
185
176
 
177
+ class OneOf < Base
186
178
  def self.load_members
187
- object_of :phone, Phone
179
+ object_of :phone, Phone
188
180
  end
189
-
190
181
  end
191
- class CreditCardToken < Base
192
182
 
183
+ class CreditCardToken < Base
193
184
  def self.load_members
194
- object_of :credit_card_id, String
195
- object_of :payer_id, String
196
- object_of :last4, String
197
- object_of :type, String
198
- object_of :expire_month, Integer
199
- object_of :expire_year, Integer
185
+ object_of :credit_card_id, String
186
+ object_of :payer_id, String
187
+ object_of :last4, String
188
+ object_of :type, String
189
+ object_of :expire_month, Integer
190
+ object_of :expire_year, Integer
200
191
  end
201
-
202
192
  end
203
- class PaymentCard < Base
204
193
 
194
+ class PaymentCard < Base
205
195
  def self.load_members
206
- object_of :id, String
207
- object_of :number, String
208
- object_of :type, String
209
- object_of :expire_month, Integer
210
- object_of :expire_year, Integer
211
- object_of :start_month, String
212
- object_of :start_year, String
213
- object_of :cvv2, String
214
- object_of :first_name, String
215
- object_of :last_name, String
216
- object_of :billing_country, String
217
- object_of :billing_address, Address
218
- object_of :external_customer_id, String
219
- object_of :status, String
220
- object_of :valid_until, String
196
+ object_of :id, String
197
+ object_of :number, String
198
+ object_of :type, String
199
+ object_of :expire_month, Integer
200
+ object_of :expire_year, Integer
201
+ object_of :start_month, String
202
+ object_of :start_year, String
203
+ object_of :cvv2, String
204
+ object_of :first_name, String
205
+ object_of :last_name, String
206
+ object_of :billing_country, String
207
+ object_of :billing_address, Address
208
+ object_of :external_customer_id, String
209
+ object_of :status, String
210
+ object_of :valid_until, String
221
211
  end
222
-
223
212
  end
224
- class BankAccount < Base
225
213
 
214
+ class BankAccount < Base
226
215
  def self.load_members
227
- object_of :id, String
228
- object_of :account_number, String
229
- object_of :account_number_type, String
230
- object_of :routing_number, String
231
- object_of :account_type, String
232
- object_of :account_name, String
233
- object_of :check_type, String
234
- object_of :auth_type, String
235
- object_of :auth_capture_timestamp, String
236
- object_of :bank_name, String
237
- object_of :country_code, String
238
- object_of :first_name, String
239
- object_of :last_name, String
240
- object_of :birth_date, String
241
- object_of :billing_address, Address
242
- object_of :state, String
243
- object_of :confirmation_status, String
244
- object_of :payer_id, String
245
- object_of :external_customer_id, String
246
- object_of :merchant_id, String
247
- object_of :create_time, String
248
- object_of :update_time, String
249
- object_of :valid_until, String
216
+ object_of :id, String
217
+ object_of :account_number, String
218
+ object_of :account_number_type, String
219
+ object_of :routing_number, String
220
+ object_of :account_type, String
221
+ object_of :account_name, String
222
+ object_of :check_type, String
223
+ object_of :auth_type, String
224
+ object_of :auth_capture_timestamp, String
225
+ object_of :bank_name, String
226
+ object_of :country_code, String
227
+ object_of :first_name, String
228
+ object_of :last_name, String
229
+ object_of :birth_date, String
230
+ object_of :billing_address, Address
231
+ object_of :state, String
232
+ object_of :confirmation_status, String
233
+ object_of :payer_id, String
234
+ object_of :external_customer_id, String
235
+ object_of :merchant_id, String
236
+ object_of :create_time, String
237
+ object_of :update_time, String
238
+ object_of :valid_until, String
250
239
  end
251
240
 
252
241
  include RequestDataType
@@ -280,157 +269,142 @@ module PayPal::SDK
280
269
  self.merge!(response)
281
270
  success?
282
271
  end
283
-
284
272
  end
285
- class ExtendedBankAccount < BankAccount
286
273
 
274
+ class ExtendedBankAccount < BankAccount
287
275
  def self.load_members
288
- object_of :mandate_reference_number, String
276
+ object_of :mandate_reference_number, String
289
277
  end
290
-
291
278
  end
292
- class BankToken < Base
293
279
 
280
+ class BankToken < Base
294
281
  def self.load_members
295
- object_of :bank_id, String
296
- object_of :external_customer_id, String
297
- object_of :mandate_reference_number, String
282
+ object_of :bank_id, String
283
+ object_of :external_customer_id, String
284
+ object_of :mandate_reference_number, String
298
285
  end
299
-
300
286
  end
301
- class Credit < Base
302
287
 
288
+ class Credit < Base
303
289
  def self.load_members
304
- object_of :id, String
305
- object_of :type, String
290
+ object_of :id, String
291
+ object_of :type, String
306
292
  end
307
-
308
293
  end
309
- class Incentive < Base
310
294
 
295
+ class Incentive < Base
311
296
  def self.load_members
312
- object_of :id, String
313
- object_of :code, String
314
- object_of :name, String
315
- object_of :description, String
316
- object_of :minimum_purchase_amount, Currency
317
- object_of :logo_image_url, String
318
- object_of :expiry_date, String
319
- object_of :type, String
320
- object_of :terms, String
297
+ object_of :id, String
298
+ object_of :code, String
299
+ object_of :name, String
300
+ object_of :description, String
301
+ object_of :minimum_purchase_amount, Currency
302
+ object_of :logo_image_url, String
303
+ object_of :expiry_date, String
304
+ object_of :type, String
305
+ object_of :terms, String
321
306
  end
322
-
323
307
  end
324
- class Currency < Base
325
308
 
309
+ class Currency < Base
326
310
  def self.load_members
327
- object_of :currency, String
328
- object_of :value, String
311
+ object_of :currency, String
312
+ object_of :value, String
329
313
  end
330
-
331
314
  end
332
- class CarrierAccountToken < Base
333
315
 
316
+ class CarrierAccountToken < Base
334
317
  def self.load_members
335
- object_of :carrier_account_id, String
336
- object_of :external_customer_id, String
318
+ object_of :carrier_account_id, String
319
+ object_of :external_customer_id, String
337
320
  end
338
-
339
321
  end
340
- class FundingOption < Base
341
322
 
323
+ class FundingOption < Base
342
324
  def self.load_members
343
- object_of :id, String
344
- array_of :funding_sources, FundingSource
345
- object_of :backup_funding_instrument, FundingInstrument
346
- object_of :currency_conversion, CurrencyConversion
347
- object_of :installment_info, InstallmentInfo
325
+ object_of :id, String
326
+ array_of :funding_sources, FundingSource
327
+ object_of :backup_funding_instrument, FundingInstrument
328
+ object_of :currency_conversion, CurrencyConversion
329
+ object_of :installment_info, InstallmentInfo
348
330
  end
349
-
350
331
  end
351
- class FundingSource < Base
352
332
 
333
+ class FundingSource < Base
353
334
  def self.load_members
354
- object_of :funding_mode, String
355
- object_of :funding_instrument_type, String
356
- object_of :soft_descriptor, String
357
- object_of :amount, Currency
358
- object_of :legal_text, String
359
- object_of :funding_detail, FundingDetail
360
- object_of :additional_text, String
361
- object_of :extends, FundingInstrument
335
+ object_of :funding_mode, String
336
+ object_of :funding_instrument_type, String
337
+ object_of :soft_descriptor, String
338
+ object_of :amount, Currency
339
+ object_of :legal_text, String
340
+ object_of :funding_detail, FundingDetail
341
+ object_of :additional_text, String
342
+ object_of :extends, FundingInstrument
362
343
  end
363
-
364
344
  end
365
- class FundingDetail < Base
366
345
 
346
+ class FundingDetail < Base
367
347
  def self.load_members
368
- object_of :clearing_time, String
369
- object_of :payment_hold_date, String
348
+ object_of :clearing_time, String
349
+ object_of :payment_hold_date, String
370
350
  end
371
-
372
351
  end
373
- class CurrencyConversion < Base
374
352
 
353
+ class CurrencyConversion < Base
375
354
  def self.load_members
376
- object_of :conversion_date, String
377
- object_of :from_currency, String
378
- object_of :from_amount, Number
379
- object_of :to_currency, String
380
- object_of :to_amount, Number
381
- object_of :conversion_type, String
382
- object_of :conversion_type_changeable, Boolean
383
- object_of :web_url, String
355
+ object_of :conversion_date, String
356
+ object_of :from_currency, String
357
+ object_of :from_amount, Number
358
+ object_of :to_currency, String
359
+ object_of :to_amount, Number
360
+ object_of :conversion_type, String
361
+ object_of :conversion_type_changeable, Boolean
362
+ object_of :web_url, String
384
363
  end
385
-
386
364
  end
387
- class InstallmentInfo < Base
388
365
 
366
+ class InstallmentInfo < Base
389
367
  def self.load_members
390
- object_of :installment_id, String
391
- object_of :network, String
392
- object_of :issuer, String
393
- array_of :installment_options, InstallmentOption
368
+ object_of :installment_id, String
369
+ object_of :network, String
370
+ object_of :issuer, String
371
+ array_of :installment_options, InstallmentOption
394
372
  end
395
-
396
373
  end
397
- class InstallmentOption < Base
398
374
 
375
+ class InstallmentOption < Base
399
376
  def self.load_members
400
- object_of :term, Integer
401
- object_of :monthly_payment, Currency
402
- object_of :discount_amount, Currency
403
- object_of :discount_percentage, Percentage
377
+ object_of :term, Integer
378
+ object_of :monthly_payment, Currency
379
+ object_of :discount_amount, Currency
380
+ object_of :discount_percentage, Percentage
404
381
  end
405
-
406
382
  end
407
- class Percentage < Base
408
383
 
384
+ class Percentage < Base
409
385
  def self.load_members
410
386
  end
411
-
412
387
  end
413
- class PayerInfo < Base
414
388
 
389
+ class PayerInfo < Base
415
390
  def self.load_members
416
- object_of :email, String
417
- object_of :external_remember_me_id, String
418
- object_of :buyer_account_number, String
419
- object_of :first_name, String
420
- object_of :last_name, String
421
- object_of :payer_id, String
422
- object_of :phone, String
423
- object_of :phone_type, String
424
- object_of :birth_date, String
425
- object_of :tax_id, String
426
- object_of :tax_id_type, String
427
- object_of :billing_address, Address
428
- object_of :shipping_address, ShippingAddress
391
+ object_of :email, String
392
+ object_of :external_remember_me_id, String
393
+ object_of :buyer_account_number, String
394
+ object_of :first_name, String
395
+ object_of :last_name, String
396
+ object_of :payer_id, String
397
+ object_of :phone, String
398
+ object_of :phone_type, String
399
+ object_of :birth_date, String
400
+ object_of :tax_id, String
401
+ object_of :tax_id_type, String
402
+ object_of :billing_address, Address
403
+ object_of :shipping_address, ShippingAddress
429
404
  end
430
-
431
405
  end
432
- class ShippingAddress < Base
433
406
 
407
+ class ShippingAddress < Base
434
408
  def self.load_members
435
409
  object_of :line1, String
436
410
  object_of :line2, String
@@ -441,17 +415,15 @@ module PayPal::SDK
441
415
  object_of :phone, String
442
416
  object_of :recipient_name, String
443
417
  end
444
-
445
418
  end
446
- class AllOf < Base
447
419
 
420
+ class AllOf < Base
448
421
  def self.load_members
449
- array_of :related_resources, RelatedResources
422
+ array_of :related_resources, RelatedResources
450
423
  end
451
-
452
424
  end
453
- class Transaction < Base
454
425
 
426
+ class Transaction < Base
455
427
  def self.load_members
456
428
  object_of :amount, Amount
457
429
  object_of :payee, Payee
@@ -463,102 +435,92 @@ module PayPal::SDK
463
435
  array_of :related_resources, RelatedResources
464
436
  array_of :transactions, Transaction
465
437
  end
466
-
467
438
  end
468
- class CartBase < Base
469
439
 
440
+ class CartBase < Base
470
441
  def self.load_members
471
- object_of :amount, Amount
472
- object_of :payee, Payee
473
- object_of :description, String
474
- object_of :note_to_payee, String
475
- object_of :custom, String
476
- object_of :invoice_number, String
477
- object_of :soft_descriptor, String
478
- object_of :payment_options, PaymentOptions
479
- object_of :item_list, ItemList
442
+ object_of :amount, Amount
443
+ object_of :payee, Payee
444
+ object_of :description, String
445
+ object_of :note_to_payee, String
446
+ object_of :custom, String
447
+ object_of :invoice_number, String
448
+ object_of :soft_descriptor, String
449
+ object_of :payment_options, PaymentOptions
450
+ object_of :item_list, ItemList
480
451
  end
481
-
482
452
  end
483
- class Amount < Base
484
453
 
454
+ class Amount < Base
485
455
  def self.load_members
486
- object_of :currency, String
487
- object_of :total, String
488
- object_of :details, Details
456
+ object_of :currency, String
457
+ object_of :total, String
458
+ object_of :details, Details
489
459
  end
490
-
491
460
  end
492
- class Details < Base
493
461
 
462
+ class Details < Base
494
463
  def self.load_members
495
- object_of :subtotal, String
496
- object_of :shipping, String
497
- object_of :tax, String
498
- object_of :handling_fee, String
499
- object_of :shipping_discount, String
500
- object_of :insurance, String
501
- object_of :gift_wrap, String
464
+ object_of :subtotal, String
465
+ object_of :shipping, String
466
+ object_of :tax, String
467
+ object_of :handling_fee, String
468
+ object_of :shipping_discount, String
469
+ object_of :insurance, String
470
+ object_of :gift_wrap, String
502
471
  end
503
-
504
472
  end
505
- class Payee < Base
506
473
 
474
+ class Payee < Base
507
475
  def self.load_members
508
476
  end
509
-
510
477
  end
511
- class Phone < Base
512
478
 
479
+ class Phone < Base
513
480
  def self.load_members
514
- object_of :country_code, String
515
- object_of :national_number, String
516
- object_of :extension, String
481
+ object_of :country_code, String
482
+ object_of :national_number, String
483
+ object_of :extension, String
517
484
  end
518
-
519
485
  end
520
- class PaymentOptions < Base
521
486
 
487
+ class PaymentOptions < Base
522
488
  def self.load_members
523
- object_of :allowed_payment_method, String
489
+ object_of :allowed_payment_method, String
524
490
  end
525
-
526
491
  end
527
- class Item < Base
528
492
 
493
+ class Item < Base
529
494
  def self.load_members
530
- object_of :quantity, String
531
- object_of :name, String
532
- object_of :description, String
533
- object_of :price, String
534
- object_of :tax, String
535
- object_of :currency, String
536
- object_of :sku, String
537
- object_of :url, String
538
- object_of :category, String
539
- array_of :supplementary_data, NameValuePair
540
- array_of :postback_data, NameValuePair
495
+ object_of :quantity, String
496
+ object_of :name, String
497
+ object_of :description, String
498
+ object_of :price, String
499
+ object_of :tax, String
500
+ object_of :currency, String
501
+ object_of :sku, String
502
+ object_of :url, String
503
+ object_of :category, String
504
+ array_of :supplementary_data, NameValuePair
505
+ array_of :postback_data, NameValuePair
541
506
  end
542
-
543
507
  end
544
- class NameValuePair < Base
545
508
 
509
+ class NameValuePair < Base
546
510
  def self.load_members
547
- object_of :name, String
548
- object_of :value, String
511
+ object_of :name, String
512
+ object_of :value, String
549
513
  end
550
-
551
514
  end
552
- class ItemList < Base
553
515
 
516
+ class ItemList < Base
554
517
  def self.load_members
555
- array_of :items, Item
556
- object_of :shipping_address, ShippingAddress
518
+ array_of :items, Item
519
+ object_of :shipping_address, ShippingAddress
557
520
  end
558
-
559
521
  end
560
- class RelatedResources < Base
561
522
 
523
+ class RelatedResources < Base
562
524
  def self.load_members
563
525
  object_of :order, Order
564
526
  object_of :sale, Sale
@@ -566,24 +528,23 @@ module PayPal::SDK
566
528
  object_of :capture, Capture
567
529
  object_of :refund, Refund
568
530
  end
569
-
570
531
  end
571
- class Sale < Base
572
532
 
533
+ class Sale < Base
573
534
  def self.load_members
574
- object_of :id, String
575
- object_of :purchase_unit_reference_id, String
576
- object_of :amount, Amount
577
- object_of :payment_mode, String
578
- object_of :state, String
579
- object_of :reason_code, String
580
- object_of :protection_eligibility, String
581
- object_of :protection_eligibility_type, String
582
- object_of :clearing_time, String
583
- object_of :parent_payment, String
584
- object_of :create_time, String
585
- object_of :update_time, String
586
- array_of :links, Links
535
+ object_of :id, String
536
+ object_of :purchase_unit_reference_id, String
537
+ object_of :amount, Amount
538
+ object_of :payment_mode, String
539
+ object_of :state, String
540
+ object_of :reason_code, String
541
+ object_of :protection_eligibility, String
542
+ object_of :protection_eligibility_type, String
543
+ object_of :clearing_time, String
544
+ object_of :parent_payment, String
545
+ object_of :create_time, String
546
+ object_of :update_time, String
547
+ array_of :links, Links
587
548
  end
588
549
 
589
550
  include RequestDataType
@@ -602,29 +563,27 @@ module PayPal::SDK
602
563
  response = api.post(path, refund.to_hash, http_header)
603
564
  Refund.new(response)
604
565
  end
605
-
606
566
  end
607
- class AnyOf < Base
608
567
 
568
+ class AnyOf < Base
609
569
  def self.load_members
610
- object_of :refund, Refund
570
+ object_of :refund, Refund
611
571
  end
612
-
613
572
  end
614
- class Authorization < Base
615
573
 
574
+ class Authorization < Base
616
575
  def self.load_members
617
- object_of :id, String
618
- object_of :amount, Amount
619
- object_of :payment_mode, String
620
- object_of :state, String
621
- object_of :protection_eligibility, String
622
- object_of :protection_eligibility_type, String
623
- object_of :parent_payment, String
624
- object_of :valid_until, String
625
- object_of :create_time, String
626
- object_of :update_time, String
627
- array_of :links, Links
576
+ object_of :id, String
577
+ object_of :amount, Amount
578
+ object_of :payment_mode, String
579
+ object_of :state, String
580
+ object_of :protection_eligibility, String
581
+ object_of :protection_eligibility_type, String
582
+ object_of :parent_payment, String
583
+ object_of :valid_until, String
584
+ object_of :create_time, String
585
+ object_of :update_time, String
586
+ array_of :links, Links
628
587
  end
629
588
 
630
589
  include RequestDataType
@@ -657,23 +616,22 @@ module PayPal::SDK
657
616
  self.merge!(response)
658
617
  success?
659
618
  end
660
-
661
619
  end
662
- class Order < Base
663
620
 
621
+ class Order < Base
664
622
  def self.load_members
665
- object_of :id, String
666
- object_of :purchase_unit_reference_id, String
667
- object_of :amount, Amount
668
- object_of :payment_mode, String
669
- object_of :state, String
670
- object_of :pending_reason, String
671
- object_of :"protection-eligibility", String
672
- object_of :"protection-eligibility_type", String
673
- object_of :parent_payment, String
674
- object_of :create_time, String
675
- object_of :update_time, String
676
- array_of :links, Links
623
+ object_of :id, String
624
+ object_of :purchase_unit_reference_id, String
625
+ object_of :amount, Amount
626
+ object_of :payment_mode, String
627
+ object_of :state, String
628
+ object_of :pending_reason, String
629
+ object_of :"protection-eligibility", String
630
+ object_of :"protection-eligibility_type", String
631
+ object_of :parent_payment, String
632
+ object_of :create_time, String
633
+ object_of :update_time, String
634
+ array_of :links, Links
677
635
  end
678
636
 
679
637
  include RequestDataType
@@ -705,19 +663,18 @@ module PayPal::SDK
705
663
  response = api.post(path, self.to_hash, http_header)
706
664
  Authorization.new(response)
707
665
  end
708
-
709
666
  end
710
- class Capture < Base
711
667
 
668
+ class Capture < Base
712
669
  def self.load_members
713
- object_of :id, String
714
- object_of :amount, Amount
715
- object_of :is_final_capture, Boolean
716
- object_of :state, String
717
- object_of :parent_payment, String
718
- object_of :create_time, String
719
- object_of :update_time, String
720
- array_of :links, Links
670
+ object_of :id, String
671
+ object_of :amount, Amount
672
+ object_of :is_final_capture, Boolean
673
+ object_of :state, String
674
+ object_of :parent_payment, String
675
+ object_of :create_time, String
676
+ object_of :update_time, String
677
+ array_of :links, Links
721
678
  end
722
679
 
723
680
  include RequestDataType
@@ -736,22 +693,21 @@ module PayPal::SDK
736
693
  response = api.post(path, refund.to_hash, http_header)
737
694
  Refund.new(response)
738
695
  end
739
-
740
696
  end
741
- class Refund < Base
742
697
 
698
+ class Refund < Base
743
699
  def self.load_members
744
- object_of :id, String
745
- object_of :amount, Amount
746
- object_of :state, String
747
- object_of :reason, String
748
- object_of :sale_id, String
749
- object_of :capture_id, String
750
- object_of :parent_payment, String
751
- object_of :description, String
752
- object_of :create_time, String
753
- object_of :update_time, String
754
- array_of :links, Links
700
+ object_of :id, String
701
+ object_of :amount, Amount
702
+ object_of :state, String
703
+ object_of :reason, String
704
+ object_of :sale_id, String
705
+ object_of :capture_id, String
706
+ object_of :parent_payment, String
707
+ object_of :description, String
708
+ object_of :create_time, String
709
+ object_of :update_time, String
710
+ array_of :links, Links
755
711
  end
756
712
 
757
713
  include RequestDataType
@@ -763,37 +719,34 @@ module PayPal::SDK
763
719
  self.new(api.get(path))
764
720
  end
765
721
  end
766
-
767
722
  end
768
- class Error < Base
769
723
 
724
+ class Error < Base
770
725
  def self.load_members
771
- object_of :name, String
772
- object_of :debug_id, String
773
- object_of :message, String
774
- object_of :information_link, String
775
- array_of :details, ErrorDetails
726
+ object_of :name, String
727
+ object_of :debug_id, String
728
+ object_of :message, String
729
+ object_of :information_link, String
730
+ array_of :details, ErrorDetails
776
731
  end
777
-
778
732
  end
779
- class ErrorDetails < Base
780
733
 
734
+ class ErrorDetails < Base
781
735
  def self.load_members
782
- object_of :field, String
783
- object_of :issue, String
736
+ object_of :field, String
737
+ object_of :issue, String
784
738
  end
785
-
786
739
  end
787
- class PaymentInstruction < Base
788
740
 
741
+ class PaymentInstruction < Base
789
742
  def self.load_members
790
- object_of :reference_number, String
791
- object_of :instruction_type, String
792
- object_of :recipient_banking_instruction, RecipientBankingInstruction
793
- object_of :amount, Currency
794
- object_of :payment_due_date, String
795
- object_of :note, String
796
- array_of :links, Links
743
+ object_of :reference_number, String
744
+ object_of :instruction_type, String
745
+ object_of :recipient_banking_instruction, RecipientBankingInstruction
746
+ object_of :amount, Currency
747
+ object_of :payment_due_date, String
748
+ object_of :note, String
749
+ array_of :links, Links
797
750
  end
798
751
 
799
752
  include RequestDataType
@@ -805,99 +758,96 @@ module PayPal::SDK
805
758
  self.new(api.get(path))
806
759
  end
807
760
  end
808
-
809
761
  end
810
- class RecipientBankingInstruction < Base
811
762
 
763
+ class RecipientBankingInstruction < Base
812
764
  def self.load_members
813
- object_of :bank_name, String
814
- object_of :account_holder_name, String
815
- object_of :account_number, String
816
- object_of :routing_number, String
817
- object_of :international_bank_account_number, String
818
- object_of :bank_identifier_code, String
765
+ object_of :bank_name, String
766
+ object_of :account_holder_name, String
767
+ object_of :account_number, String
768
+ object_of :routing_number, String
769
+ object_of :international_bank_account_number, String
770
+ object_of :bank_identifier_code, String
819
771
  end
820
-
821
772
  end
822
- class RedirectUrls < Base
823
773
 
774
+ class RedirectUrls < Base
824
775
  def self.load_members
825
- object_of :return_url, String
826
- object_of :cancel_url, String
776
+ object_of :return_url, String
777
+ object_of :cancel_url, String
827
778
  end
828
-
829
779
  end
830
- class Patch < Base
831
780
 
781
+ class Patch < Base
832
782
  def self.load_members
833
783
  object_of :op, String
834
784
  object_of :path, String
835
- object_of :value, String
785
+ object_of :value, Object
836
786
  object_of :from, String
837
787
  end
838
-
839
788
  end
840
- class PaymentExecution < Base
789
+ class PatchRequest < Base
841
790
 
842
791
  def self.load_members
843
- object_of :payer_id, String
844
- array_of :transactions, CartBase
845
792
  end
846
793
 
847
794
  end
848
- class PaymentHistory < Base
849
-
795
+ class PaymentExecution < Base
850
796
  def self.load_members
851
- array_of :payments, Payment
852
- object_of :count, Integer
853
- object_of :next_id, String
797
+ object_of :payer_id, String
798
+ array_of :transactions, CartBase
854
799
  end
855
-
856
800
  end
857
- class CreditCardList < Base
858
801
 
802
+ class PaymentHistory < Base
859
803
  def self.load_members
860
- array_of :"credit-cards", CreditCard
861
- object_of :count, Integer
862
- object_of :next_id, String
804
+ array_of :payments, Payment
805
+ object_of :count, Integer
806
+ object_of :next_id, String
863
807
  end
864
-
865
808
  end
866
- class BankAccountsList < Base
867
809
 
810
+ class CreditCardList < Base
868
811
  def self.load_members
869
- array_of :"bank-accounts", BankAccount
870
- object_of :count, Integer
871
- object_of :next_id, String
812
+ array_of :"credit-cards", CreditCard
813
+ object_of :count, Integer
814
+ object_of :next_id, String
872
815
  end
816
+ end
873
817
 
818
+ class BankAccountsList < Base
819
+ def self.load_members
820
+ array_of :"bank-accounts", BankAccount
821
+ object_of :count, Integer
822
+ object_of :next_id, String
823
+ end
874
824
  end
875
- class Invoice < Base
876
825
 
826
+ class Invoice < Base
877
827
  def self.load_members
878
- object_of :id, String
879
- object_of :number, String
880
- object_of :uri, String
881
- object_of :status, String
882
- object_of :merchant_info, MerchantInfo
883
- array_of :billing_info, BillingInfo
884
- object_of :shipping_info, ShippingInfo
885
- array_of :items, InvoiceItem
886
- object_of :invoice_date, String
887
- object_of :payment_term, PaymentTerm
888
- object_of :discount, Cost
889
- object_of :shipping_cost, ShippingCost
890
- object_of :custom, CustomAmount
891
- object_of :tax_calculated_after_discount, Boolean
892
- object_of :tax_inclusive, Boolean
893
- object_of :terms, String
894
- object_of :note, String
895
- object_of :merchant_memo, String
896
- object_of :logo_url, String
897
- object_of :total_amount, Currency
898
- array_of :payment_details, PaymentDetail
899
- array_of :refund_details, RefundDetail
900
- object_of :metadata, Metadata
828
+ object_of :id, String
829
+ object_of :number, String
830
+ object_of :uri, String
831
+ object_of :status, String
832
+ object_of :merchant_info, MerchantInfo
833
+ array_of :billing_info, BillingInfo
834
+ object_of :shipping_info, ShippingInfo
835
+ array_of :items, InvoiceItem
836
+ object_of :invoice_date, String
837
+ object_of :payment_term, PaymentTerm
838
+ object_of :discount, Cost
839
+ object_of :shipping_cost, ShippingCost
840
+ object_of :custom, CustomAmount
841
+ object_of :tax_calculated_after_discount, Boolean
842
+ object_of :tax_inclusive, Boolean
843
+ object_of :terms, String
844
+ object_of :note, String
845
+ object_of :merchant_memo, String
846
+ object_of :logo_url, String
847
+ object_of :total_amount, Currency
848
+ array_of :payment_details, PaymentDetail
849
+ array_of :refund_details, RefundDetail
850
+ object_of :metadata, Metadata
901
851
  end
902
852
 
903
853
  include RequestDataType
@@ -909,14 +859,6 @@ module PayPal::SDK
909
859
  success?
910
860
  end
911
861
 
912
- class << self
913
- def self.search(options)
914
- path = "v1/invoicing/search"
915
- response = api.post(path, options)
916
- Invoices.new(response)
917
- end
918
- end
919
-
920
862
  def send_invoice()
921
863
  path = "v1/invoicing/invoices/#{self.id}/send"
922
864
  response = api.post(path, {}, http_header)
@@ -956,21 +898,6 @@ module PayPal::SDK
956
898
  success?
957
899
  end
958
900
 
959
- class << self
960
- def find(resource_id)
961
- raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
962
- path = "v1/invoicing/invoices/#{resource_id}"
963
- self.new(api.get(path))
964
- end
965
- end
966
-
967
- class << self
968
- def get_all(options = {})
969
- path = "v1/invoicing/invoices/"
970
- Invoices.new(api.get(path, options))
971
- end
972
- end
973
-
974
901
  def update()
975
902
  path = "v1/invoicing/invoices/#{self.id}"
976
903
  response = api.put(path, self.to_hash, http_header)
@@ -985,287 +912,276 @@ module PayPal::SDK
985
912
  success?
986
913
  end
987
914
 
915
+ class << self
916
+ def search(options)
917
+ path = "v1/invoicing/search"
918
+ response = api.post(path, options)
919
+ Invoices.new(response)
920
+ end
921
+
922
+ def find(resource_id)
923
+ raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
924
+ path = "v1/invoicing/invoices/#{resource_id}"
925
+ self.new(api.get(path))
926
+ end
927
+
928
+ def get_all(options = {})
929
+ path = "v1/invoicing/invoices/"
930
+ Invoices.new(api.get(path, options))
931
+ end
932
+ end
988
933
  end
989
- class Invoices < Base
990
934
 
935
+ class Invoices < Base
991
936
  def self.load_members
992
- object_of :total_count, Integer
993
- array_of :invoices, Invoice
937
+ object_of :total_count, Integer
938
+ array_of :invoices, Invoice
994
939
  end
995
-
996
940
  end
997
- class InvoiceItem < Base
998
941
 
942
+ class InvoiceItem < Base
999
943
  def self.load_members
1000
- object_of :name, String
1001
- object_of :description, String
1002
- object_of :quantity, Number
1003
- object_of :unit_price, Currency
1004
- object_of :tax, Tax
1005
- object_of :date, String
1006
- object_of :discount, Cost
944
+ object_of :name, String
945
+ object_of :description, String
946
+ object_of :quantity, Number
947
+ object_of :unit_price, Currency
948
+ object_of :tax, Tax
949
+ object_of :date, String
950
+ object_of :discount, Cost
1007
951
  end
1008
-
1009
952
  end
1010
- class MerchantInfo < Base
1011
953
 
954
+ class MerchantInfo < Base
1012
955
  def self.load_members
1013
- object_of :email, String
1014
- object_of :first_name, String
1015
- object_of :last_name, String
1016
- object_of :address, Address
1017
- object_of :business_name, String
1018
- object_of :phone, Phone
1019
- object_of :fax, Phone
1020
- object_of :website, String
1021
- object_of :tax_id, String
1022
- object_of :additional_info, String
956
+ object_of :email, String
957
+ object_of :first_name, String
958
+ object_of :last_name, String
959
+ object_of :address, Address
960
+ object_of :business_name, String
961
+ object_of :phone, Phone
962
+ object_of :fax, Phone
963
+ object_of :website, String
964
+ object_of :tax_id, String
965
+ object_of :additional_info, String
1023
966
  end
1024
-
1025
967
  end
1026
- class BillingInfo < Base
1027
968
 
969
+ class BillingInfo < Base
1028
970
  def self.load_members
1029
- object_of :email, String
1030
- object_of :first_name, String
1031
- object_of :last_name, String
1032
- object_of :business_name, String
1033
- object_of :address, Address
1034
- object_of :language, String
1035
- object_of :additional_info, String
971
+ object_of :email, String
972
+ object_of :first_name, String
973
+ object_of :last_name, String
974
+ object_of :business_name, String
975
+ object_of :address, Address
976
+ object_of :language, String
977
+ object_of :additional_info, String
1036
978
  end
1037
-
1038
979
  end
1039
- class ShippingInfo < Base
1040
980
 
981
+ class ShippingInfo < Base
1041
982
  def self.load_members
1042
- object_of :first_name, String
1043
- object_of :last_name, String
1044
- object_of :business_name, String
1045
- object_of :address, Address
1046
- object_of :email, String
983
+ object_of :first_name, String
984
+ object_of :last_name, String
985
+ object_of :business_name, String
986
+ object_of :address, Address
987
+ object_of :email, String
1047
988
  end
1048
-
1049
989
  end
1050
- class InvoicingNotification < Base
1051
990
 
991
+ class InvoicingNotification < Base
1052
992
  def self.load_members
1053
- object_of :subject, String
1054
- object_of :note, String
1055
- object_of :send_to_merchant, Boolean
993
+ object_of :subject, String
994
+ object_of :note, String
995
+ object_of :send_to_merchant, Boolean
1056
996
  end
1057
-
1058
997
  end
1059
- class InvoicingMetaData < Base
1060
998
 
999
+ class InvoicingMetaData < Base
1061
1000
  def self.load_members
1062
- object_of :created_date, String
1063
- object_of :created_by, String
1064
- object_of :cancelled_date, String
1065
- object_of :cancelled_by, String
1066
- object_of :last_updated_date, String
1067
- object_of :last_updated_by, String
1068
- object_of :first_sent_date, String
1069
- object_of :last_sent_date, String
1070
- object_of :last_sent_by, String
1001
+ object_of :created_date, String
1002
+ object_of :created_by, String
1003
+ object_of :cancelled_date, String
1004
+ object_of :cancelled_by, String
1005
+ object_of :last_updated_date, String
1006
+ object_of :last_updated_by, String
1007
+ object_of :first_sent_date, String
1008
+ object_of :last_sent_date, String
1009
+ object_of :last_sent_by, String
1071
1010
  end
1072
-
1073
1011
  end
1074
- class InvoicingPaymentDetail < Base
1075
1012
 
1013
+ class InvoicingPaymentDetail < Base
1076
1014
  def self.load_members
1077
- object_of :type, String
1078
- object_of :transaction_id, String
1079
- object_of :transaction_type, String
1080
- object_of :date, String
1081
- object_of :method, String
1082
- object_of :note, String
1015
+ object_of :type, String
1016
+ object_of :transaction_id, String
1017
+ object_of :transaction_type, String
1018
+ object_of :date, String
1019
+ object_of :method, String
1020
+ object_of :note, String
1083
1021
  end
1084
-
1085
1022
  end
1086
- class InvoicingRefundDetail < Base
1087
1023
 
1024
+ class InvoicingRefundDetail < Base
1088
1025
  def self.load_members
1089
- object_of :type, String
1090
- object_of :date, String
1091
- object_of :note, String
1026
+ object_of :type, String
1027
+ object_of :date, String
1028
+ object_of :note, String
1092
1029
  end
1093
-
1094
1030
  end
1095
- class InvoicingSearch < Base
1096
1031
 
1032
+ class InvoicingSearch < Base
1097
1033
  def self.load_members
1098
- object_of :email, String
1099
- object_of :recipient_first_name, String
1100
- object_of :recipient_last_name, String
1101
- object_of :recipient_business_name, String
1102
- object_of :number, String
1103
- object_of :status, String
1104
- object_of :lower_total_amount, Currency
1105
- object_of :upper_total_amount, Currency
1106
- object_of :start_invoice_date, String
1107
- object_of :end_invoice_date, String
1108
- object_of :start_due_date, String
1109
- object_of :end_due_date, String
1110
- object_of :start_payment_date, String
1111
- object_of :end_payment_date, String
1112
- object_of :start_creation_date, String
1113
- object_of :end_creation_date, String
1114
- object_of :page, Number
1115
- object_of :page_size, Number
1116
- object_of :total_count_required, Boolean
1034
+ object_of :email, String
1035
+ object_of :recipient_first_name, String
1036
+ object_of :recipient_last_name, String
1037
+ object_of :recipient_business_name, String
1038
+ object_of :number, String
1039
+ object_of :status, String
1040
+ object_of :lower_total_amount, Currency
1041
+ object_of :upper_total_amount, Currency
1042
+ object_of :start_invoice_date, String
1043
+ object_of :end_invoice_date, String
1044
+ object_of :start_due_date, String
1045
+ object_of :end_due_date, String
1046
+ object_of :start_payment_date, String
1047
+ object_of :end_payment_date, String
1048
+ object_of :start_creation_date, String
1049
+ object_of :end_creation_date, String
1050
+ object_of :page, Number
1051
+ object_of :page_size, Number
1052
+ object_of :total_count_required, Boolean
1117
1053
  end
1118
-
1119
1054
  end
1120
- class PaymentTerm < Base
1121
1055
 
1056
+ class PaymentTerm < Base
1122
1057
  def self.load_members
1123
- object_of :term_type, String
1124
- object_of :due_date, String
1058
+ object_of :term_type, String
1059
+ object_of :due_date, String
1125
1060
  end
1126
-
1127
1061
  end
1128
- class Cost < Base
1129
1062
 
1063
+ class Cost < Base
1130
1064
  def self.load_members
1131
- object_of :percent, Number
1132
- object_of :amount, Currency
1065
+ object_of :percent, Number
1066
+ object_of :amount, Currency
1133
1067
  end
1134
-
1135
1068
  end
1136
- class ShippingCost < Base
1137
1069
 
1070
+ class ShippingCost < Base
1138
1071
  def self.load_members
1139
- object_of :amount, Currency
1140
- object_of :tax, Tax
1072
+ object_of :amount, Currency
1073
+ object_of :tax, Tax
1141
1074
  end
1142
-
1143
1075
  end
1144
- class Tax < Base
1145
1076
 
1077
+ class Tax < Base
1146
1078
  def self.load_members
1147
- object_of :id, String
1148
- object_of :name, String
1149
- object_of :percent, Number
1150
- object_of :amount, Currency
1079
+ object_of :id, String
1080
+ object_of :name, String
1081
+ object_of :percent, Number
1082
+ object_of :amount, Currency
1151
1083
  end
1152
-
1153
1084
  end
1154
- class CustomAmount < Base
1155
1085
 
1086
+ class CustomAmount < Base
1156
1087
  def self.load_members
1157
- object_of :label, String
1158
- object_of :amount, Currency
1088
+ object_of :label, String
1089
+ object_of :amount, Currency
1159
1090
  end
1160
-
1161
1091
  end
1162
- class PaymentDetail < Base
1163
1092
 
1093
+ class PaymentDetail < Base
1164
1094
  def self.load_members
1165
- object_of :type, String
1166
- object_of :transaction_id, String
1167
- object_of :transaction_type, String
1168
- object_of :date, String
1169
- object_of :method, String
1170
- object_of :note, String
1095
+ object_of :type, String
1096
+ object_of :transaction_id, String
1097
+ object_of :transaction_type, String
1098
+ object_of :date, String
1099
+ object_of :method, String
1100
+ object_of :note, String
1171
1101
  end
1172
-
1173
1102
  end
1174
- class RefundDetail < Base
1175
1103
 
1104
+ class RefundDetail < Base
1176
1105
  def self.load_members
1177
- object_of :type, String
1178
- object_of :date, String
1179
- object_of :note, String
1106
+ object_of :type, String
1107
+ object_of :date, String
1108
+ object_of :note, String
1180
1109
  end
1181
-
1182
1110
  end
1183
- class Metadata < Base
1184
1111
 
1112
+ class Metadata < Base
1185
1113
  def self.load_members
1186
- object_of :created_date, String
1187
- object_of :created_by, String
1188
- object_of :cancelled_date, String
1189
- object_of :cancelled_by, String
1190
- object_of :last_updated_date, String
1191
- object_of :last_updated_by, String
1192
- object_of :first_sent_date, String
1193
- object_of :last_sent_date, String
1194
- object_of :last_sent_by, String
1195
- object_of :payer_view_url, String
1114
+ object_of :created_date, String
1115
+ object_of :created_by, String
1116
+ object_of :cancelled_date, String
1117
+ object_of :cancelled_by, String
1118
+ object_of :last_updated_date, String
1119
+ object_of :last_updated_by, String
1120
+ object_of :first_sent_date, String
1121
+ object_of :last_sent_date, String
1122
+ object_of :last_sent_by, String
1123
+ object_of :payer_view_url, String
1196
1124
  end
1197
-
1198
1125
  end
1199
- class Notification < Base
1200
1126
 
1127
+ class Notification < Base
1201
1128
  def self.load_members
1202
- object_of :subject, String
1203
- object_of :note, String
1204
- object_of :send_to_merchant, Boolean
1129
+ object_of :subject, String
1130
+ object_of :note, String
1131
+ object_of :send_to_merchant, Boolean
1205
1132
  end
1206
-
1207
1133
  end
1208
- class Search < Base
1209
1134
 
1135
+ class Search < Base
1210
1136
  def self.load_members
1211
- object_of :email, String
1212
- object_of :recipient_first_name, String
1213
- object_of :recipient_last_name, String
1214
- object_of :recipient_business_name, String
1215
- object_of :number, String
1216
- object_of :status, String
1217
- object_of :lower_total_amount, Currency
1218
- object_of :upper_total_amount, Currency
1219
- object_of :start_invoice_date, String
1220
- object_of :end_invoice_date, String
1221
- object_of :start_due_date, String
1222
- object_of :end_due_date, String
1223
- object_of :start_payment_date, String
1224
- object_of :end_payment_date, String
1225
- object_of :start_creation_date, String
1226
- object_of :end_creation_date, String
1227
- object_of :page, Number
1228
- object_of :page_size, Number
1229
- object_of :total_count_required, Boolean
1137
+ object_of :email, String
1138
+ object_of :recipient_first_name, String
1139
+ object_of :recipient_last_name, String
1140
+ object_of :recipient_business_name, String
1141
+ object_of :number, String
1142
+ object_of :status, String
1143
+ object_of :lower_total_amount, Currency
1144
+ object_of :upper_total_amount, Currency
1145
+ object_of :start_invoice_date, String
1146
+ object_of :end_invoice_date, String
1147
+ object_of :start_due_date, String
1148
+ object_of :end_due_date, String
1149
+ object_of :start_payment_date, String
1150
+ object_of :end_payment_date, String
1151
+ object_of :start_creation_date, String
1152
+ object_of :end_creation_date, String
1153
+ object_of :page, Number
1154
+ object_of :page_size, Number
1155
+ object_of :total_count_required, Boolean
1230
1156
  end
1231
-
1232
1157
  end
1233
- class CancelNotification < Base
1234
1158
 
1159
+ class CancelNotification < Base
1235
1160
  def self.load_members
1236
- object_of :subject, String
1237
- object_of :note, String
1238
- object_of :send_to_merchant, Boolean
1239
- object_of :send_to_payer, Boolean
1161
+ object_of :subject, String
1162
+ object_of :note, String
1163
+ object_of :send_to_merchant, Boolean
1164
+ object_of :send_to_payer, Boolean
1240
1165
  end
1241
-
1242
1166
  end
1243
- class Plan < Base
1244
1167
 
1168
+ class Plan < Base
1245
1169
  def self.load_members
1246
- object_of :id, String
1247
- object_of :name, String
1248
- object_of :description, String
1249
- object_of :type, String
1250
- object_of :state, String
1251
- object_of :create_time, String
1252
- object_of :update_time, String
1253
- array_of :payment_definitions, PaymentDefinition
1254
- array_of :terms, Terms
1255
- object_of :merchant_preferences, MerchantPreferences
1256
- array_of :links, Links
1170
+ object_of :id, String
1171
+ object_of :name, String
1172
+ object_of :description, String
1173
+ object_of :type, String
1174
+ object_of :state, String
1175
+ object_of :create_time, String
1176
+ object_of :update_time, String
1177
+ array_of :payment_definitions, PaymentDefinition
1178
+ array_of :terms, Terms
1179
+ object_of :merchant_preferences, MerchantPreferences
1180
+ array_of :links, Links
1257
1181
  end
1258
1182
 
1259
1183
  include RequestDataType
1260
1184
 
1261
- class << self
1262
- def find(resource_id)
1263
- raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
1264
- path = "v1/payments/billing-plans/#{resource_id}"
1265
- self.new(api.get(path))
1266
- end
1267
- end
1268
-
1269
1185
  def create()
1270
1186
  path = "v1/payments/billing-plans/"
1271
1187
  response = api.post(path, self.to_hash, http_header)
@@ -1273,148 +1189,148 @@ module PayPal::SDK
1273
1189
  success?
1274
1190
  end
1275
1191
 
1276
- def update(patch_request)
1277
- patch_request = PatchRequest.new(patch_request) unless patch_request.is_a? PatchRequest
1192
+ def update(patch)
1193
+ patch = Patch.new(patch) unless patch.is_a? Patch
1194
+ patch_request = Array.new(1, patch.to_hash)
1278
1195
  path = "v1/payments/billing-plans/#{self.id}"
1279
- response = api.patch(path, patch_request.to_hash, http_header)
1196
+ response = api.patch(path, patch_request, http_header)
1280
1197
  self.merge!(response)
1281
1198
  success?
1282
1199
  end
1283
1200
 
1284
1201
  class << self
1202
+ def find(resource_id)
1203
+ raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
1204
+ path = "v1/payments/billing-plans/#{resource_id}"
1205
+ self.new(api.get(path))
1206
+ end
1207
+
1285
1208
  def all(options = {})
1286
1209
  path = "v1/payments/billing-plans/"
1287
1210
  PlanList.new(api.get(path, options))
1288
1211
  end
1289
1212
  end
1290
-
1291
1213
  end
1292
- class PaymentDefinition < Base
1293
1214
 
1215
+ class PaymentDefinition < Base
1294
1216
  def self.load_members
1295
- object_of :id, String
1296
- object_of :name, String
1297
- object_of :type, String
1298
- object_of :frequency_interval, String
1299
- object_of :frequency, String
1300
- object_of :cycles, String
1301
- object_of :amount, Currency
1302
- array_of :charge_models, ChargeModels
1217
+ object_of :id, String
1218
+ object_of :name, String
1219
+ object_of :type, String
1220
+ object_of :frequency_interval, String
1221
+ object_of :frequency, String
1222
+ object_of :cycles, String
1223
+ object_of :amount, Currency
1224
+ array_of :charge_models, ChargeModels
1303
1225
  end
1304
-
1305
1226
  end
1306
- class ChargeModels < Base
1307
1227
 
1228
+ class ChargeModels < Base
1308
1229
  def self.load_members
1309
- object_of :id, String
1310
- object_of :type, String
1311
- object_of :amount, Currency
1230
+ object_of :id, String
1231
+ object_of :type, String
1232
+ object_of :amount, Currency
1312
1233
  end
1313
-
1314
1234
  end
1315
- class Terms < Base
1316
1235
 
1236
+ class Terms < Base
1317
1237
  def self.load_members
1318
- object_of :id, String
1319
- object_of :type, String
1320
- object_of :max_billing_amount, Currency
1321
- object_of :occurrences, String
1322
- object_of :amount_range, Currency
1323
- object_of :buyer_editable, String
1238
+ object_of :id, String
1239
+ object_of :type, String
1240
+ object_of :max_billing_amount, Currency
1241
+ object_of :occurrences, String
1242
+ object_of :amount_range, Currency
1243
+ object_of :buyer_editable, String
1324
1244
  end
1325
-
1326
1245
  end
1327
- class MerchantPreferences < Base
1328
1246
 
1247
+ class MerchantPreferences < Base
1329
1248
  def self.load_members
1330
- object_of :id, String
1331
- object_of :setup_fee, Currency
1332
- object_of :cancel_url, String
1333
- object_of :return_url, String
1334
- object_of :notify_url, String
1335
- object_of :max_fail_attempts, String
1336
- object_of :auto_bill_amount, String
1337
- object_of :initial_fail_amount_action, String
1338
- object_of :accepted_payment_type, String
1339
- object_of :char_set, String
1249
+ object_of :id, String
1250
+ object_of :setup_fee, Currency
1251
+ object_of :cancel_url, String
1252
+ object_of :return_url, String
1253
+ object_of :notify_url, String
1254
+ object_of :max_fail_attempts, String
1255
+ object_of :auto_bill_amount, String
1256
+ object_of :initial_fail_amount_action, String
1257
+ object_of :accepted_payment_type, String
1258
+ object_of :char_set, String
1340
1259
  end
1341
-
1342
1260
  end
1343
- class Links < Base
1344
1261
 
1262
+ class Links < Base
1345
1263
  def self.load_members
1346
- object_of :href, String
1347
- object_of :rel, String
1348
- object_of :targetSchema, HyperSchema
1349
- object_of :method, String
1350
- object_of :enctype, String
1351
- object_of :schema, HyperSchema
1264
+ object_of :href, String
1265
+ object_of :rel, String
1266
+ object_of :targetSchema, HyperSchema
1267
+ object_of :method, String
1268
+ object_of :enctype, String
1269
+ object_of :schema, HyperSchema
1352
1270
  end
1353
-
1354
1271
  end
1355
- class Schema < Base
1356
1272
 
1273
+ class Schema < Base
1357
1274
  def self.load_members
1358
- object_of :type, Object
1359
- object_of :properties, Schema
1360
- object_of :patternProperties, Schema
1361
- object_of :additionalProperties, Object
1362
- object_of :items, Object
1363
- object_of :additionalItems, Object
1364
- object_of :required, Boolean
1365
- object_of :dependencies, Object
1366
- object_of :minimum, Number
1367
- object_of :maximum, Number
1368
- object_of :exclusiveMinimum, Boolean
1369
- object_of :exclusiveMaximum, Boolean
1370
- object_of :minItems, Integer
1371
- object_of :maxItems, Integer
1372
- object_of :uniqueItems, Boolean
1373
- object_of :pattern, String
1374
- object_of :minLength, Integer
1375
- object_of :maxLength, Integer
1376
- array_of :enum, Array
1377
- object_of :title, String
1378
- object_of :description, String
1379
- object_of :format, String
1380
- object_of :divisibleBy, Number
1381
- object_of :disallow, Object
1382
- object_of :extends, Object
1383
- object_of :id, String
1384
- object_of :$ref, String
1385
- object_of :$schema, String
1275
+ object_of :type, Object
1276
+ object_of :properties, Schema
1277
+ object_of :patternProperties, Schema
1278
+ object_of :additionalProperties, Object
1279
+ object_of :items, Object
1280
+ object_of :additionalItems, Object
1281
+ object_of :required, Boolean
1282
+ object_of :dependencies, Object
1283
+ object_of :minimum, Number
1284
+ object_of :maximum, Number
1285
+ object_of :exclusiveMinimum, Boolean
1286
+ object_of :exclusiveMaximum, Boolean
1287
+ object_of :minItems, Integer
1288
+ object_of :maxItems, Integer
1289
+ object_of :uniqueItems, Boolean
1290
+ object_of :pattern, String
1291
+ object_of :minLength, Integer
1292
+ object_of :maxLength, Integer
1293
+ array_of :enum, Array
1294
+ object_of :title, String
1295
+ object_of :description, String
1296
+ object_of :format, String
1297
+ object_of :divisibleBy, Number
1298
+ object_of :disallow, Object
1299
+ object_of :extends, Object
1300
+ object_of :id, String
1301
+ object_of :$ref, String
1302
+ object_of :$schema, String
1386
1303
  end
1387
-
1388
1304
  end
1389
- class HyperSchema < Schema
1390
1305
 
1306
+ class HyperSchema < Schema
1391
1307
  def self.load_members
1392
- array_of :links, Links
1393
- object_of :fragmentResolution, String
1394
- object_of :readonly, Boolean
1395
- object_of :contentEncoding, String
1396
- object_of :pathStart, String
1397
- object_of :mediaType, String
1308
+ array_of :links, Links
1309
+ object_of :fragmentResolution, String
1310
+ object_of :readonly, Boolean
1311
+ object_of :contentEncoding, String
1312
+ object_of :pathStart, String
1313
+ object_of :mediaType, String
1398
1314
  end
1399
-
1400
1315
  end
1401
- class PlanList < Base
1402
1316
 
1317
+ class PlanList < Base
1403
1318
  def self.load_members
1404
- array_of :plans, Plan
1405
- object_of :total_items, String
1406
- object_of :total_pages, String
1407
- array_of :links, Links
1319
+ array_of :plans, Plan
1320
+ object_of :total_items, String
1321
+ object_of :total_pages, String
1322
+ array_of :links, Links
1408
1323
  end
1409
-
1410
1324
  end
1411
- class Agreement < Base
1412
1325
 
1326
+ class Agreement < Base
1413
1327
  def self.load_members
1414
1328
  object_of :id, String
1329
+ object_of :state, String
1415
1330
  object_of :name, String
1416
1331
  object_of :description, String
1417
1332
  object_of :start_date, String
1333
+ object_of :agreement_details, AgreementDetails
1418
1334
  object_of :payer, Payer
1419
1335
  object_of :shipping_address, Address
1420
1336
  object_of :override_merchant_preferences, MerchantPreferences
@@ -1423,6 +1339,7 @@ module PayPal::SDK
1423
1339
  object_of :create_time, String
1424
1340
  object_of :update_time, String
1425
1341
  array_of :links, Links
1342
+ object_of :token, String
1426
1343
  end
1427
1344
 
1428
1345
  include RequestDataType
@@ -1431,11 +1348,13 @@ module PayPal::SDK
1431
1348
  path = "v1/payments/billing-agreements/"
1432
1349
  response = api.post(path, self.to_hash, http_header)
1433
1350
  self.merge!(response)
1351
+ self.get_token(self.links)
1434
1352
  success?
1435
1353
  end
1436
1354
 
1437
1355
  def execute()
1438
- path = "v1/payments/billing-agreements/#{self.id}/agreement-execute"
1356
+ path = "v1/payments/billing-agreements/#{self.token}/agreement-execute"
1357
+ puts path
1439
1358
  response = api.post(path, {}, http_header)
1440
1359
  self.merge!(response)
1441
1360
  success?
@@ -1449,10 +1368,10 @@ module PayPal::SDK
1449
1368
  end
1450
1369
  end
1451
1370
 
1452
- def update(patch_request)
1453
- patch_request = PatchRequest.new(patch_request) unless patch_request.is_a? PatchRequest
1371
+ def update(patch)
1372
+ patch = Patch.new(patch) unless patch.is_a? Patch
1454
1373
  path = "v1/payments/billing-agreements/#{self.id}"
1455
- response = api.patch(path, patch_request.to_hash, http_header)
1374
+ response = api.patch(path, [patch.to_hash], http_header)
1456
1375
  self.merge!(response)
1457
1376
  success?
1458
1377
  end
@@ -1498,60 +1417,79 @@ module PayPal::SDK
1498
1417
  end
1499
1418
 
1500
1419
  class << self
1501
- def transactions(options = {})
1502
- path = "v1/payments/billing-agreements/{agreement-id}/transactions"
1420
+ def transactions(agreement_id, start_date, end_date, options = {})
1421
+ path = "v1/payments/billing-agreements/#{agreement_id}/transactions" #?start-date=#{start_date}&end-date=#{end_date}"
1422
+ options = { :start_date => start_date, :end_date => end_date }
1503
1423
  AgreementTransactions.new(api.get(path, options))
1504
1424
  end
1505
1425
  end
1506
1426
 
1427
+ def get_token(links)
1428
+ links.each do |link|
1429
+ if link.rel.eql? "approval_url"
1430
+ uri = URI.parse(link.href)
1431
+ params = CGI.parse(uri.query)
1432
+ self.token = params['token'][0]
1433
+ return
1434
+ end
1435
+ end
1436
+ end
1507
1437
  end
1508
- class OverrideChargeModel < Base
1509
-
1438
+ class AgreementDetails < Base
1510
1439
  def self.load_members
1511
- object_of :charge_id, String
1512
- object_of :amount, Currency
1440
+ object_of :outstanding_balance, Currency
1441
+ object_of :cycles_remaining, String
1442
+ object_of :cycles_completed, String
1443
+ object_of :next_billing_date, String
1444
+ object_of :last_payment_date, String
1445
+ object_of :last_payment_amount, Currency
1446
+ object_of :final_payment_date, String
1447
+ object_of :failed_payment_count, String
1513
1448
  end
1514
-
1515
1449
  end
1516
- class AgreementStateDescriptor < Base
1517
1450
 
1451
+ class OverrideChargeModel < Base
1518
1452
  def self.load_members
1519
- object_of :note, String
1520
- object_of :amount, Currency
1453
+ object_of :charge_id, String
1454
+ object_of :amount, Currency
1521
1455
  end
1522
-
1523
1456
  end
1524
- class AgreementTransactions < Base
1525
1457
 
1458
+ class AgreementStateDescriptor < Base
1526
1459
  def self.load_members
1527
- array_of :agreement_transaction_list, AgreementTransaction
1460
+ object_of :note, String
1461
+ object_of :amount, Currency
1528
1462
  end
1529
-
1530
1463
  end
1531
- class AgreementTransaction < Base
1532
1464
 
1465
+ class AgreementTransactions < Base
1533
1466
  def self.load_members
1534
- object_of :transaction_id, String
1535
- object_of :status, String
1536
- object_of :transaction_type, String
1537
- object_of :amount, Currency
1538
- object_of :fee_amount, Currency
1539
- object_of :net_amount, Currency
1540
- object_of :payer_email, String
1541
- object_of :payer_name, String
1542
- object_of :time_updated, String
1543
- object_of :time_zone, String
1467
+ array_of :agreement_transaction_list, AgreementTransaction
1544
1468
  end
1469
+ end
1545
1470
 
1471
+ class AgreementTransaction < Base
1472
+ def self.load_members
1473
+ object_of :transaction_id, String
1474
+ object_of :status, String
1475
+ object_of :transaction_type, String
1476
+ object_of :amount, Currency
1477
+ object_of :fee_amount, Currency
1478
+ object_of :net_amount, Currency
1479
+ object_of :payer_email, String
1480
+ object_of :payer_name, String
1481
+ object_of :time_updated, String
1482
+ object_of :time_zone, String
1483
+ end
1546
1484
  end
1547
- class WebProfile < Base
1548
1485
 
1486
+ class WebProfile < Base
1549
1487
  def self.load_members
1550
- object_of :id, String
1551
- object_of :name, String
1552
- object_of :flow_config, FlowConfig
1553
- object_of :input_fields, InputFields
1554
- object_of :presentation, Presentation
1488
+ object_of :id, String
1489
+ object_of :name, String
1490
+ object_of :flow_config, FlowConfig
1491
+ object_of :input_fields, InputFields
1492
+ object_of :presentation, Presentation
1555
1493
  end
1556
1494
 
1557
1495
  include RequestDataType
@@ -1576,80 +1514,71 @@ module PayPal::SDK
1576
1514
  success?
1577
1515
  end
1578
1516
 
1517
+ def delete()
1518
+ path = "v1/payment-experience/web-profiles/#{self.id}"
1519
+ response = api.delete(path, {})
1520
+ self.merge!(response)
1521
+ success?
1522
+ end
1523
+
1579
1524
  class << self
1580
1525
  def find(resource_id)
1581
1526
  raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
1582
1527
  path = "v1/payment-experience/web-profiles/#{resource_id}"
1583
1528
  self.new(api.get(path))
1584
1529
  end
1585
- end
1586
1530
 
1587
- class << self
1588
1531
  def get_list(options = {})
1589
1532
  path = "v1/payment-experience/web-profiles/"
1590
1533
  l = api.get(path, options)
1591
1534
  l.each { |x| WebProfileList.new(x) }
1592
1535
  end
1593
1536
  end
1594
-
1595
- def delete()
1596
- path = "v1/payment-experience/web-profiles/#{self.id}"
1597
- response = api.delete(path, {})
1598
- self.merge!(response)
1599
- success?
1600
- end
1601
-
1602
1537
  end
1603
- class FlowConfig < Base
1604
1538
 
1539
+ class FlowConfig < Base
1605
1540
  def self.load_members
1606
- object_of :landing_page_type, String
1607
- object_of :bank_txn_pending_url, String
1541
+ object_of :landing_page_type, String
1542
+ object_of :bank_txn_pending_url, String
1608
1543
  end
1609
-
1610
1544
  end
1611
- class InputFields < Base
1612
1545
 
1546
+ class InputFields < Base
1613
1547
  def self.load_members
1614
- object_of :allow_note, Boolean
1615
- object_of :no_shipping, Integer
1616
- object_of :address_override, Integer
1548
+ object_of :allow_note, Boolean
1549
+ object_of :no_shipping, Integer
1550
+ object_of :address_override, Integer
1617
1551
  end
1618
-
1619
1552
  end
1620
- class Presentation < Base
1621
1553
 
1554
+ class Presentation < Base
1622
1555
  def self.load_members
1623
- object_of :brand_name, String
1624
- object_of :logo_image, String
1625
- object_of :locale_code, String
1556
+ object_of :brand_name, String
1557
+ object_of :logo_image, String
1558
+ object_of :locale_code, String
1626
1559
  end
1627
-
1628
1560
  end
1629
- class CreateProfileResponse < Base
1630
1561
 
1562
+ class CreateProfileResponse < Base
1631
1563
  def self.load_members
1632
- object_of :id, String
1564
+ object_of :id, String
1633
1565
  end
1634
-
1635
1566
  end
1636
- class WebProfileList < Base
1637
1567
 
1568
+ class WebProfileList < Base
1638
1569
  def self.load_members
1639
- object_of :id, String
1640
- object_of :name, String
1641
- object_of :flow_config, FlowConfig
1642
- object_of :input_fields, InputFields
1643
- object_of :presentation, Presentation
1570
+ object_of :id, String
1571
+ object_of :name, String
1572
+ object_of :flow_config, FlowConfig
1573
+ object_of :input_fields, InputFields
1574
+ object_of :presentation, Presentation
1644
1575
  end
1645
-
1646
1576
  end
1647
1577
 
1648
1578
  constants.each do |data_type_klass|
1649
1579
  data_type_klass = const_get(data_type_klass)
1650
1580
  data_type_klass.load_members if defined? data_type_klass.load_members
1651
1581
  end
1652
-
1653
1582
  end
1654
1583
  end
1655
- end
1584
+ end