mangopay4-python-sdk 3.52.0__tar.gz → 3.54.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/PKG-INFO +1 -1
  2. mangopay4_python_sdk-3.54.0/mangopay/__init__.py +33 -0
  3. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/constants.py +13 -1
  4. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/fields.py +160 -1
  5. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/resources.py +172 -71
  6. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/utils.py +145 -4
  7. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay4_python_sdk.egg-info/PKG-INFO +1 -1
  8. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay4_python_sdk.egg-info/SOURCES.txt +2 -1
  9. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/setup.py +1 -1
  10. mangopay4_python_sdk-3.54.0/tests/resources/settlement_sample.csv +8 -0
  11. mangopay4_python_sdk-3.54.0/tests/resources/settlement_sample_bad.csv +8 -0
  12. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_base.py +57 -0
  13. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_conversion.py +13 -2
  14. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_payins.py +132 -10
  15. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_payouts.py +44 -1
  16. mangopay4_python_sdk-3.54.0/tests/test_settlements.py +60 -0
  17. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_users.py +9 -13
  18. mangopay4_python_sdk-3.52.0/mangopay/__init__.py +0 -27
  19. mangopay4_python_sdk-3.52.0/tests/resources/settlement_sample.csv +0 -8
  20. mangopay4_python_sdk-3.52.0/tests/test_settlements.py +0 -38
  21. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/DESCRIPTION.md +0 -0
  22. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/LICENSE +0 -0
  23. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/MANIFEST.in +0 -0
  24. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/Makefile +0 -0
  25. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/README.md +0 -0
  26. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/api.py +0 -0
  27. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/auth.py +0 -0
  28. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/base.py +0 -0
  29. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/compat.py +0 -0
  30. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/exceptions.py +0 -0
  31. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/page.py +0 -0
  32. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/query.py +0 -0
  33. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/ratelimit.py +0 -0
  34. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay/signals.py +0 -0
  35. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay4_python_sdk.egg-info/dependency_links.txt +0 -0
  36. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay4_python_sdk.egg-info/entry_points.txt +0 -0
  37. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay4_python_sdk.egg-info/requires.txt +0 -0
  38. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/mangopay4_python_sdk.egg-info/top_level.txt +0 -0
  39. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/setup.cfg +0 -0
  40. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/__init__.py +0 -0
  41. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/card.json +0 -0
  42. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/cardregistrations.json +0 -0
  43. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/cardregistrations_update.json +0 -0
  44. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/declarative_user.json +0 -0
  45. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/legal_user.json +0 -0
  46. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/legal_user_wallet.json +0 -0
  47. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/legal_user_wallet_89.json +0 -0
  48. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/legal_user_wallet_99.json +0 -0
  49. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/list_ubo_declarations.json +0 -0
  50. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/natural_user.json +0 -0
  51. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/natural_user_wallet.json +0 -0
  52. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/natural_user_wallet_9.json +0 -0
  53. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/ubo.json +0 -0
  54. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/ubo_declaration.json +0 -0
  55. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/ubo_declaration_submit.json +0 -0
  56. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/ubo_update.json +0 -0
  57. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/user_list_2_per_page.json +0 -0
  58. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/user_list_2_per_page_page1.json +0 -0
  59. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/user_list_3_per_page_page2.json +0 -0
  60. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/user_list_full.json +0 -0
  61. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/user_list_page1.json +0 -0
  62. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/fixtures/user_wallet.json +0 -0
  63. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/images/image.jpg +0 -0
  64. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/mocks.py +0 -0
  65. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/resources/TestKycPageFile.png +0 -0
  66. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/resources.py +0 -0
  67. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/settings.py +0 -0
  68. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_bankaccounts.py +0 -0
  69. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_banking_aliases.py +0 -0
  70. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_cards.py +0 -0
  71. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_client_wallets.py +0 -0
  72. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_clients.py +0 -0
  73. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_country_authorizations.py +0 -0
  74. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_deposits.py +0 -0
  75. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_disputes.py +0 -0
  76. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_documentconsult.py +0 -0
  77. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_emoney.py +0 -0
  78. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_idempotency.py +0 -0
  79. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_identity_verification.py +0 -0
  80. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_kyc_document.py +0 -0
  81. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_kycs.py +0 -0
  82. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_mandates.py +0 -0
  83. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_notifications.py +0 -0
  84. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_preauthorizations.py +0 -0
  85. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_rate_limit.py +0 -0
  86. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_recipients.py +0 -0
  87. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_refunds.py +0 -0
  88. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_reports.py +0 -0
  89. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_reports_v2.py +0 -0
  90. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_repudiations.py +0 -0
  91. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_tokens.py +0 -0
  92. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_transactions.py +0 -0
  93. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_transfers.py +0 -0
  94. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_ubos.py +0 -0
  95. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_utils.py +0 -0
  96. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_virtual_account.py +0 -0
  97. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.54.0}/tests/test_wallets.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mangopay4-python-sdk
