incognia-python 3.1.0__tar.gz → 3.3.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 (33) hide show
  1. {incognia_python-3.1.0 → incognia_python-3.3.0}/PKG-INFO +1 -1
  2. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia/api.py +28 -9
  3. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia/models.py +24 -1
  4. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia_python.egg-info/PKG-INFO +1 -1
  5. {incognia_python-3.1.0 → incognia_python-3.3.0}/tests/test_api.py +56 -16
  6. {incognia_python-3.1.0 → incognia_python-3.3.0}/.github/dependabot.yml +0 -0
  7. {incognia_python-3.1.0 → incognia_python-3.3.0}/.github/workflows/codeql.yaml +0 -0
  8. {incognia_python-3.1.0 → incognia_python-3.3.0}/.github/workflows/continuous.yaml +0 -0
  9. {incognia_python-3.1.0 → incognia_python-3.3.0}/.gitignore +0 -0
  10. {incognia_python-3.1.0 → incognia_python-3.3.0}/CODEOWNERS +0 -0
  11. {incognia_python-3.1.0 → incognia_python-3.3.0}/LICENSE.txt +0 -0
  12. {incognia_python-3.1.0 → incognia_python-3.3.0}/MANIFEST.in +0 -0
  13. {incognia_python-3.1.0 → incognia_python-3.3.0}/README.md +0 -0
  14. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia/__init__.py +0 -0
  15. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia/base_request.py +0 -0
  16. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia/datetime_util.py +0 -0
  17. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia/endpoints.py +0 -0
  18. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia/exceptions.py +0 -0
  19. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia/feedback_events.py +0 -0
  20. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia/json_util.py +0 -0
  21. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia/singleton.py +0 -0
  22. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia/token_manager.py +0 -0
  23. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia_python.egg-info/SOURCES.txt +0 -0
  24. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia_python.egg-info/dependency_links.txt +0 -0
  25. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia_python.egg-info/not-zip-safe +0 -0
  26. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia_python.egg-info/requires.txt +0 -0
  27. {incognia_python-3.1.0 → incognia_python-3.3.0}/incognia_python.egg-info/top_level.txt +0 -0
  28. {incognia_python-3.1.0 → incognia_python-3.3.0}/pyproject.toml +0 -0
  29. {incognia_python-3.1.0 → incognia_python-3.3.0}/requirements.txt +0 -0
  30. {incognia_python-3.1.0 → incognia_python-3.3.0}/setup.cfg +0 -0
  31. {incognia_python-3.1.0 → incognia_python-3.3.0}/tests/__init__.py +0 -0
  32. {incognia_python-3.1.0 → incognia_python-3.3.0}/tests/test_base_request.py +0 -0
  33. {incognia_python-3.1.0 → incognia_python-3.3.0}/tests/test_token_manager.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: incognia-python
3
- Version: 3.1.0
3
+ Version: 3.3.0
4
4
  Summary: Python lightweight client library for Incognia APIs
5
5
  Home-page: https://github.com/inloco/incognia-python
6
6
  Author: Incognia
@@ -13,6 +13,8 @@ from .models import (
13
13
  PaymentMethod,
14
14
  Location,
15
15
  Coupon,
16
+ PersonID,
17
+ BankAccountInfo,
16
18
  )
17
19
  from .singleton import Singleton
18
20
  from .token_manager import TokenManager
@@ -37,7 +39,9 @@ class IncogniaAPI(metaclass=Singleton):
37
39
  policy_id: Optional[str] = None,
38
40
  account_id: Optional[str] = None,
39
41
  device_os: Optional[str] = None,
40
- app_version: Optional[str] = None) -> dict:
42
+ app_version: Optional[str] = None,
43
+ person_id: Optional[PersonID] = None,
44
+ custom_properties: Optional[dict] = None) -> dict:
41
45
  if not request_token:
42
46
  raise IncogniaError('request_token is required.')
43
47
 
@@ -53,7 +57,9 @@ class IncogniaAPI(metaclass=Singleton):
53
57
  'policy_id': policy_id,
54
58
  'account_id': account_id,
55
59
  'device_os': device_os.lower() if device_os is not None else None,
