diff --git a/fintoc/core.py b/fintoc/core.py index 92c443f..5182ac4 100644 --- a/fintoc/core.py +++ b/fintoc/core.py @@ -23,6 +23,7 @@ from fintoc.managers.v2 import AccountsManager as AccountsManagerV2 from fintoc.managers.v2 import ( AccountVerificationsManager, + CustomersManager, EntitiesManager, SimulateManager, TransfersManager, @@ -78,5 +79,6 @@ def __init__(self, client): self.account_verifications = AccountVerificationsManager( "/v2/account_verifications", client ) + self.customers = CustomersManager("/v2/customers", client) self.entities = EntitiesManager("/v2/entities", client) self.simulate = SimulateManager("/v2/simulate", client) diff --git a/fintoc/managers/v2/__init__.py b/fintoc/managers/v2/__init__.py index 5a56b9f..eb4b9db 100644 --- a/fintoc/managers/v2/__init__.py +++ b/fintoc/managers/v2/__init__.py @@ -3,6 +3,7 @@ from .account_numbers_manager import AccountNumbersManager from .account_verifications_manager import AccountVerificationsManager from .accounts_manager import AccountsManager +from .customers_manager import CustomersManager from .entities_manager import EntitiesManager from .movements_manager import MovementsManager from .simulate_manager import SimulateManager diff --git a/fintoc/managers/v2/customers_manager.py b/fintoc/managers/v2/customers_manager.py new file mode 100644 index 0000000..df1bdd9 --- /dev/null +++ b/fintoc/managers/v2/customers_manager.py @@ -0,0 +1,10 @@ +"""Module to hold the customers manager.""" + +from fintoc.mixins import ManagerMixin + + +class CustomersManager(ManagerMixin): + """Represents a customers manager.""" + + resource = "customer" + methods = ["list", "get", "create"] diff --git a/fintoc/resources/__init__.py b/fintoc/resources/__init__.py index a5e7cad..faab757 100644 --- a/fintoc/resources/__init__.py +++ b/fintoc/resources/__init__.py @@ -26,6 +26,7 @@ from .v2.account import Account as AccountV2 from .v2.account_number import AccountNumber from .v2.account_verification import AccountVerification +from .v2.customer import Customer from .v2.entity import Entity from .v2.transfer import Transfer from .webhook_endpoint import WebhookEndpoint diff --git a/fintoc/resources/v2/customer.py b/fintoc/resources/v2/customer.py new file mode 100644 index 0000000..4073f28 --- /dev/null +++ b/fintoc/resources/v2/customer.py @@ -0,0 +1,7 @@ +"""Module to hold the Customer resource.""" + +from fintoc.mixins import ResourceMixin + + +class Customer(ResourceMixin): + """Represents a Fintoc Customer.""" diff --git a/tests/test_integration.py b/tests/test_integration.py index 0ea03cc..65ddf55 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -714,6 +714,38 @@ def test_v2_account_verification_create(self): assert account_verification.url == "v2/account_verifications" assert account_verification.json.account_number == account_number + def test_v2_customers_list(self): + """Test getting all customers using v2 API.""" + customers = list(self.fintoc.v2.customers.list()) + + assert len(customers) > 0 + for customer in customers: + assert customer.method == "get" + assert customer.url == "v2/customers" + + def test_v2_customer_get(self): + """Test getting a specific customer using v2 API.""" + customer_id = "test_customer_id" + + customer = self.fintoc.v2.customers.get(customer_id) + + assert customer.method == "get" + assert customer.url == f"v2/customers/{customer_id}" + + def test_v2_customer_create(self): + """Test creating a customer using v2 API.""" + customer_data = { + "name": "Test Customer", + "email": "test@example.com", + } + + customer = self.fintoc.v2.customers.create(**customer_data) + + assert customer.method == "post" + assert customer.url == "v2/customers" + assert customer.json.name == customer_data["name"] + assert customer.json.email == customer_data["email"] + def test_v2_entities_list(self): """Test getting all entities using v2 API.""" entities = list(self.fintoc.v2.entities.list())