unit-python-sdk 0.23.1__tar.gz → 0.25.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 (72) hide show
  1. {unit-python-sdk-0.23.1/unit_python_sdk.egg-info → unit-python-sdk-0.25.0}/PKG-INFO +1 -1
  2. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/setup.py +1 -1
  3. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/__init__.py +4 -0
  4. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/application_resource.py +16 -11
  5. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/counterparty_resource.py +3 -0
  6. unit-python-sdk-0.25.0/unit/api/recurring_payment_resource.py +53 -0
  7. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/__init__.py +184 -21
  8. unit-python-sdk-0.25.0/unit/models/application.py +427 -0
  9. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/codecs.py +25 -4
  10. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/counterparty.py +3 -2
  11. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/payment.py +235 -0
  12. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/utils/configuration.py +1 -1
  13. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0/unit_python_sdk.egg-info}/PKG-INFO +1 -1
  14. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit_python_sdk.egg-info/SOURCES.txt +1 -0
  15. unit-python-sdk-0.23.1/unit/models/application.py +0 -296
  16. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/LICENSE +0 -0
  17. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/README.md +0 -0
  18. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/setup.cfg +0 -0
  19. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/__init__.py +0 -0
  20. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/account_end_of_day_resource.py +0 -0
  21. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/account_resource.py +0 -0
  22. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/api_token_resource.py +0 -0
  23. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/applicationForm_resource.py +0 -0
  24. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/atmLocation_resource.py +0 -0
  25. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/authorization_request_resource.py +0 -0
  26. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/authorization_resource.py +0 -0
  27. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/base_resource.py +0 -0
  28. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/bill_pay_resource.py +0 -0
  29. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/card_resource.py +0 -0
  30. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/checkDeposit_resource.py +0 -0
  31. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/customerToken_resource.py +0 -0
  32. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/customer_resource.py +0 -0
  33. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/dispute_resource.py +0 -0
  34. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/event_resource.py +0 -0
  35. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/fee_resource.py +0 -0
  36. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/institution_resource.py +0 -0
  37. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/payment_resource.py +0 -0
  38. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/received_payment_resource.py +0 -0
  39. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/repayment_resource.py +0 -0
  40. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/returnAch_resource.py +0 -0
  41. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/reward_resource.py +0 -0
  42. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/statement_resource.py +0 -0
  43. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/transaction_resource.py +0 -0
  44. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/api/webhook_resource.py +0 -0
  45. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/account.py +0 -0
  46. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/account_end_of_day.py +0 -0
  47. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/api_token.py +0 -0
  48. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/applicationForm.py +0 -0
  49. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/atm_location.py +0 -0
  50. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/authorization.py +0 -0
  51. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/authorization_request.py +0 -0
  52. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/bill_pay.py +0 -0
  53. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/card.py +0 -0
  54. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/check_deposit.py +0 -0
  55. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/customer.py +0 -0
  56. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/customerToken.py +0 -0
  57. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/dispute.py +0 -0
  58. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/event.py +0 -0
  59. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/fee.py +0 -0
  60. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/institution.py +0 -0
  61. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/received_payment.py +0 -0
  62. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/repayment.py +0 -0
  63. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/returnAch.py +0 -0
  64. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/reward.py +0 -0
  65. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/statement.py +0 -0
  66. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/transaction.py +0 -0
  67. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/models/webhook.py +0 -0
  68. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/utils/__init__.py +0 -0
  69. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit/utils/date_utils.py +0 -0
  70. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit_python_sdk.egg-info/dependency_links.txt +0 -0
  71. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit_python_sdk.egg-info/requires.txt +0 -0
  72. {unit-python-sdk-0.23.1 → unit-python-sdk-0.25.0}/unit_python_sdk.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unit-python-sdk
3
- Version: 0.23.1
3
+ Version: 0.25.0
4
4
  Summary: This library provides a python wrapper to http://unit.co API. See https://docs.unit.co/
5
5
  Home-page: https://github.com/unit-finance/unit-python-sdk
6
6
  Download-URL: https://github.com/unit-finance/unit-python-sdk.git
