paypal-sdk-rest 1.4.9 → 1.7.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,9 @@
1
1
  require 'paypal-sdk-core'
2
- require 'uuidtools'
2
+ require 'securerandom'
3
3
  require 'multi_json'
4
- require 'open-uri'
5
4
  require 'zlib'
6
5
  require "base64"
6
+ require 'net/http'
7
7
 
8
8
  module PayPal::SDK
9
9
  module REST
@@ -17,7 +17,7 @@ module PayPal::SDK
17
17
  end
18
18
 
19
19
  def request_id
20
- @request_id ||= UUIDTools::UUID.random_create.to_s
20
+ @request_id ||= SecureRandom.uuid
21
21
  end
22
22
 
23
23
  def http_header
@@ -64,7 +64,9 @@ module PayPal::SDK
64
64
  object_of :payment_instruction, PaymentInstruction
65
65
  object_of :state, String
66
66
  object_of :experience_profile_id, String
67
+ object_of :note_to_payer, String
67
68
  object_of :redirect_urls, RedirectUrls
69
+ object_of :failure_reason, String
68
70
  object_of :create_time, String
69
71
  object_of :update_time, String
70
72
  array_of :links, Links
@@ -168,6 +170,7 @@ module PayPal::SDK
168
170
  class Billing < Base
169
171
  def self.load_members
170
172
  object_of :billing_agreement_id, String
173
+ object_of :selected_installment_option, InstallmentOption
171
174
  end
172
175
 
173
176
  include RequestDataType
@@ -180,13 +183,6 @@ module PayPal::SDK
180
183
  include RequestDataType
181
184
  end
182
185
 
183
- class CarrierAccountToken < Base
184
- def self.load_members
185
- object_of :carrier_account_id, String
186
- object_of :external_customer_id, String
187
- end
188
- end
189
-
190
186
  class CountryCode < Base
191
187
  def self.load_members
192
188
  object_of :country_code, String
@@ -214,6 +210,8 @@ module PayPal::SDK
214
210
  object_of :code, String
215
211
  object_of :funding_account_id, String
216
212
  object_of :display_text, String
213
+ object_of :amount, Currency
214
+ object_of :funding_instruction, String
217
215
  end
218
216
 
219
217
  include RequestDataType
@@ -295,6 +293,7 @@ module PayPal::SDK
295
293
  array_of :funding_instruments, FundingInstrument
296
294
  object_of :funding_option_id, String
297
295
  object_of :funding_option, FundingOption
296
+ object_of :external_selected_funding_instrument_type, String
298
297
  object_of :related_funding_option, FundingOption
299
298
  object_of :payer_info, PayerInfo
300
299
  object_of :billing, Billing
@@ -366,7 +365,7 @@ module PayPal::SDK
366
365
  raise_on_api_error :create, :update, :delete
367
366
  end
368
367
 
369
- class Address < Base
368
+ class BaseAddress < Base
370
369
  def self.load_members
371
370
  object_of :line1, String
372
371
  object_of :line2, String
@@ -374,9 +373,21 @@ module PayPal::SDK
374
373
  object_of :country_code, String
375
374
  object_of :postal_code, String
376
375
  object_of :state, String
377
- object_of :phone, String
378
376
  object_of :normalization_status, String
379
377
  object_of :status, String
378
+ object_of :type, String
379
+ end
380
+ end
381
+
382
+ class Address < BaseAddress
383
+ def self.load_members
384
+ object_of :phone, String
385
+ end
386
+ end
387
+
388
+ class InvoiceAddress < BaseAddress
389
+ def self.load_members
390
+ object_of :phone, Phone
380
391
  end
381
392
  end
382
393
 
@@ -413,6 +424,7 @@ module PayPal::SDK
413
424
  object_of :billing_address, Address
414
425
  object_of :external_customer_id, String
415
426
  object_of :status, String
427
+ object_of :card_product_class, String
416
428
  object_of :valid_until, String
417
429
  object_of :issue_number, String
418
430
  end
@@ -545,7 +557,9 @@ module PayPal::SDK
545
557
  object_of :funding_instrument_type, String
546
558
  object_of :soft_descriptor, String
547
559
  object_of :amount, Currency
560
+ object_of :negative_balance_amount, Currency
548
561
  object_of :legal_text, String
562
+ object_of :terms, String
549
563
  object_of :funding_detail, FundingDetail
550
564
  object_of :additional_text, String