3
- Version: 3.52.0
3
+ Version: 3.54.0
4
4
  Summary: A client library written in python to work with mangopay v2 api
5
5
  Home-page: https://github.com/Mangopay/mangopay2-python-sdk
6
6
  Author: Mangopay (www.mangopay.com)
@@ -0,0 +1,33 @@
1
+ client_id = None
2
+ apikey = None
3
+ api_url = 'https://api.mangopay.com/v2.01/'
4
+ api_sandbox_url = 'https://api.sandbox.mangopay.com/v2.01/'
5
+ temp_dir = None
6
+ api_version = 2.01
7
+ sandbox = True
8
+ uk_header_flag = False
9
+
10
+ package_version = None
11
+ try:
12
+ # try importlib.metadata first
13
+ from importlib.metadata import version
14
+ package_version = version('mangopay4-python-sdk')
15
+ except Exception:
16
+ # fallback for development/editable installs
17
+ try:
18
+ with open('./setup.py', 'r') as f:
19
+ for line in f:
20
+ if line.startswith(' version'):
21
+ package_version = line.split('=')[1].replace("'", "").replace(",", "").replace("\n", "").strip()
22
+ except:
23
+ None
24
+
25
+
26
+ from .api import APIRequest # noqa
27
+ from .utils import memoize
28
+
29
+
30
+ def _get_default_handler():
31
+ return APIRequest()
32
+
33
+ get_default_handler = memoize(_get_default_handler, {}, 0)
@@ -136,7 +136,6 @@ EVENT_TYPE_CHOICES = Choices(
136
136
  ('MANDATE_ACTIVATED', 'mandate_activated', 'Mandate activated'),
137
137
  ('MANDATE_SUBMITTED', 'mandate_submitted', 'Mandate submitted'),
138
138
  ('MANDATE_EXPIRED', 'mandate_expired', 'Mandate expired'),
139
- ('USER_KYC_REGULAR', 'user_kyc_regular', 'User kyc regular'),
140
139
  ('USER_INFLOWS_BLOCKED', 'user_inflows_blocked', 'User inflows blocked'),
141
140
  ('USER_INFLOWS_UNBLOCKED', 'user_inflows_unblocked', 'User inflows unblocked'),
142
141
  ('USER_OUTFLOWS_BLOCKED', 'user_outflows_blocked', 'User outflows blocked'),
@@ -178,10 +177,23 @@ EVENT_TYPE_CHOICES = Choices(
178
177
  ('UBO_DECLARATION_VALIDATED', 'ubo_declaration_validated', 'Ubo Declaration Validated'),
179
178
  ('UBO_DECLARATION_INCOMPLETE', 'ubo_declaration_incomplete', 'Ubo Declaration Incomplete'),
180
179
  ('USER_KYC_LIGHT', 'user_kyc_light', 'User Kyc Light'),
180
+ ('USER_KYC_REGULAR', 'user_kyc_regular', 'User kyc regular'),
181
+ ('USER_KYC_RENEWAL_REQUIRED', 'user_kyc_renewal_required', 'User KYC Renewal Required'),
182
+ ('USER_KYC_RENEWED', 'user_kyc_renewed', 'User KYC Renewed'),
181
183
 
182
184
  ('SCA_ENROLLMENT_SUCCEEDED', 'sca_enrollment_succeeded', 'Sca enrollment succeeded'),
183
185
  ('SCA_ENROLLMENT_FAILED', 'sca_enrollment_failed', 'Sca enrollment failed'),
184
186
  ('SCA_ENROLLMENT_EXPIRED', 'sca_enrollment_expired', 'Sca enrollment expired'),
187
+ ('SCA_CONTACT_INFORMATION_UPDATE_CONSENT_GIVEN', 'sca_contact_information_update_consent_given', 'Sca Contact Information Update Consent Given'),
188
+ ('SCA_CONTACT_INFORMATION_UPDATE_CONSENT_REVOKED', 'sca_contact_information_update_consent_revoked', 'Sca Contact Information Update Consent Revoked'),
189
+ ('SCA_TRANSFER_CONSENT_GIVEN', 'sca_transfer_consent_given', 'Sca Transfer Consent Given'),
190
+ ('SCA_TRANSFER_CONSENT_REVOKED', 'sca_transfer_consent_revoked', 'Sca Transfer Consent Revoked'),
191
+ ('SCA_RECIPIENT_REGISTRATION_CONSENT_GIVEN', 'sca_recipient_registration_consent_given', 'Sca Recipient Registration Consent Given'),
192
+ ('SCA_RECIPIENT_REGISTRATION_CONSENT_REVOKED', 'sca_recipient_registration_consent_revoked', 'Sca Recipient Registration Consent Revoked'),
193
+ ('SCA_VIEW_ACCOUNT_INFORMATION_CONSENT_GIVEN', 'sca_view_account_information_consent_given', 'Sca View Account Information Consent Given'),
194
+ ('SCA_VIEW_ACCOUNT_INFORMATION_CONSENT_REVOKED', 'sca_view_account_information_consent_revoked', 'Sca View Account Information Consent Revoked'),
195
+ ('SCA_EMAIL_VERIFIED', 'sca_email_verified', 'Sca Email Verified'),
196
+ ('SCA_PHONE_NUMBER_VERIFIED', 'sca_phone_number_verified', 'Sca Phone Number Verified'),
185
197
 
186
198
  ('VIRTUAL_ACCOUNT_ACTIVE', 'virtual_account_active', 'Virtual Account Active'),
187
199
  ('VIRTUAL_ACCOUNT_BLOCKED', 'virtual_account_blocked', 'Virtual Account Blocked'),
@@ -13,7 +13,9 @@ from .utils import timestamp_from_datetime, timestamp_from_date, Money, DebitedB
13
13
  PayinsLinked, ConversionRate, CardInfo, LocalAccountDetails, InternationalAccountDetails, \
14
14
  VirtualAccountCapabilities, PaymentRef, PendingUserAction, LegalRepresentative, IndividualRecipient, \
15
15
  BusinessRecipient, RecipientPropertySchema, IndividualRecipientPropertySchema, BusinessRecipientPropertySchema, \
16
- CompanyNumberValidation, ReportFilter, PayInIntentExternalData, PayInIntentBuyer, SupportedBank, VerificationOfPayee
16
+ CompanyNumberValidation, ReportFilter, PayInIntentExternalData, PayInIntentBuyer, SupportedBank, \
17
+ VerificationOfPayee, PayInIntentRefund, PayInIntentCapture, PayInIntentDispute, CustomFees, MarginsResponse, \
18
+ UserMargin, ConsentScope
17
19
 
18
20
 
19
21
  class FieldDescriptor(object):
@@ -1343,3 +1345,160 @@ class VerificationOfPayeeField(Field):
1343
1345
  return result
1344
1346
 
1345
1347
  return value
1348
+
1349
+
1350
+ class PayInIntentRefundField(Field):
1351
+ def python_value(self, value):
1352
+ if value is not None:
1353
+ return PayInIntentRefund(id=value.get('Id', None))
1354
+
1355
+ return value
1356
+
1357
+ def api_value(self, value):
1358
+ value = super(PayInIntentRefundField, self).api_value(value)
1359
+
1360
+ if isinstance(value, PayInIntentRefund):
1361
+ result = {}
1362
+ if value.id is not None:
1363
+ result['Id'] = value.id
1364
+ return result
1365
+
1366
+ return value
1367
+
1368
+
1369
+ class PayInIntentCaptureField(Field):
1370
+ def python_value(self, value):
1371
+ if value is not None:
1372
+ return PayInIntentCapture(id=value.get('Id', None))
1373
+
1374
+ return value
1375
+
1376
+ def api_value(self, value):
1377
+ value = super(PayInIntentCaptureField, self).api_value(value)
1378
+
1379
+ if isinstance(value, PayInIntentCapture):
1380
+ result = {}
1381
+ if value.id is not None:
1382
+ result['Id'] = value.id
1383
+ return result
1384
+
1385
+ return value
1386
+
1387
+
1388
+ class PayInIntentDisputeField(Field):
1389
+ def python_value(self, value):
1390
+ if value is not None:
1391
+ return PayInIntentDispute(id=value.get('Id', None))
1392
+
1393
+ return value
1394
+
1395
+ def api_value(self, value):
1396
+ value = super(PayInIntentDisputeField, self).api_value(value)
1397
+
1398
+ if isinstance(value, PayInIntentDispute):
1399
+ result = {}
1400
+ if value.id is not None:
1401
+ result['Id'] = value.id
1402
+ return result
1403
+
1404
+ return value
1405
+
1406
+
1407
+ class CustomFeesField(Field):
1408
+ def python_value(self, value):
1409
+ if value is not None:
1410
+ return CustomFees(amount=value.get('Amount', None),
1411
+ currency=value.get('Currency', None),
1412
+ type=value.get('Type', None),
1413
+ value=value.get('Value', None))
1414
+
1415
+ return value
1416
+
1417
+ def api_value(self, value):
1418
+ value = super(CustomFeesField, self).api_value(value)
1419
+
1420
+ if isinstance(value, CustomFees):
1421
+ result = {}
1422
+ if value.amount is not None:
1423
+ result['Amount'] = value.amount
1424
+ if value.currency is not None:
1425
+ result['Currency'] = value.currency
1426
+ if value.type is not None:
1427
+ result['Type'] = value.type
1428
+ if value.value is not None:
1429
+ result['Value'] = value.value
1430
+ return result
1431
+
1432
+ return value
1433
+
1434
+
1435
+ class MarginsResponseField(Field):
1436
+ def python_value(self, value):
1437
+ if value is not None:
1438
+ return MarginsResponse(mangopay=value.get('Mangopay', None),
1439
+ user=value.get('User', None))
1440
+
1441
+ return value
1442
+
1443
+ def api_value(self, value):
1444
+ value = super(MarginsResponseField, self).api_value(value)
1445
+
1446
+ if isinstance(value, MarginsResponse):
1447
+ result = {}
1448
+ if value.mangopay is not None:
1449
+ result['Mangopay'] = value.mangopay
1450
+ if value.user is not None:
1451
+ result['User'] = value.user
1452
+ return result
1453
+
1454
+ return value
1455
+
1456
+
1457
+ class UserMarginField(Field):
1458
+ def python_value(self, value):
1459
+ if value is not None:
1460
+ return UserMargin(type=value.get('Type', None),
1461
+ value=value.get('Value', None))
1462
+
1463
+ return value
1464
+
1465
+ def api_value(self, value):
1466
+ value = super(UserMarginField, self).api_value(value)
1467
+
1468
+ if isinstance(value, UserMargin):
1469
+ result = {}
1470
+ if value.type is not None:
1471
+ result['Type'] = value.type
1472
+ if value.value is not None:
1473
+ result['Value'] = value.value
1474
+ return result
1475
+
1476
+ return value
1477
+
1478
+
1479
+ class ConsentScopeField(Field):
1480
+ def python_value(self, value):
1481
+ if value is not None:
1482
+ return ConsentScope(contact_information_update=value.get('ContactInformationUpdate', None),
1483
+ recipient_registration=value.get('RecipientRegistration', None),
1484
+ transfer=value.get('Transfer', None),
1485
+ view_account_information=value.get('ViewAccountInformation', None))
1486
+
1487
+ return value
1488
+
1489
+ def api_value(self, value):
1490
+ value = super(ConsentScopeField, self).api_value(value)
1491
+
1492
+ if isinstance(value, ConsentScope):
1493
+ result = {}
1494
+ if value.contact_information_update is not None:
1495
+ result['ContactInformationUpdate'] = value.contact_information_update
1496
+ if value.recipient_registration is not None:
1497
+ result['RecipientRegistration'] = value.recipient_registration
1498
+ if value.transfer is not None:
1499
+ result['Transfer'] = value.transfer
1500
+ if value.view_account_information is not None:
1501
+ result['ViewAccountInformation'] = value.view_account_information
1502
+ return result
1503
+
1504
+ return value
@@ -19,9 +19,10 @@ from .fields import (PrimaryKeyField, EmailField, CharField,
19
19
  LegalRepresentativeField, IndividualRecipientField, BusinessRecipientField,
20
20
  RecipientPropertySchemaField, IndividualRecipientPropertySchemaField,
21
21
  BusinessRecipientPropertySchemaField, CompanyNumberValidationField, ReportFilterField,
22
- PayInIntentExternalDataField, PayInIntentBuyerField, SupportedBanksField, VerificationOfPayeeField)
23
- from .query import InsertQuery, UpdateQuery, SelectQuery, ActionQuery, DeleteQuery, InsertMultipartQuery, \
24
- UpdateMultipartQuery
22
+ PayInIntentExternalDataField, PayInIntentBuyerField, SupportedBanksField, VerificationOfPayeeField,
23
+ PayInIntentRefundField, PayInIntentCaptureField, PayInIntentDisputeField, CustomFeesField,
24
+ UserMarginField, MarginsResponseField, ConsentScopeField)
25
+ from .query import InsertQuery, UpdateQuery, SelectQuery, ActionQuery, DeleteQuery
25
26
 
26
27
 
27
28
  class BaseModel(BaseApiModel):
@@ -479,6 +480,10 @@ class ConversionQuote(BaseModel):
479
480
  debited_funds = MoneyField(api_name='DebitedFunds', required=True)
480
481
  credited_funds = MoneyField(api_name='CreditedFunds', required=True)
481
482
  conversion_rate = ConversionRateField(api_name='ConversionRateResponse')
483
+ fees = CustomFeesField(api_name="Fees")
484
+ requested_fees = CustomFeesField(api_name="RequestedFees")
485
+ user_margin = UserMarginField(api_name="UserMargin")
486
+ margins_response = MarginsResponseField(api_name='MarginsResponse')
482
487
 
483
488
  def create_conversion_quote(self, **kwargs):
484
489
  insert = InsertQuery(self, **kwargs)
@@ -514,11 +519,13 @@ class Conversion(BaseModel):
514
519
  debited_funds = MoneyField(api_name='DebitedFunds', required=True)
515
520
  credited_funds = MoneyField(api_name='CreditedFunds', required=True)
516
521
  fees = MoneyField(api_name="Fees", required=True)
522
+ requested_fees = CustomFeesField(api_name="RequestedFees")
517
523
  result_code = CharField(api_name='ResultCode')
518
524
  result_message = CharField(api_name='ResultMessage')
519
525
  execution_date = DateTimeField(api_name='ExecutionDate')
520
526
  conversion_rate = ConversionRateField(api_name='ConversionRate')
521
527
  creation_date = DateTimeField(api_name='CreationDate')
528
+ margins_response = MarginsResponseField(api_name='MarginsResponse')
522
529
 
523
530
  @staticmethod
524
531
  def get_conversion(id, *args, **kwargs):
@@ -582,8 +589,9 @@ class InstantConversion(BaseModel):
582
589
  credited_wallet = ForeignKeyField(Wallet, api_name="CreditedWalletId")
583
590
  debited_funds = MoneyField(api_name="DebitedFunds")
584
591
  credited_funds = MoneyField(api_name="CreditedFunds")
585
- fees = MoneyField(api_name="Fees")
592
+ fees = CustomFeesField(api_name="Fees")
586
593
  tag = CharField(api_name="Tag")
594
+ user_margin = UserMarginField(api_name="UserMargin")
587
595
 
588
596
  def save(self, **kwargs):
589
597
  insert = InsertQuery(self, **kwargs)
@@ -1909,6 +1917,61 @@ class BankAccount(BaseModel):
1909
1917
  return BankAccount.update(self.id, active=False, user_id=self.user_id).execute()
1910
1918
 
1911
1919
 
1920
+ class Recipient(BaseModel):
1921
+ status = CharField(api_name='Status')
1922
+ display_name = CharField(api_name='DisplayName', required=True)
1923
+ payout_method_type = CharField(api_name='PayoutMethodType', required=True)
1924
+ recipient_type = CharField(api_name='RecipientType', required=True)
1925
+ currency = CharField(api_name='Currency', required=True)
1926
+ country = CharField(api_name='Country')
1927
+ recipient_scope = CharField(api_name='RecipientScope')
1928
+ user_id = CharField(api_name='UserId')
1929
+ individual_recipient = IndividualRecipientField(api_name='IndividualRecipient')
1930
+ business_recipient = BusinessRecipientField(api_name='BusinessRecipient')
1931
+ local_bank_transfer = DictField(api_name='LocalBankTransfer')
1932
+ international_bank_transfer = DictField(api_name='InternationalBankTransfer')
1933
+ pending_user_action = PendingUserActionField(api_name='PendingUserAction')
1934
+ recipient_verification_of_payee = VerificationOfPayeeField(api_name='RecipientVerificationOfPayee')
1935
+ sca_context = CharField(api_name='ScaContext')
1936
+
1937
+ class Meta:
1938
+ verbose_name = 'recipient'
1939
+ verbose_name_plural = 'recipients'
1940
+
1941
+ url = {
1942
+ InsertQuery.identifier: '/users/%(user_id)s/recipients',
1943
+ SelectQuery.identifier: '/recipients',
1944
+ UpdateQuery.identifier: '/recipients',
1945
+ 'GET_USER_RECIPIENTS': '/users/%(user_id)s/recipients',
1946
+ 'VALIDATE': '/users/%(user_id)s/recipients/validate'
1947
+ }
1948
+
1949
+ def create(self, user_id, idempotency_key=None, **kwargs):
1950
+ path_params = {'user_id': user_id}
1951
+ insert = InsertQuery(self, idempotency_key, path_params, **kwargs)
1952
+ insert.insert_query = self.get_field_dict()
1953
+ return insert.execute()
1954
+
1955
+ def validate(self, user_id, idempotency_key=None, **kwargs):
1956
+ path_params = {'user_id': user_id}
1957
+ insert = InsertQuery(self, idempotency_key, path_params, **kwargs)
1958
+ insert.insert_query = self.get_field_dict()
1959
+ insert.identifier = 'VALIDATE'
1960
+ insert.execute()
1961
+
1962
+ @classmethod
1963
+ def get_user_recipients(cls, user_id, *args, **kwargs):
1964
+ kwargs['user_id'] = user_id
1965
+ select = SelectQuery(Recipient, *args, **kwargs)
1966
+ select.identifier = 'GET_USER_RECIPIENTS'
1967
+ return select.all(*args, **kwargs)
1968
+
1969
+ @classmethod
1970
+ def deactivate(cls, recipient_id, **kwargs):
1971
+ update = UpdateQuery(Recipient, recipient_id, **kwargs)
1972
+ return update.execute()
1973
+
1974
+
1912
1975
  @python_2_unicode_compatible
1913
1976
  class BankWirePayOut(BaseModel):
1914
1977
  author = ForeignKeyField(User, api_name='AuthorId', required=True)
@@ -1916,7 +1979,7 @@ class BankWirePayOut(BaseModel):
1916
1979
  credited_funds = MoneyField(api_name='CreditedFunds')
1917
1980
  debited_funds = MoneyField(api_name='DebitedFunds', required=True)
1918
1981
  debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId', required=True)
1919
- bank_account = ForeignKeyField(BankAccount, api_name='BankAccountId', required=True)
1982
+ bank_account = ForeignKeyField(BankAccount, api_name='BankAccountId')
1920
1983
  status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
1921
1984
  result_code = CharField(api_name='ResultCode')
1922
1985
  result_message = CharField(api_name='ResultMessage')
@@ -1934,6 +1997,7 @@ class BankWirePayOut(BaseModel):
1934
1997
  mode_applied = CharField(api_name='ModeApplied')
1935
1998
  fallback_reason = FallbackReasonField(api_name='FallbackReason')
1936
1999
  recipient_verification_of_payee = VerificationOfPayeeField(api_name='RecipientVerificationOfPayee')
2000
+ recipient = ForeignKeyField(Recipient, api_name='RecipientId')
1937
2001
 
1938
2002
  def get_refunds(self, *args, **kwargs):
1939
2003
  kwargs['id'] = self.id
@@ -2892,61 +2956,6 @@ class IdentityVerification(BaseModel):
2892
2956
  return select.all(*args, **kwargs)
2893
2957
 
2894
2958
 
2895
- class Recipient(BaseModel):
2896
- status = CharField(api_name='Status')
2897
- display_name = CharField(api_name='DisplayName', required=True)
2898
- payout_method_type = CharField(api_name='PayoutMethodType', required=True)
2899
- recipient_type = CharField(api_name='RecipientType', required=True)
2900
- currency = CharField(api_name='Currency', required=True)
2901
- country = CharField(api_name='Country')
2902
- recipient_scope = CharField(api_name='RecipientScope')
2903
- user_id = CharField(api_name='UserId')
2904
- individual_recipient = IndividualRecipientField(api_name='IndividualRecipient')
2905
- business_recipient = BusinessRecipientField(api_name='BusinessRecipient')
2906
- local_bank_transfer = DictField(api_name='LocalBankTransfer')
2907
- international_bank_transfer = DictField(api_name='InternationalBankTransfer')
2908
- pending_user_action = PendingUserActionField(api_name='PendingUserAction')
2909
- recipient_verification_of_payee = VerificationOfPayeeField(api_name='RecipientVerificationOfPayee')
2910
- sca_context = CharField(api_name='ScaContext')
2911
-
2912
- class Meta:
2913
- verbose_name = 'recipient'
2914
- verbose_name_plural = 'recipients'
2915
-
2916
- url = {
2917
- InsertQuery.identifier: '/users/%(user_id)s/recipients',
2918
- SelectQuery.identifier: '/recipients',
2919
- UpdateQuery.identifier: '/recipients',
2920
- 'GET_USER_RECIPIENTS': '/users/%(user_id)s/recipients',
2921
- 'VALIDATE': '/users/%(user_id)s/recipients/validate'
2922
- }
2923
-
2924
- def create(self, user_id, idempotency_key=None, **kwargs):
2925
- path_params = {'user_id': user_id}
2926
- insert = InsertQuery(self, idempotency_key, path_params, **kwargs)
2927
- insert.insert_query = self.get_field_dict()
2928
- return insert.execute()
2929
-
2930
- def validate(self, user_id, idempotency_key=None, **kwargs):
2931
- path_params = {'user_id': user_id}
2932
- insert = InsertQuery(self, idempotency_key, path_params, **kwargs)
2933
- insert.insert_query = self.get_field_dict()
2934
- insert.identifier = 'VALIDATE'
2935
- insert.execute()
2936
-
2937
- @classmethod
2938
- def get_user_recipients(cls, user_id, *args, **kwargs):
2939
- kwargs['user_id'] = user_id
2940
- select = SelectQuery(Recipient, *args, **kwargs)
2941
- select.identifier = 'GET_USER_RECIPIENTS'
2942
- return select.all(*args, **kwargs)
2943
-
2944
- @classmethod
2945
- def deactivate(cls, recipient_id, **kwargs):
2946
- update = UpdateQuery(Recipient, recipient_id, **kwargs)
2947
- return update.execute()
2948
-
2949
-
2950
2959
  class RecipientSchema(BaseModel):
2951
2960
  display_name = RecipientPropertySchemaField(api_name='DisplayName')
2952
2961
  payout_method_type = RecipientPropertySchemaField(api_name='PayoutMethodType')
@@ -3022,10 +3031,15 @@ class PayInIntent(BaseModel):
3022
3031
  buyer = PayInIntentBuyerField(api_name='Buyer')
3023
3032
  line_items = ListField(api_name='LineItems')
3024
3033
  captures = ListField(api_name='Captures')
3034
+ capture = PayInIntentCaptureField(api_name='Capture')
3025
3035
  refunds = ListField(api_name='Refunds')
3036
+ refund = PayInIntentRefundField(api_name='Refund')
3026
3037
  disputes = ListField(api_name='Disputes')
3038
+ dispute = PayInIntentDisputeField(api_name='Dispute')
3027
3039
  splits = ListField(api_name='Splits')
3028
3040
  settlement_id = CharField(api_name='SettlementId')
3041
+ unfunded_amount = IntegerField(api_name='UnfundedAmount')
3042
+ decision = CharField(api_name='Decision')
3029
3043
 
3030
3044
  class Meta:
3031
3045
  verbose_name = 'pay_in_intent'
@@ -3035,7 +3049,11 @@ class PayInIntent(BaseModel):
3035
3049
  'CREATE_AUTHORIZATION': '/payins/intents',
3036
3050
  'CREATE_CAPTURE': '/payins/intents/%(intent_id)s/captures',
3037
3051
  'GET': '/payins/intents',
3038
- 'CANCEL': '/payins/intents/%(intent_id)s/cancel'
3052
+ 'CANCEL': '/payins/intents/%(intent_id)s/cancel',
3053
+ 'CREATE_REFUND': '/payins/intents/%(intent_id)s/refunds',
3054
+ 'REVERSE_REFUND': '/payins/intents/%(intent_id)s/refunds/%(refund_id)s/reverse',
3055
+ 'CREATE_DISPUTE': '/payins/intents/%(intent_id)s/captures/%(capture_id)s/disputes',
3056
+ 'UPDATE_DISPUTE_OUTCOME': '/payins/intents/%(intent_id)s/captures/%(capture_id)s/disputes/%(dispute_id)s/decision',
3039
3057
  }
