mangopay4-python-sdk 3.52.0__tar.gz → 3.53.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 (94) hide show
  1. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/PKG-INFO +1 -1
  2. mangopay4_python_sdk-3.53.0/mangopay/__init__.py +33 -0
  3. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/constants.py +13 -1
  4. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/fields.py +30 -1
  5. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/resources.py +82 -57
  6. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/utils.py +22 -0
  7. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay4_python_sdk.egg-info/PKG-INFO +1 -1
  8. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/setup.py +1 -1
  9. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_payins.py +2 -3
  10. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_payouts.py +44 -1
  11. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_users.py +9 -13
  12. mangopay4_python_sdk-3.52.0/mangopay/__init__.py +0 -27
  13. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/DESCRIPTION.md +0 -0
  14. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/LICENSE +0 -0
  15. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/MANIFEST.in +0 -0
  16. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/Makefile +0 -0
  17. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/README.md +0 -0
  18. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/api.py +0 -0
  19. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/auth.py +0 -0
  20. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/base.py +0 -0
  21. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/compat.py +0 -0
  22. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/exceptions.py +0 -0
  23. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/page.py +0 -0
  24. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/query.py +0 -0
  25. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/ratelimit.py +0 -0
  26. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay/signals.py +0 -0
  27. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay4_python_sdk.egg-info/SOURCES.txt +0 -0
  28. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay4_python_sdk.egg-info/dependency_links.txt +0 -0
  29. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay4_python_sdk.egg-info/entry_points.txt +0 -0
  30. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay4_python_sdk.egg-info/requires.txt +0 -0
  31. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/mangopay4_python_sdk.egg-info/top_level.txt +0 -0
  32. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/setup.cfg +0 -0
  33. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/__init__.py +0 -0
  34. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/card.json +0 -0
  35. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/cardregistrations.json +0 -0
  36. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/cardregistrations_update.json +0 -0
  37. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/declarative_user.json +0 -0
  38. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/legal_user.json +0 -0
  39. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/legal_user_wallet.json +0 -0
  40. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/legal_user_wallet_89.json +0 -0
  41. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/legal_user_wallet_99.json +0 -0
  42. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/list_ubo_declarations.json +0 -0
  43. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/natural_user.json +0 -0
  44. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/natural_user_wallet.json +0 -0
  45. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/natural_user_wallet_9.json +0 -0
  46. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/ubo.json +0 -0
  47. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/ubo_declaration.json +0 -0
  48. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/ubo_declaration_submit.json +0 -0
  49. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/ubo_update.json +0 -0
  50. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/user_list_2_per_page.json +0 -0
  51. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/user_list_2_per_page_page1.json +0 -0
  52. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/user_list_3_per_page_page2.json +0 -0
  53. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/user_list_full.json +0 -0
  54. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/user_list_page1.json +0 -0
  55. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/fixtures/user_wallet.json +0 -0
  56. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/images/image.jpg +0 -0
  57. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/mocks.py +0 -0
  58. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/resources/TestKycPageFile.png +0 -0
  59. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/resources/settlement_sample.csv +0 -0
  60. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/resources.py +0 -0
  61. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/settings.py +0 -0
  62. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_bankaccounts.py +0 -0
  63. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_banking_aliases.py +0 -0
  64. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_base.py +0 -0
  65. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_cards.py +0 -0
  66. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_client_wallets.py +0 -0
  67. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_clients.py +0 -0
  68. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_conversion.py +0 -0
  69. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_country_authorizations.py +0 -0
  70. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_deposits.py +0 -0
  71. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_disputes.py +0 -0
  72. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_documentconsult.py +0 -0
  73. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_emoney.py +0 -0
  74. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_idempotency.py +0 -0
  75. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_identity_verification.py +0 -0
  76. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_kyc_document.py +0 -0
  77. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_kycs.py +0 -0
  78. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_mandates.py +0 -0
  79. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_notifications.py +0 -0
  80. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_preauthorizations.py +0 -0
  81. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_rate_limit.py +0 -0
  82. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_recipients.py +0 -0
  83. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_refunds.py +0 -0
  84. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_reports.py +0 -0
  85. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_reports_v2.py +0 -0
  86. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_repudiations.py +0 -0
  87. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_settlements.py +0 -0
  88. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_tokens.py +0 -0
  89. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_transactions.py +0 -0
  90. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_transfers.py +0 -0
  91. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_ubos.py +0 -0
  92. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_utils.py +0 -0
  93. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.0}/tests/test_virtual_account.py +0 -0
  94. {mangopay4_python_sdk-3.52.0 → mangopay4_python_sdk-3.53.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.53.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,8 @@ 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, ConsentScope
17
18
 
18
19
 
19
20
  class FieldDescriptor(object):
@@ -1343,3 +1344,31 @@ class VerificationOfPayeeField(Field):
1343
1344
  return result
1344
1345
 
1345
1346
  return value
1347
+
1348
+
1349
+ class ConsentScopeField(Field):
1350
+ def python_value(self, value):
1351
+ if value is not None:
1352
+ return ConsentScope(contact_information_update=value.get('ContactInformationUpdate', None),
1353
+ recipient_registration=value.get('RecipientRegistration', None),
1354
+ transfer=value.get('Transfer', None),
1355
+ view_account_information=value.get('ViewAccountInformation', None))
1356
+
1357
+ return value
1358
+
1359
+ def api_value(self, value):
1360
+ value = super(ConsentScopeField, self).api_value(value)
1361
+
1362
+ if isinstance(value, ConsentScope):
1363
+ result = {}
1364
+ if value.contact_information_update is not None:
1365
+ result['ContactInformationUpdate'] = value.contact_information_update
1366
+ if value.recipient_registration is not None:
1367
+ result['RecipientRegistration'] = value.recipient_registration
1368
+ if value.transfer is not None:
1369
+ result['Transfer'] = value.transfer
1370
+ if value.view_account_information is not None:
1371
+ result['ViewAccountInformation'] = value.view_account_information
1372
+ return result
1373
+
1374
+ return value
@@ -19,7 +19,8 @@ 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)
22
+ PayInIntentExternalDataField, PayInIntentBuyerField, SupportedBanksField, VerificationOfPayeeField,
23
+ ConsentScopeField)
23
24
  from .query import InsertQuery, UpdateQuery, SelectQuery, ActionQuery, DeleteQuery, InsertMultipartQuery, \
