unit-python-sdk 1.0.1__tar.gz → 1.1.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.
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/PKG-INFO +1 -1
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/setup.py +1 -1
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/application_resource.py +29 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/__init__.py +52 -0
- unit_python_sdk-1.1.0/unit/models/application.py +776 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/card.py +1 -1
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/utils/configuration.py +1 -1
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit_python_sdk.egg-info/PKG-INFO +1 -1
- unit_python_sdk-1.0.1/unit/models/application.py +0 -385
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/LICENSE +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/README.md +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/setup.cfg +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/__init__.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/__init__.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/account_end_of_day_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/account_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/api_token_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/applicationForm_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/atmLocation_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/authorization_request_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/authorization_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/base_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/batch_release_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/card_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/checkDeposit_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/check_payment_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/counterparty_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/customerToken_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/customer_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/dispute_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/event_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/fee_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/institution_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/payment_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/received_payment_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/recurring_payment_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/repayment_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/returnAch_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/reward_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/statement_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/tax_form_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/transaction_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/api/webhook_resource.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/account.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/account_end_of_day.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/api_token.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/applicationForm.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/atm_location.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/authorization.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/authorization_request.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/batch_release.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/benificial_owner.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/check_deposit.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/check_payment.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/codecs.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/counterparty.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/customer.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/customerToken.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/dispute.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/event.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/fee.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/institution.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/payment.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/received_payment.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/repayment.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/returnAch.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/reward.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/statement.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/tax_form.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/transaction.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/models/webhook.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/utils/__init__.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit/utils/date_utils.py +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit_python_sdk.egg-info/SOURCES.txt +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit_python_sdk.egg-info/dependency_links.txt +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.0}/unit_python_sdk.egg-info/requires.txt +0 -0
- {unit_python_sdk-1.0.1 → unit_python_sdk-1.1.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: 1.0
|
|
3
|
+
Version: 1.1.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="1.0
|
|
6
|
+
version="1.1.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',
|
|
@@ -19,6 +19,17 @@ class ApplicationResource(BaseResource):
|
|
|
19
19
|
else:
|
|
20
20
|
return UnitError.from_json_api(response.json())
|
|
21
21
|
|
|
22
|
+
def create_thread_application(self, request: CreateThreadApplicationRequest) -> Union[UnitResponse[ThreadApplicationDTO], UnitError]:
|
|
23
|
+
payload = request.to_json_api()
|
|
24
|
+
response = super().post_create(self.resource, payload)
|
|
25
|
+
|
|
26
|
+
if super().is_20x(response.status_code):
|
|
27
|
+
data = response.json().get("data")
|
|
28
|
+
included = response.json().get("included")
|
|
29
|
+
return UnitResponse[ThreadApplicationDTO](DtoDecoder.decode(data), DtoDecoder.decode(included))
|
|
30
|
+
else:
|
|
31
|
+
return UnitError.from_json_api(response.json())
|
|
32
|
+
|
|
22
33
|
def list(self, params: ListApplicationParams = None) -> Union[UnitResponse[List[ApplicationDTO]], UnitError]:
|
|
23
34
|
params = params or ListApplicationParams()
|
|
24
35
|
response = super().get(self.resource, params.to_dict())
|
|
@@ -68,6 +79,15 @@ class ApplicationResource(BaseResource):
|
|
|
68
79
|
else:
|
|
69
80
|
return UnitError.from_json_api(response.json())
|
|
70
81
|
|
|
82
|
+
def update_thread_application(self, request: UnionPatchThreadApplicationRequest) -> Union[UnitResponse[ThreadApplicationDTO], UnitError]:
|
|
83
|
+
payload = request.to_json_api()
|
|
84
|
+
response = super().patch(f"{self.resource}/{request.application_id}", payload)
|
|
85
|
+
if super().is_20x(response.status_code):
|
|
86
|
+
data = response.json().get("data")
|
|
87
|
+
return UnitResponse[ThreadApplicationDTO](DtoDecoder.decode(data), None)
|
|
88
|
+
else:
|
|
89
|
+
return UnitError.from_json_api(response.json())
|
|
90
|
+
|
|
71
91
|
def update_business_beneficial_owner(self, request: PatchBusinessBeneficialOwnerRequest) -> Union[UnitResponse[BeneficialOwnerDTO], UnitError]:
|
|
72
92
|
payload = request.to_json_api()
|
|
73
93
|
response = super().patch(f"beneficial-owner/{request.beneficial_owner_id}", payload)
|
|
@@ -77,6 +97,15 @@ class ApplicationResource(BaseResource):
|
|
|
77
97
|
else:
|
|
78
98
|
return UnitError.from_json_api(response.json())
|
|
79
99
|
|
|
100
|
+
def update_thread_business_beneficial_owner(self, request: PatchThreadBusinessBeneficialOwnerRequest) -> Union[UnitResponse[ThreadBeneficialOwnerDTO], UnitError]:
|
|
101
|
+
payload = request.to_json_api()
|
|
102
|
+
response = super().patch(f"beneficial-owner/{request.beneficial_owner_id}", payload)
|
|
103
|
+
if super().is_20x(response.status_code):
|
|
104
|
+
data = response.json().get("data")
|
|
105
|
+
return UnitResponse[ThreadBeneficialOwnerDTO](DtoDecoder.decode(data), None)
|
|
106
|
+
else:
|
|
107
|
+
return UnitError.from_json_api(response.json())
|
|
108
|
+
|
|
80
109
|
def cancel(self, request: CancelApplicationRequest) -> Union[UnitResponse[ApplicationDTO], UnitError]:
|
|
81
110
|
payload = request.to_json_api()
|
|
82
111
|
response = super().post(f"{self.resource}/{request.application_id}/cancel", payload)
|
|
@@ -344,6 +344,58 @@ class BeneficialOwnerDTO(UnitDTO):
|
|
|
344
344
|
return BeneficialOwnerDTO(_id, _type, BeneficialOwner.from_json_api(attributes), relationships)
|
|
345
345
|
|
|
346
346
|
|
|
347
|
+
class ThreadBeneficialOwner(UnitDTO):
|
|
348
|
+
def __init__(self, status: Optional[Status], full_name: FullName, ssn: Optional[str],
|
|
349
|
+
passport: Optional[str], nationality: Optional[str], date_of_birth: date,
|
|
350
|
+
address: Address, phone: Phone, email: str):
|
|
351
|
+
self.status = status
|
|
352
|
+
self.full_name = full_name
|
|
353
|
+
self.ssn = ssn
|
|
354
|
+
self.passport = passport
|
|
355
|
+
self.nationality = nationality
|
|
356
|
+
self.date_of_birth = date_of_birth
|
|
357
|
+
self.address = address
|
|
358
|
+
self.phone = phone
|
|
359
|
+
self.email = email
|
|
360
|
+
|
|
361
|
+
@staticmethod
|
|
362
|
+
def create(data: Dict):
|
|
363
|
+
return ThreadBeneficialOwner(
|
|
364
|
+
data.get("status"),
|
|
365
|
+
FullName.from_json_api(data.get("fullName")),
|
|
366
|
+
data.get("ssn"),
|
|
367
|
+
data.get("passport"),
|
|
368
|
+
data.get("nationality"),
|
|
369
|
+
data.get("dateOfBirth"),
|
|
370
|
+
Address.from_json_api(data.get("address")),
|
|
371
|
+
Phone.from_json_api(data.get("phone")),
|
|
372
|
+
data.get("email"))
|
|
373
|
+
|
|
374
|
+
@staticmethod
|
|
375
|
+
def from_json_api(l: Union[List, Dict]):
|
|
376
|
+
if l is None:
|
|
377
|
+
return None
|
|
378
|
+
if isinstance(l, list):
|
|
379
|
+
beneficial_owners = []
|
|
380
|
+
for data in l:
|
|
381
|
+
beneficial_owners.append(ThreadBeneficialOwner.create(data))
|
|
382
|
+
return beneficial_owners
|
|
383
|
+
else:
|
|
384
|
+
return ThreadBeneficialOwner.create(l)
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
class ThreadBeneficialOwnerDTO(UnitDTO):
|
|
388
|
+
def __init__(self, _id: str, _type: str, attributes: ThreadBeneficialOwner, relationships: Dict[str, Relationship]):
|
|
389
|
+
self.id = _id
|
|
390
|
+
self.type = _type
|
|
391
|
+
self.attributes = attributes
|
|
392
|
+
self.relationships = relationships
|
|
393
|
+
|
|
394
|
+
@staticmethod
|
|
395
|
+
def from_json_api(_id, _type, attributes, relationships):
|
|
396
|
+
return ThreadBeneficialOwnerDTO(_id, _type, ThreadBeneficialOwner.from_json_api(attributes), relationships)
|
|
397
|
+
|
|
398
|
+
|
|
347
399
|
class AuthorizedUser(UnitDTO):
|
|
348
400
|
def __init__(self, full_name: FullName, email: str, phone: Phone, jwt_subject: Optional[str]):
|
|
349
401
|
self.full_name = full_name
|