56
- 'app_version': app_version
60
+ 'app_version': app_version,
61
+ 'person_id': person_id,
62
+ 'custom_properties': custom_properties
57
63
  }
58
64
  data = encode(body)
59
65
  return self.__request.post(Endpoints.SIGNUPS, headers=headers, data=data)
@@ -66,7 +72,7 @@ class IncogniaAPI(metaclass=Singleton):
66
72
  policy_id: Optional[str] = None,
67
73
  account_id: Optional[str] = None,
68
74
  custom_properties: Optional[dict] = None,
69
- ) -> dict:
75
+ person_id: Optional[PersonID] = None) -> dict:
70
76
  if not request_token:
71
77
  raise IncogniaError('request_token is required.')
72
78
 
@@ -77,7 +83,8 @@ class IncogniaAPI(metaclass=Singleton):
77
83
  'request_token': request_token,
78
84
  'policy_id': policy_id,
79
85
  'account_id': account_id,
80
- 'custom_properties': custom_properties
86
+ 'custom_properties': custom_properties,
87
+ 'person_id': person_id,
81
88
  }
82
89
  data = encode(body)
83
90
  return self.__request.post(Endpoints.SIGNUPS, headers=headers, data=data)
@@ -95,7 +102,8 @@ class IncogniaAPI(metaclass=Singleton):
95
102
  installation_id: Optional[str] = None,
96
103
  request_token: Optional[str] = None,
97
104
  occurred_at: dt.datetime = None,
98
- expires_at: dt.datetime = None) -> None:
105
+ expires_at: dt.datetime = None,
106
+ person_id: Optional[PersonID] = None) -> None:
99
107
  if not event:
100
108
  raise IncogniaError('event is required.')
101
109
  if occurred_at is not None and not has_timezone(occurred_at):
@@ -114,7 +122,8 @@ class IncogniaAPI(metaclass=Singleton):
114
122
  'signup_id': signup_id,
115
123
  'account_id': account_id,
116
124
  'installation_id': installation_id,
117
- 'request_token': request_token
125
+ 'request_token': request_token,
126
+ 'person_id': person_id,
118
127
  }
119
128
  if occurred_at is not None:
120
129
  body['occurred_at'] = occurred_at.isoformat()
@@ -140,7 +149,10 @@ class IncogniaAPI(metaclass=Singleton):
140
149
  coupon: Optional[Coupon] = None,
141
150
  device_os: Optional[str] = None,
142
151
  app_version: Optional[str] = None,
143
- store_id: Optional[str] = None) -> dict:
152
+ store_id: Optional[str] = None,
153
+ person_id: Optional[PersonID] = None,
154
+ debtor_account: Optional[BankAccountInfo] = None,
155
+ creditor_account: Optional[BankAccountInfo] = None) -> dict:
144
156
  if not request_token:
145
157
  raise IncogniaError('request_token is required.')
146
158
  if not account_id:
@@ -175,6 +187,9 @@ class IncogniaAPI(metaclass=Singleton):
175
187
  'device_os': device_os.lower() if device_os is not None else None,
176
188
  'app_version': app_version,
177
189
  'store_id': store_id,
190
+ 'person_id': person_id,
191
+ 'debtor_account': debtor_account,
192
+ 'creditor_account': creditor_account,
178
193
  }
179
194
  data = encode(body)
180
195
  return self.__request.post(Endpoints.TRANSACTIONS, headers=headers, params=params,
@@ -191,7 +206,8 @@ class IncogniaAPI(metaclass=Singleton):
191
206
  evaluate: Optional[bool] = None,
192
207
  policy_id: Optional[str] = None,
193
208
  device_os: Optional[str] = None,
194
- app_version: Optional[str] = None) -> dict:
209
+ app_version: Optional[str] = None,
210
+ person_id: Optional[PersonID] = None) -> dict:
195
211
  if not request_token:
196
212
  raise IncogniaError('request_token is required.')
197
213
  if not account_id:
@@ -220,6 +236,7 @@ class IncogniaAPI(metaclass=Singleton):
220
236
  'policy_id': policy_id,
221
237
  'device_os': device_os.lower() if device_os is not None else None,
222
238
  'app_version': app_version,