24
25
  UpdateMultipartQuery
25
26
 
@@ -1909,6 +1910,61 @@ class BankAccount(BaseModel):
1909
1910
  return BankAccount.update(self.id, active=False, user_id=self.user_id).execute()
1910
1911
 
1911
1912
 
1913
+ class Recipient(BaseModel):
1914
+ status = CharField(api_name='Status')
1915
+ display_name = CharField(api_name='DisplayName', required=True)
1916
+ payout_method_type = CharField(api_name='PayoutMethodType', required=True)
1917
+ recipient_type = CharField(api_name='RecipientType', required=True)
1918
+ currency = CharField(api_name='Currency', required=True)
1919
+ country = CharField(api_name='Country')
1920
+ recipient_scope = CharField(api_name='RecipientScope')
1921
+ user_id = CharField(api_name='UserId')
1922
+ individual_recipient = IndividualRecipientField(api_name='IndividualRecipient')
1923
+ business_recipient = BusinessRecipientField(api_name='BusinessRecipient')
1924
+ local_bank_transfer = DictField(api_name='LocalBankTransfer')
1925
+ international_bank_transfer = DictField(api_name='InternationalBankTransfer')
1926
+ pending_user_action = PendingUserActionField(api_name='PendingUserAction')
1927
+ recipient_verification_of_payee = VerificationOfPayeeField(api_name='RecipientVerificationOfPayee')
1928
+ sca_context = CharField(api_name='ScaContext')
1929
+
1930
+ class Meta:
1931
+ verbose_name = 'recipient'
1932
+ verbose_name_plural = 'recipients'
1933
+
1934
+ url = {
1935
+ InsertQuery.identifier: '/users/%(user_id)s/recipients',
1936
+ SelectQuery.identifier: '/recipients',
1937
+ UpdateQuery.identifier: '/recipients',
1938
+ 'GET_USER_RECIPIENTS': '/users/%(user_id)s/recipients',
1939
+ 'VALIDATE': '/users/%(user_id)s/recipients/validate'
1940
+ }
1941
+
1942
+ def create(self, user_id, idempotency_key=None, **kwargs):
1943
+ path_params = {'user_id': user_id}
1944
+ insert = InsertQuery(self, idempotency_key, path_params, **kwargs)
1945
+ insert.insert_query = self.get_field_dict()
1946
+ return insert.execute()
1947
+
1948
+ def validate(self, user_id, idempotency_key=None, **kwargs):
1949
+ path_params = {'user_id': user_id}
1950
+ insert = InsertQuery(self, idempotency_key, path_params, **kwargs)
1951
+ insert.insert_query = self.get_field_dict()
1952
+ insert.identifier = 'VALIDATE'
1953
+ insert.execute()
1954
+
1955
+ @classmethod
1956
+ def get_user_recipients(cls, user_id, *args, **kwargs):
1957
+ kwargs['user_id'] = user_id
1958
+ select = SelectQuery(Recipient, *args, **kwargs)
1959
+ select.identifier = 'GET_USER_RECIPIENTS'
1960
+ return select.all(*args, **kwargs)
1961
+
1962
+ @classmethod
1963
+ def deactivate(cls, recipient_id, **kwargs):
1964
+ update = UpdateQuery(Recipient, recipient_id, **kwargs)
1965
+ return update.execute()
1966
+
1967
+
1912
1968
  @python_2_unicode_compatible
