Skip to content

Commit 22467cf

Browse files
authored
Merge pull request #107 from fintoc-com/master
Release 2.15.0
2 parents 4410a61 + 2e482af commit 22467cf

8 files changed

Lines changed: 55 additions & 2 deletions

File tree

fintoc/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from fintoc.managers.v2 import AccountsManager as AccountsManagerV2
2424
from fintoc.managers.v2 import (
2525
AccountVerificationsManager,
26+
CustomersManager,
2627
EntitiesManager,
2728
SimulateManager,
2829
TransfersManager,
@@ -78,5 +79,6 @@ def __init__(self, client):
7879
self.account_verifications = AccountVerificationsManager(
7980
"/v2/account_verifications", client
8081
)
82+
self.customers = CustomersManager("/v2/customers", client)
8183
self.entities = EntitiesManager("/v2/entities", client)
8284
self.simulate = SimulateManager("/v2/simulate", client)

fintoc/managers/v2/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .account_numbers_manager import AccountNumbersManager
44
from .account_verifications_manager import AccountVerificationsManager
55
from .accounts_manager import AccountsManager
6+
from .customers_manager import CustomersManager
67
from .entities_manager import EntitiesManager
78
from .movements_manager import MovementsManager
89
from .simulate_manager import SimulateManager
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""Module to hold the customers manager."""
2+
3+
from fintoc.mixins import ManagerMixin
4+
5+
6+
class CustomersManager(ManagerMixin):
7+
"""Represents a customers manager."""
8+
9+
resource = "customer"
10+
methods = ["list", "get", "create"]

fintoc/resources/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from .v2.account import Account as AccountV2
2727
from .v2.account_number import AccountNumber
2828
from .v2.account_verification import AccountVerification
29+
from .v2.customer import Customer
2930
from .v2.entity import Entity
3031
from .v2.transfer import Transfer
3132
from .webhook_endpoint import WebhookEndpoint

fintoc/resources/v2/customer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""Module to hold the Customer resource."""
2+
3+
from fintoc.mixins import ResourceMixin
4+
5+
6+
class Customer(ResourceMixin):
7+
"""Represents a Fintoc Customer."""

fintoc/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""Module to hold the version utilities."""
22

3-
version_info = (2, 14, 0)
3+
version_info = (2, 15, 0)
44
__version__ = ".".join([str(x) for x in version_info])

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "fintoc"
3-
version = "2.14.0"
3+
version = "2.15.0"
44
description = "The official Python client for the Fintoc API."
55
authors = ["Daniel Leal <daniel@fintoc.com>", "Nebil Kawas <nebil@uc.cl>"]
66
maintainers = ["Daniel Leal <daniel@fintoc.com>"]

tests/test_integration.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,38 @@ def test_v2_account_verification_create(self):
714714
assert account_verification.url == "v2/account_verifications"
715715
assert account_verification.json.account_number == account_number
716716

717+
def test_v2_customers_list(self):
718+
"""Test getting all customers using v2 API."""
719+
customers = list(self.fintoc.v2.customers.list())
720+
721+
assert len(customers) > 0
722+
for customer in customers:
723+
assert customer.method == "get"
724+
assert customer.url == "v2/customers"
725+
726+
def test_v2_customer_get(self):
727+
"""Test getting a specific customer using v2 API."""
728+
customer_id = "test_customer_id"
729+
730+
customer = self.fintoc.v2.customers.get(customer_id)
731+
732+
assert customer.method == "get"
733+
assert customer.url == f"v2/customers/{customer_id}"
734+
735+
def test_v2_customer_create(self):
736+
"""Test creating a customer using v2 API."""
737+
customer_data = {
738+
"name": "Test Customer",
739+
"email": "test@example.com",
740+
}
741+
742+
customer = self.fintoc.v2.customers.create(**customer_data)
743+
744+
assert customer.method == "post"
745+
assert customer.url == "v2/customers"
746+
assert customer.json.name == customer_data["name"]
747+
assert customer.json.email == customer_data["email"]
748+
717749
def test_v2_entities_list(self):
718750
"""Test getting all entities using v2 API."""
719751
entities = list(self.fintoc.v2.entities.list())

0 commit comments

Comments
 (0)