551
565
  object_of :extends, FundingInstrument
@@ -721,13 +735,13 @@ module PayPal::SDK
721
735
 
722
736
  class Item < Base
723
737
  def self.load_members
724
- object_of :quantity, String
738
+ object_of :sku, String
725
739
  object_of :name, String
726
740
  object_of :description, String
741
+ object_of :quantity, String
727
742
  object_of :price, String
728
- object_of :tax, String
729
743
  object_of :currency, String
730
- object_of :sku, String
744
+ object_of :tax, String
731
745
  object_of :url, String
732
746
  object_of :category, String
733
747
  object_of :weight, Measurement
@@ -764,9 +778,9 @@ module PayPal::SDK
764
778
 
765
779
  class RelatedResources < Base
766
780
  def self.load_members
767
- object_of :order, Order
768
781
  object_of :sale, Sale
769
782
  object_of :authorization, Authorization
783
+ object_of :order, Order
770
784
  object_of :capture, Capture
771
785
  object_of :refund, Refund
772
786
  end
@@ -784,6 +798,7 @@ module PayPal::SDK
784
798
  object_of :protection_eligibility_type, String
785
799
  object_of :clearing_time, String
786
800
  object_of :recipient_fund_status, String
801
+ object_of :payment_hold_status, String
787
802
  object_of :hold_reason, String
788
803
  object_of :transaction_fee, Currency
789
804
  object_of :receivable_amount, Currency
@@ -794,7 +809,6 @@ module PayPal::SDK
794
809
  object_of :create_time, String
795
810
  object_of :update_time, String
796
811
  array_of :links, Links
797
- object_of :processor_response, ProcessorResponse
798
812
  object_of :billing_agreement_id, String
799
813
  object_of :payment_hold_reasons, String
800
814
  object_of :processor_response, ProcessorResponse
@@ -816,6 +830,14 @@ module PayPal::SDK
816
830
  response = api.post(path, refund.to_hash, http_header)
817
831
  Refund.new(response)
818
832
  end
833
+
834
+ def refund_request(refund_request)
835
+ refund_request = RefundRequest.new(refund_request) unless refund_request.is_a? RefundRequest
836
+ path = "v1/payments/sale/#{self.id}/refund"
837
+ response = api.post(path, refund_request.to_hash, http_header)
838
+ DetailedRefund.new(response)
839
+ end
840
+
819
841
  end
820
842
 
821
843
  class AnyOf < Base
@@ -838,6 +860,8 @@ module PayPal::SDK
838
860
  object_of :valid_until, String
839
861
  object_of :create_time, String
840
862
  object_of :update_time, String
863
+ object_of :reference_id, String
864
+ object_of :receipt_id, String
841
865
  array_of :links, Links
842
866
  end
843
867
 
@@ -878,7 +902,8 @@ module PayPal::SDK
878
902
  class Order < Base
879
903
  def self.load_members
880
904
  object_of :id, String
881
- object_of :purchase_unit_reference_id, String
905
+ object_of :purchase_unit_reference_id, String # Deprecated - use :reference_id instead
906
+ object_of :reference_id, String
882
907
  object_of :amount, Amount
883
908
  object_of :payment_mode, String
884
909
  object_of :state, String
@@ -932,11 +957,12 @@ module PayPal::SDK
932
957
  object_of :amount, Amount
933
958
  object_of :is_final_capture, Boolean
934
959
  object_of :state, String
960
+ object_of :reason_code, String
935
961
  object_of :parent_payment, String
962
+ object_of :invoice_number, String
936
963
  object_of :transaction_fee, Currency
937
964
  object_of :create_time, String
938
965
  object_of :update_time, String
939
- object_of :invoice_number, String
940
966
  array_of :links, Links
941
967
  end
942
968
 
@@ -950,12 +976,20 @@ module PayPal::SDK
950
976
  end
951
977
  end
952
978
 
979
+ # Deprecated - please use refund_request
953
980
  def refund(refund)
954
981
  refund = Refund.new(refund) unless refund.is_a? Refund
955
982
  path = "v1/payments/capture/#{self.id}/refund"
956
983
  response = api.post(path, refund.to_hash, http_header)
957
984
  Refund.new(response)
958
985
  end
986
+
987
+ def refund_request(refund_request)
988
+ refund_request = RefundRequest.new(refund_request) unless refund_request.is_a? RefundRequest
989
+ path = "v1/payments/capture/#{self.id}/refund"
990
+ response = api.post(path, refund_request.to_hash, http_header)
991
+ DetailedRefund.new(response)
992
+ end
959
993
  end
