diff --git a/package.json b/package.json index 174ea64..8402f7e 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "bundle": "redocly bundle openapi.json -o dist/bundledSchema.json", "generate-java": "rm -rf ./dist/java-sdk && npm run bundle && npx mkdirp dist/java-sdk/src/test/java/unit/java/sdk && cp -a ./unit/e2e_tests/java/. ./dist/java-sdk/src/test/java/unit/java/sdk && openapi-generator-cli generate -g java -i ./dist/bundledSchema.json -o ./dist/java-sdk -p hideGenerationTimestamp=true -p packageName=unit.java.sdk -p modelPackage=unit.java.sdk.model -p apiPackage=unit.java.sdk.api --library native -p useJakartaEe=true --openapi-normalizer REFACTOR_ALLOF_WITH_PROPERTIES_ONLY=true", "generate-ruby": "rm -rf ./dist/ruby-sdk && npm run bundle && cp -r unit ./dist/ruby-sdk && openapi-generator-cli generate -g ruby -i ./dist/bundledSchema.json -o ./dist/ruby-sdk", + "generate-python": "rm -rf dist/pythonsdk && npm run bundle && cp -r unit dist/pythonsdk && openapi-generator-cli generate -g python -i ./dist/bundledSchema.json -o dist/pythonsdk", "generate-node": "rm -rf ./dist/node-sdk && npm run bundle && openapi-generator-cli generate -g typescript-axios -i ./dist/bundledSchema.json -o ./dist/node-sdk", "lint": "redocly lint --config .redocly.yaml openapi.json", "format": "prettier ./schemas --write" diff --git a/unit/e2e_tests/python/account_test.py b/unit/e2e_tests/python/account_test.py index 4f4b487..73b8ef4 100644 --- a/unit/e2e_tests/python/account_test.py +++ b/unit/e2e_tests/python/account_test.py @@ -3,10 +3,9 @@ from helpers.helpers import create_api_client, create_individual_application_request, \ create_business_application_request -from swagger_client import CreateApplicationApi, CreateAnAccountApi, \ - CreateDepositAccountAttributes, CreateDepositAccountRelationships, CreateDepositAccount, GetListAccountsApi, \ - GetAccountApi, CloseAnAccountApi, ReopenAnAccountApi, FreezeAnAccountApi, UnfreezeAccountApi, \ - CreateCreditAccountAttributes, CreateCreditAccount +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import CreateDepositAccountAttributes, CreateDepositAccountRelationships, CreateCreditAccountAttributes, \ + CreateCreditAccount, CreateDepositAccount class TestAccountApi(unittest.TestCase): @@ -20,11 +19,16 @@ def tearDown(self): pass def create_individual_customer(self): - app = CreateApplicationApi(self.api_client).execute(create_individual_application_request()).data + # Ensure that create_individual_application_request() returns the correct type + application_request = create_individual_application_request() + + # Pass the application_request directly to create_application + app = UnitApi.create_application(self.api_client).execute(application_request).data + return app.relationships.customer.data.id def create_business_customer(self): - app = CreateApplicationApi(self.api_client).execute(create_business_application_request()).data + app = UnitApi.create_application(self.api_client).execute(create_business_application_request()).data return app.relationships.customer.data.id def create_deposit_account(self): @@ -35,7 +39,7 @@ def create_deposit_account(self): "id": customer_id}}) req = CreateDepositAccount("depositAccount", attributes, relationships) - response = CreateAnAccountApi(self.api_client).execute({"data": req}) + response = UnitApi.create_account(self.api_client).execute({"data": req}) return response.data def create_credit_account_for_business(self): @@ -45,7 +49,7 @@ def create_credit_account_for_business(self): "id": customer_id}}) req = CreateCreditAccount("creditAccount", attributes, relationships) - response = CreateAnAccountApi(self.api_client).execute({"data": req}) + response = UnitApi.create_account(self.api_client).execute({"data": req}) return response.data @@ -61,7 +65,7 @@ def create_deposit_account_for_business(self): "id": customer_id}}) req = CreateDepositAccount("depositAccount", attributes, relationships) - response = CreateAnAccountApi(self.api_client).execute({"data": req}) + response = UnitApi.create_account(self.api_client).execute({"data": req}) return response.data def test_create_deposit_account(self): @@ -75,22 +79,22 @@ def test_create_business_deposit_account(self): assert account.type == "depositAccount" def test_list_accounts(self): - res = GetListAccountsApi(self.api_client).execute() #no unit response type + res = UnitApi.get_accounts_list(self.api_client).execute() #no unit response type for acc in res.data: assert acc.type == "depositAccount" def test_list_accounts(self): - res = GetListAccountsApi(self.api_client).execute() #no unit response type + res = UnitApi.get_accounts_list(self.api_client).execute() #no unit response type for acc in res.data: assert acc.type == "depositAccount" - response_account = GetAccountApi(self.api_client).execute(acc.id).data + response_account = UnitApi.get_account(self.api_client).execute(acc.id).data assert acc.type == response_account.type assert acc.id == response_account.id def close_account(self, close_reason="Fraud"): account_id = self.create_deposit_account().id - account = CloseAnAccountApi(self.api_client).execute({"data": { + account = UnitApi.close_account(self.api_client).execute({"data": { "type": "depositAccountClose", "attributes": { "reason": close_reason @@ -111,7 +115,7 @@ def test_reopen_account(self): account = self.close_account("ByCustomer") assert account.type == "depositAccount" - reopen_account = ReopenAnAccountApi(self.api_client).execute(account.id).data + reopen_account = UnitApi.reopen_account(self.api_client).execute(account.id).data assert reopen_account.id == account.id assert reopen_account.type == "depositAccount" assert reopen_account.attributes.status == "Open" @@ -121,7 +125,7 @@ def freeze_account(self): freeze_reason_text = "This is a test - SDK" - account = FreezeAnAccountApi(self.api_client).execute({"data": { + account = UnitApi.freeze_account(self.api_client).execute({"data": { "type": "accountFreeze", "attributes": { "reason": "Other", @@ -143,7 +147,7 @@ def test_unfreeze_account(self): account = self.freeze_account() assert account.type == "depositAccount" - reopen_account = UnfreezeAccountApi(self.api_client).execute(account.id).data + reopen_account = UnitApi.unfreeze_account(self.api_client).execute(account.id).data assert reopen_account.id == account.id assert reopen_account.type == "depositAccount" assert reopen_account.attributes.status == "Open" diff --git a/unit/e2e_tests/python/application_form_test.py b/unit/e2e_tests/python/application_form_test.py index 234aaa3..9cb28e6 100644 --- a/unit/e2e_tests/python/application_form_test.py +++ b/unit/e2e_tests/python/application_form_test.py @@ -1,20 +1,19 @@ import unittest -from e2e_tests.python.helpers.helpers import create_api_client -from swagger_client import GetListApplicationFormsApi - +from helpers.helpers import create_api_client +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi class TestApplicationFormApi(unittest.TestCase): """ApplicationFormApi unit test stubs""" def setUp(self): self.api_client = create_api_client() + self.unit_api = UnitApi(self.api_client) # Instantiate UnitApi with ApiClient def tearDown(self): pass def test_get_list_application_forms(self): - response = GetListApplicationFormsApi(self.api_client).execute() + response = self.unit_api.get_application_forms_list().execute() for w in response.data: assert w.type == "applicationForm" - diff --git a/unit/e2e_tests/python/application_test.py b/unit/e2e_tests/python/application_test.py index 25cef21..8d8c850 100644 --- a/unit/e2e_tests/python/application_test.py +++ b/unit/e2e_tests/python/application_test.py @@ -3,13 +3,12 @@ import base64 import unittest -from e2e_tests.python.helpers.helpers import create_api_client, create_individual_application_request,\ +from helpers.helpers import create_api_client, create_individual_application_request,\ create_business_application_request -from swagger_client import GetListApplicationsApi, CreateApplicationApi, CreateSoleProprietorApplication, \ - CreateSoleProprietorApplicationAttributes, Address, FullName, Phone, \ - CreateTrustApplication, CreateTrustApplicationAttributes, Grantor, Trustee, Beneficiary, TrustContact, \ - UploadAPNGDocumentForAnApplicationApi, UploadAJPEGDocumentForAnApplicationApi, UploadAPDFDocumentForAnApplicationApi -from swagger_client.api.get_application_api import GetApplicationApi # noqa: E501 +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import CreateDepositAccountAttributes, CreateDepositAccountRelationships, CreateCreditAccountAttributes, \ + CreateCreditAccount, CreateDepositAccount, Address, Phone, FullName, CreateSoleProprietorApplicationAttributes, \ + CreateSoleProprietorApplication ApplicationTypes = ["individualApplication", "businessApplication", "trustApplication"] @@ -24,12 +23,12 @@ def tearDown(self): pass def create_individual_application(self, ssn="721074426"): - app = CreateApplicationApi(self.api_client).execute(create_individual_application_request(ssn)) + app = UnitApi.create_application(self.api_client).execute(create_individual_application_request(ssn)) return app.data def create_individual_application_with_included(self, ssn="721074426"): - app = CreateApplicationApi(self.api_client).execute(create_individual_application_request(ssn)) + app = UnitApi.create_application(self.api_client).execute(create_individual_application_request(ssn)) return app @@ -39,7 +38,7 @@ def test_create_individual_application(self): assert res.type == "individualApplication" def test_find_application_by_id(self): - get_application_api = GetApplicationApi(self.api_client) + get_application_api = UnitApi.get_application(self.api_client) app = self.create_individual_application() res = get_application_api.execute(app.id).data @@ -48,7 +47,7 @@ def test_find_application_by_id(self): assert res.id == app.id def create_business_application(self): - app = CreateApplicationApi(self.api_client).execute(create_business_application_request()) + app = UnitApi.create_application(self.api_client).execute(create_business_application_request()) return app.data @@ -57,13 +56,13 @@ def test_create_business_application(self): assert response.type == "businessApplication" def test_list_applications(self): - res = GetListApplicationsApi(self.api_client).execute() + res = UnitApi.get_applications_list(self.api_client).execute() for app in res.data: assert app.type in ApplicationTypes def test_list_and_get_applications(self): - res = GetListApplicationsApi(self.api_client).execute() - get_application_api = GetApplicationApi(self.api_client) + res = UnitApi.get_applications_list(self.api_client).execute() + get_application_api = UnitApi.get_application(self.api_client) for app in res.data: assert app.type in ApplicationTypes @@ -79,7 +78,7 @@ def test_upload_png_document(self): image_file = open("unit_photo.png", 'rb').read() - res = UploadAPNGDocumentForAnApplicationApi(self.api_client).execute(image_file.decode('latin-1'), application_id, document_id) + res = UnitApi.upload_application_document_file(self.api_client).execute(image_file.decode('latin-1'), application_id, document_id) assert res.data.type == "document" def test_upload_jpg_document(self): @@ -90,7 +89,7 @@ def test_upload_jpg_document(self): image_file = open("Unit_Logo.jpg", "r", encoding='latin-1').read() - res = UploadAJPEGDocumentForAnApplicationApi(self.api_client).execute(str(image_file), application_id, document_id) + res = UnitApi.upload_application_document_file(self.api_client).execute(str(image_file), application_id, document_id) assert res.data.type == "document" def test_upload_pdf_document(self): @@ -101,70 +100,8 @@ def test_upload_pdf_document(self): image_file = open("sample.pdf", "r").read() - res = UploadAPDFDocumentForAnApplicationApi(self.api_client).execute(str(image_file), application_id, document_id) + res = UnitApi.upload_application_document_file(self.api_client).execute(str(image_file), application_id, document_id) assert res.data.type == "document" - def test_create_sole_proprietor_application(self): - address = Address(street="1600 Pennsylvania Avenue Northwest", city="Washington", state="CA", - postal_code="20500", - country="US") - attr = CreateSoleProprietorApplicationAttributes(FullName("Peter", "Parker"), "jone.doe1@unit-finance.com", - Phone("1", "2025550108"), "721074426", - address=address, date_of_birth="2001-08-10", - dba="Piedpiper Inc", ein="123456789", - annual_income="Between50kAnd100k", - source_of_income="EmploymentOrPayrollIncome", - annual_revenue="Between100kAnd200k", - sole_proprietorship=True, - number_of_employees="Between5And10", - business_vertical="TechnologyMediaOrTelecom", - jwt_subject="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9fQ") - - req = {"data": CreateSoleProprietorApplication(attributes=attr)} - - app = CreateApplicationApi(self.api_client).execute(req) - - assert app.data.type == "individualApplication" - - def test_create_trust_application(self): - address = Address(street="1600 Pennsylvania Avenue Northwest", city="Washington", state="CA", - postal_code="20500", - country="US") - full_name = FullName("Richard", "Hendricks") - - attr = CreateTrustApplicationAttributes("Trust me Inc.", "CA", "Revocable", "Salary", "123456789", - Grantor(full_name, "richard@piedpiper.com", - Phone("1", "2025550108"), "000000002", - date_of_birth="2000-01-01", address=address), - [Trustee(full_name, "richard@piedpiper.com", address=address, - date_of_birth="2000-01-01", ssn="000000002", - phone=Phone("1", "2025550108"))], - [Beneficiary(FullName("Dinesh","Chugtai"), "2000-01-01"), - Beneficiary(FullName("Gilfoyle","Unknown"), "2000-01-01")], - TrustContact(FullName("Jared","Dann"), "jared@piedpiper.com", - Phone("1", "2025550108"), - address=Address("5230 Newell Rd", "", "Palo Alto", "CA", - "94303"))) - - req = {"data": CreateTrustApplication(attributes=attr)} - - app = CreateApplicationApi(self.api_client).execute(req) - - assert app.data.type == "trustApplication" - - if __name__ == '__main__': - unittest.main() - - # def test_update_individual_application(): - # app = create_individual_application() - # updated = client.applications.update(PatchApplicationRequest(app.data.id, tags={"patch": "test-patch"})) - # assert updated.data.type == "individualApplication" - # - # def test_update_business_application(): - # app = create_business_application() - # updated = client.applications.update(PatchApplicationRequest(app.data.id, "businessApplication", - # tags={"patch": "test-patch"})) - # assert updated.data.type == "businessApplication" - diff --git a/unit/e2e_tests/python/authorization_request_test.py b/unit/e2e_tests/python/authorization_request_test.py index 5777dda..cc7952b 100644 --- a/unit/e2e_tests/python/authorization_request_test.py +++ b/unit/e2e_tests/python/authorization_request_test.py @@ -2,8 +2,8 @@ import unittest -from e2e_tests.python.helpers.helpers import create_api_client -from swagger_client import GetAuthorizationRequestApi, GetListAuthorizationRequestsApi +from helpers.helpers import create_api_client +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi class TestAuthorizationRequestsApi(unittest.TestCase): @@ -16,13 +16,13 @@ def tearDown(self): pass def test_list_authorization_requests(self): - res = GetListAuthorizationRequestsApi(self.api_client).execute() + res = UnitApi.get_authorizations_list(self.api_client).execute() for app in res.data: assert "AuthorizationRequest" in app.type def test_list_and_get_authorization_requests(self): - res = GetListAuthorizationRequestsApi(self.api_client).execute() - get_application_request_api = GetAuthorizationRequestApi(self.api_client) + res = UnitApi.get_authorizations_list(self.api_client).execute() + get_application_request_api = UnitApi.get_authorization_request(self.api_client) for app in res.data: assert "AuthorizationRequest" in app.type diff --git a/unit/e2e_tests/python/card_test.py b/unit/e2e_tests/python/card_test.py index 2944a8f..93b75f6 100644 --- a/unit/e2e_tests/python/card_test.py +++ b/unit/e2e_tests/python/card_test.py @@ -1,9 +1,16 @@ import os import unittest -from e2e_tests.python.helpers.helpers import * -from swagger_client import * - +from helpers.helpers import create_api_client, create_individual_application_request, \ + create_business_application_request, create_address +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import Address, CardLevelLimits, \ + CreateCardRelationships, Relationship, RelationshipData, CreateDepositAccountAttributes, \ + CreateDepositAccountRelationships, CreateDepositAccount, CreateIndividualDebitCardRequestAttributes, \ +CreateIndividualDebitCardRequest, CreateBusinessDebitCardRequestAttributes, \ +CreateBusinessDebitCardRequest, FullName, Phone, CreateBusinessVirtualDebitCardRequestAttributes,\ +CreateBusinessVirtualDebitCardRequest, CreateIndividualVirtualDebitCardRequestAttributes, CreateIndividualVirtualDebitCardRequest, \ + UpdateIndividualDebitCardAttributes, UpdateIndividualDebitCard card_types = ["individualDebitCard", "businessDebitCard", "individualVirtualDebitCard", "businessVirtualDebitCard", "businessCreditCard", "businessVirtualCreditCard"] @@ -11,7 +18,7 @@ headers = { "content-type": "application/vnd.api+json", "authorization": f"Bearer {os.environ.get('TOKEN')}", - "user-agent": "unit-python-sdk" + "user-agent": "unit-pythonsdk" } address = Address("5230 Newell Rd", city="Palo Alto", state="CA", postal_code="94303") @@ -32,7 +39,7 @@ def create_card_relationships(self, account_id: str, _type="depositAccount"): def card_list(self): - return GetListOfCardsApi(self.api_client).execute().data + return UnitApi.get_cards_list(self.api_client).execute().data def test_card_list(self): res = self.card_list() @@ -40,36 +47,36 @@ def test_card_list(self): assert card.type in card_types def test_card_list_and_get(self): - res = GetListOfCardsApi(self.api_client).execute() + res = UnitApi.get_cards_list(self.api_client).execute() assert res.included is None for card in res.data: assert card.type in card_types - response_card = GetCardApi(self.api_client).execute(card.id).data + response_card = UnitApi.get_card(self.api_client).execute(card.id).data assert card.id == response_card.id assert card.type == response_card.type def test_card_list_with_filters(self): - res = GetListOfCardsApi(self.api_client).execute(filter_status=["Active"], include="customer") + res = UnitApi.get_cards_list(self.api_client).execute(filter_status=["Active"], include="customer") assert res.included is not None for card in res.data: assert card.type in card_types assert card.attributes.status == "Active" - response_card = GetCardApi(self.api_client).execute(card.id).data + response_card = UnitApi.get_card(self.api_client).execute(card.id).data assert card.id == response_card.id assert card.type == response_card.type assert card.attributes.status == response_card.attributes.status assert card.attributes.created_at == response_card.attributes.created_at def create_individual_customer(self): - app = CreateApplicationApi(self.api_client).execute(create_individual_application_request()).data + app = UnitApi.create_application(self.api_client).execute(create_individual_application_request()).data return app.relationships.customer.data.id def create_business_customer(self): - app = CreateApplicationApi(self.api_client).execute(create_business_application_request()).data + app = UnitApi.create_application(self.api_client).execute(create_business_application_request()).data return app.relationships.customer.data.id def create_deposit_account(self): @@ -80,7 +87,7 @@ def create_deposit_account(self): "id": customer_id}}) req = CreateDepositAccount(attributes=attributes, relationships=relationships) - response = CreateAnAccountApi(self.api_client).execute({"data": req}) + response = UnitApi.create_account(self.api_client).execute({"data": req}) return response.data def create_deposit_account_for_business(self): @@ -91,15 +98,15 @@ def create_deposit_account_for_business(self): "id": customer_id}}) req = CreateDepositAccount(attributes=attributes, relationships=relationships) - response = CreateAnAccountApi(self.api_client).execute({"data": req}) + response = UnitApi.create_account(self.api_client).execute({"data": req}) return response.data def create_individual_debit_card(self): account_id = self.create_deposit_account().id - attributes = CreateIndividualDebitCardAttributes(address, limits=limits) - req = CreateIndividualDebitCard(attributes=attributes, relationships=self.create_card_relationships(account_id)) + attributes = CreateIndividualDebitCardRequestAttributes(address, limits=limits) + req = CreateIndividualDebitCardRequest(attributes=attributes, relationships=self.create_card_relationships(account_id)) - card = CreateACardApi(self.api_client).execute({"data": req}).data + card = UnitApi.create_card(self.api_client).execute({"data": req}).data return card def test_create_individual_debit_card(self): @@ -109,12 +116,12 @@ def test_create_individual_debit_card(self): def create_business_debit_card(self): account_id = self.create_deposit_account_for_business().id - attributes = CreateBusinessDebitCardAttributes(address, address, FullName("Richard", "Hendricks"), - Phone("1", "5555555555"), "richard@piedpiper.com", "2001-08-10", + attributes = CreateBusinessDebitCardRequestAttributes(address, address, FullName(first="Richard", last="Hendricks"), + Phone(country_code="1", number="5555555555"), "richard@piedpiper.com", "2001-08-10", limits=limits) - req = CreateBusinessDebitCard(attributes=attributes, relationships=self.create_card_relationships(account_id)) + req = CreateBusinessDebitCardRequest(attributes=attributes, relationships=self.create_card_relationships(account_id)) - card = CreateACardApi(self.api_client).execute({"data": req}).data + card = UnitApi.create_card(self.api_client).execute({"data": req}).data return card def test_create_business_debit_card(self): @@ -124,12 +131,12 @@ def test_create_business_debit_card(self): def create_business_virtual_debit_card(self): account_id = self.create_deposit_account_for_business().id - attributes = CreateBusinessVirtualDebitCardAttributes(address, FullName("Richard", "Hendricks"), + attributes = CreateBusinessVirtualDebitCardRequestAttributes(address, FullName("Richard", "Hendricks"), Phone("1", "5555555555"), "richard@piedpiper.com", "2001-08-10", limits=limits) - req = CreateBusinessVirtualDebitCard(attributes=attributes, relationships=self.create_card_relationships(account_id)) + req = CreateBusinessVirtualDebitCardRequest(attributes=attributes, relationships=self.create_card_relationships(account_id)) - card = CreateACardApi(self.api_client).execute({"data": req}).data + card = UnitApi.create_card(self.api_client).execute({"data": req}).data return card def test_create_business_virtual_debit_card(self): @@ -139,11 +146,11 @@ def test_create_business_virtual_debit_card(self): def create_individual_virtual_debit_card(self): account_id = self.create_deposit_account().id - attributes = CreateIndividualVirtualDebitCardAttributes(limits=limits) - req = CreateIndividualVirtualDebitCard(attributes=attributes, + attributes = CreateIndividualVirtualDebitCardRequestAttributes(limits=limits) + req = CreateIndividualVirtualDebitCardRequest(attributes=attributes, relationships=self.create_card_relationships(account_id)) - card = CreateACardApi(self.api_client).execute({"data": req}).data + card = UnitApi.create_card(self.api_client).execute({"data": req}).data return card def test_create_individual_virtual_debit_card(self): @@ -153,14 +160,14 @@ def test_create_individual_virtual_debit_card(self): def test_freeze_and_unfreeze_card(self): card = self.create_individual_debit_card() assert card.type == "individualDebitCard" - response = FreezeACardApi(self.api_client).execute(card.id).data + response = UnitApi.freeze_card(self.api_client).execute(card.id).data assert response.attributes.status == "Frozen" - response = UnfreezeACardApi(self.api_client).execute(card.id).data + response = UnitApi.unfreeze_card(self.api_client).execute(card.id).data assert response.attributes.status != "Frozen" def test_close_card(self): card = self.create_individual_debit_card() - response = CloseACardApi(self.api_client).execute(card.id).data + response = UnitApi.close_card(self.api_client).execute(card.id).data assert response.attributes.status == "ClosedByCustomer" # def test_replace_card(self): @@ -172,15 +179,15 @@ def test_close_card(self): def test_get_debit_card(self): card = self.create_individual_debit_card() - response = GetCardApi(self.api_client).execute(card.id) + response = UnitApi.get_card(self.api_client).execute(card.id) assert response.data.type in card_types def test_update_individual_card(self): card = self.create_individual_debit_card() _address = create_address("1818 Pennsylvania Avenue Northwest", "Washington", "CA", "21500", "US") - _attributes = PatchIndividualDebitCardAttributes(shipping_address=_address, tags={"test": "updated"}) - request = PatchIndividualDebitCard(type="individualDebitCard",attributes=_attributes) - response = UpdateCardApi(self.api_client).execute(card_id=card.id,body={"data": request}) + _attributes = UpdateIndividualDebitCardAttributes(shipping_address=_address, tags={"test": "updated"}) + request = UpdateIndividualDebitCard(type="individualDebitCard",attributes=_attributes) + response = UnitApi.update_card(self.api_client).execute(card_id=card.id,body={"data": request}) assert response.data.type == "individualDebitCard" def test_get_pin_status(self): @@ -191,7 +198,7 @@ def test_get_pin_status(self): if card_status == "active": card_id = card.id if card_id: - pin_status = GetCardPINStatusApi(self.api_client).execute(card_id=card_id) + pin_status = UnitApi.get_card_pin_status(self.api_client).execute(card_id=card_id) assert pin_status.type == "pinStatus" diff --git a/unit/e2e_tests/python/customer_test.py b/unit/e2e_tests/python/customer_test.py index 70d965f..841262d 100644 --- a/unit/e2e_tests/python/customer_test.py +++ b/unit/e2e_tests/python/customer_test.py @@ -1,7 +1,8 @@ import os import unittest -from e2e_tests.python.helpers.helpers import * -from swagger_client import * +from helpers.helpers import * +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import * CustomerTypes = ["individualCustomer", "businessCustomer"] @@ -30,12 +31,12 @@ def tearDown(self): pass def list_customers(self): - return GetListCustomersApi(self.api_client).execute() + return UnitApi.get_customers_list(self.api_client).execute() def test_get_customer(self): customers = self.list_customers() for customer in customers.data: - GetCustomerApi(self.api_client).execute(customer.id) + UnitApi.get_customer(self.api_client).execute(customer.id) assert customer.type in CustomerTypes def test_list_customers(self): @@ -48,7 +49,7 @@ def get_customer(self, customer_type='individualCustomer'): for customer in customers.data: if customer.type == customer_type: - return GetCustomerApi(self.api_client).execute(customer.id) + return UnitApi.get_customer(self.api_client).execute(customer.id) return None @@ -57,7 +58,7 @@ def test_update_individual_customer(self): _attributes = UpdateIndividualCustomerAttributes(address=_address, tags={"test": "updated"}) request = UpdateIndividualCustomer(type="individualCustomer", attributes=_attributes) - response = UpdateCustomerApi(self.api_client).execute(customer_id=self.get_customer().data.id, body={"data": request}) + response = UnitApi.update_customer(self.api_client).execute(customer_id=self.get_customer().data.id, body={"data": request}) assert response.data.type == "individualCustomer" if __name__ == '__main__': diff --git a/unit/e2e_tests/python/helpers/helpers.py b/unit/e2e_tests/python/helpers/helpers.py index 641b0bc..a921563 100644 --- a/unit/e2e_tests/python/helpers/helpers.py +++ b/unit/e2e_tests/python/helpers/helpers.py @@ -2,7 +2,8 @@ import os from dotenv import load_dotenv from datetime import date, timedelta -from swagger_client import configuration, api_client, Address, CreateIndividualApplicationAttributes, FullName, Phone \ +from dist.pythonsdk.openapi_client import (configuration, api_client) +from dist.pythonsdk.openapi_client.models import Address, CreateIndividualApplicationAttributes, FullName, Phone \ , CreateIndividualApplication, CreateBusinessApplication, CreateBusinessApplicationAttributes, BeneficialOwner, \ Contact, Officer, CreateBeneficialOwner @@ -32,14 +33,18 @@ def create_individual_application_request(ssn="721074426"): address = Address(street="1600 Pennsylvania Avenue Northwest", city="Washington", state="CA", postal_code="20500", country="US") - attr = CreateIndividualApplicationAttributes(FullName("Peter", "Parker"), "jone.doe1@unit-finance.com", - Phone("1", "2025550108"), ssn, + attr = CreateIndividualApplicationAttributes(full_name = FullName(first="Peter", last="Parker"),email = "jone.doe1@unit-finance.com", + phone =Phone(country_code = "1", number = "2025550108"), ssn = ssn, address=address, date_of_birth="2001-08-10", idempotency_key=str(uuid.uuid1()), jwt_subject="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9fQ", occupation="ArchitectOrEngineer") - return {"data": CreateIndividualApplication(attributes=attr)} + individual_application = CreateIndividualApplication( + type='individualApplication', # This must exactly match the expected enum value + attributes=attr # This should be an instance of CreateIndividualApplicationAttributes + ) + return {"data": individual_application} def create_business_application_request(): diff --git a/unit/e2e_tests/python/payment_test.py b/unit/e2e_tests/python/payment_test.py index 8b9301b..969d172 100644 --- a/unit/e2e_tests/python/payment_test.py +++ b/unit/e2e_tests/python/payment_test.py @@ -1,12 +1,8 @@ import unittest -from e2e_tests.helpers import create_api_client, create_individual_application_request, create_relationship, \ - create_counterparty_dto, create_wire_counterparty_dto -from swagger_client import CreateBookPayment, CreateBookPaymentAttributes, \ - CreateBookPaymentRelationships, CreateDepositAccountAttributes, CreateDepositAccountRelationships, \ - CreateDepositAccount, CreateAnAccountApi, CreateAPaymentApi, CreateApplicationApi, CreateAchPayment, \ - CreateAchPaymentAttributes, CreateAchPaymentRelationships, Address, CreateWirePayment, CreateWirePaymentAttributes, \ - CreateAchPaymentPlaid, CreateAchPaymentPlaidAttributes +from helpers.helpers import * +from dist.pythonsdk.openapi_client.models import * +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi class TestPaymentApi(unittest.TestCase): @@ -19,7 +15,7 @@ def tearDown(self): pass def create_individual_customer(self): - app = CreateApplicationApi(self.api_client).create_application(create_individual_application_request()).data + app = UnitApi.create_application(self.api_client).create_application(create_individual_application_request()).data return app.relationships.customer.data.id def create_deposit_account(self): @@ -30,7 +26,7 @@ def create_deposit_account(self): "id": customer_id}}) req = CreateDepositAccount("depositAccount", attributes, relationships) - response = CreateAnAccountApi(self.api_client).create_account({"data": req}) + response = UnitApi.create_account(self.api_client).create_account({"data": req}) return response.data.id # def test_get_payments_list(self): @@ -55,7 +51,7 @@ def test_create_book_payment(self): relationships = CreateBookPaymentRelationships(create_relationship("depositAccount", id1), create_relationship("depositAccount", id2)) req = CreateBookPayment("bookPayment", attributes, relationships) - res = CreateAPaymentApi(self.api_client).execute({"data": req}) + res = UnitApi.create_payment(self.api_client).execute({"data": req}) assert res.data.type == "bookPayment" @@ -67,7 +63,7 @@ def test_create_inline_ach_payment(self): relationships = CreateAchPaymentRelationships(create_relationship("depositAccount", account_id)) req = CreateAchPayment("achPayment", attributes, relationships) - res = CreateAPaymentApi(self.api_client).execute({"data": req}) + res = UnitApi.create_payment(self.api_client).execute({"data": req}) assert res.data.type == "achPayment" @@ -82,7 +78,7 @@ def test_create_wire_payment(self): req = CreateWirePayment("wirePayment", attributes, relationships) - res = CreateAPaymentApi(self.api_client).execute({"data": req}) + res = UnitApi.create_payment(self.api_client).execute({"data": req}) assert res.data.type == "wirePayment" @@ -95,7 +91,7 @@ def test_create_verified_ach_payment(self): relationships = CreateAchPaymentRelationships(create_relationship("depositAccount", account_id)) req = CreateAchPaymentPlaid("achPayment", attributes, relationships) - res = CreateAPaymentApi(self.api_client).execute({"data": req}) + res = UnitApi.create_payment(self.api_client).execute({"data": req}) assert res.data.type == "achPayment" diff --git a/unit/e2e_tests/python/repayment_test.py b/unit/e2e_tests/python/repayment_test.py index c6ba7a3..fe5f7b7 100644 --- a/unit/e2e_tests/python/repayment_test.py +++ b/unit/e2e_tests/python/repayment_test.py @@ -2,13 +2,9 @@ import unittest -from e2e_tests.python.helpers.helpers import create_api_client -from swagger_client import GetListRepaymentsApi, GetRepaymentApi, CreateBookRepaymentRelationships, Relationship, \ - RelationshipData -from swagger_client.api import CreateARepaymentApi -from swagger_client.models.create_book_repayment import CreateBookRepayment -from swagger_client.models.create_book_repayment_attributes import CreateBookRepaymentAttributes -from swagger_client.models.repayments_body import RepaymentsBody +from helpers.helpers import * +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import * class TestRepaymentsApi(unittest.TestCase): @@ -21,13 +17,13 @@ def tearDown(self): pass def test_list_repayments(self): - res = GetListRepaymentsApi(self.api_client).execute() + res = UnitApi.get_repayments_list(self.api_client).execute() for app in res.data: assert "Repayment" in app.type def test_list_and_get_repayments(self): - res = GetListRepaymentsApi(self.api_client).execute() - get_repayment_api = GetRepaymentApi(self.api_client) + res = UnitApi.get_repayments_list(self.api_client).execute() + get_repayment_api = UnitApi.get_repayment(self.api_client) for app in res.data: assert "Repayment" in app.type @@ -42,8 +38,8 @@ def test_create_book_repayment(self): Relationship(RelationshipData("1538445", "creditAccount")), Relationship(RelationshipData("447232", "account"))) data = CreateBookRepayment(attributes=attr, relationships=relationships) - body = RepaymentsBody(data) - res = CreateARepaymentApi(self.api_client).execute(body) + # body = RepaymentsBody(data) + res = UnitApi.create_repayment(self.api_client).execute(data) assert res.data.type == "bookRepayment" diff --git a/unit/e2e_tests/python/statement_test.py b/unit/e2e_tests/python/statement_test.py index 96086e4..06890fa 100644 --- a/unit/e2e_tests/python/statement_test.py +++ b/unit/e2e_tests/python/statement_test.py @@ -1,8 +1,8 @@ import unittest -from e2e_tests.python.helpers.helpers import create_api_client -from swagger_client import GetListStatementsApi, GetStatementPDFApi, GetStatementHTMLApi - +from helpers.helpers import * +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import * class TestStatementApi(unittest.TestCase): """StatementAPI unit test stubs""" @@ -14,18 +14,18 @@ def tearDown(self): pass def test_list_and_get_statements(self): - statements = GetListStatementsApi(self.api_client).execute().data + statements = UnitApi.get_statements_list(self.api_client).execute().data for s in statements: assert s.type == "accountStatementDTO" - pdf_statement = GetStatementPDFApi(self.api_client).execute(s.id) + pdf_statement = UnitApi.get_statement_pdf(self.api_client).execute(s.id) assert "PDF" in pdf_statement # account_id = s.relationships["account"].id # pdf_response = client.statements.get_bank_verification(account_id).data - html_statement = GetStatementHTMLApi(self.api_client).execute(s.id) + html_statement = UnitApi.get_statement_html(self.api_client).execute(s.id) assert "" in html_statement if __name__ == '__main__': diff --git a/unit/e2e_tests/python/transaction_test.py b/unit/e2e_tests/python/transaction_test.py index 2554d95..f36f484 100644 --- a/unit/e2e_tests/python/transaction_test.py +++ b/unit/e2e_tests/python/transaction_test.py @@ -1,8 +1,8 @@ import unittest -from e2e_tests.python.helpers.helpers import create_api_client -from swagger_client import GetListTransactionsApi - +from helpers.helpers import * +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import * class TestTransactionApi(unittest.TestCase): """TransactionApi unit test stubs""" @@ -14,7 +14,7 @@ def tearDown(self): pass def test_get_list_transactions(self): - response = GetListTransactionsApi(self.api_client).execute() + response = UnitApi.get_transactions_list(self.api_client).execute() for t in response.data: assert "Transaction" in t.type # res = GetPaymentApi(self.api_client).execute(p.id).data diff --git a/unit/e2e_tests/python/webhook_test.py b/unit/e2e_tests/python/webhook_test.py index ec4270d..25c4b20 100644 --- a/unit/e2e_tests/python/webhook_test.py +++ b/unit/e2e_tests/python/webhook_test.py @@ -1,9 +1,8 @@ import unittest -from e2e_tests.python.helpers.helpers import create_api_client -from swagger_client import GetListWebhooksApi, CreateWebhookApi -from swagger_client.models.webhooks_data import WebhooksData -from swagger_client.models.webhooks_data_attributes import WebhooksDataAttributes +from helpers.helpers import * +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import * class TestWebhookApi(unittest.TestCase): @@ -16,15 +15,15 @@ def tearDown(self): pass def test_get_list_webhooks(self): - response = GetListWebhooksApi(self.api_client).execute() + response = UnitApi.get_webhooks_list(self.api_client).execute() for w in response.data: assert w.type == "webhook" def test_create_webhook(self): - body = WebhooksData(attributes=WebhooksDataAttributes( + body = CreateWebhook(attributes=CreateWebhookDataAttributes( "some label", "https://webhook.site/81ee6b53-fde4-4b7d-85a0-0b6249a4488d", "myToken", "Json", "AtLeastOnce", False, "OnlyAuthorizationRequest")) - response = CreateWebhookApi(self.api_client).execute({"data": body}) + response = UnitApi.create_webhook(self.api_client).execute({"data": body}) assert response.data.type == "webhook" diff --git a/unit/e2e_tests/ruby/spec/models/account_spec.rb b/unit/e2e_tests/ruby/spec/models/account_spec.rb index 4426758..751c4fc 100644 --- a/unit/e2e_tests/ruby/spec/models/account_spec.rb +++ b/unit/e2e_tests/ruby/spec/models/account_spec.rb @@ -36,7 +36,7 @@ credit_limit: 20_000, tags: { "purpose": 'tax' } } ), - relationships: OpenapiClient::CreateCreditAccountRelationships.new( + relationships: OpenapiClient::CreateDepositAccountRelationships.new( customer: { "data": { "type": 'customer', "id": '851228' } } ).to_hash).to_hash }