mangopay4-python-sdk 3.54.1__tar.gz → 3.56.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 (96) hide show
  1. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/PKG-INFO +1 -1
  2. mangopay4_python_sdk-3.56.0/README.md +127 -0
  3. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/__init__.py +2 -0
  4. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/api.py +21 -12
  5. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/fields.py +4 -1
  6. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/resources.py +232 -45
  7. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/utils.py +14 -10
  8. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay4_python_sdk.egg-info/PKG-INFO +1 -1
  9. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay4_python_sdk.egg-info/SOURCES.txt +1 -0
  10. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/setup.py +1 -1
  11. mangopay4_python_sdk-3.56.0/tests/test_acquiring.py +215 -0
  12. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_base.py +66 -40
  13. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_cards.py +5 -0
  14. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_conversion.py +1 -1
  15. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_payins.py +5 -106
  16. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_users.py +2 -1
  17. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_wallets.py +3 -1
  18. mangopay4_python_sdk-3.54.1/README.md +0 -53
  19. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/DESCRIPTION.md +0 -0
  20. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/LICENSE +0 -0
  21. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/MANIFEST.in +0 -0
  22. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/Makefile +0 -0
  23. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/auth.py +0 -0
  24. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/base.py +0 -0
  25. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/compat.py +0 -0
  26. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/constants.py +0 -0
  27. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/exceptions.py +0 -0
  28. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/page.py +0 -0
  29. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/query.py +0 -0
  30. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/ratelimit.py +0 -0
  31. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay/signals.py +0 -0
  32. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay4_python_sdk.egg-info/dependency_links.txt +0 -0
  33. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay4_python_sdk.egg-info/entry_points.txt +0 -0
  34. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay4_python_sdk.egg-info/requires.txt +0 -0
  35. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/mangopay4_python_sdk.egg-info/top_level.txt +0 -0
  36. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/setup.cfg +0 -0
  37. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/__init__.py +0 -0
  38. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/card.json +0 -0
  39. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/cardregistrations.json +0 -0
  40. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/cardregistrations_update.json +0 -0
  41. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/declarative_user.json +0 -0
  42. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/legal_user.json +0 -0
  43. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/legal_user_wallet.json +0 -0
  44. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/legal_user_wallet_89.json +0 -0
  45. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/legal_user_wallet_99.json +0 -0
  46. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/list_ubo_declarations.json +0 -0
  47. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/natural_user.json +0 -0
  48. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/natural_user_wallet.json +0 -0
  49. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/natural_user_wallet_9.json +0 -0
  50. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/ubo.json +0 -0
  51. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/ubo_declaration.json +0 -0
  52. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/ubo_declaration_submit.json +0 -0
  53. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/ubo_update.json +0 -0
  54. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/user_list_2_per_page.json +0 -0
  55. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/user_list_2_per_page_page1.json +0 -0
  56. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/user_list_3_per_page_page2.json +0 -0
  57. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/user_list_full.json +0 -0
  58. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/user_list_page1.json +0 -0
  59. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/fixtures/user_wallet.json +0 -0
  60. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/images/image.jpg +0 -0
  61. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/mocks.py +0 -0
  62. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/resources/TestKycPageFile.png +0 -0
  63. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/resources/settlement_sample.csv +0 -0
  64. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/resources/settlement_sample_bad.csv +0 -0
  65. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/resources.py +0 -0
  66. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/settings.py +0 -0
  67. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_bankaccounts.py +0 -0
  68. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_banking_aliases.py +0 -0
  69. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_client_wallets.py +0 -0
  70. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_clients.py +0 -0
  71. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_country_authorizations.py +0 -0
  72. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_deposits.py +0 -0
  73. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_disputes.py +0 -0
  74. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_documentconsult.py +0 -0
  75. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_emoney.py +0 -0
  76. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_idempotency.py +0 -0
  77. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_identity_verification.py +0 -0
  78. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_kyc_document.py +0 -0
  79. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_kycs.py +0 -0
  80. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_mandates.py +0 -0
  81. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_notifications.py +0 -0
  82. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_payouts.py +0 -0
  83. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_preauthorizations.py +0 -0
  84. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_rate_limit.py +0 -0
  85. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_recipients.py +0 -0
  86. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_refunds.py +0 -0
  87. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_reports.py +0 -0
  88. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_reports_v2.py +0 -0
  89. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_repudiations.py +0 -0
  90. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_settlements.py +0 -0
  91. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_tokens.py +0 -0
  92. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_transactions.py +0 -0
  93. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_transfers.py +0 -0
  94. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_ubos.py +0 -0
  95. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_utils.py +0 -0
  96. {mangopay4_python_sdk-3.54.1 → mangopay4_python_sdk-3.56.0}/tests/test_virtual_account.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mangopay4-python-sdk