3040
3058
 
3041
3059
  def create_authorization(self, idempotency_key=None, **kwargs):
@@ -3064,6 +3082,34 @@ class PayInIntent(BaseModel):
3064
3082
  insert.identifier = 'CANCEL'
3065
3083
  return insert.execute(is_v3=True)
3066
3084
 
3085
+ @classmethod
3086
+ def create_refund(cls, intent_id, idempotency_key=None, **kwargs):
3087
+ path_params = {'intent_id': intent_id}
3088
+ insert = InsertQuery(PayInIntent, idempotency_key, path_params, **kwargs)
3089
+ insert.identifier = 'CREATE_REFUND'
3090
+ return insert.execute(is_v3=True)
3091
+
3092
+ @classmethod
3093
+ def reverse_refund(cls, intent_id, refund_id, idempotency_key=None, **kwargs):
3094
+ path_params = {'intent_id': intent_id, 'refund_id': refund_id}
3095
+ insert = InsertQuery(PayInIntent, idempotency_key, path_params, **kwargs)
3096
+ insert.identifier = 'REVERSE_REFUND'
3097
+ return insert.execute(is_v3=True)
3098
+
3099
+ @classmethod
3100
+ def create_dispute(cls, intent_id, capture_id, idempotency_key=None, **kwargs):
3101
+ path_params = {'intent_id': intent_id, 'capture_id': capture_id}
3102
+ insert = InsertQuery(PayInIntent, idempotency_key, path_params, **kwargs)
3103
+ insert.identifier = 'CREATE_DISPUTE'
3104
+ return insert.execute(is_v3=True)
3105
+
3106
+ @classmethod
3107
+ def update_dispute_outcome(cls, intent_id, capture_id, dispute_id, **kwargs):
3108
+ path_params = {'intent_id': intent_id, 'capture_id': capture_id, 'dispute_id': dispute_id}
3109
+ update = UpdateQuery(PayInIntent, "", path_params, **kwargs)
3110
+ update.identifier = 'UPDATE_DISPUTE_OUTCOME'
3111
+ return update.execute(is_v3=True)
3112
+
3067
3113
 