@@ -3,7 +3,7 @@ from distutils.core import setup
3
3
  setup(
4
4
  name='unit-python-sdk',
5
5
  packages=['unit', 'unit.api', 'unit.models', 'unit.utils'],
6
- version="0.23.1",
6
+ version="0.25.0",
7
7
  license='Mozilla Public License 2.0',
8
8
  description='This library provides a python wrapper to http://unit.co API. See https://docs.unit.co/',
9
9
  author='unit.co',
@@ -23,6 +23,7 @@ from unit.api.account_end_of_day_resource import AccountEndOfDayResource
23
23
  from unit.api.checkDeposit_resource import CheckDepositResource
24
24
  from unit.api.dispute_resource import DisputeResource
25
25
  from unit.api.reward_resource import RewardResource
26
+ from unit.api.recurring_payment_resource import RecurringPaymentResource
26
27
  from unit.api.repayment_resource import RepaymentResource
27
28
  from unit.utils.configuration import Configuration
28
29
 
@@ -35,6 +36,7 @@ class Unit(object):
35
36
  raise Exception("use only configuration")
36
37
 
37
38
  c = configuration if configuration else Configuration(api_url, token, retries, timeout)
39
+
38
40
  self.applications = ApplicationResource(c)
39
41
  self.customers = CustomerResource(c)
40
42
  self.accounts = AccountResource(c)
@@ -61,3 +63,5 @@ class Unit(object):
61
63
  self.rewards = RewardResource(c)
62
64
  self.received_payments = ReceivedPaymentResource(c)
63
65
  self.repayments = RepaymentResource(c)
66
+ self.recurring_payments = RecurringPaymentResource(c)
67
+
@@ -8,33 +8,29 @@ class ApplicationResource(BaseResource):
8
8
  def __init__(self, configuration: Configuration):
9
9
  super().__init__("applications", configuration)
10
10
 
11
- def create(self, request: Union[CreateIndividualApplicationRequest, CreateBusinessApplicationRequest]) -> Union[UnitResponse[ApplicationDTO], UnitError]:
11
+ def create(self, request: CreateApplicationRequest) -> Union[UnitResponse[ApplicationDTO], UnitError]:
12
12
  payload = request.to_json_api()
13
13
  response = super().post_create(self.resource, payload)
14
14
 
15
- if response.ok:
15
+ if super().is_20x(response.status_code):
16
16
  data = response.json().get("data")
17
17
  included = response.json().get("included")
18
- if data["type"] == "individualApplication":
19
- return UnitResponse[IndividualApplicationDTO](DtoDecoder.decode(data), DtoDecoder.decode(included))
20
- else:
21
- return UnitResponse[BusinessApplicationDTO](DtoDecoder.decode(data), DtoDecoder.decode(included))
18
+ return UnitResponse[ApplicationDTO](DtoDecoder.decode(data), DtoDecoder.decode(included))
22
19
  else:
23
20
  return UnitError.from_json_api(response.json())
24
21
 
25
22
  def list(self, params: ListApplicationParams = None) -> Union[UnitResponse[List[ApplicationDTO]], UnitError]:
26
23
  params = params or ListApplicationParams()
27
24
  response = super().get(self.resource, params.to_dict())
28
- if response.status_code == 200:
25
+ if super().is_20x(response.status_code):
29
26
  data = response.json().get("data")
30
- included = response.json().get("included")
31
27
  return UnitResponse[ApplicationDTO](DtoDecoder.decode(data), None)
32
28
  else:
33
29
  return UnitError.from_json_api(response.json())
34
30
 
35
31
  def get(self, application_id: str) -> Union[UnitResponse[ApplicationDTO], UnitError]:
36
32
  response = super().get(f"{self.resource}/{application_id}")
37
- if response.status_code == 200:
33
+ if super().is_20x(response.status_code):
38
34
  data = response.json().get("data")
39
35
  included = response.json().get("included")
40
36
  return UnitResponse[ApplicationDTO](DtoDecoder.decode(data), DtoDecoder.decode(included))
@@ -56,13 +52,13 @@ class ApplicationResource(BaseResource):
56
52
  headers = {"Content-Type": "application/pdf"}
57
53
 
58
54
  response = super().put(url, request.file, headers)
59
- if response.status_code == 200:
55
+ if super().is_20x(response.status_code):
60
56
  data = response.json().get("data")
61
57
  return UnitResponse[ApplicationDocumentDTO](DtoDecoder.decode(data), None)
62
58
  else:
63
59
  return UnitError.from_json_api(response.json())
64
60
 
65
- def update(self, request: PatchApplicationRequest) -> Union[UnitResponse[ApplicationDTO], UnitError]:
61
+ def update(self, request: UnionPatchApplicationRequest) -> Union[UnitResponse[ApplicationDTO], UnitError]:
66
62
  payload = request.to_json_api()
67
63
  response = super().patch(f"{self.resource}/{request.application_id}", payload)
68
64
  if super().is_20x(response.status_code):
@@ -71,6 +67,15 @@ class ApplicationResource(BaseResource):
71
67
  else:
72
68
  return UnitError.from_json_api(response.json())
73
69
 
70
+ def update_business_beneficial_owner(self, request: PatchBusinessBeneficialOwnerRequest) -> Union[UnitResponse[BeneficialOwnerDTO], UnitError]:
71
+ payload = request.to_json_api()
72
+ response = super().patch(f"beneficial-owner/{request.beneficial_owner_id}", payload)
73
+ if super().is_20x(response.status_code):
74
+ data = response.json().get("data")
75
+ return UnitResponse[BeneficialOwnerDTO](DtoDecoder.decode(data), None)
76
+ else:
77
+ return UnitError.from_json_api(response.json())
78
+
74
79
  def cancel(self, request: CancelApplicationRequest) -> Union[UnitResponse[ApplicationDTO], UnitError]:
75
80
  payload = request.to_json_api()
76
81
  response = super().post(f"{self.resource}/{request.application_id}/cancel", payload)
@@ -1,5 +1,8 @@
1
+ from typing import Union, List
2
+
1
3
  from unit.utils.configuration import Configuration
2
4
  from unit.api.base_resource import BaseResource
5
+ from unit.models import UnitResponse, UnitError
3
6
  from unit.models.counterparty import *
4
7
  from unit.models.codecs import DtoDecoder
5
8
 
@@ -0,0 +1,53 @@
1
+ from unit.utils.configuration import Configuration
2
+ from unit.api.base_resource import BaseResource
3
+ from unit.models.payment import *
4
+ from unit.models.codecs import DtoDecoder
5
+
6
+
7
+ class RecurringPaymentResource(BaseResource):
8
+ def __init__(self, configuration: Configuration):
9
+ super().__init__("recurring-payments", configuration)
10
+
11
+ def create(self, request: CreateRecurringPaymentRequest) -> Union[UnitResponse[RecurringPaymentDTO], UnitError]:
12
+ payload = request.to_json_api()
13
+ response = super().post(f"{self.resource}", payload)
14
+ if super().is_20x(response.status_code):
15
+ data = response.json().get("data")
16
+ return UnitResponse[RecurringPaymentDTO](DtoDecoder.decode(data), None)
17
+ else:
18
+ return UnitError.from_json_api(response.json())
19
+
20
+ def get(self, payment_id: str, include: Optional[str] = "") -> Union[UnitResponse[RecurringPaymentDTO], UnitError]:
21
+ response = super().get(f"{self.resource}/{payment_id}", {"include": include})
22
+ if super().is_20x(response.status_code):
23
+ data = response.json().get("data")
24
+ included = response.json().get("included")
25
+ return UnitResponse[RecurringPaymentDTO](DtoDecoder.decode(data), DtoDecoder.decode(included))
26
+ else:
27
+ return UnitError.from_json_api(response.json())
28
+
29
+ def list(self, params: ListRecurringPaymentParams = None) -> Union[UnitResponse[List[RecurringPaymentDTO]], UnitError]:
30
+ params = params or ListRecurringPaymentParams()
31
+ response = super().get(self.resource, params.to_dict())
32
+ if super().is_20x(response.status_code):
33
+ data = response.json().get("data")
34
+ included = response.json().get("included")
35
+ return UnitResponse[RecurringPaymentDTO](DtoDecoder.decode(data), DtoDecoder.decode(included))
36
+ else:
37
+ return UnitError.from_json_api(response.json())
38
+
39
+ def disable(self, payment_id: str) -> Union[UnitResponse[RecurringPaymentDTO], UnitError]:
40
+ response = super().post(f"{self.resource}/{payment_id}/disable")
41
+ if super().is_20x(response.status_code):
42
+ data = response.json().get("data")
43
+ return UnitResponse[RecurringPaymentDTO](DtoDecoder.decode(data), None)
44
+ else:
45
+ return UnitError.from_json_api(response.json())
46
+
47
+ def enable(self, payment_id: str) -> Union[UnitResponse[RecurringPaymentDTO], UnitError]:
48
+ response = super().post(f"{self.resource}/{payment_id}/enable")
49
+ if super().is_20x(response.status_code):
50
+ data = response.json().get("data")
51
+ return UnitResponse[RecurringPaymentDTO](DtoDecoder.decode(data), None)
52
+ else:
53
+ return UnitError.from_json_api(response.json())
@@ -1,4 +1,5 @@
1
1
  import json
2
+
2
3
  try:
3
4
  from typing import TypeVar, Generic, Union, Optional, Literal, List, Dict
4
5
  except ImportError:
@@ -7,6 +8,23 @@ except ImportError:
7
8
 
8
9
  from datetime import datetime, date
9
10
 
11
+ Occupation = Literal["ArchitectOrEngineer", "BusinessAnalystAccountantOrFinancialAdvisor",
12
+ "CommunityAndSocialServicesWorker", "ConstructionMechanicOrMaintenanceWorker", "Doctor",
13
+ "Educator", "EntertainmentSportsArtsOrMedia", "ExecutiveOrManager", "FarmerFishermanForester",
14
+ "FoodServiceWorker", "GigWorker", "HospitalityOfficeOrAdministrativeSupportWorker",
15
+ "HouseholdManager", "JanitorHousekeeperLandscaper", "Lawyer", "ManufacturingOrProductionWorker",
16
+ "MilitaryOrPublicSafety", "NurseHealthcareTechnicianOrHealthcareSupport",
17
+ "PersonalCareOrServiceWorker", "PilotDriverOperator", "SalesRepresentativeBrokerAgent",
18
+ "ScientistOrTechnologist", "Student"]
19
+ AnnualIncome = Literal["UpTo10k", "Between10kAnd25k", "Between25kAnd50k", "Between50kAnd100k", "Between100kAnd250k",
20
+ "Over250k"]
21
+ SourceOfIncome = Literal["EmploymentOrPayrollIncome", "PartTimeOrContractorIncome", "InheritancesAndGifts",
22
+ "PersonalInvestments", "BusinessOwnershipInterests", "GovernmentBenefits"]
23
+ Status = Literal["Approved", "Denied", "PendingReview"]
24
+ Title = Literal["CEO", "COO", "CFO", "President"]
25
+ EntityType = Literal["Corporation", "LLC", "Partnership"]
26
+ UseSelfieVerification = Literal["Never", "ReplaceIdentification"]
27
+
10
28
 
11
29
  def to_camel_case(snake_str):
12
30
  components = snake_str.lstrip('_').split('_')
@@ -104,6 +122,9 @@ class UnitRequest(object):
104
122
 
105
123
  return payload
106
124
 
125
+ def __repr__(self):
126
+ return json.dumps(self.to_json_api())
127
+
107
128
 
108
129
  class UnitParams(object):
109
130
  def to_dict(self) -> Dict:
@@ -155,12 +176,8 @@ class UnitError(object):
155
176
 
156
177
  def __str__(self):
157
178
  return json.dumps({"errors": [{"title": err.title, "status": err.status, "detail": err.detail,
158
- "details": err.details, "source": err.source, "code": err.code} for err in self.errors]})
159
-
160
-
161
- Status = Literal["Approved", "Denied", "PendingReview"]
162
- Title = Literal["CEO", "COO", "CFO", "President"]
163
- EntityType = Literal["Corporation", "LLC", "Partnership"]
179
+ "details": err.details, "source": err.source, "code": err.code} for err in
180
+ self.errors]})
164
181
 