960
994
 
961
995
  class Refund < Base
@@ -964,12 +998,14 @@ module PayPal::SDK
964
998
  object_of :amount, Amount
965
999
  object_of :state, String
966
1000
  object_of :reason, String
1001
+ object_of :invoice_number, String
967
1002
  object_of :sale_id, String
968
1003
  object_of :capture_id, String
969
1004
  object_of :parent_payment, String
970
1005
  object_of :description, String
971
1006
  object_of :create_time, String
972
1007
  object_of :update_time, String
1008
+ object_of :reason_code, String
973
1009
  array_of :links, Links
974
1010
  end
975
1011
 
@@ -984,6 +1020,31 @@ module PayPal::SDK
984
1020
  end
985
1021
  end
986
1022
 
1023
+ class RefundRequest < Base
1024
+ def self.load_members
1025
+ object_of :amount, Amount
1026
+ object_of :description, String
1027
+ object_of :refund_type, String
1028
+ object_of :refund_source, String
1029
+ object_of :reason, String
1030
+ object_of :invoice_number, String
1031
+ object_of :refund_advice, Boolean
1032
+ object_of :is_non_platform_transaction, String
1033
+ end
1034
+ end
1035
+
1036
+ class DetailedRefund < Refund
1037
+ def self.load_members
1038
+ object_of :custom, String
1039
+ object_of :invoice_number, String
1040
+ object_of :refund_to_payer, Currency
1041
+ array_of :refund_to_external_funding, ExternalFunding
1042
+ object_of :refund_from_transaction_fee, Currency
1043
+ object_of :refund_from_received_amount, Currency
1044
+ object_of :total_refunded_amount, Currency
1045
+ end
1046
+ end
1047
+
987
1048
  class Error < Base
988
1049
  def self.load_members
989
1050
  object_of :name, String
@@ -1055,14 +1116,14 @@ module PayPal::SDK
1055
1116
 
1056
1117
  class Patch < Base
1057
1118
  def self.load_members
1058
- object_of :op, String
1059
- object_of :path, String
1060
- object_of :value, Object
1061
- object_of :from, String
1119
+ object_of :op, String
1120
+ object_of :path, String
1121
+ object_of :value, Object
1122
+ object_of :from, String
1062
1123
  end
1063
1124
  end
1064
- class PatchRequest < Base
1065
1125
 
1126
+ class PatchRequest < Base
1066
1127
  def self.load_members
1067
1128
  object_of :op, String
1068
1129
  object_of :path, String
@@ -1074,8 +1135,8 @@ module PayPal::SDK
1074
1135
  class PaymentExecution < Base
1075
1136
  def self.load_members
1076
1137
  object_of :payer_id, String
1077
- array_of :transactions, CartBase
1078
1138
  object_of :carrier_account_id, String
1139
+ array_of :transactions, CartBase
1079
1140
  end
1080
1141
  end
1081
1142
 
@@ -1122,30 +1183,39 @@ module PayPal::SDK
1122
1183
  class Invoice < Base
1123
1184
  def self.load_members
1124
1185
  object_of :id, String
1125
- object_of :number, String
1126
- object_of :uri, String
1127
- object_of :status, String
1128
- object_of :merchant_info, MerchantInfo
1129
- array_of :billing_info, BillingInfo
1130
- object_of :shipping_info, ShippingInfo
1131
- array_of :items, InvoiceItem
1132
- object_of :invoice_date, String
1133
- object_of :payment_term, PaymentTerm
1134
- object_of :reference, String
1135
- object_of :discount, Cost
1136
- object_of :shipping_cost, ShippingCost
1137
- object_of :custom, CustomAmount
1138
- object_of :tax_calculated_after_discount, Boolean
1139
- object_of :tax_inclusive, Boolean
1140
- object_of :terms, String
1141
- object_of :note, String
1142
- object_of :refunded_amount, InvoiceAmountWrapper
1143
- object_of :merchant_memo, String
1144
- object_of :logo_url, String
1145
- object_of :total_amount, Currency
1186
+ object_of :number, String
1187
+ object_of :template_id, String
1188
+ object_of :uri, String
1189
+ object_of :status, String
1190
+ object_of :merchant_info, MerchantInfo
1191
+ array_of :billing_info, BillingInfo
1192
+ array_of :cc_info, Participant
1193
+ object_of :shipping_info, ShippingInfo
1194
+ array_of :items, InvoiceItem
1195
+ object_of :invoice_date, String
1196
+ object_of :payment_term, PaymentTerm
1197
+ object_of :reference, String
1198
+ object_of :discount, Cost
1199
+ object_of :shipping_cost, ShippingCost
1200
+ object_of :custom, CustomAmount
1201
+ object_of :allow_partial_payment, Boolean
1202
+ object_of :minimum_amount_due, Currency
1203
+ object_of :tax_calculated_after_discount, Boolean
1204
+ object_of :tax_inclusive, Boolean
1205
+ object_of :terms, String
1206
+ object_of :note, String
1207
+ object_of :merchant_memo, String
1208
+ object_of :logo_url, String
1209
+ object_of :total_amount, Currency
1146
1210
  array_of :payments, PaymentDetail