1913
1969
  class BankWirePayOut(BaseModel):
1914
1970
  author = ForeignKeyField(User, api_name='AuthorId', required=True)
@@ -1916,7 +1972,7 @@ class BankWirePayOut(BaseModel):
1916
1972
  credited_funds = MoneyField(api_name='CreditedFunds')
1917
1973
  debited_funds = MoneyField(api_name='DebitedFunds', required=True)
1918
1974
  debited_wallet = ForeignKeyField(Wallet, api_name='DebitedWalletId', required=True)
1919
- bank_account = ForeignKeyField(BankAccount, api_name='BankAccountId', required=True)
1975
+ bank_account = ForeignKeyField(BankAccount, api_name='BankAccountId')
1920
1976
  status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
1921
1977
  result_code = CharField(api_name='ResultCode')
1922
1978
  result_message = CharField(api_name='ResultMessage')
@@ -1934,6 +1990,7 @@ class BankWirePayOut(BaseModel):
1934
1990
  mode_applied = CharField(api_name='ModeApplied')
1935
1991
  fallback_reason = FallbackReasonField(api_name='FallbackReason')
1936
1992
  recipient_verification_of_payee = VerificationOfPayeeField(api_name='RecipientVerificationOfPayee')
1993
+ recipient = ForeignKeyField(Recipient, api_name='RecipientId')
1937
1994
 
1938
1995
  def get_refunds(self, *args, **kwargs):
1939
1996
  kwargs['id'] = self.id
@@ -2892,61 +2949,6 @@ class IdentityVerification(BaseModel):
2892
2949
  return select.all(*args, **kwargs)
2893
2950
 
2894
2951
 
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
2952
  class RecipientSchema(BaseModel):
2951
2953
  display_name = RecipientPropertySchemaField(api_name='DisplayName')
2952
2954
  payout_method_type = RecipientPropertySchemaField(api_name='PayoutMethodType')
@@ -3217,3 +3219,26 @@ class PayPalDataCollection(BaseModel):
3217
3219
  select = SelectQuery(PayPalDataCollection, *args, **kwargs)
3218
3220
  select.identifier = 'GET'
3219
3221
  return select.get(data_collection_id, strict_dict_parsing=False, **kwargs)
3222
+
3223
+
3224
+ @python_2_unicode_compatible
3225
+ class ScaStatus(BaseModel):
3226
+ user_status = CharField(api_name='UserStatus')
3227
+ is_enrolled = BooleanField(api_name='IsEnrolled')
3228
+ last_enrollment_date = DateTimeField(api_name='LastEnrollmentDate')
3229
+ last_consent_collection_date = DateTimeField(api_name='LastConsentCollectionDate')
3230
+ consent_scope = ConsentScopeField(api_name='ConsentScope')
3231
+
3232
+ class Meta:
3233
+ verbose_name = 'sca_status'
3234
+ verbose_name_plural = 'sca_statuses'
3235
+ url = {
3236
+ 'GET': '/sca/users/%(id)s/sca-status',
3237
+ }
3238
+
3239
+ @staticmethod
3240
+ def get(user_id, *args, **kwargs):
3241
+ kwargs['id'] = user_id
3242
+ select = SelectQuery(ScaStatus, *args, **kwargs)
3243
+ select.identifier = 'GET'
3244
+ return select.get("", *args, **kwargs)
@@ -1580,3 +1580,25 @@ class VerificationOfPayee(object):
1580
1580
  "RecipientVerificationCheck": self.recipient_verification_check,