165
182
 
166
183
  class FullName(UnitDTO):
@@ -192,6 +209,7 @@ class Address(UnitDTO):
192
209
 
193
210
  return None
194
211
 
212
+
195
213
  class Phone(UnitDTO):
196
214
  def __init__(self, country_code: str, number: str):
197
215
  self.country_code = country_code
@@ -202,6 +220,26 @@ class Phone(UnitDTO):
202
220
  return Phone(data.get("countryCode"), data.get("number"))
203
221
 
204
222
 
223
+ class EvaluationParams(object):
224
+ def __init__(self, use_selfie_verification: Optional[UseSelfieVerification] = None,
225
+ require_id_verification: Optional[bool] = False):
226
+ self.use_selfie_verification = use_selfie_verification
227
+ self.require_id_verification = require_id_verification
228
+
229
+ def to_json_api(self):
230
+ return {
231
+ "useSelfieVerification": self.use_selfie_verification,
232
+ "requireIdVerification": self.require_id_verification,
233
+ }
234
+
235
+ @staticmethod
236
+ def from_json_api(data: Dict):
237
+ if data:
238
+ return EvaluationParams(data.get("useSelfieVerification"), data.get("requireIdVerification"))
239
+
240
+ return None
241
+
242
+
205
243
  class BusinessContact(UnitDTO):