3
- Version: 3.54.1
3
+ Version: 3.56.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,127 @@
1
+ Mangopay Python SDK
2
+ =================================================
3
+
4
+ MangopaySDK is a Python client library to work with
5
+ [Mangopay REST API](http://docs.mangopay.com/api-references/).
6
+
7
+
8
+ Installation
9
+ ------------
10
+
11
+ mangopaysdk requires:
12
+
13
+ * [requests](https://pypi.python.org/pypi/requests)
14
+ * [blinker](https://pypi.python.org/pypi/blinker)
15
+
16
+ To install the package:
17
+
18
+ ```
19
+ pip install mangopay4-python-sdk
20
+ ```
21
+
22
+ By installing this package with [pip](https://pypi.python.org/pypi/pip), all dependencies will be installed for you.
23
+
24
+
25
+ Documentation
26
+ -------------
27
+
28
+ For documentation and examples of usage for the Mangopay API please refer to: [API references](https://docs.mangopay.com/api-references/)
29
+
30
+ See [docs](https://github.com/Mangopay/mangopay2-python-sdk/blob/master/docs/usage.rst) to find examples.
31
+
32
+ mTLS certificates
33
+ -----------------
34
+
35
+ ### Set the base URL for mTLS
36
+
37
+ Using mTLS authentication requires your integration to call a base URL with a different hostname from the standard API:
38
+
39
+ * Sandbox: `https://api-mtls.sandbox.mangopay.com`
40
+ * Production: `https://api-mtls.mangopay.com`
41
+
42
+ If using mTLS, your integration should use the `api-mtls` URLs for all API calls, including OAuth token generation.
43
+
44
+ **Caution:** Ensure you set the mTLS base URL, as shown in the configuration examples below. If you don’t, the mTLS certificate will not be transferred to Mangopay. When mTLS is enforced, your integration will result in an error.
45
+
46
+ ### Configure the SDK’s mTLS properties
47
+
48
+ The Python SDK allows you to load the `.pem` and `.key` file paths in the global configuration or in the per-request handler.
49
+
50
+ | Property (global / per-request) | Type | Description |
51
+ | ------------------------------- | ------ | ------------------------------------ |
52
+ | `mtls_cert` / `cert` | string | Path to the certificate `.pem` file. |
53
+ | `mtls_private_key` / `key` | string | Path to the private `.key` file. |
54
+
55
+ **Caution:** The per-request properties `cert` and `key` take precedence if set and the global ones are ignored (`mangopay.mtls_cert` and `mangopay.mtls_private_key`).
56
+
57
+ The certificate files must be accessible at runtime; the SDK does not validate their content at initialization time.
58
+
59
+ When both are provided, the SDK sets `session.cert = (cert, key)` on the underlying `requests.Session`. If a combined certificate is provided (bundling the key), the SDK sets `session.cert = cert`.
60
+
61
+ #### Global configuration
62
+
63
+ The global properties allow you to set the certificate and key before making any API calls. The certificate is used for all requests made through the default handler.
64
+
65
+ ```python theme={null}
66
+ import mangopay
67
+
68
+ mangopay.client_id = 'your-mangopay-client-id'
69
+ mangopay.apikey = 'your-mangopay-api-key'
70
+ mangopay.api_sandbox_url = 'https://api-mtls.sandbox.mangopay.com/v2.01/'
71
+ sandbox = True
72
+ # mangopay.api_url = 'https://api-mtls.mangopay.com/v2.01/'
73
+ mangopay.mtls_cert = '/path/to/certificate.pem'
74
+ mangopay.mtls_private_key = '/path/to/private.key'
75
+ ```
76
+
77
+ #### Per-request handler
78
+
79
+ **Caution:** The per-request values take precedence over the global values.
80
+
81
+ Each `APIRequest` instance maintains its own `requests.Session`, so mTLS certificates are scoped to that instance and do not leak between handlers.
82
+
83
+ ```python theme={null}
84
+ from mangopay.api import APIRequest
85
+
86
+ handler = APIRequest(
87
+ client_id='your-mangopay-client-id',
88
+ apikey='your-mangopay-api-key',
89
+ api_sandbox_url = 'https://api-mtls.sandbox.mangopay.com/v2.01/' # mTlS base URL
90
+ sandbox = True
91
+ # mangopay.api_url = 'https://api-mtls.mangopay.com/v2.01/'
92
+ cert='/path/to/certificate.pem',
93
+ key='/path/to/private.key'
94
+ )
95
+ ```
96
+
97
+ Then pass the handler when making API calls:
98
+
99
+ ```python theme={null}
100
+ from mangopay.resources import NaturalUser, Wallet
101
+
102
+ user = NaturalUser.get(user_id, handler=handler)
103
+ wallet = Wallet.get(wallet_id, handler=handler)
104
+ ```
105
+
106
+ License
107
+ -------------------------------------------------
108
+ MangopaySDK is distributed under MIT license, see LICENSE file.
109
+
110
+ Contact
111
+ -------------------------------------------------
112
+ Report bugs or suggest features using [issue tracker at GitHub](https://github.com/Mangopay/mangopay2-python-sdk/issues).
113
+
114
+
115
+ Account creation
116
+ -------------------------------------------------
117
+ You can get yourself a free sandbox account or sign up for a production account by [registering on the Mangopay site](https://www.mangopay.com/start/) (note that validation of your production account involves several steps, so think about doing it in advance of when you actually want to go live).
118
+
119
+ Inspiration
120
+ -----------
121
+
122
+ The data model of python-mangopay is highly inspired by [peewee](https://github.com/coleifer/peewee).
123
+
124
+ Credits
125
+ -----------
126
+
127
+ The inital basis of this SDK was generously coded and donated by [Ulule](https://www.ulule.com/)
@@ -6,6 +6,8 @@ temp_dir = None
6
6
  api_version = 2.01
7
7
  sandbox = True
8
8
  uk_header_flag = False
9
+ mtls_cert = None # Path to client certificate file for mTLS
10
+ mtls_private_key = None # Path to client private key file for mTLS
9
11
 
10
12
  package_version = None
11
13
  try:
@@ -30,14 +30,14 @@ except ImportError:
30
30
 
31
31
  logger = logging.getLogger('mangopay')
32
32
 
33
- requests_session = requests.Session()
34
33
  rate_limits = None
35
34
 
36
35
 
37
36
  class APIRequest(object):
38
37
 
39
38
  def __init__(self, client_id=None, apikey=None, api_url=None, api_sandbox_url=None, sandbox=None,
40
- timeout=30.0, storage_strategy=None, proxies=None, uk_header_flag=False):
39
+ timeout=30.0, storage_strategy=None, proxies=None, uk_header_flag=False,
40
+ cert=None, key=None):
41
41
  global rate_limits
42
42
  rate_limits = None
43
43
  if (sandbox is None and mangopay.sandbox) or sandbox:
@@ -52,6 +52,15 @@ class APIRequest(object):
52
52
  self.proxies = proxies
53
53
  self.uk_header_flag = uk_header_flag or mangopay.uk_header_flag
54
54
 
55
+ self._session = requests.Session()
56
+
57
+ _cert = cert or mangopay.mtls_cert
58
+ _key = key or mangopay.mtls_private_key
59
+ if _cert and _key:
60
+ self._session.cert = (_cert, _key)
61
+ elif _cert:
62
+ self._session.cert = _cert
63
+
55
64
  def set_rate_limit(self, rate_limit):
56
65
  global rate_limits
57
66
  rate_limits = rate_limit
@@ -124,11 +133,11 @@ class APIRequest(object):
124
133
  request_started.send(url=url, data=data, headers=headers, method=method)
125
134
 
126
135
  try:
127
- result = requests_session.request(method, url,
128
- data=data,
129
- headers=headers,
130
- timeout=self.timeout,
131
- proxies=self.proxies)
136
+ result = self._session.request(method, url,
137
+ data=data,
138
+ headers=headers,
139
+ timeout=self.timeout,
140
+ proxies=self.proxies)
132
141
  except ConnectionError as e:
133
142
  msg = '{}'.format(e)
134
143
 
@@ -225,11 +234,11 @@ class APIRequest(object):
225
234
  request_started.send(url=url, data=None, headers=headers, method=method)
226
235
 
227
236
  try:
228
- result = requests_session.request(method, url,
229
- files=files,
230
- headers=headers,
231
- timeout=self.timeout,
232
- proxies=self.proxies)
237
+ result = self._session.request(method, url,
238
+ files=files,
239
+ headers=headers,
240
+ timeout=self.timeout,
241
+ proxies=self.proxies)
233
242
  except ConnectionError as e:
234
243
  msg = f'{type(e).__name__}: {e}' if str(e) else type(e).__name__
235
244
  reraise_as(APIError(msg))
@@ -1220,7 +1220,8 @@ class ReportFilterField(Field):
1220
1220
  status=value.get('Status', None), type=value.get('Type', None),
1221
1221
  intent_id=value.get('IntentId', None),
1222
1222
  external_provider_name=value.get('ExternalProviderName', None),
1223
- scheduled=value.get('Scheduled', None))
1223
+ scheduled=value.get('Scheduled', None),
1224
+ settlement_id=value.get('SettlementId', None))
1224
1225
 
1225
1226
  return value
1226
1227
 
@@ -1247,6 +1248,8 @@ class ReportFilterField(Field):
1247
1248
  result['ExternalProviderName'] = value.external_provider_name
1248
1249
  if value.scheduled is not None:
1249
1250
  result['Scheduled'] = value.scheduled
1251
+ if value.settlement_id is not None:
1252
+ result['SettlementId'] = value.settlement_id
1250
1253
  return result
1251
1254
 
1252
1255
  return value
@@ -762,12 +762,21 @@ class CardValidation(BaseModel):
762
762
  select.identifier = 'GET_CARD_VALIDATION'
763
763
  return select.all(*args, **kwargs)
764
764
 
765
+ @classmethod
766
+ def get(cls, card_validation_id, card_id, *args, **kwargs):
767
+ kwargs['card_id'] = card_id
768
+ kwargs['id'] = card_validation_id
769
+ select = SelectQuery(CardValidation, *args, **kwargs)
770
+ select.identifier = 'GET'
771
+ return select.get("", *args, **kwargs)
772
+
765
773
  class Meta:
766
774
  verbose_name = 'card_validation'
767
775
  verbose_name_plural = 'card_validations'
768
776
  url = {
769
777
  'CARD_VALIDATE': '/cards/%(id)s/validation',
770
- 'GET_CARD_VALIDATION': '/cards/%(card_id)s/validation/%(id)s'
778
+ 'GET_CARD_VALIDATION': '/cards/%(card_id)s/validation/%(id)s',
779
+ 'GET': '/cards/%(card_id)s/validation/%(id)s'
771
780
  }
772
781
 
773
782
 
@@ -1263,50 +1272,6 @@ class PayPalWebPayIn(PayIn):
1263
1272
  return action.execute()
1264
1273
 
1265
1274
 
1266
- @python_2_unicode_compatible
1267
- class PayconiqPayIn(PayIn):
1268
- author = ForeignKeyField(User, api_name='AuthorId', required=True)
1269
- debited_funds = MoneyField(api_name='DebitedFunds', required=True)
1270
- fees = MoneyField(api_name='Fees', required=True)
1271
- return_url = CharField(api_name='ReturnURL', required=False)
1272
- redirect_url = CharField(api_name='RedirectURL', required=False)
1273
- creation_date = DateField(api_name='CreationDate', required=False)
1274
- expiration_date = CharField(api_name='ExpirationDate', required=False)
1275
- deep_link_url = CharField(api_name='DeepLinkURL', required=False)
1276
-
1277
- class Meta:
1278
- verbose_name = 'payin'
1279
- verbose_name_plural = 'payins'
1280
- url = {
1281
- InsertQuery.identifier: '/payins/payconiq/web',
1282
- SelectQuery.identifier: '/payins'
1283
- }
1284
-
1285
-
1286
- @python_2_unicode_compatible
1287
- class PayconiqV2PayIn(PayIn):
1288
- author = ForeignKeyField(User, api_name='AuthorId', required=True)
1289
- debited_funds = MoneyField(api_name='DebitedFunds', required=True)
1290
- fees = MoneyField(api_name='Fees', required=True)
1291
- return_url = CharField(api_name='ReturnURL', required=True)
1292
- credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
1293
- redirect_url = CharField(api_name='RedirectURL')
1294
- creation_date = DateField(api_name='CreationDate')
1295
- expiration_date = CharField(api_name='ExpirationDate')
1296
- deep_link_url = CharField(api_name='DeepLinkURL')
1297
- country = CharField(api_name='Country', required=True)
1298
- statement_descriptor = CharField(api_name='StatementDescriptor')
1299
- qr_code_url = CharField(api_name='QRCodeURL')
1300
-
1301
- class Meta:
1302
- verbose_name = 'payin'
1303
- verbose_name_plural = 'payins'
1304
- url = {
1305
- InsertQuery.identifier: '/payins/payment-methods/payconiq',
1306
- SelectQuery.identifier: '/payins'
1307
- }
1308
-
1309
-
1310
1275
  class ApplepayPayIn(PayIn):
1311
1276
  tag = CharField(api_name='Tag')
1312
1277
  author = ForeignKeyField(User, api_name='AuthorId', required=True)
@@ -3325,3 +3290,225 @@ class ScaStatus(BaseModel):
3325
3290
  select = SelectQuery(ScaStatus, *args, **kwargs)
3326
3291
  select.identifier = 'GET'
3327
3292
  return select.get("", *args, **kwargs)
3293
+
3294
+
3295
+ class AcquiringDirectPayIn(PayIn):
3296
+ secure_mode_redirect_url = CharField(api_name='SecureModeRedirectURL')
3297
+ secure_mode_return_url = CharField(api_name='SecureModeReturnURL', required=True)
3298
+ card = ForeignKeyField(Card, api_name='CardId', required=True)
3299
+ secure_mode_needed = BooleanField(api_name='SecureModeNeeded')
3300
+ secure_mode = CharField(api_name='SecureMode',
3301
+ choices=constants.SECURE_MODE_CHOICES,
3302
+ default=constants.SECURE_MODE_CHOICES.default,
3303
+ required=True)
3304
+ creation_date = DateTimeField(api_name='CreationDate')
3305
+ statement_descriptor = CharField(api_name='StatementDescriptor')
3306
+ debited_funds = MoneyField(api_name='DebitedFunds', required=True)
3307
+ billing = BillingField(api_name='Billing')
3308
+ security_info = SecurityInfoField(api_name='SecurityInfo')
3309
+ culture = CharField(api_name='Culture')
3310
+ ip_address = CharField(api_name='IpAddress', required=True)
3311
+ browser_info = BrowserInfoField(api_name='BrowserInfo', required=True)
3312
+ shipping = ShippingField(api_name='Shipping')
3313
+ requested_3ds_version = CharField(api_name='Requested3DSVersion')
3314
+ applied_3ds_version = CharField(api_name='Applied3DSVersion')
3315
+ preferred_card_network = CharField(api_name='PreferredCardNetwork')
3316
+ card_info = CardInfoField(api_name='CardInfo')
3317
+ payment_category = CharField(api_name='PaymentCategory')
3318
+
3319
+ class Meta:
3320
+ verbose_name = 'acquiring_payin'
3321
+ verbose_name_plural = 'acquiring_payins'
3322
+ url = {
3323
+ InsertQuery.identifier: '/acquiring/payins/card/direct',
3324
+ SelectQuery.identifier: '/payins'
3325
+ }
3326
+
3327
+
3328
+ class AcquiringIdealPayIn(PayIn):
3329
+ debited_funds = MoneyField(api_name='DebitedFunds', required=True)
3330
+ return_url = CharField(api_name='ReturnURL', required=True)
3331
+ bic = CharField(api_name='Bic', choices=constants.BIC_CHOICES)
3332
+ statement_descriptor = CharField(api_name='StatementDescriptor')
3333
+ creation_date = DateTimeField(api_name='CreationDate')
3334
+ redirect_url = CharField(api_name='RedirectURL')
3335
+ bank_name = CharField(api_name='BankName', choices=constants.BANK_NAME_CHOICES)
3336
+
3337
+ class Meta:
3338
+ verbose_name = 'acquiring_ideal_payin'
3339
+ verbose_name_plural = 'acquiring_ideal_payins'
3340
+ url = {
3341
+ InsertQuery.identifier: '/acquiring/payins/payment-methods/ideal',
3342
+ SelectQuery.identifier: '/payins'
3343
+ }
3344
+
3345
+
3346
+ class AcquiringApplepayPayIn(PayIn):
3347
+ tag = CharField(api_name='Tag')
3348
+ payment_data = ApplepayPaymentDataField(api_name='PaymentData', required=True)
3349
+ debited_funds = MoneyField(api_name='DebitedFunds', required=True)
3350
+ statement_descriptor = CharField(api_name='StatementDescriptor')
3351
+ card_info = CardInfoField(api_name='CardInfo')
3352
+
3353
+ class Meta:
3354
+ verbose_name = 'acquiring_applepay_payin'
3355
+ verbose_name_plural = 'acquiring_applepay_payins'
3356
+ url = {
3357
+ InsertQuery.identifier: '/acquiring/payins/payment-methods/applepay',
3358
+ SelectQuery.identifier: '/payins'
3359
+ }
3360
+
3361
+
3362
+ class AcquiringGooglePayDirectPayIn(PayIn):
3363
+ debited_funds = MoneyField(api_name='DebitedFunds', required=True)
3364
+ secure_mode_return_url = CharField(api_name='SecureModeReturnURL', required=True)
3365
+ secure_mode_redirect_url = CharField(api_name='SecureModeRedirectURL')
3366
+ secure_mode = CharField(api_name='SecureMode',
3367
+ choices=constants.SECURE_MODE_CHOICES,
3368
+ default=constants.SECURE_MODE_CHOICES.default)
3369
+ ip_address = CharField(api_name='IpAddress', required=True)
3370
+ browser_info = BrowserInfoField(api_name='BrowserInfo', required=True)
3371
+ payment_data = CharField(api_name='PaymentData', required=True)
3372
+ shipping = ShippingField(api_name='Shipping')
3373
+ billing = BillingField(api_name='Billing')
3374
+ statement_descriptor = CharField(api_name='StatementDescriptor')
3375
+ card_info = CardInfoField(api_name='CardInfo')
3376
+
3377
+ class Meta:
3378
+ verbose_name = 'acquiring_googlepay_direct_payin'
3379
+ verbose_name_plural = 'acquiring_googlepay_direct_payins'
3380
+ url = {
3381
+ InsertQuery.identifier: '/acquiring/payins/payment-methods/googlepay',
3382
+ SelectQuery.identifier: '/payins'
3383
+ }
3384
+
3385
+
3386
+ class AcquiringPayPalWebPayIn(PayIn):
3387
+ creation_date = DateTimeField(api_name='CreationDate')
3388
+ debited_funds = MoneyField(api_name='DebitedFunds', required=True)
3389
+ return_url = CharField(api_name='ReturnURL', required=True)
3390
+ redirect_url = CharField(api_name='RedirectURL')
3391
+ statement_descriptor = CharField(api_name='StatementDescriptor')
3392
+ shipping = ShippingField(api_name='Shipping')
3393
+ line_items = ListField(api_name='LineItems', required=True)
3394
+ culture = CharField(api_name='Culture')
3395
+ shipping_preference = CharField(api_name='ShippingPreference', choices=constants.SHIPPING_PREFERENCE_CHOICES,
3396
+ default=None)
3397
+ reference = CharField(api_name='Reference')
3398
+ cancel_url = CharField(api_name='CancelURL')
3399
+ paypal_payer_id = CharField(api_name='PaypalPayerID')
3400
+ buyer_country = CharField(api_name='BuyerCountry')
3401
+ buyer_first_name = CharField(api_name='BuyerFirstname')
3402
+ buyer_last_name = CharField(api_name='BuyerLastname')
3403
+ buyer_phone = CharField(api_name='BuyerPhone')
3404
+ paypal_order_id = CharField(api_name='PaypalOrderID')
3405
+ trackings = ListField(api_name='Trackings')
3406
+ data_collection_id = CharField(api_name='DataCollectionId')
3407
+
3408
+ class Meta:
3409
+ verbose_name = 'acquiring_paypal_web_payin'
3410
+ verbose_name_plural = 'acquiring_paypal_web_payins'
3411
+ url = {
3412
+ InsertQuery.identifier: '/acquiring/payins/payment-methods/paypal',
3413
+ SelectQuery.identifier: '/payins'
3414
+ }
3415
+
3416
+
3417
+ class AcquiringPayPalDataCollection(BaseModel):
3418
+ # since the properties needed by PayPal are different depending on the use-case,
3419
+ # use Dict as payload and response for Create and Get. The cast to AcquiringPayPalDataCollection model is skipped.
3420
+ class Meta:
3421
+ verbose_name = 'acquiring_paypal_data_collection'
3422
+ verbose_name_plural = 'acquiring_paypal_data_collections'
3423
+ url = {
3424
+ 'CREATE': '/acquiring/payins/payment-methods/paypal/data-collection',
3425
+ 'GET': '/acquiring/payins/payment-methods/paypal/data-collection'
3426
+ }
3427
+
3428
+ @classmethod
3429
+ def create(cls, idempotency_key=None, handler=None, **kwargs):
3430
+ insert = InsertQuery(AcquiringPayPalDataCollection, idempotency_key, None, **kwargs)
3431
+ insert.insert_query = kwargs
3432
+ insert.identifier = 'CREATE'
3433
+ return insert.execute(handler=handler, strict_dict_parsing=False)
3434
+
3435
+ @classmethod
3436
+ def get(cls, data_collection_id, *args, **kwargs):
3437
+ select = SelectQuery(AcquiringPayPalDataCollection, *args, **kwargs)
3438
+ select.identifier = 'GET'
3439
+ return select.get(data_collection_id, strict_dict_parsing=False, **kwargs)
3440
+
3441
+
3442
+ class AcquiringPayInRefund(BaseModel):
3443
+ debited_funds = MoneyField(api_name='DebitedFunds')
3444
+ payin = ForeignKeyField(PayIn)
3445
+ reference = CharField(api_name='Reference')
3446
+ statement_descriptor = CharField(api_name='StatementDescriptor')
3447
+ status = CharField(api_name='Status', choices=constants.STATUS_CHOICES, default=None)
3448
+ result_code = CharField(api_name='ResultCode')
3449
+ result_message = CharField(api_name='ResultMessage')
3450
+ execution_date = DateTimeField(api_name='ExecutionDate')
3451
+ type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None)
3452
+ nature = CharField(api_name='Nature', choices=constants.NATURE_CHOICES, default=None)
3453
+ refund_reason = RefundReasonField(api_name='RefundReason')
3454
+ initial_transaction_id = CharField(api_name='InitialTransactionId')
3455
+ initial_transaction_type = CharField(api_name='InitialTransactionType', choices=constants.TRANSACTION_TYPE_CHOICES,
3456
+ default=None)
3457
+ initial_transaction_nature = CharField(api_name='InitialTransactionNature', choices=constants.NATURE_CHOICES,
3458
+ default=None)
3459
+
3460
+ class Meta:
3461
+ verbose_name = 'acquiring_payin_refund'
3462
+ verbose_name_plural = 'acquiring_payin_refund'
3463
+ url = {
3464
+ InsertQuery.identifier: '/acquiring/payins/%(payin_id)s/refunds'
3465
+ }
3466
+
3467
+
3468
+ class AcquiringCardValidation(BaseModel):
3469
+ creation_date = DateTimeField(api_name='CreationDate')
3470
+ ip_address = CharField(api_name='IpAddress', required=True)
3471
+ browser_info = BrowserInfoField(api_name='BrowserInfo', required=True)
3472
+ secure_mode_return_url = CharField(api_name='SecureModeReturnURL', required=True)
3473
+ secure_mode_redirect_url = CharField(api_name='SecureModeRedirectURL')
3474
+ secure_mode_needed = BooleanField(api_name='SecureModeNeeded')
3475
+ secure_mode = CharField(api_name='SecureMode',
3476
+ choices=constants.SECURE_MODE_CHOICES)
3477
+ validity = CharField(api_name='Validity',
3478
+ choices=constants.VALIDITY_CHOICES,
3479
+ default=constants.VALIDITY_CHOICES.unknown)
3480
+ type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None)
3481
+ applied_3ds_version = CharField(api_name='Applied3DSVersion')
3482
+ status = CharField(api_name='Status',
3483
+ choices=constants.STATUS_CHOICES,
3484
+ default=None)
3485
+ result_code = CharField(api_name='ResultCode')
3486
+ result_message = CharField(api_name='ResultMessage')
3487
+ preferred_card_network = CharField(api_name='PreferredCardNetwork')
3488
+ authorization_date = DateTimeField(api_name='AuthorizationDate')
3489
+ card_info = CardInfoField(api_name='CardInfo')
3490
+ payment_category = CharField(api_name='PaymentCategory')
3491
+ authentication_result = AuthenticationResultField(api_name='AuthenticationResult')
3492
+
3493
+ def validate(self, card_id, **kwargs):
3494
+ insert = InsertQuery(self, **kwargs)
3495
+ insert.insert_query = self.get_field_dict()
3496
+ insert.insert_query['id'] = card_id
3497
+ insert.identifier = 'CREATE_CARD_VALIDATION'
3498
+ return insert.execute()
3499
+
3500
+ @classmethod
3501
+ def get(cls, card_validation_id, card_id, *args, **kwargs):
3502
+ kwargs['card_id'] = card_id
3503
+ kwargs['id'] = card_validation_id
3504
+ select = SelectQuery(AcquiringCardValidation, *args, **kwargs)
3505
+ select.identifier = 'GET'
3506
+ return select.get("", *args, **kwargs)
3507
+
3508
+ class Meta:
3509
+ verbose_name = 'acquiring_card_validation'
3510
+ verbose_name_plural = 'acquiring_card_validations'
3511
+ url = {
3512
+ 'CREATE_CARD_VALIDATION': '/acquiring/cards/%(id)s/validation',
3513
+ 'GET': '/cards/%(card_id)s/validation/%(id)s'
3514
+ }
@@ -952,7 +952,7 @@ class PayinsLinked(object):
952
952
 
953
953
  class LineItem(object):
954
954
  def __init__(self, name=None, quantity=None, unit_amount=None, tax_amount=None, description=None, category=None,
955
- sku=None):
955
+ sku=None, discount=None):
956
956
  self.name = name
957
957
  self.quantity = quantity
958
958
  self.unit_amount = unit_amount
@@ -960,10 +960,11 @@ class LineItem(object):
960
960
  self.description = description
961
961
  self.category = category
962
962
  self.sku = sku
963
+ self.discount = discount
963
964
 
964
965
  def __str__(self):
965
- return 'LineItem: %s %s %s %s %s %s %s' % \
966
- (self.name, self.quantity, self.unit_amount, self.tax_amount, self.description, self.category, self.sku)
966
+ return 'LineItem: %s %s %s %s %s %s %s %s' % \
967
+ (self.name, self.quantity, self.unit_amount, self.tax_amount, self.description, self.category, self.sku, self.discount)
967
968
 
968
969
  def to_api_json(self):
969
970
  return {
@@ -973,7 +974,8 @@ class LineItem(object):
973
974
  "TaxAmount": self.tax_amount,
974
975
  "Description": self.description,
975
976
  "Category": self.category,
976
- "Sku": self.sku
977
+ "Sku": self.sku,
978
+ "Discount": self.discount
977
979
  }
978
980
 
979
981
 
@@ -1337,8 +1339,7 @@ class CompanyNumberValidation(object):
1337
1339
  @add_camelcase_aliases
1338
1340
  class ReportFilter(object):
1339
1341
  def __init__(self, currency=None, user_id=None, wallet_id=None, payment_method=None, status=None, type=None,
1340
- intent_id=None,
1341
- external_provider_name=None, scheduled=None):
1342
+ intent_id=None, external_provider_name=None, scheduled=None, settlement_id=None):
1342
1343
  self.currency = currency
1343
1344
  self.user_id = user_id
1344
1345
  self.wallet_id = wallet_id
@@ -1348,11 +1349,12 @@ class ReportFilter(object):
1348
1349
  self.intent_id = intent_id
1349
1350
  self.external_provider_name = external_provider_name
1350
1351
  self.scheduled = scheduled
1352
+ self.settlement_id = settlement_id
1351
1353
 
1352
1354
  def __str__(self):
1353
- return 'ReportFilter: %s, %s, %s, %s, %s, %s, %s, %s, %s' % \
1355
+ return 'ReportFilter: %s, %s, %s, %s, %s, %s, %s, %s, %s %s' % \
1354
1356
  (self.currency, self.user_id, self.wallet_id, self.payment_method, self.status, self.type, self.intent_id,
1355
- self.external_provider_name, self.scheduled)
1357
+ self.external_provider_name, self.scheduled, self.settlement_id)
1356
1358
 
1357
1359
  def __eq__(self, other):
1358
1360
  if isinstance(other, ReportFilter):
@@ -1364,7 +1366,8 @@ class ReportFilter(object):
1364
1366
  (self.type == other.type) and
1365
1367
  (self.intent_id == other.intent_id) and
1366
1368
  (self.external_provider_name == other.external_provider_name) and
1367
- (self.scheduled == other.scheduled))
1369
+ (self.scheduled == other.scheduled) and
1370
+ (self.settlement_id == other.settlement_id))
1368
1371
  return stat
1369
1372
  return False
1370
1373
 
@@ -1378,7 +1381,8 @@ class ReportFilter(object):
1378
1381
  "Type": self.type,
1379
1382
  "IntentId": self.intent_id,
1380
1383
  "ExternalProviderName": self.external_provider_name,
1381
- "Scheduled": self.scheduled
1384
+ "Scheduled": self.scheduled,
1385
+ "SettlementId": self.settlement_id
1382
1386
  }
1383
1387
 
1384
1388
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mangopay4-python-sdk
3
- Version: 3.54.1
3
+ Version: 3.56.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)
@@ -29,6 +29,7 @@ tests/__init__.py
29
29
  tests/mocks.py
30
30
  tests/resources.py
31
31
  tests/settings.py
32
+ tests/test_acquiring.py
32
33
  tests/test_bankaccounts.py
33
34
  tests/test_banking_aliases.py
34
35
  tests/test_base.py
@@ -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.54.1',
13
+ version='3.56.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',