diff --git a/app/main.py b/app/main.py index 195b5c88..4d793b5a 100644 --- a/app/main.py +++ b/app/main.py @@ -20,6 +20,7 @@ app.include_router(applications.router) app.include_router(guest.applications.router) app.include_router(guest.emails.router) +app.include_router(guest.meta.router) app.include_router(downloads.router) app.include_router(lenders.router) app.include_router(statistics.router) diff --git a/app/models.py b/app/models.py index 6194ea07..fa1c848e 100644 --- a/app/models.py +++ b/app/models.py @@ -316,13 +316,13 @@ class BorrowerSector(StrEnum): class CreditType(StrEnum): - LOAN = "LOAN" - CREDIT_LINE = "CREDIT_LINE" + LOAN = i("LOAN") + CREDIT_LINE = i("CREDIT_LINE") class BorrowerType(StrEnum): - NATURAL_PERSON = "NATURAL_PERSON" - LEGAL_PERSON = "LEGAL_PERSON" + NATURAL_PERSON = i("NATURAL_PERSON") + LEGAL_PERSON = i("LEGAL_PERSON") class StatisticType(StrEnum): @@ -346,7 +346,7 @@ class LenderBase(SQLModel): #: .. seealso:: :attr:`~app.settings.Settings.progress_to_remind_started_applications` sla_days: int | None #: Additional HTML content to include in a :attr:`app.models.MessageType.APPROVED_APPLICATION` message, if the - #: "additional_comments" key in the application's :attr:`app.models.APplication.lender_approved_data` isn't set. + #: "additional_comments" key in the application's :attr:`app.models.Application.lender_approved_data` isn't set. default_pre_approval_message: str = Field(default="") diff --git a/app/routers/guest/__init__.py b/app/routers/guest/__init__.py index b1ad0ab3..c72d2451 100644 --- a/app/routers/guest/__init__.py +++ b/app/routers/guest/__init__.py @@ -1 +1 @@ -from . import applications, emails # noqa: F401 +from . import applications, emails, meta # noqa: F401 diff --git a/app/routers/guest/meta.py b/app/routers/guest/meta.py new file mode 100644 index 00000000..c4c174a3 --- /dev/null +++ b/app/routers/guest/meta.py @@ -0,0 +1,32 @@ +from fastapi import APIRouter + +from app import models +from app.i18n import _ + +router = APIRouter() + + +@router.get( + "/meta", + tags=["meta"], +) +async def get_settings_by_domain() -> dict[str, list[dict[str, str]]]: + """ + Get the keys and localized descriptions of constants, where a constant can be: + + - BorrowerDocumentType + - BorrowerSector + - BorrowerSize + - BorrowerType + + :return: A dict of constants with their keys and localized values. + """ + constants = {} + for domain in ( + "BorrowerDocumentType", + "BorrowerSector", + "BorrowerSize", + "BorrowerType", + ): + constants[domain] = [{"label": _(name), "value": name} for name in getattr(models, domain)] + return constants diff --git a/docs/frontend.rst b/docs/frontend.rst index 3a3d2ed5..6deb636a 100644 --- a/docs/frontend.rst +++ b/docs/frontend.rst @@ -17,14 +17,12 @@ Credere frontend's ``src/constants/index.ts`` constants should match ``app.model - Frontend * - ApplicationStatus - APPLICATION_STATUS - * - BorrowerType - - BORROWER_TYPE + * - BorrowerSize.NOT_INFORMED + - DEFAULT_BORROWER_SIZE + * - BorrowerDocumentType.SIGNED_CONTRACT + - SIGNED_CONTRACT_DOCUMENT_TYPE * - CreditType - CREDIT_PRODUCT_TYPE - * - BorrowerDocumentType - - DOCUMENTS_TYPE - * - BorrowerSize - - MSME_TYPES * - StatisticCustomRange - STATISTICS_DATE_FILTER * - UserType diff --git a/locale/es/LC_MESSAGES/messages.po b/locale/es/LC_MESSAGES/messages.po index 64b5e26e..8f196f5b 100644 --- a/locale/es/LC_MESSAGES/messages.po +++ b/locale/es/LC_MESSAGES/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-08-23 14:39-0400\n" +"POT-Creation-Date: 2024-08-24 12:58-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: es\n" @@ -148,17 +148,17 @@ msgstr "Opción de crédito alternativa" msgid "Application updated" msgstr "Aplicación actualizada" -#: app/main.py:30 +#: app/main.py:31 msgid "An unexpected error occurred" msgstr "Ocurrió un error inesperado" #: app/models.py:130 msgid "INCORPORATION_DOCUMENT" -msgstr "Documento de incorporación" +msgstr "Certificado de incorporación de tu empresa" #: app/models.py:131 msgid "SUPPLIER_REGISTRATION_DOCUMENT" -msgstr "Documento de registro de proveedor" +msgstr "Registro Único de Proponentes (RUP) de su empresa" #: app/models.py:132 msgid "BANK_NAME" @@ -166,11 +166,19 @@ msgstr "Nombre del banco" #: app/models.py:133 msgid "BANK_CERTIFICATION_DOCUMENT" -msgstr "Certificado bancario" +msgstr "" +"Certificado Bancario de la empresa: Documento debe estar firmado y con " +"emisión menor a 3 meses." #: app/models.py:134 msgid "FINANCIAL_STATEMENT" -msgstr "Estados financieros" +msgstr "" +"Documento de Estados Financieros de su empresa: A corte del último " +"trimestre y del corte anual y el anterior (ejemplo; si estamos en " +"Septiembre, la información disponible estaría a Junio 2023 y a Diciembre " +"2022 y Diciembre 2021). Si no se tiene disponible la información a corte " +"parcial del trimestre, se recibe pero puede llegar a ser solicitada más " +"adelante por la institución financiera." #: app/models.py:135 msgid "SIGNED_CONTRACT" @@ -178,15 +186,22 @@ msgstr "Contrato firmado" #: app/models.py:136 msgid "SHAREHOLDER_COMPOSITION" -msgstr "Composición accionaria" +msgstr "" +"Documento de Composición Accionaria: Debe enviarse completo, hasta llegar" +" al beneficiario final con concentración mayor al 5 por ciento." #: app/models.py:137 msgid "CHAMBER_OF_COMMERCE" -msgstr "Cámara de comercio" +msgstr "" +"Documento de Registro de la Cámara de Comercio: Documento debe estar " +"firmado y con emisión menor a 3 meses." #: app/models.py:138 msgid "THREE_LAST_BANK_STATEMENT" -msgstr "Últimos tres extractos bancarios" +msgstr "" +"Extractos Bancarios de los últimos 3 meses: De la o las cuentas " +"principales de la empresa. El documento deber ser emitido por el banco y " +"deber ser enviado SIN alterar." #: app/models.py:163 msgid "PENDING" @@ -339,6 +354,22 @@ msgstr "" msgid "actividades_organizaciones_extraterritoriales" msgstr "Actividades de organizaciones y entidades extraterritoriales" +#: app/models.py:319 +msgid "LOAN" +msgstr "Préstamo" + +#: app/models.py:320 +msgid "CREDIT_LINE" +msgstr "Línea de crédito" + +#: app/models.py:324 +msgid "NATURAL_PERSON" +msgstr "Persona natural" + +#: app/models.py:325 +msgid "LEGAL_PERSON" +msgstr "Persona jurídica" + #: app/util.py:55 #, python-format msgid "%(model_name)s not found"