Skip to content

Commit

Permalink
fix: remove borrower type filter from get credit products
Browse files Browse the repository at this point in the history
As we are not sending invitations to natural persons
  • Loading branch information
yolile committed Aug 19, 2024
1 parent 4ee387c commit 8d0ef0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
8 changes: 0 additions & 8 deletions app/routers/guest/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
from botocore.exceptions import ClientError
from fastapi import APIRouter, BackgroundTasks, Depends, Form, HTTPException, UploadFile, status
from fastapi.encoders import jsonable_encoder
from sqlalchemy import text
from sqlalchemy.orm import Session, joinedload
from sqlmodel import col

from app import aws, dependencies, mail, models, parsers, serializers, util
from app.db import get_db, rollback_on_error
from app.dependencies import ApplicationScope
from app.sources import colombia as data_access
from app.util import commit_and_refresh

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -225,11 +223,6 @@ async def credit_product_options(
:raise: HTTPException with status code 404 if the application is expired, not in the ACCEPTED status, or if the
previous lenders are not found.
"""
if application.borrower.type.lower() == data_access.SUPPLIER_TYPE_TO_EXCLUDE:
borrower_type = models.BorrowerType.NATURAL_PERSON
else:
borrower_type = models.BorrowerType.LEGAL_PERSON

base_query = (
session.query(models.CreditProduct)
.join(models.Lender)
Expand All @@ -240,7 +233,6 @@ async def credit_product_options(
models.CreditProduct.upper_limit >= payload.amount_requested,
models.CreditProduct.procurement_category_to_exclude != application.award.procurement_category,
col(models.Lender.id).notin_(application.rejected_lenders(session)),
text(f"(borrower_types->>'{borrower_type}')::boolean is True"),
)
)

Expand Down
4 changes: 2 additions & 2 deletions app/sources/colombia.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ def get_borrower(borrower_identifier: str, documento_proveedor: str, entry: dict

if (
remote_borrower.get("tipo_organizacion", "").lower() == SUPPLIER_TYPE_TO_EXCLUDE
or remote_borrower.get("regimen_tributario", "").lower() == "Persona Natural"
or remote_borrower.get("tipo_de_documento") == "Cédula de Ciudadanía"
or remote_borrower.get("regimen_tributario", "") == "Persona Natural"
or remote_borrower.get("tipo_de_documento", "") == "Cédula de Ciudadanía"
):
raise SkippedAwardError(
f"Borrower is {SUPPLIER_TYPE_TO_EXCLUDE}",
Expand Down

0 comments on commit 8d0ef0a

Please sign in to comment.