3068
3114
  class Settlement(BaseModel):
3069
3115
  settlement_id = CharField(api_name='SettlementId')
@@ -3074,21 +3120,24 @@ class Settlement(BaseModel):
3074
3120
  external_processor_fees_amount = IntegerField(api_name='ExternalProcessorFeesAmount')
3075
3121
  actual_settlement_amount = IntegerField(api_name='ActualSettlementAmount')
3076
3122
  funds_missing_amount = IntegerField(api_name='FundsMissingAmount')
3123
+ file_name = CharField(api_name='FileName')
3124
+ upload_url = CharField(api_name='UploadUrl')
3077
3125
 
3078
3126
  class Meta:
3079
3127
  verbose_name = 'settlement'
3080
3128
  verbose_name_plural = 'settlements'
3081
3129
 
3082
3130
  url = {
3083
- 'UPLOAD': '/payins/intents/settlements',
3131
+ 'GENERATE_UPLOAD_URL': '/payins/intents/settlements',
3084
3132
  'GET': '/payins/intents/settlements',
3085
- 'UPDATE': '/payins/intents/settlements'
3133
+ 'GENERATE_NEW_UPLOAD_URL': '/payins/intents/settlements',
3134
+ 'CANCEL': '/payins/intents/settlements/%(settlement_id)s/cancel',
3086
3135
  }