1147
- array_of :refund_details, RefundDetail
1148
- object_of :metadata, Metadata
1211
+ array_of :refunds, RefundDetail
1212
+ object_of :metadata, Metadata
1213
+ object_of :additional_data, String
1214
+ object_of :gratuity, Currency
1215
+ object_of :paid_amount, PaymentSummary
1216
+ object_of :refunded_amount, PaymentSummary
1217
+ array_of :attachments, FileAttachment
1218
+ array_of :links, Links
1149
1219
  end
1150
1220
 
1151
1221
  include RequestDataType
@@ -1213,7 +1283,6 @@ module PayPal::SDK
1213
1283
  raise_on_api_error :create, :send_invoice, :remind, :cancel,
1214
1284
  :record_payment, :record_refund, :update, :delete
1215
1285
 
1216
-
1217
1286
  #
1218
1287
  class << self
1219
1288
  def search(options, access_token = nil)
@@ -1235,11 +1304,157 @@ module PayPal::SDK
1235
1304
  api.token = access_token unless access_token.nil?
1236
1305
  Invoices.new(api.get(path, options))
1237
1306
  end
1307
+
1308
+ def qr_code(options = {})
1309
+ path = "v1/invoicing/invoices/{invoice_id}/qr-code"
1310
+ object.new(api.get(path, options))
1311
+ end
1312
+
1313
+ def self.generate_number(options)
1314
+ path = "v1/invoicing/invoices/next-invoice-number"
1315
+ response = api.post(path, options)
1316
+ object.new(response)
1317
+ end
1238
1318
  end
1239
1319
  end
1240
1320
 