239
+ 'person_id': person_id,
223
240
  }
224
241
  data = encode(body)
225
242
  return self.__request.post(Endpoints.TRANSACTIONS, headers=headers, params=params,
@@ -234,7 +251,8 @@ class IncogniaAPI(metaclass=Singleton):
234
251
  external_id: Optional[str] = None,
235
252
  evaluate: Optional[bool] = None,
236
253
  policy_id: Optional[str] = None,
237
- custom_properties: Optional[dict] = None) -> dict:
254
+ custom_properties: Optional[dict] = None,
255
+ person_id: Optional[PersonID] = None) -> dict:
238
256
  if not request_token:
239
257
  raise IncogniaError('request_token is required.')
240
258
  if not account_id:
@@ -251,6 +269,7 @@ class IncogniaAPI(metaclass=Singleton):
251
269
  'external_id': external_id,
252
270
  'policy_id': policy_id,
253
271
  'custom_properties': custom_properties,
272
+ 'person_id': person_id,
254
273
  }
255
274
  data = encode(body)
256
275
  return self.__request.post(Endpoints.TRANSACTIONS, headers=headers, params=params,
@@ -1,4 +1,4 @@
1
- from typing import TypedDict, Literal
1
+ from typing import TypedDict, Literal, List
2
2
 
3
3
 
4
4
  class Coordinates(TypedDict):
@@ -58,3 +58,26 @@ class Location(TypedDict, total=False):
58
58
  latitude: float
59
59
  longitude: float
60
60
  collected_at: str
61
+
62
+
63
+ class PersonID(TypedDict, total=False):
64
+ type: str
65
+ value: str
66
+
67
+
68
+ class PixKey(TypedDict):
69
+ type: str
70
+ value: str
71
+
72
+
73
+ class BankAccountInfo(TypedDict, total=False):
74
+ account_type: str
75
+ account_purpose: str
76
+ holder_type: str
77
+ holder_tax_id: PersonID
78
+ country: str
79
+ ispb_code: str
80
+ branch_code: str
81
+ account_number: str
82
+ account_check_digit: str
83
+ pix_keys: List[PixKey]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: incognia-python
3
- Version: 3.1.0
3
+ Version: 3.3.0
4
4
  Summary: Python lightweight client library for Incognia APIs
5
5
  Home-page: https://github.com/inloco/incognia-python
6
6
  Author: Incognia
@@ -22,6 +22,10 @@ class TestIncogniaAPI(TestCase):
22
22
  ADDRESS_LINE: Final[str] = 'ANY_ADDRESS_LINE'
23
23
  DEVICE_OS: Final[str] = 'ANY_DEVICE_OS'
24
24
  APP_VERSION: Final[str] = 'ANY_APP_VERSION'
25
+ PERSON_ID: Final[dict] = {
26
+ 'type': 'cpf',
27
+ 'value': '12345678901'
28
+ }
25
29
  STRUCTURED_ADDRESS: Final[dict] = {
26
30
  'locale': 'ANY_LOCALE',
27
31
  'country_name': 'ANY_COUNTRY_NAME',
@@ -62,6 +66,10 @@ class TestIncogniaAPI(TestCase):
62
66
  REGISTER_INVALID_SIGNUP_DATA: Final[bytes] = encode({
63
67
  'request_token': f'{INVALID_REQUEST_TOKEN}'
64
68
  })
69
+ CUSTOM_PROPERTIES: Final[dict] = {
70
+ 'float_field': 6.092,
71
+ 'string_field': "the next generation of identity",
72
+ }
65
73
  FULL_REGISTER_SIGNUP_DATA: Final[bytes] = encode({
66
74
  'request_token': f'{REQUEST_TOKEN}',
67
75
  'address_line': f'{ADDRESS_LINE}',
@@ -71,12 +79,10 @@ class TestIncogniaAPI(TestCase):
71
79
  'policy_id': f'{POLICY_ID}',
72
80
  'account_id': f'{ACCOUNT_ID}',
73
81
  'device_os': f'{DEVICE_OS.lower()}',
74
- 'app_version': f'{APP_VERSION}'
82
+ 'app_version': f'{APP_VERSION}',
83
+ 'person_id': PERSON_ID,
84
+ 'custom_properties': CUSTOM_PROPERTIES
75
85
  })
76
- CUSTOM_PROPERTIES: Final[dict] = {
77
- 'float_field': 6.092,
78
- 'string_field': "the next generation of identity",
79
- }
80
86
  REGISTER_WEB_SIGNUP_DATA: Final[bytes] = encode({
81
87
  'request_token': f'{REQUEST_TOKEN}'
82
88
  })
@@ -87,7 +93,8 @@ class TestIncogniaAPI(TestCase):
87
93
  'request_token': f'{REQUEST_TOKEN}',
88
94
  'policy_id': f'{POLICY_ID}',
89
95
  'account_id': f'{ACCOUNT_ID}',
90
- 'custom_properties': CUSTOM_PROPERTIES
96
+ 'custom_properties': CUSTOM_PROPERTIES,
97
+ 'person_id': PERSON_ID
91
98
  })