3087
3136
 
3088
- @classmethod
3089
- def upload(cls, file, idempotency_key=None, **kwargs):
3090
- insert = InsertMultipartQuery(Settlement, file, 'settlement_file.csv', idempotency_key, **kwargs)
3091
- insert.identifier = 'UPLOAD'
3137
+ def generate_upload_url(self, idempotency_key=None, **kwargs):
3138
+ insert = InsertQuery(Settlement, idempotency_key, None, **kwargs)
3139
+ insert.insert_query = self.get_field_dict()
3140
+ insert.identifier = 'GENERATE_UPLOAD_URL'
3092
3141
  return insert.execute(is_v3=True)
3093
3142
 
3094
3143
  @classmethod
@@ -3097,12 +3146,40 @@ class Settlement(BaseModel):
3097
3146
  select.identifier = 'GET'
3098
3147
  return select.get(settlement_id, is_v3=True, *args, **kwargs)
3099
3148
 
3100
- @classmethod
3101
- def update_file(cls, settlement_id, file, **kwargs):
3102
- update = UpdateMultipartQuery(Settlement, file, 'settlement_file.csv', settlement_id, **kwargs)
3103
- update.identifier = 'UPDATE'
3149
+ def generate_new_upload_url(self, **kwargs):
3150
+ update = UpdateQuery(Settlement, self.id, None, **kwargs)
3151
+ update.update_query = self.get_field_dict()
3152
+ update.identifier = 'GENERATE_NEW_UPLOAD_URL'
3104
3153
  return update.execute(is_v3=True)