1241
- class WebhooksEventType < Base
1321
+ class Participant < Base
1322
+ def self.load_members
1323
+ object_of :email, String
1324
+ object_of :first_name, String
1325
+ object_of :last_name, String
1326
+ object_of :business_name, String
1327
+ object_of :phone, Phone
1328
+ object_of :fax, Phone
1329
+ object_of :website, String
1330
+ object_of :additional_info, String
1331
+ object_of :address, Address
1332
+ end
1333
+ end
1334
+
1335
+ class Template < Base
1336
+
1337
+ def self.load_members
1338
+ object_of :template_id, String
1339
+ object_of :name, String
1340
+ object_of :default, Boolean
1341
+ object_of :template_data, TemplateData
1342
+ array_of :settings, TemplateSettings
1343
+ object_of :unit_of_measure, String
1344
+ object_of :custom, Boolean
1345
+ array_of :links, Links
1346
+ end
1347
+
1348
+ include RequestDataType
1349
+
1350
+ def delete()
1351
+ path = "v1/invoicing/templates/#{self.template_id}"
1352
+ response = api.delete(path, {})
1353
+ self.merge!(response)
1354
+ success?
1355
+ end
1356
+
1357
+ def update()
1358
+ path = "v1/invoicing/templates/#{self.template_id}"
1359
+ response = api.put(path, self.to_hash, http_header)
1360
+ self.merge!(response)
1361
+ Template.new(response)
1362
+ end
1363
+
1364
+ def create()
1365
+ path = "v1/invoicing/templates"
1366
+ response = api.post(path, self.to_hash, http_header)
1367
+ self.merge!(response)
1368
+ Template.new(response)
1369
+ end
1370
+
1371
+ class << self
1372
+ def get(template_id, options = {})
1373
+ raise ArgumentError.new("template_id required") if template_id.to_s.strip.empty?
1374
+ path = "v1/invoicing/templates/#{template_id}"
1375
+ self.new(api.get(path, options))
1376
+ end
1377
+ end
1378
+ end
1379
+
1380
+ class TemplateData < Base
1381
+
1382
+ def self.load_members
1383
+ object_of :merchant_info, MerchantInfo
1384
+ array_of :billing_info, BillingInfo
1385
+ array_of :cc_info, String
1386
+ object_of :shipping_info, ShippingInfo
1387
+ array_of :items, InvoiceItem
1388
+ object_of :payment_term, PaymentTerm
1389
+ object_of :reference, String
1390
+ object_of :discount, Cost
1391
+ object_of :shipping_cost, ShippingCost
1392
+ object_of :custom, CustomAmount
1393
+ object_of :allow_partial_payment, Boolean
1394
+ object_of :minimum_amount_due, Currency
1395
+ object_of :tax_calculated_after_discount, Boolean
1396
+ object_of :tax_inclusive, Boolean
1397
+ object_of :terms, String
1398
+ object_of :note, String
1399
+ object_of :merchant_memo, String
1400
+ object_of :logo_url, String
1401
+ object_of :total_amount, Currency
1402
+ array_of :attachments, FileAttachment
1403
+ end
1404
+
1405
+ end
1406
+
1407
+ class TemplateSettings < Base
1408
+
1409
+ def self.load_members
1410
+ object_of :field_name, String
1411
+ object_of :display_preference, TemplateSettingsMetadata
1412
+ end
1413
+ end
1414
+
1415
+ class TemplateSettingsMetadata < Base
1416
+
1417
+ def self.load_members
1418
+ object_of :hidden, Boolean
1419
+ end
1420
+
1421
+ end
1422
+
1423
+ class PaymentSummary < Base
1424
+ def self.load_members
1425
+ object_of :paypal, Currency
1426
+ object_of :other, Currency
1427
+ end
1428
+ end
1429
+ class FileAttachment < Base
1242
1430
 
1431
+ def self.load_members
1432
+ object_of :name, String
1433
+ object_of :url, String
1434
+ end
1435
+
1436
+ end
1437
+ class Templates < Base
1438
+
1439
+ def self.load_members
1440
+ array_of :addresses, Address
1441
+ array_of :emails, String
1442
+ array_of :phones, Phone
1443
+ array_of :templates, Template
1444
+ array_of :links, Links
1445
+ end
1446
+
1447
+ include RequestDataType
1448
+
1449
+ class << self
1450
+ def get_all(options = {})
1451
+ path = "v1/invoicing/templates/"
1452
+ Templates.new(api.get(path, options))
1453
+ end
1454
+ end
1455
+ end
1456
+
1457
+ class WebhooksEventType < Base
1243
1458
  def self.load_members
1244
1459
  array_of :event_types, EventType
1245
1460
  end
@@ -1270,6 +1485,7 @@ module PayPal::SDK
1270
1485
  def self.load_members
1271
1486
  object_of :name, String
1272
1487
  object_of :description, String
1488
+ object_of :status, String
1273
1489
  end
1274
1490
  end
1275
1491
 
@@ -1286,10 +1502,12 @@ module PayPal::SDK
1286
1502
  object_of :id, String
1287
1503
  object_of :create_time, String
1288
1504
  object_of :resource_type, String
1505
+ object_of :event_version, String
1289
1506
  object_of :event_type, String
1290
1507
  object_of :summary, String
1508
+ object_of :status, String
1291
1509
  object_of :resource, Hash
1292
- array_of :links, Links
1510
+ array_of :links, Links
1293
1511
  end
1294
1512
 
1295
1513
  def resend()
@@ -1312,8 +1530,8 @@ module PayPal::SDK
1312
1530
  class << self
1313
1531
 
1314
1532
  def get_cert(cert_url)
1315
- data = open(cert_url).read()
1316
- cert = OpenSSL::X509::Certificate.new data
1533
+ data = Net::HTTP.get_response(URI.parse(cert_url))
1534
+ cert = OpenSSL::X509::Certificate.new data.body
1317
1535
  end
1318
1536
 
1319
1537
  def get_cert_chain()
@@ -1384,9 +1602,18 @@ module PayPal::SDK
1384
1602
  end
1385
1603
 
1386
1604
  def get(webhook_event_id)