1581
1581
  "RecipientVerificationMessage": self.recipient_verification_message
1582
1582
  }
1583
+
1584
+
1585
+ @add_camelcase_aliases
1586
+ class ConsentScope(object):
1587
+ def __init__(self, contact_information_update=None, recipient_registration=None,
1588
+ transfer=None, view_account_information=None):
1589
+ self.contact_information_update = contact_information_update
1590
+ self.recipient_registration = recipient_registration
1591
+ self.transfer = transfer
1592
+ self.view_account_information = view_account_information
1593
+
1594
+ def __str__(self):
1595
+ return ('ConsentScope: %s %s %s %s' % self.contact_information_update, self.recipient_registration,
1596
+ self.transfer, self.view_account_information)
1597
+
1598
+ def to_api_json(self):
1599
+ return {
1600
+ "ContactInformationUpdate": self.contact_information_update,
1601
+ "RecipientRegistration": self.recipient_registration,
1602
+ "Transfer": self.transfer,
1603
+ "ViewAccountInformation": self.view_account_information
1604
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mangopay4-python-sdk
3
- Version: 3.52.0
3
+ Version: 3.53.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)
@@ -10,7 +10,7 @@ with open(path.join(here, 'DESCRIPTION.md'), encoding='utf-8') as f:
10
10
 
11
11
  setup(
12
12
  name='mangopay4-python-sdk',
13
- version='3.52.0',
13
+ version='3.53.0',
14
14
  description='A client library written in python to work with mangopay v2 api',
15
15
  long_description='This SDK is a client library for interacting with the Mangopay API.',
16
16
  url='https://github.com/Mangopay/mangopay2-python-sdk',
@@ -924,7 +924,7 @@ class PayInsTestLive(BaseTestLive):
924
924
  address.postal_code = "68400"
925
925
  recurring.billing = Billing(first_name="John", last_name="Doe", address=address)
926
926
  recurring.shipping = Shipping(first_name="John", last_name="Doe", address=address)
927
- recurring.end_date = 1768656033
927
+ recurring.end_date = 1863783530
928
928
  recurring.migration = True
929
929
  recurring.next_transaction_fees = Money(1, "EUR")
930
930
  recurring.next_transaction_debited_funds = Money(12, "EUR")
@@ -2186,7 +2186,7 @@ class PayInsTestLive(BaseTestLive):
2186
2186
  address.postal_code = "68400"
2187
2187
  recurring.billing = Billing(first_name="John", last_name="Doe", address=address)
2188
2188
  recurring.shipping = Shipping(first_name="John", last_name="Doe", address=address)
2189
- recurring.end_date = 1768656033
2189
+ recurring.end_date = 1863783530
2190
2190
  recurring.migration = True
2191
2191
  recurring.next_transaction_fees = Money(1, "EUR")
2192
2192
  recurring.next_transaction_debited_funds = Money(12, "EUR")
@@ -2196,7 +2196,6 @@ class PayInsTestLive(BaseTestLive):
2196
2196
 
2197
2197
  created_recurring = RecurringPayInRegistration.get(result.get('id'))
2198
2198
  self.assertIsNotNone(created_recurring)
2199
- print(created_recurring.id)
2200
2199
  cit = RecurringPayInCIT()
2201
2200
  cit.recurring_payin_registration_id = created_recurring.id
2202
2201
  cit.tag = "custom meta"
@@ -1,10 +1,12 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  import responses
3
3
 
4
+ from mangopay.resources import Recipient
4
5
  from mangopay.utils import Money, Address
5
6
  from tests import settings
6
7
  from tests.resources import BankAccount, BankWirePayOut, PayOutEligibility
7
- from tests.test_base import BaseTest
8
+ from tests.test_base import BaseTest, BaseTestLive
9
+ from tests.test_recipients import RecipientsTest
8
10
 
9
11
 
10
12
  class PayOutsTest(BaseTest):
@@ -206,3 +208,44 @@ class PayOutsTest(BaseTest):
206
208
  bank_wire_payout = BankWirePayOut(**bank_wire_payout_params)
207
209
 
208
210
  self.assertIsNotNone(bank_wire_payout)
211
+
212
+
213
+ class PayOutsTestLive(BaseTestLive):
214
+
215
+ def test_PayOut_GetRefunds(self):
216
+ payout = BaseTestLive.get_johns_payout()
217
+ self.assertIsNotNone(payout.recipient_verification_of_payee)
218
+
219
+ refunds = payout.get_refunds()
220
+
221
+ self.assertIsNotNone(refunds.data)
222
+ self.assertIsInstance(refunds.data, list)
223
+
224
+ def test_PayOut_WithRecipientId(self):
225
+ john = BaseTestLive.get_john()
226
+ wallet = BaseTestLive.get_johns_wallet()
227
+ recipientDto = RecipientsTest.get_new_recipient_obj()
228
+ recipientDto.country = 'DE'
229
+ recipientDto.currency = 'EUR'
230
+ recipientDto.local_bank_transfer = {
231
+ 'EUR': {
232
+ 'IBAN': 'DE75512108001245126199'
233
+ }
234
+ }
235
+ recipient = Recipient(**recipientDto.create(john.id))
236
+
237
+ payout = BankWirePayOut()
238
+ payout.debited_wallet = wallet
239
+ payout.author = john
240
+ payout.credited_user = john
241
+ payout.tag = 'DefaultTag'
242
+ payout.debited_funds = Money(amount=10, currency='EUR')
243
+ payout.fees = Money(amount=5, currency='EUR')
244
+ payout.recipient = recipient
245
+ payout.bank_wire_ref = 'User payment'
246
+ payout.payment_type = 'BANK_WIRE'
247
+
248
+ created_payout = BankWirePayOut(**payout.save())
249
+
250
+ self.assertIsNotNone(created_payout.id)
251
+ self.assertIsNotNone(created_payout.recipient)
@@ -9,7 +9,7 @@ import responses
9
9
  from mangopay.exceptions import APIError
10
10
  from mangopay.resources import (User, NaturalUser, Wallet,
11
11
  LegalUser, Transfer, Transaction, NaturalUserSca, LegalUserSca,
12
- UserDataFormatValidation)
12
+ UserDataFormatValidation, ScaStatus)
13
13
  from mangopay.utils import Money, Address, CompanyNumberValidation