206
244
  def __init__(self, full_name: FullName, email: str, phone: Phone):
207
245
  self.full_name = full_name
@@ -210,13 +248,17 @@ class BusinessContact(UnitDTO):
210
248
 
211
249
  @staticmethod
212
250
  def from_json_api(data: Dict):
213
- return BusinessContact(FullName.from_json_api(data.get("fullName")), data.get("email"), Phone.from_json_api(data.get("phone")))
251
+ return BusinessContact(FullName.from_json_api(data.get("fullName")), data.get("email"),
252
+ Phone.from_json_api(data.get("phone")))
214
253
 
215
254
 
216
255
  class Officer(UnitDTO):
217
256
  def __init__(self, full_name: FullName, date_of_birth: date, address: Address, phone: Phone, email: str,
218
257
  status: Optional[Status] = None, title: Optional[Title] = None, ssn: Optional[str] = None,
219
- passport: Optional[str] = None, nationality: Optional[str] = None):
258
+ passport: Optional[str] = None, nationality: Optional[str] = None,
259
+ evaluation_params: Optional[EvaluationParams] = None, id_theft_score: Optional[str] = None,
260
+ occupation: Optional[Occupation] = None, annual_income: Optional[AnnualIncome] = None,
261
+ source_of_income: Optional[SourceOfIncome] = None):
220
262
  self.full_name = full_name