92
99
  OK_STATUS_CODE: Final[int] = 200
93
100
  CLIENT_ERROR_CODE: Final[int] = 400
@@ -143,6 +150,24 @@ class TestIncogniaAPI(TestCase):
143
150
  'longitude': 13.123,
144
151
  'collected_at': "12:04 14/10/2024"
145
152
  }
153
+ BANK_ACCOUNT_INFO: Final[dict] = {
154
+ "account_type": "checking",
155
+ "account_purpose": "personal",
156
+ "holder_type": "individual",
157
+ "holder_tax_id": {
158
+ "type": "cpf",
159
+ "value": "12345678900",
160
+ },
161
+ "country": "BR",
162
+ "ispb_code": "12345678",
163
+ "branch_code": "0001",
164
+ "account_number": "987654",
165
+ "account_check_digit": "0",
166
+ "pix_keys": [
167
+ {"type": "email", "value": "user@example.com"},
168
+ {"type": "phone", "value": "+5511999999999"},
169
+ ],
170
+ }
146
171
  REGISTER_VALID_FEEDBACK_DATA: Final[bytes] = encode({
147
172
  'event': f'{VALID_EVENT_FEEDBACK_TYPE}'
148
173
  })
@@ -155,8 +180,9 @@ class TestIncogniaAPI(TestCase):
155
180
  'account_id': f'{ACCOUNT_ID}',
156
181
  'installation_id': f'{INSTALLATION_ID}',
157
182
  'request_token': f'{REQUEST_TOKEN}',
183
+ 'person_id': PERSON_ID,
158
184
  'occurred_at': TIMESTAMP.isoformat(),
159
- 'expires_at': TIMESTAMP.isoformat(),
185
+ 'expires_at': TIMESTAMP.isoformat()
160
186
  })
161
187
  REGISTER_VALID_PAYMENT_DATA: Final[bytes] = encode({
162
188
  'type': 'payment',
@@ -178,7 +204,10 @@ class TestIncogniaAPI(TestCase):
178
204
  'coupon': COUPON,
179
205
  'device_os': f'{DEVICE_OS.lower()}',
180
206
  'app_version': f'{APP_VERSION}',
181
- 'store_id': f'{STORE_ID}'
207
+ 'store_id': f'{STORE_ID}',
208
+ 'person_id': PERSON_ID,
209
+ 'debtor_account': BANK_ACCOUNT_INFO,
210
+ 'creditor_account': BANK_ACCOUNT_INFO
182
211
  })
183
212
  REGISTER_VALID_PAYMENT_DATA_WITH_LOCATION: Final[bytes] = encode({
184
213
  'type': 'payment',
@@ -213,7 +242,8 @@ class TestIncogniaAPI(TestCase):
213
242
  'external_id': f'{EXTERNAL_ID}',
214
243
  'policy_id': f'{POLICY_ID}',
215
244
  'device_os': f'{DEVICE_OS.lower()}',
216
- 'app_version': f'{APP_VERSION}'
245
+ 'app_version': f'{APP_VERSION}',
246
+ 'person_id': PERSON_ID
217
247
  })