1387
- raise ArgumentError.new("webhook_event_id required") if webhook_event_id.to_s.strip.empty?
1388
- path = "v1/notifications/webhooks-events/#{webhook_event_id}"
1389
- WebhookEvent.new(api.get(path))
1605
+ WebhookEvent.find(webhook_event_id)
1606
+ end
1607
+
1608
+ def find(resource_id)
1609
+ raise ArgumentError.new("webhook_event_id required") if resource_id.to_s.strip.empty?
1610
+ path = "v1/notifications/webhooks-events/#{resource_id}"
1611
+ self.new(api.get(path))
1612
+ end
1613
+
1614
+ def all(options = {})
1615
+ path = "v1/notifications/webhooks-events"
1616
+ WebhookEventList.new(api.get(path, options))
1390
1617
  end
1391
1618
  end
1392
1619
  end
@@ -1396,8 +1623,8 @@ module PayPal::SDK
1396
1623
  def self.load_members
1397
1624
  object_of :id, String
1398
1625
  object_of :url, String
1399
- array_of :event_types, EventType
1400
- array_of :links, Links
1626
+ array_of :event_types, EventType
1627
+ array_of :links, Links
1401
1628
  end
1402
1629
 
1403
1630
  include RequestDataType
@@ -1433,11 +1660,13 @@ module PayPal::SDK
1433
1660
  path = "v1/notifications/webhooks/#{webhook_id}"
1434
1661
  Webhook.new(api.get(path))
1435
1662
  end
1663
+
1436
1664
  def get_event_types(webhook_id)
1437
1665
  raise ArgumentError.new("webhook_id required") if webhook_id.to_s.strip.empty?
1438
1666
  path = "v1/notifications/webhooks/#{webhook_id}/event-types"
1439
1667
  EventTypeList.new(api.get(path))
1440
1668
  end
1669
+
1441
1670
  def all(options={})
1442
1671
  path = "v1/notifications/webhooks"
1443
1672
  WebhookList.new(api.get(path))
@@ -1484,6 +1713,7 @@ module PayPal::SDK
1484
1713
  object_of :note, String
1485
1714
  object_of :receiver, String
1486
1715
  object_of :sender_item_id, String
1716
+ object_of :recipient_wallet, String
1487
1717
  end
1488
1718
 
1489
1719
  include RequestDataType
@@ -1559,28 +1789,31 @@ module PayPal::SDK
1559
1789
 
1560
1790
  class InvoiceItem < Base
1561
1791
  def self.load_members
1562
- object_of :name, String
1563
- object_of :description, String
1564
- object_of :quantity, Number
1565
- object_of :unit_price, Currency
1566
- object_of :tax, Tax
1567
- object_of :date, String
1568
- object_of :discount, Cost
1792
+ object_of :name, String
1793
+ object_of :description, String
1794
+ object_of :quantity, Number
1795
+ object_of :unit_price, Currency
1796
+ object_of :tax, Tax
1797
+ object_of :date, String
1798
+ object_of :discount, Cost
1799
+ object_of :image_url, String
1800
+ object_of :unit_of_measure, String
1569
1801
  end
1570
1802
  end
1571
1803
 
1572
1804
  class MerchantInfo < Base
1573
1805
  def self.load_members
1574
- object_of :email, String
1575
- object_of :first_name, String
1576
- object_of :last_name, String
1577
- object_of :address, Address
1578
- object_of :business_name, String
1579
- object_of :phone, Phone
1580
- object_of :fax, Phone
1581
- object_of :website, String
1582
- object_of :tax_id, String
1583
- object_of :additional_info, String
1806
+ object_of :email, String
1807
+ object_of :first_name, String
1808
+ object_of :last_name, String
1809
+ object_of :address, Address
1810
+ object_of :business_name, String
1811
+ object_of :phone, Phone
1812
+ object_of :fax, Phone
1813
+ object_of :website, String
1814
+ object_of :tax_id, String
1815
+ object_of :additional_info_label, String
1816
+ object_of :additional_info, String
1584
1817
  end
1585
1818
  end
1586
1819
 
@@ -1590,9 +1823,37 @@ module PayPal::SDK
1590
1823
  object_of :first_name, String
1591
1824
  object_of :last_name, String
1592
1825
  object_of :business_name, String
1593
- object_of :address, Address
1826
+ object_of :address, InvoiceAddress
1594
1827
  object_of :language, String
1595
1828
  object_of :additional_info, String