221
263
  self.date_of_birth = date_of_birth
222
264
  self.address = address
@@ -227,18 +269,28 @@ class Officer(UnitDTO):
227
269
  self.ssn = ssn
228
270
  self.passport = passport
229
271
  self.nationality = nationality
272
+ self.evaluation_params = evaluation_params
273
+ self.id_theft_score = id_theft_score
274
+ self.occupation = occupation
275
+ self.annual_income = annual_income
276
+ self.source_of_income = source_of_income
230
277
 
231
278
  @staticmethod
232
279
  def from_json_api(data: Dict):
233
280
  return Officer(data.get("fullName"), data.get("dateOfBirth"), data.get("address"), data.get("phone"),
234
- data.get("email"), data.get("status"), data.get("title"), data.get("ssn"), data.get("passport"),
235
- data.get("nationality"))
281
+ data.get("email"), data.get("status"), data.get("title"), data.get("ssn"), data.get("passport"),
282
+ data.get("nationality"), EvaluationParams.from_json_api(data.get("evaluationParams")),
283
+ data.get("idTheftScore"), data.get("occupation"), data.get("annualIncome"),
284
+ data.get("sourceOfIncome"))
236
285
 
237
286
 
238
287
  class BeneficialOwner(UnitDTO):
239
288
  def __init__(self, full_name: FullName, date_of_birth: date, address: Address, phone: Phone, email: str,
240
289
  status: Optional[Status] = None, ssn: Optional[str] = None, passport: Optional[str] = None,
241
- nationality: Optional[str] = None, percentage: Optional[int] = None):
290
+ nationality: Optional[str] = None, percentage: Optional[int] = None,
291
+ evaluation_params: Optional[EvaluationParams] = None, id_theft_score: Optional[str] = None,
292
+ occupation: Optional[Occupation] = None, annual_income: Optional[AnnualIncome] = None,
293
+ source_of_income: Optional[SourceOfIncome] = None):
242
294
  self.full_name = full_name
243
295
  self.date_of_birth = date_of_birth
244
296
  self.address = address
@@ -249,15 +301,41 @@ class BeneficialOwner(UnitDTO):
249
301
  self.passport = passport
250
302
  self.nationality = nationality