3105
3154
 
3155
+ @classmethod
3156
+ def cancel(cls, settlement_id, idempotency_key=None, *args, **kwargs):
3157
+ path_params = {'settlement_id': settlement_id}
3158
+ insert = InsertQuery(Settlement, idempotency_key, path_params, **kwargs)
3159
+ insert.identifier = 'CANCEL'
3160
+ return insert.execute(*args, is_v3=True)
3161
+
3162
+
3163
+ class SettlementValidation(BaseModel):
3164
+ footer_errors = ListField(api_name='FooterErrors')
3165
+ lines_errors = ListField(api_name='LinesErrors')
3166
+
3167
+ class Meta:
3168
+ verbose_name = 'settlement_validation'
3169
+ verbose_name_plural = 'settlement_validations'
3170
+
3171
+ url = {
3172
+ 'GET': '/payins/intents/settlements/%(settlement_id)s/validations',
3173
+ }
3174
+
3175
+ @classmethod
3176
+ def get(cls, settlement_id, *args, **kwargs):
3177
+ if kwargs.get('settlement_id') is None:
3178
+ kwargs['settlement_id'] = settlement_id
3179
+ select = SelectQuery(SettlementValidation, *args, **kwargs)
3180
+ select.identifier = 'GET'
3181
+ return select.get("", with_query_params=True, is_v3=True, *args, **kwargs)
3182
+
3106
3183
 