1829
+ object_of :notification_channel, String
1830
+ object_of :phone, Phone
1831
+
1832
+ define_method "address=" do |value|
1833
+ if value.is_a?(Address)
1834
+ value = value.to_hash
1835
+ end
1836
+ object = convert_object(value, InvoiceAddress)
1837
+ instance_variable_set("@address", object)
1838
+ end
1839
+
1840
+ define_method "address" do |&block|
1841
+ default_value = PayPal::SDK::Core::Util::OrderedHash.new
1842
+ value = instance_variable_get("@address") || ( default_value && (send("address=", default_value)))
1843
+ value = convert_object(value.to_hash, Address)
1844
+ value
1845
+ end
1846
+
1847
+ define_method "invoice_address=" do |value|
1848
+ object = convert_object(value, InvoiceAddress)
1849
+ instance_variable_set("@address", object)
1850
+ end
1851
+
1852
+ define_method "invoice_address" do |&block|
1853
+ default_value = PayPal::SDK::Core::Util::OrderedHash.new
1854
+ value = instance_variable_get("@address") || ( default_value && (send("address=", default_value)))
1855
+ value
1856
+ end
1596
1857
  end
1597
1858
  end
1598
1859
 
@@ -1601,8 +1862,34 @@ module PayPal::SDK
1601
1862
  object_of :first_name, String
1602
1863
  object_of :last_name, String
1603
1864
  object_of :business_name, String
1604
- object_of :address, Address
1865
+ object_of :address, InvoiceAddress
1605
1866
  object_of :email, String
1867
+
1868
+ define_method "address=" do |value|
1869
+ if value.is_a?(Address)
1870
+ value = value.to_hash
1871
+ end
1872
+ object = convert_object(value, InvoiceAddress)
1873
+ instance_variable_set("@address", object)
1874
+ end
1875
+
1876
+ define_method "address" do |&block|
1877
+ default_value = PayPal::SDK::Core::Util::OrderedHash.new
1878
+ value = instance_variable_get("@address") || ( default_value && (send("address=", default_value)))
1879
+ value = convert_object(value.to_hash, Address)
1880
+ value
1881
+ end
1882
+
1883
+ define_method "invoice_address=" do |value|
1884
+ object = convert_object(value, InvoiceAddress)
1885
+ instance_variable_set("@address", object)
1886
+ end
1887
+
1888
+ define_method "invoice_address" do |&block|
1889
+ default_value = PayPal::SDK::Core::Util::OrderedHash.new
1890
+ value = instance_variable_get("@address") || ( default_value && (send("address=", default_value)))
1891
+ value
1892
+ end
1606
1893
  end
1607
1894
  end
1608
1895
 
@@ -1611,6 +1898,7 @@ module PayPal::SDK
1611
1898
  object_of :subject, String
1612
1899
  object_of :note, String
1613
1900
  object_of :send_to_merchant, Boolean
1901
+ array_of :cc_emails, String
1614
1902
  end
1615
1903
  end
1616
1904
 
@@ -1668,6 +1956,7 @@ module PayPal::SDK
1668
1956
  object_of :page, Number
1669
1957
  object_of :page_size, Number
1670
1958
  object_of :total_count_required, Boolean
1959
+ object_of :archived, Boolean
1671
1960
  end
1672
1961
  end
1673
1962
 
@@ -1885,7 +2174,7 @@ module PayPal::SDK
1885
2174
  object_of :rel, String
1886
2175
  object_of :targetSchema, HyperSchema
1887
2176
  object_of :method, String
1888
- object_of :enctype, String
2177
+ object_of :encType, String
1889
2178
  object_of :schema, HyperSchema
1890
2179
  end
1891
2180
  end
@@ -2109,10 +2398,10 @@ module PayPal::SDK
2109
2398
  def self.load_members
2110
2399
  object_of :id, String
2111
2400
  object_of :name, String
2401
+ object_of :temporary, Boolean
2112
2402
  object_of :flow_config, FlowConfig
2113
2403
  object_of :input_fields, InputFields
2114
2404
  object_of :presentation, Presentation
2115
- object_of :temporary, Boolean
2116
2405
  end
2117
2406
 
2118
2407
  include RequestDataType
@@ -2132,8 +2421,9 @@ module PayPal::SDK
2132
2421
  end
2133
2422
 
2134
2423
  def partial_update(patch_request)
2424
+ patch_request = PatchRequest.new(patch_request) unless patch_request.is_a? PatchRequest
2135
2425
  path = "v1/payment-experience/web-profiles/#{self.id}"