251
303
  self.percentage = percentage
304
+ self.evaluation_params = evaluation_params
305
+ self.id_theft_score = id_theft_score
306
+ self.occupation = occupation
307
+ self.annual_income = annual_income
308
+ self.source_of_income = source_of_income
252
309
 
253
310
  @staticmethod
254
- def from_json_api(l: List):
255
- beneficial_owners = []
256
- for data in l:
257
- beneficial_owners.append(BeneficialOwner(data.get("fullName"), data.get("dateOfBirth"), data.get("address"),
258
- data.get("phone"), data.get("email"), data.get("status"), data.get("ssn"),
259
- data.get("passport"), data.get("nationality"), data.get("percentage")))
260
- return beneficial_owners
311
+ def create(data: Dict):
312
+ return BeneficialOwner(data.get("fullName"), data.get("dateOfBirth"), data.get("address"),
313
+ data.get("phone"), data.get("email"), data.get("status"), data.get("ssn"),
314
+ data.get("passport"), data.get("nationality"), data.get("percentage"),
315
+ EvaluationParams.from_json_api(data.get("evaluationParams")), data.get("idTheftScore"),
316
+ data.get("occupation"), data.get("annualIncome"), data.get("sourceOfIncome"))
317
+
318
+ @staticmethod
319
+ def from_json_api(l: Union[List, Dict]):
320
+ if isinstance(l, list):
321
+ beneficial_owners = []
322
+ for data in l:
323
+ beneficial_owners.append(BeneficialOwner.create(data))
324
+ return beneficial_owners
325
+ else:
326
+ return BeneficialOwner.create(l)
327
+
328
+
329
+ class BeneficialOwnerDTO(UnitDTO):
330
+ def __init__(self, _id: str, _type: str, attributes: BeneficialOwner, relationships: Dict[str, Relationship]):
331
+ self.id = _id
332
+ self.type = _type
333
+ self.attributes = attributes
334
+ self.relationships = relationships
335
+
336
+ @staticmethod
337
+ def from_json_api(_id, _type, attributes, relationships):
338
+ return BeneficialOwnerDTO(_id, _type, BeneficialOwner.from_json_api(attributes), relationships)
261
339
 
262
340
 
263
341
  class AuthorizedUser(UnitDTO):
@@ -277,10 +355,11 @@ class AuthorizedUser(UnitDTO):
277
355
 
278
356
  if type(data) is dict:
279
357
  return AuthorizedUser(FullName.from_json_api(data.get("fullName")), data.get("email"),
280
- Phone.from_json_api(data.get("phone")), data.get("jwtSubject"))
358
+ Phone.from_json_api(data.get("phone")), data.get("jwtSubject"))
281
359
 
282
360
  return [AuthorizedUser(FullName.from_json_api(d.get("fullName")), d.get("email"),
283
- Phone.from_json_api(d.get("phone")), d.get("jwtSubject")) for d in data]
361
+ Phone.from_json_api(d.get("phone")), d.get("jwtSubject")) for d in data]
362
+
284
363
 
285
364
  class WireCounterparty(UnitDTO):
286
365
  def __init__(self, routing_number: str, account_number: str, name: str, address: Address):
@@ -294,6 +373,7 @@ class WireCounterparty(UnitDTO):
294
373
  return WireCounterparty(data["routingNumber"], data["accountNumber"], data["name"],
295
374
  Address.from_json_api(data["address"]))
296
375
 
376
+
297
377
  class Counterparty(UnitDTO):
298
378
  def __init__(self, routing_number: str, account_number: str, account_type: str, name: str):
299
379
  self.routing_number = routing_number
@@ -305,6 +385,7 @@ class Counterparty(UnitDTO):
305
385
  def from_json_api(data: Dict):
306
386
  return Counterparty(data["routingNumber"], data["accountNumber"], data["accountType"], data["name"])
307
387
 
388
+
308
389
  class Coordinates(UnitDTO):
309
390
  def __init__(self, longitude: float, latitude: float):
310
391
  self.longitude = longitude
@@ -344,7 +425,8 @@ class CardLevelLimits(UnitDTO):
344
425
  @staticmethod
345
426
  def from_json_api(data: Dict):