14
14
  from tests import settings
15
15
  from tests.mocks import today, today_timestamp
@@ -889,18 +889,6 @@ class UserTestLive(BaseTestLive):
889
889
  self.assertIsNotNone(categorized)
890
890
 
891
891
 
892
- class PayOutsTestLive(BaseTestLive):
893
-
894
- def test_PayOut_GetRefunds(self):
895
- payout = BaseTestLive.get_johns_payout()
896
- self.assertIsNotNone(payout.recipient_verification_of_payee)
897
-
898
- refunds = payout.get_refunds()
899
-
900
- self.assertIsNotNone(refunds.data)
901
- self.assertIsInstance(refunds.data, list)
902
-
903
-
904
892
  class PayInsTestLive(BaseTestLive):
905
893
  def test_PayIn_GetRefunds(self):
906
894
  payin = BaseTestLive.get_johns_payin()
@@ -988,3 +976,11 @@ class PayInsTestLive(BaseTestLive):
988
976
  validation.save()
989
977
  except APIError as e:
990
978
  self.assertTrue("One or several required parameters are missing or incorrect" in e.content['Message'])
979
+
980
+ def test_get_sca_status(self):
981
+ active_user_id = 'user_m_01JKZW095BFB2TRQMCZ8GE7M8D'
982
+ sca_status = ScaStatus.get(active_user_id)
983
+
984
+ self.assertIsNotNone(sca_status)
985
+ self.assertEqual('ACTIVE', sca_status.user_status)
986
+ self.assertIsNotNone(sca_status.consent_scope.contact_information_update)
@@ -1,27 +0,0 @@
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
- with open('./setup.py', 'r') as f:
13
- for line in f:
14
- if line.startswith(' version'):
15
- package_version = line.split('=')[1].replace("'", "").replace(",", "").replace("\n", "")
16
- except:
17
- None
18
-
19
-
20
- from .api import APIRequest # noqa
21
- from .utils import memoize
22
-
23
-
24
- def _get_default_handler():
25
- return APIRequest()
26
-
27
- get_default_handler = memoize(_get_default_handler, {}, 0)