218
248
  REGISTER_VALID_WEB_LOGIN_DATA: Final[bytes] = encode({
219
249
  'type': 'login',
@@ -227,7 +257,8 @@ class TestIncogniaAPI(TestCase):
227
257
  'account_id': f'{ACCOUNT_ID}',
228
258
  'external_id': f'{EXTERNAL_ID}',
229
259
  'policy_id': f'{POLICY_ID}',
230
- 'custom_properties': CUSTOM_PROPERTIES
260
+ 'custom_properties': CUSTOM_PROPERTIES,
261
+ 'person_id': PERSON_ID
231
262
  })
232
263
  REGISTER_INVALID_LOGIN_DATA: Final[bytes] = encode({
233
264
  'type': 'login',
@@ -294,7 +325,9 @@ class TestIncogniaAPI(TestCase):
294
325
  account_id=self.ACCOUNT_ID,
295
326
  request_token=self.REQUEST_TOKEN,
296
327
  device_os=self.DEVICE_OS,
297
- app_version=self.APP_VERSION)
328
+ app_version=self.APP_VERSION,
329
+ person_id=self.PERSON_ID,
330
+ custom_properties=self.CUSTOM_PROPERTIES)
298
331
 
299
332
  mock_token_manager_get.assert_called()
300
333
  mock_base_request_post.assert_called_with(Endpoints.SIGNUPS,
@@ -313,7 +346,8 @@ class TestIncogniaAPI(TestCase):
313
346
  response = api.register_new_web_signup(request_token=self.REQUEST_TOKEN,
314
347
  policy_id=self.POLICY_ID,
315
348
  account_id=self.ACCOUNT_ID,
316
- custom_properties=self.CUSTOM_PROPERTIES)
349
+ custom_properties=self.CUSTOM_PROPERTIES,
350
+ person_id=self.PERSON_ID)
317
351
 
318
352
  mock_token_manager_get.assert_called()
319
353
  mock_base_request_post.assert_called_with(Endpoints.SIGNUPS,
@@ -403,7 +437,8 @@ class TestIncogniaAPI(TestCase):
403
437
  signup_id=self.SIGNUP_ID,
404
438
  account_id=self.ACCOUNT_ID,
405
439
  installation_id=self.INSTALLATION_ID,
406
- request_token=self.REQUEST_TOKEN)
440
+ request_token=self.REQUEST_TOKEN,
441
+ person_id=self.PERSON_ID)
407
442
 
408
443
  mock_token_manager_get.assert_called()
409
444
  mock_base_request_post.assert_called_with(Endpoints.FEEDBACKS,
@@ -490,7 +525,10 @@ class TestIncogniaAPI(TestCase):
490
525
  coupon=self.COUPON,
491
526
  device_os=self.DEVICE_OS,
492
527
  app_version=self.APP_VERSION,
493
- store_id=self.STORE_ID
528
+ store_id=self.STORE_ID,
529
+ person_id=self.PERSON_ID,
530
+ debtor_account=self.BANK_ACCOUNT_INFO,
531
+ creditor_account=self.BANK_ACCOUNT_INFO
494
532
  )
495
533
 
496
534
  mock_token_manager_get.assert_called()
@@ -641,7 +679,8 @@ class TestIncogniaAPI(TestCase):
641
679
  self.ACCOUNT_ID,
642
680
  external_id=self.EXTERNAL_ID,
643
681
  policy_id=self.POLICY_ID,
644
- custom_properties=self.CUSTOM_PROPERTIES)
682
+ custom_properties=self.CUSTOM_PROPERTIES,
683
+ person_id=self.PERSON_ID)
645
684
  mock_token_manager_get.assert_called()
646
685
  mock_base_request_post.assert_called_with(Endpoints.TRANSACTIONS,
647
686
  headers=self.AUTH_AND_JSON_CONTENT_HEADERS,
@@ -731,7 +770,8 @@ class TestIncogniaAPI(TestCase):
731
770
  external_id=self.EXTERNAL_ID,
732
771
  policy_id=self.POLICY_ID,
733
772
  device_os=self.DEVICE_OS,
734
- app_version=self.APP_VERSION)
773
+ app_version=self.APP_VERSION,
774
+ person_id=self.PERSON_ID)
735
775
 
736
776
  mock_token_manager_get.assert_called()
737
777
  mock_base_request_post.assert_called_with(Endpoints.TRANSACTIONS,