346
427
  return CardLevelLimits(data["dailyWithdrawal"], data["dailyPurchase"], data["monthlyWithdrawal"],
347
- data["monthlyPurchase"])
428
+ data["monthlyPurchase"])
429
+
348
430
 
349
431
  class CardTotals(UnitDTO):
350
432
  def __init__(self, withdrawals: int, deposits: int, purchases: int):
@@ -372,6 +454,7 @@ class DeviceFingerprint(UnitDTO):
372
454
  def from_json_api(cls, data: Dict):
373
455
  return cls(value=data["value"], provider=data["provider"])
374
456
 
457
+
375
458
  class CheckCounterparty(object):
376
459
  def __init__(self, routing_number: str, account_number: str, name: str):
377
460
  self.routing_number = routing_number
@@ -384,3 +467,83 @@ class CheckCounterparty(object):
384
467
  return None
385
468
 
386
469
  return CheckCounterparty(data["routingNumber"], data["accountNumber"], data["name"])
470
+
471
+
472
+ class BaseIndividual(UnitDTO):
473
+ def __init__(self, full_name: FullName, date_of_birth: date, ssn: str, email: str, phone: Phone, address: Address):
474
+ self.full_name = full_name
475
+ self.date_of_birth = date_of_birth
476
+ self.ssn = ssn
477
+ self.email = email
478
+ self.phone = phone
479
+ self.address = address
480
+
481
+
482
+ class Grantor(BaseIndividual):
483
+ @staticmethod
484
+ def from_json_api(data: Dict):
485
+ if not data:
486
+ return None
487
+
488
+ return Grantor(FullName.from_json_api(data["fullName"]), data["dateOfBirth"], data["ssn"], data["email"],
489
+ Phone.from_json_api(data["phone"]), Address.from_json_api(data["address"]))
490
+
491
+
492
+ class Trustee(BaseIndividual):
493
+ @staticmethod
494
+ def from_json_api(data: Dict):
495
+ if not data:
496
+ return None
497
+
498
+ return Trustee(FullName.from_json_api(data["fullName"]), data["dateOfBirth"], data["ssn"], data["email"],
499
+ Phone.from_json_api(data["phone"]), Address.from_json_api(data["address"]))
500
+
501
+
502
+ class TrustContact(UnitDTO):
503
+ def __init__(self, full_name: FullName, email: str, phone: Phone, address: Address, jwt_subject: Optional[str]):
504
+ self.full_name = full_name
505
+ self.email = email
506
+ self.phone = phone
507
+ self.address = address
508
+ self.jwt_subject = jwt_subject
509
+
510
+ @staticmethod
511
+ def from_json_api(data: Dict):
512
+ if not data:
513
+ return None
514
+
515
+ return TrustContact(FullName.from_json_api(data["fullName"]), data["email"], Phone.from_json_api(data["phone"]),
516
+ Address.from_json_api(data["address"]), data.get("jwtSubject"))
517
+
518
+
519
+ class Agent(BaseIndividual):
520
+ def __init__(self, status: str, full_name: FullName, ssn: Optional[str], passport: Optional[str],
521
+ nationality: Optional[str], date_of_birth: date, email: str, phone: Phone, address: Address,
522
+ jwt_subject: Optional[str]):
523
+ super().__init__(full_name, date_of_birth, ssn, email, phone, address)
524
+ self.status = status
525
+ self.passport = passport
526
+ self.nationality = nationality
527
+ self.jwt_subject = jwt_subject
528
+
529
+ @staticmethod
530
+ def from_json_api(data: Dict):
531
+ if not data:
532
+ return None
533
+
534
+ return Agent(data["status"], FullName.from_json_api(data["fullName"]), data.get("ssn"), data.get("passport"),
535
+ data.get("nationality"), data["dateOfBirth"], data["email"], Phone.from_json_api(data["phone"]),
536
+ Address.from_json_api(data["address"]), data.get("jwtSubject"))
537
+
538
+
539
+ class Beneficiary(UnitDTO):
540
+ def __init__(self, full_name: FullName, date_of_birth: date):
541
+ self.full_name = full_name
542
+ self.date_of_birth = date_of_birth
543
+
544
+ @staticmethod
545
+ def from_json_api(data: Dict):
546
+ if not data:
547
+ return None
548
+
549
+ return Beneficiary(FullName.from_json_api(data["fullName"]), data.get("dateOfBirth"))