2136
- response = api.patch(path, patch_request, http_header)
2426
+ response = api.patch(path, patch_request.to_hash, http_header)
2137
2427
  self.merge!(response)
2138
2428
  success?
2139
2429
  end
@@ -2173,6 +2463,8 @@ module PayPal::SDK
2173
2463
  def self.load_members
2174
2464
  object_of :landing_page_type, String
2175
2465
  object_of :bank_txn_pending_url, String
2466
+ object_of :user_action, String
2467
+ object_of :return_uri_http_method, String
2176
2468
  end
2177
2469
  end
2178
2470
 
@@ -2189,12 +2481,8 @@ module PayPal::SDK
2189
2481
  object_of :brand_name, String
2190
2482
  object_of :logo_image, String
2191
2483
  object_of :locale_code, String
2192
- end
2193
- end
2194
-
2195
- class CreateProfileResponse < Base
2196
- def self.load_members
2197
- object_of :id, String
2484
+ object_of :return_url_label, String
2485
+ object_of :note_to_seller_label, String
2198
2486
  end
2199
2487
  end
2200
2488
 
@@ -2209,6 +2497,97 @@ module PayPal::SDK
2209
2497
  end
2210
2498
  end
2211
2499
 
2500
+ class Dispute < Base
2501
+ def self.load_members
2502
+ object_of :dispute_id, String
2503
+ object_of :create_time, String
2504
+ object_of :update_time, String
2505
+ array_of :disputed_transactions, TransactionInfo
2506
+ object_of :reason, String
2507
+ object_of :status, String
2508
+ object_of :dispute_amount, Money
2509
+ object_of :external_reason_code, String
2510
+ object_of :dispute_outcome, DisputeOutcome
2511
+ object_of :dispute_life_cycle_stage, String
2512
+ object_of :dispute_channel, String
2513
+ array_of :messages, Messages
2514
+ object_of :buyer_response_due_date, String
2515
+ object_of :seller_response_due_date, String
2516
+ object_of :offer, Offer
2517
+ array_of :links, Links
2518
+ end
2519
+ end
2520
+
2521
+ class TransactionInfo < Base
2522
+ def self.load_members
2523
+ object_of :buyer_transaction_id, String
2524
+ object_of :seller_transaction_id, String
2525
+ object_of :create_time, String
2526
+ object_of :transaction_status, String
2527
+ object_of :gross_amount, Money
2528
+ object_of :invoice_number, String
2529
+ object_of :custom, String
2530
+ object_of :buyer, Buyer
2531
+ object_of :seller, Seller
2532
+ array_of :items, ItemInfo
2533
+ end
2534
+ end
2535
+
2536
+ class Buyer < Base
2537
+ def self.load_members
2538
+ object_of :email, String
2539
+ object_of :name, String
2540
+ end
2541
+ end
2542
+
2543
+ class Seller < Base
2544
+ def self.load_members
2545
+ object_of :email, String
2546
+ object_of :merchant_id, String
2547
+ object_of :name, String
2548
+ end
2549
+ end
2550
+
2551
+ class ItemInfo < Base
2552
+ def self.load_members
2553
+ object_of :item_id, String
2554
+ object_of :partner_transaction_id, String
2555
+ object_of :reason, String
2556
+ object_of :dispute_amount, Money
2557
+ object_of :notes, String
2558
+ end
2559
+ end
2560
+
2561
+ class Money < Base
2562
+ def self.load_members
2563
+ object_of :currency_code, String
2564
+ object_of :value, String
2565
+ end
2566
+ end
2567
+
2568
+ class DisputeOutcome < Base
2569
+ def self.load_members
2570
+ object_of :outcome_code, String
2571
+ object_of :amount_refunded, Money
2572
+ end
2573
+ end
2574
+
2575
+ class Messages < Base
2576
+ def self.load_members
2577
+ object_of :posted_by, String
2578
+ object_of :time_posted, String
2579
+ object_of :content, String
2580
+ end
2581
+ end
2582
+
2583
+ class Offer < Base
2584
+ def self.load_members
2585
+ object_of :buyer_requested_amount, Money
2586
+ object_of :seller_offered_amount, Money
2587
+ object_of :offer_type, String
2588
+ end
2589
+ end
2590
+
2212
2591
  constants.each do |data_type_klass|
2213
2592
  data_type_klass = const_get(data_type_klass)
2214
2593
  data_type_klass.load_members if defined? data_type_klass.load_members