3107
3184
  class PayInIntentSplit(BaseModel):
3108
3185
  line_item_id = CharField(api_name='LineItemId')
@@ -3113,6 +3190,7 @@ class PayInIntentSplit(BaseModel):
3113
3190
  description = CharField(api_name='Description')
3114
3191
  status = CharField(api_name='Status')
3115
3192
  transfer_date = DateTimeField(api_name='TransferDate')
3193
+ split_origin_wallet_id = CharField(api_name='SplitOriginWalletId')
3116
3194
 
3117
3195
  class Meta:
3118
3196
  verbose_name = 'intent_split'
@@ -3217,3 +3295,26 @@ class PayPalDataCollection(BaseModel):
3217
3295
  select = SelectQuery(PayPalDataCollection, *args, **kwargs)
3218
3296
  select.identifier = 'GET'
3219
3297
  return select.get(data_collection_id, strict_dict_parsing=False, **kwargs)
3298
+
3299
+
3300
+ @python_2_unicode_compatible
3301
+ class ScaStatus(BaseModel):
3302
+ user_status = CharField(api_name='UserStatus')
3303
+ is_enrolled = BooleanField(api_name='IsEnrolled')
3304
+ last_enrollment_date = DateTimeField(api_name='LastEnrollmentDate')
3305
+ last_consent_collection_date = DateTimeField(api_name='LastConsentCollectionDate')
3306
+ consent_scope = ConsentScopeField(api_name='ConsentScope')
3307
+
3308
+ class Meta:
3309
+ verbose_name = 'sca_status'
3310
+ verbose_name_plural = 'sca_statuses'
3311
+ url = {
3312
+ 'GET': '/sca/users/%(id)s/sca-status',
3313
+ }
3314
+
3315
+ @staticmethod
3316
+ def get(user_id, *args, **kwargs):
3317
+ kwargs['id'] = user_id
3318
+ select = SelectQuery(ScaStatus, *args, **kwargs)
3319
+ select.identifier = 'GET'
3320
+ return select.get("", *args, **kwargs)