diff --git a/facturapi/resources/customers.py b/facturapi/resources/customers.py index 93896ec..5e93b2f 100644 --- a/facturapi/resources/customers.py +++ b/facturapi/resources/customers.py @@ -7,10 +7,10 @@ import datetime as dt from typing import ClassVar, Optional, cast -from cuenca_validations.types import SATRegimeCode from pydantic import BaseModel from pydantic.dataclasses import dataclass +from ..types.enums import TaxSystemType from ..types.general import CustomerAddress from .base import Creatable, Queryable, Retrievable, Updatable @@ -23,7 +23,7 @@ class CustomerRequest(BaseModel): Attributes: legal_name (str): Full name of the customer. tax_id (str): RFC of the customer. - tax_system: SATRegimeCode regime code from SAT + tax_system: TaxSystemType regime code from SAT email (str): Email of the customer. phone (str): Phone of the customer. Optional. address (CustomerAddress): Address object of the customer. Optional. @@ -32,7 +32,7 @@ class CustomerRequest(BaseModel): legal_name: str tax_id: str - tax_system: SATRegimeCode + tax_system: TaxSystemType email: str phone: Optional[str] address: CustomerAddress @@ -46,7 +46,7 @@ class CustomerUpdateRequest(BaseModel): Attributes: legal_name (str): Full name of the customer. Optional. tax_id (str): RFC of the customer. Optional. - tax_system: SATRegimeCode regime code from SAT + tax_system: TaxSystemType regime code from SAT email (str): Email of the customer. Optional. phone (str): Phone of the customer. Optional. address (CustomerAddress): Address object of the customer. Optional. @@ -55,7 +55,7 @@ class CustomerUpdateRequest(BaseModel): legal_name: Optional[str] tax_id: Optional[str] - tax_system: Optional[SATRegimeCode] + tax_system: Optional[TaxSystemType] email: Optional[str] phone: Optional[str] address: Optional[CustomerAddress] @@ -77,7 +77,7 @@ class Customer(Creatable, Queryable, Retrievable, Updatable): tax_id (str): RFC of the customer. email (str): Email of the customer. address (CustomerAddress): Address data of the model. Optional. - tax_system (SATRegimeCode): Enum from catalogue of SAT + tax_system (TaxSystemType): Enum from catalogue of SAT phone (str): Phone of the customer. Defaults to `None`. """ @@ -89,7 +89,7 @@ class Customer(Creatable, Queryable, Retrievable, Updatable): tax_id: str email: str address: CustomerAddress - tax_system: Optional[SATRegimeCode] = None + tax_system: Optional[TaxSystemType] = None phone: Optional[str] = None @classmethod diff --git a/facturapi/types/__init__.py b/facturapi/types/__init__.py index 0d8d271..6fa7c22 100644 --- a/facturapi/types/__init__.py +++ b/facturapi/types/__init__.py @@ -9,6 +9,7 @@ 'PaymentForm', 'PaymentMethod', 'SanitizedDict', + 'TaxSystemType', 'exc', 'general', 'validators', @@ -22,5 +23,6 @@ InvoiceUse, PaymentForm, PaymentMethod, + TaxSystemType, ) from .queries import BaseQuery, DateFilter diff --git a/facturapi/types/enums.py b/facturapi/types/enums.py index ed99ae5..6ffb74c 100644 --- a/facturapi/types/enums.py +++ b/facturapi/types/enums.py @@ -94,3 +94,29 @@ class PaymentMethod(str, Enum): contado = 'PUE' parcialidades = 'PPD' + + +class TaxSystemType(str, Enum): + GRL_PM = "601" # General de Ley Personas Morales + PM_FN = "603" # Personas Morales con Fines no Lucrativos + SAL_IS = "605" # Sueldos y Salarios e Ingresos Asimilados a Salarios + ARR = "606" # Arrendamiento + DEM_ING = "608" # Demás ingresos + CONS = "609" # Consolidación + RES_EXT = "610" # Residentes en el Extranjero sin Establecimiento Permanente en México # noqa: E501 + DIV = "611" # Ingresos por Dividendos (socios y accionistas) + PF_AEP = "612" # Personas Físicas con Actividades Empresariales y Profesionales # noqa: E501 + INT = "614" # Ingresos por intereses + SIN_OBL = "616" # Sin obligaciones fiscales + SCP_DIF = "620" # Sociedades Cooperativas de Producción que optan por diferir sus ingresos # noqa: E501 + INC_FISC = "621" # Incorporación Fiscal + AGRO_GAN_SILV_PES = "622" # Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras # noqa: E501 + OP_GRUPO_SOC = "623" # Opcional para Grupos de Sociedades + COOR = "624" # Coordinados + HID = "628" # Hidrocarburos + ENAJ_ADQ = "607" # Régimen de Enajenación o Adquisición de Bienes + PREF_EM_MULT = "629" # De los Regímenes Fiscales Preferentes y de las Empresas Multinacionales # noqa: E501 + ENAJ_ACC_BOL = "630" # Enajenación de acciones en bolsa de valores + ING_PREM = "615" # Régimen de los ingresos por obtención de premios + AE_PLAT_TEC = "625" # Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas # noqa: E501 + RS_CONF = "626" # Régimen Simplificado de Confianza diff --git a/facturapi/version.py b/facturapi/version.py index 57098d6..a8ade31 100644 --- a/facturapi/version.py +++ b/facturapi/version.py @@ -1,2 +1,2 @@ -__version__ = '0.1.0' # pragma: no cover +__version__ = '0.1.1' # pragma: no cover CLIENT_VERSION = __version__ diff --git a/requirements.txt b/requirements.txt index 6e29fac..8cc3387 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ requests==2.28.1 -pydantic==1.8.2 +pydantic==1.7.3 dataclasses>=0.7;python_version<"3.7" -cuenca-validations==0.11.18 diff --git a/setup.py b/setup.py index b8a0d74..57ae11b 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ python_requires='>=3.6', install_requires=[ 'requests>=2.4,<2.26', - 'pydantic==1.8.2', + 'pydantic==1.7.3', 'dataclasses>=0.7;python_version<"3.7"', ], classifiers=[