diff --git a/app/models.py b/app/models.py index 0fbd714b..515d0019 100644 --- a/app/models.py +++ b/app/models.py @@ -173,8 +173,9 @@ class ApplicationStatus(StrEnum): #: #: (``/applications/email-sme/{id}``) INFORMATION_REQUESTED = i("INFORMATION_REQUESTED") - #: Borrower doesn't accept or decline the invitation, doesn't submit the application or information requested, or - #: doesn't start external onboarding while the lender hasn't started application review. + #: Borrower doesn't accept or decline the invitation, doesn't submit the application or information requested, + #: doesn't start external onboarding while the lender hasn't started application review, or doesn't respond to + #: the lender externally. #: #: (:typer:`python-m-app-update-applications-to-lapsed`) LAPSED = i("LAPSED") @@ -267,6 +268,7 @@ class ApplicationActionType(StrEnum): OCP_DOWNLOAD_APPLICATION = "OCP_DOWNLOAD_APPLICATION" FI_START_APPLICATION = "FI_START_APPLICATION" FI_REQUEST_INFORMATION = "FI_REQUEST_INFORMATION" + FI_LAPSE_APPLICATION = "FI_LAPSE_APPLICATION" OCP_DOWNLOAD_DOCUMENT = "OCP_DOWNLOAD_DOCUMENT" APPROVED_APPLICATION = "APPROVED_APPLICATION" REJECTED_APPLICATION = "REJECTED_APPLICATION" diff --git a/app/routers/applications.py b/app/routers/applications.py index a7331144..67e93045 100644 --- a/app/routers/applications.py +++ b/app/routers/applications.py @@ -528,3 +528,42 @@ async def previous_contracts( :raise: HTTPException if the user is not authorized to access the application. """ return application.previous_awards(session) + + +@router.post( + "/applications/{id}/lapse", + tags=[util.Tags.applications], + response_model=models.ApplicationWithRelations, +) +async def lapse_application( + id: int, + user: Annotated[models.User, Depends(dependencies.get_user)], + session: Annotated[Session, Depends(get_db)], + application: Annotated[ + models.Application, + Depends( + dependencies.get_scoped_application_as_user( + roles=(models.UserType.FI,), statuses=(models.ApplicationStatus.STARTED,) + ) + ), + ], +) -> Any: + """ + :param id: The ID of the application to lapse. + :return: The lapsed application with its associated relations. + :raise: HTTPException if the user is not authorized to lapse the application. + """ + with rollback_on_error(session): + application.status = models.ApplicationStatus.LAPSED + application.application_lapsed_at = datetime.now(application.created_at.tzinfo) + + models.ApplicationAction.create( + session, + type=models.ApplicationActionType.FI_LAPSE_APPLICATION, + data=jsonable_encoder(application, exclude_unset=True), + application_id=application.id, + user_id=user.id, + ) + + session.commit() + return application diff --git a/docs/_static/openapi.json b/docs/_static/openapi.json index 4c438e03..afc769b6 100644 --- a/docs/_static/openapi.json +++ b/docs/_static/openapi.json @@ -1 +1 @@ -{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/users":{"post":{"tags":["users"],"summary":"Create User","description":"Create a new user in Cognito.\n\nEmail the user a temporary password.\n\nAccessible only to users with the OCP role.","operationId":"create_user_users_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["users"],"summary":"Get All Users","description":"Retrieve a list of users.\n\nThis endpoint retrieves a list of users, paginated and sorted based on the provided parameters.","operationId":"get_all_users_users_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"default":10,"title":"Page Size"}},{"name":"sort_field","in":"query","required":false,"schema":{"type":"string","default":"created_at","title":"Sort Field"}},{"name":"sort_order","in":"query","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/SortOrder"}],"default":"asc","title":"Sort Order"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/change-password":{"put":{"tags":["authentication"],"summary":"Change Password","description":"Change user password.\n\nThis endpoint allows users to change their password. It initiates the password change process\nand handles different scenarios such as new password requirement, MFA setup, and error handling.","operationId":"change_password_users_change_password_put","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasicUser"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ChangePasswordResponse"},{"$ref":"#/components/schemas/ResponseBase"}],"title":"Response Change Password Users Change Password Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/setup-mfa":{"put":{"tags":["authentication"],"summary":"Setup Mfa","description":"Set up multi-factor authentication (MFA) for the user.\n\nThis endpoint allows users to set up MFA using a software token. It verifies the software\ntoken with the provided secret, session, and temporary password.","operationId":"setup_mfa_users_setup_mfa_put","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupMFA"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseBase"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/login":{"post":{"tags":["authentication"],"summary":"Login","description":"Authenticate the user with Multi-Factor Authentication (MFA) and generate access and refresh tokens.\n\nThis endpoint handles user login and authentication with MFA. It initiates the authentication\nprocess using the provided username and password. If the authentication process requires MFA,\nit responds to the MFA challenge by providing the MFA code. If the authentication is successful,\nit returns the user information along with the generated access and refresh tokens.\n\n:param payload: The user data including the username, password, and MFA code.\n:return: The response containing the user information and tokens if the login is successful.","operationId":"login_users_login_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasicUser"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/logout":{"get":{"tags":["authentication"],"summary":"Logout","description":"Logout the user from all devices in Cognito.","operationId":"logout_users_logout_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseBase"}}}}}}},"/users/me":{"get":{"tags":["authentication"],"summary":"Me","description":"Get the details of the currently authenticated user.\n\nThis endpoint retrieves the details of the currently authenticated user.\nIt uses the username extracted from the JWT token to query the database\nand retrieve the user details.","operationId":"me_users_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserResponse"}}}}}}},"/users/forgot-password":{"post":{"tags":["authentication"],"summary":"Forgot Password","description":"Initiate the process of resetting a user's password.\n\nEmail the user a temporary password and a reset link.","operationId":"forgot_password_users_forgot_password_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPassword"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseBase"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/{user_id}":{"get":{"tags":["users"],"summary":"Get User","description":"Retrieve information about a user.\n\nThis endpoint retrieves information about a user based on their user_id.","operationId":"get_user_users__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["users"],"summary":"Update User","description":"Update a user's information.\n\nThis endpoint updates the information of a specific user identified by the provided ID.","operationId":"update_user_users__user_id__put","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserWithLender"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/reject-application":{"post":{"tags":["applications"],"summary":"Reject Application","description":"Reject an application.\n\nChanges application status from \"STARTED\" to \"REJECTED\".\n\n:param payload: The rejected application data.\n:return: The rejected application with its associated relations.","operationId":"reject_application_applications__id__reject_application_post","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LenderRejectedApplication"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/approve-application":{"post":{"tags":["applications"],"summary":"Approve Application","description":"Approve an application.\n\nChange application status from \"STARTED\" to \"APPROVED\". Notify the borrower of the approval.\n\n:param payload: The approved application data.\n:return: The approved application with its associated relations.","operationId":"approve_application_applications__id__approve_application_post","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LenderApprovedData"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/verify-data-field":{"put":{"tags":["applications"],"summary":"Verify Data Field","description":"Verify and update a data field in an application.\n\n:param payload: The data field update payload.\n:return: The updated application with its associated relations.","operationId":"verify_data_field_applications__id__verify_data_field_put","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDataField"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/documents/{document_id}/verify-document":{"put":{"tags":["applications"],"summary":"Verify Document","description":"Verify a borrower document in an application.\n\n:param document_id: The ID of the borrower document.\n:param payload: The document verification payload.\n:return: The updated application with its associated relations.","operationId":"verify_document_applications_documents__document_id__verify_document_put","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"integer","title":"Document Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyBorrowerDocument"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/award":{"put":{"tags":["applications"],"summary":"Update Application Award","description":"Update the award details of an application.\n\n:param payload: The award update payload.\n:return: The updated application with its associated relations.","operationId":"update_application_award_applications__id__award_put","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AwardUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/borrower":{"put":{"tags":["applications"],"summary":"Update Application Borrower","description":"Update the borrower details of an application.\n\n:param payload: The borrower update payload.\n:return: The updated application with its associated relations.","operationId":"update_application_borrower_applications__id__borrower_put","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BorrowerUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/admin-list":{"get":{"tags":["applications"],"summary":"Get Applications List","description":"Get a paginated list of submitted applications for administrative purposes.","operationId":"get_applications_list_applications_admin_list_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"default":10,"title":"Page Size"}},{"name":"sort_field","in":"query","required":false,"schema":{"type":"string","default":"application.borrower_submitted_at","title":"Sort Field"}},{"name":"sort_order","in":"query","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/SortOrder"}],"default":"asc","title":"Sort Order"}},{"name":"search_value","in":"query","required":false,"schema":{"type":"string","default":"","title":"Search Value"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications":{"get":{"tags":["applications"],"summary":"Get Applications","description":"Get a paginated list of submitted applications for a specific lender user.","operationId":"get_applications_applications_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"default":10,"title":"Page Size"}},{"name":"sort_field","in":"query","required":false,"schema":{"type":"string","default":"application.borrower_submitted_at","title":"Sort Field"}},{"name":"sort_order","in":"query","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/SortOrder"}],"default":"asc","title":"Sort Order"}},{"name":"search_value","in":"query","required":false,"schema":{"type":"string","default":"","title":"Search Value"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/id/{id}":{"get":{"tags":["applications"],"summary":"Get Application","description":"Retrieve an application by its ID.\n\n:return: The application with the specified ID and its associated relations.\n:raise: HTTPException if the user is not authorized to view the application.","operationId":"get_application_applications_id__id__get","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/start":{"post":{"tags":["applications"],"summary":"Start Application","description":"Start an application.\n\nChange application status from \"SUBMITTED\" to \"STARTED\".\n\n:param id: The ID of the application to start.\n:return: The started application with its associated relations.\n:raise: HTTPException if the user is not authorized to start the application.","operationId":"start_application_applications__id__start_post","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/email-sme/{id}":{"post":{"tags":["applications"],"summary":"Email Borrower","description":"Send an email to the borrower and update the application status.\n\nChange application status from \"STARTED\" to \"INFORMATION_REQUESTED\". Notify the borrower of the request.\n\n:param payload: The payload containing the message to send to the borrower.\n:return: The updated application with its associated relations.\n:raises HTTPException: If there's an error in sending the email to the borrower.","operationId":"email_borrower_applications_email_sme__id__post","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationEmailBorrower"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/previous-awards":{"get":{"tags":["applications"],"summary":"Previous Contracts","description":"Get the previous awards associated with an application.\n\n:return: A list of previous awards associated with the application.\n:raise: HTTPException if the user is not authorized to access the application.","operationId":"previous_contracts_applications__id__previous_awards_get","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Award"},"title":"Response Previous Contracts Applications Id Previous Awards Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/uuid/{uuid}":{"get":{"tags":["applications"],"summary":"Application By Uuid","description":"Retrieve an application by its UUID.\n\n:return: The application with the specified UUID and its associated entities.\n:raise: HTTPException if the application is expired.","operationId":"application_by_uuid_applications_uuid__uuid__get","parameters":[{"name":"uuid","in":"path","required":true,"schema":{"type":"string","title":"Uuid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/decline":{"post":{"tags":["applications"],"summary":"Decline","description":"Decline an application.\n\nChanges application status from \"PENDING\" to \"DECLINED\".\n\n:param payload: The application decline payload.\n:return: The application response containing the updated application, borrower, and award.\n:raise: HTTPException if the application is not in the PENDING status.","operationId":"decline_applications_decline_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationDeclinePayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/rollback-decline":{"post":{"tags":["applications"],"summary":"Rollback Decline","description":"Rollback the decline of an application.\n\n:param payload: The application base payload.\n:return: The application response containing the updated application, borrower, and award.\n:raise: HTTPException if the application is not in the DECLINED status.","operationId":"rollback_decline_applications_rollback_decline_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/decline-feedback":{"post":{"tags":["applications"],"summary":"Decline Feedback","description":"Provide feedback for a declined application.\n\n:param payload: The application decline feedback payload.\n:return: The application response containing the updated application, borrower, and award.\n:raise: HTTPException if the application is not in the DECLINED status.","operationId":"decline_feedback_applications_decline_feedback_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationDeclineFeedbackPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/access-scheme":{"post":{"tags":["applications"],"summary":"Access Scheme","description":"Access the scheme for an application.\n\nChanges the status from PENDING to ACCEPTED.\n\nSearch for previous awards for the borrower and add them to the application.\n\n:param payload: The application data.\n:return: The application response containing the updated application, borrower, and award.\n:raise: HTTPException if the application is expired or not in the PENDING status.","operationId":"access_scheme_applications_access_scheme_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/credit-product-options":{"post":{"tags":["applications"],"summary":"Credit Product Options","description":"Get the available credit product options for an application.\n\n:param payload: The application credit options.\n:return: The credit product list response containing the available loans and credit lines.\n:raise: HTTPException if the application is expired, not in the ACCEPTED status, or if the\n previous lenders are not found.","operationId":"credit_product_options_applications_credit_product_options_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationCreditOptions"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProductListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/select-credit-product":{"post":{"tags":["applications"],"summary":"Select Credit Product","description":"Select a credit product for an application.\n\n:param payload: The application credit product selection payload.\n:return: The application response containing the updated application, borrower, award, lender, documents, and\n credit product.\n:raise: HTTPException if the application is expired, not in the ACCEPTED status, or if the\n calculator data is invalid.","operationId":"select_credit_product_applications_select_credit_product_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationSelectCreditProduct"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/rollback-select-credit-product":{"post":{"tags":["applications"],"summary":"Rollback Select Credit Product","description":"Rollback the selection of a credit product for an application.\n\n:param payload: The application data.\n:return: The application response containing the updated application, borrower, and award.\n:raise: HTTPException if the credit product is not selected or if the lender is already\n assigned.","operationId":"rollback_select_credit_product_applications_rollback_select_credit_product_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/confirm-credit-product":{"post":{"tags":["applications"],"summary":"Confirm Credit Product","description":"Confirm the selected credit product for an application.\n\n:param payload: The application data.\n:return: The application response containing the updated application, borrower, award, lender, documents, and\n credit product.\n:raise: HTTPException if the credit product is not selected or not found.","operationId":"confirm_credit_product_applications_confirm_credit_product_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/rollback-confirm-credit-product":{"post":{"tags":["applications"],"summary":"Rollback Confirm Credit Product","description":"Rollback the confirmation of the selected credit product for an application.\n\n:param payload: The application data.\n:return: The application response containing the updated application, borrower, award, lender, documents, and\n credit product.\n:raise: HTTPException if the credit product is not selected or not found.","operationId":"rollback_confirm_credit_product_applications_rollback_confirm_credit_product_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/submit":{"post":{"tags":["applications"],"summary":"Update Apps Send Notifications","description":"Change application status from \"'ACCEPTED\" to \"SUBMITTED\". Send a notification to OCP and lender user.\n\nThis operation also ensures that the credit product and lender are selected before updating the status.\n\n:param payload: The application data to update.\n:return: The updated application with borrower, award and lender details.\n:raises HTTPException: If credit product or lender is not selected, or if there's an error in submitting the\n application.","operationId":"update_apps_send_notifications_applications_submit_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/upload-document":{"post":{"tags":["applications"],"summary":"Upload Document","description":"Upload a document for an application.\n\n:param file: The uploaded file.\n:param type: The type of the document.\n:return: The created or updated borrower document.","operationId":"upload_document_applications_upload_document_post","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_document_applications_upload_document_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BorrowerDocumentBase"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/complete-information-request":{"post":{"tags":["applications"],"summary":"Complete Information Request","description":"Complete the information request for an application.\n\nChanges application status from \"INFORMATION REQUESTED\" to \"STARTED\" and update the pending documents status.\n\nThis operation also sends a notification about the uploaded documents to the lender.\n\n:param payload: The application data to update.\n:return: The updated application with borrower, award, lender, and documents details.","operationId":"complete_information_request_applications_complete_information_request_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/find-alternative-credit-option":{"post":{"tags":["applications"],"summary":"Find Alternative Credit Option","description":"Find an alternative credit option for a rejected application by copying it.\n\n:param payload: The payload containing the UUID of the rejected application.\n:param client: The Cognito client for sending notifications.\n:return: The newly created application as an alternative credit option.\n:raise: HTTPException if the application has already been copied.\n:raise: HTTPException if the application is not in the rejected status.","operationId":"find_alternative_credit_option_applications_find_alternative_credit_option_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/uuid/{uuid}/access-external-onboarding":{"get":{"tags":["applications"],"summary":"Access External Onboarding","description":":return: A redirect to the lender.external_onboarding_system_url.\n:raise: HTTPException if the application has a lender without an external_onboarding_system_url.","operationId":"access_external_onboarding_applications_uuid__uuid__access_external_onboarding_get","parameters":[{"name":"uuid","in":"path","required":true,"schema":{"type":"string","title":"Uuid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/uuid/{uuid}/accessed-external-onboarding":{"get":{"tags":["applications"],"summary":"Accessed External Onboarding","description":"For when the borrower reports they've already started the onboarding process in the lender's system.\n:return: A redirect to the front end external-onboarding-completed page.\n:raise: HTTPException if the application has a lender without an external_onboarding_system_url.","operationId":"accessed_external_onboarding_applications_uuid__uuid__accessed_external_onboarding_get","parameters":[{"name":"uuid","in":"path","required":true,"schema":{"type":"string","title":"Uuid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/change-email":{"post":{"tags":["applications"],"summary":"Change Email","description":"Change the email address for an application.\n\n:param payload: The data for changing the email address.\n:return: The data for changing the email address.","operationId":"change_email_applications_change_email_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeEmail"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeEmail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/confirm-change-email":{"post":{"tags":["applications"],"summary":"Confirm Email","description":"Confirm the email address change for an application.\n\n:param payload: The data for confirming the email address change.\n:return: The data for confirming the email address change.","operationId":"confirm_email_applications_confirm_change_email_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmNewEmail"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeEmail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/meta":{"get":{"tags":["meta"],"summary":"Get Settings By Domain","description":"Get the keys and localized descriptions of constants.\n\nA constant can be:\n\n- BorrowerDocumentType\n- BorrowerSector\n- BorrowerSize\n- BorrowerType\n\n:return: A dict of constants with their keys and localized values.","operationId":"get_settings_by_domain_meta_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"array","items":{"type":"object","additionalProperties":{"type":"string"}}},"title":"Response Get Settings By Domain Meta Get"}}}}}}},"/applications/documents/id/{document_id}":{"get":{"tags":["applications"],"summary":"Get Borrower Document","description":"Retrieve a borrower document by its ID and stream the file content as a response.\n\n:param document_id: The ID of the borrower document to retrieve.\n:return: A streaming response with the borrower document file content.","operationId":"get_borrower_document_applications_documents_id__document_id__get","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"integer","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/download-application/{lang}":{"get":{"tags":["applications"],"summary":"Download Application","description":"Retrieve all documents related to an application and stream them as a zip file.\n\n:return: A streaming response with a zip file containing the documents.","operationId":"download_application_applications__id__download_application__lang__get","parameters":[{"name":"lang","in":"path","required":true,"schema":{"type":"string","title":"Lang"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/export/{lang}":{"get":{"tags":["applications"],"summary":"Export Applications","operationId":"export_applications_applications_export__lang__get","parameters":[{"name":"lang","in":"path","required":true,"schema":{"type":"string","title":"Lang"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/lenders":{"post":{"tags":["lenders"],"summary":"Create Lender","description":"Create a new lender.\n\n:param payload: The lender data to be created.\n:return: The created lender.\n:raise: lumache.OCPOnlyError if the current user is not authorized.","operationId":"create_lender_lenders_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LenderCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lender"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["lenders"],"summary":"Get Lenders List","description":"Get the list of all lenders.\n\n:return: The list of all lenders.","operationId":"get_lenders_list_lenders_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LenderListResponse"}}}}}}},"/lenders/{lender_id}/credit-products":{"post":{"tags":["lenders"],"summary":"Create Credit Products","description":"Create a new credit product for a specific lender.\n\n:param payload: The credit product data to be created.\n:param lender_id: The ID of the lender for which the credit product will be created.\n:return: The created credit product.\n:raise: lumache.OCPOnlyError if the current user is not authorized.","operationId":"create_credit_products_lenders__lender_id__credit_products_post","parameters":[{"name":"lender_id","in":"path","required":true,"schema":{"type":"integer","title":"Lender Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProduct-Input"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProduct-Output"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/lenders/{lender_id}":{"get":{"tags":["lenders"],"summary":"Get Lender","description":"Retrieve a lender by its ID.\n\n:param lender_id: The ID of the lender to retrieve.\n:return: The lender with the specified ID.\n:raise: HTTPException if the lender is not found.","operationId":"get_lender_lenders__lender_id__get","parameters":[{"name":"lender_id","in":"path","required":true,"schema":{"type":"integer","title":"Lender Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LenderWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["lenders"],"summary":"Update Lender","description":"Update an existing lender.\n\n:param lender_id: The ID of the lender to update.\n:param payload: The data to update the lender with.\n:return: The updated lender.\n:raise: lumache.OCPOnlyError if the current user is not authorized.","operationId":"update_lender_lenders__lender_id__put","parameters":[{"name":"lender_id","in":"path","required":true,"schema":{"type":"integer","title":"Lender Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LenderBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lender"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/procurement-categories":{"get":{"tags":["lenders"],"summary":"Get Procurement Categories From Source","description":"Get the list of the existing procurement categories from the source.\n\n:return: The list of existing procurement categories.","operationId":"get_procurement_categories_from_source_procurement_categories_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"},"title":"Response Get Procurement Categories From Source Procurement Categories Get"}}}}}}},"/credit-products/{credit_product_id}":{"get":{"tags":["lenders"],"summary":"Get Credit Product","description":"Retrieve a credit product by its ID, including its associated lender information.\n\n:param credit_product_id: The ID of the credit product to retrieve.\n:return: The credit product with the specified ID and its associated lender information.\n:raise: HTTPException if the credit product is not found.","operationId":"get_credit_product_credit_products__credit_product_id__get","parameters":[{"name":"credit_product_id","in":"path","required":true,"schema":{"type":"integer","title":"Credit Product Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProductWithLender"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["lenders"],"summary":"Update Credit Products","description":"Update an existing credit product.\n\n:param payload: The credit product data to update.\n:param credit_product_id: The ID of the credit product to update.\n:return: The updated credit product.\n:raise: lumache.OCPOnlyError if the current user is not authorized.","operationId":"update_credit_products_credit_products__credit_product_id__put","parameters":[{"name":"credit_product_id","in":"path","required":true,"schema":{"type":"integer","title":"Credit Product Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProduct-Input"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProduct-Output"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/statistics-ocp":{"get":{"tags":["statistics"],"summary":"Get Admin Statistics By Lender","description":"Retrieve OCP statistics by lender.\n\nThis secure endpoint is accessible only to users with the OCP role. It retrieves statistics for admins\nbased on the specified filters:\n- initial_date (optional): The initial date to filter the statistics.\n- final_date (optional): The final date to filter the statistics.\n- lender_id (optional): The lender ID to filter the statistics for a specific lender.\n\n:param initial_date: The initial date to filter the statistics (optional).\n:param final_date: The final date to filter the statistics (optional).\n:param lender_id: The lender ID to filter the statistics for a specific lender (optional).\n:return: Response containing the admin statistics.","operationId":"get_admin_statistics_by_lender_statistics_ocp_get","parameters":[{"name":"initial_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Initial Date"}},{"name":"final_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Final Date"}},{"name":"lender_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lender Id"}},{"name":"custom_range","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/StatisticRange"},{"type":"null"}],"title":"Custom Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatisticResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/statistics-ocp/opt-in":{"get":{"tags":["statistics"],"summary":"Get Admin Statistics Opt In","description":"Retrieve OCP statistics for borrower opt-in.\n\nThis secure endpoint is accessible only to users with the admin role. It retrieves\nstatistics related to borrower opt-in and the count of lenders chosen by borrower.\n\n:return: Response containing the admin statistics for borrower opt-in.","operationId":"get_admin_statistics_opt_in_statistics_ocp_opt_in_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatisticOptInResponse"}}}}}}},"/statistics-fi":{"get":{"tags":["statistics"],"summary":"Get Lender Statistics","description":"Retrieve statistics for a lender.\n\nThis endpoint retrieves statistics specific to a lender.\nIt provides general statistics such as the number of applications, awards, and borrowers\nassociated with the lender.\n\n:return: Response containing the statistics for the lender.","operationId":"get_lender_statistics_statistics_fi_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatisticResponse"}}}}}}}},"components":{"schemas":{"ApplicationBase":{"properties":{"uuid":{"type":"string","title":"Uuid"}},"type":"object","required":["uuid"],"title":"ApplicationBase"},"ApplicationCreditOptions":{"properties":{"uuid":{"type":"string","title":"Uuid"},"borrower_size":{"$ref":"#/components/schemas/BorrowerSize"},"amount_requested":{"anyOf":[{"type":"number"},{"type":"string"}],"title":"Amount Requested"}},"type":"object","required":["uuid","borrower_size","amount_requested"],"title":"ApplicationCreditOptions"},"ApplicationDeclineFeedbackPayload":{"properties":{"uuid":{"type":"string","title":"Uuid"},"dont_need_access_credit":{"type":"boolean","title":"Dont Need Access Credit"},"already_have_acredit":{"type":"boolean","title":"Already Have Acredit"},"preffer_to_go_to_bank":{"type":"boolean","title":"Preffer To Go To Bank"},"dont_want_access_credit":{"type":"boolean","title":"Dont Want Access Credit"},"suspicious_email":{"type":"boolean","title":"Suspicious Email"},"other":{"type":"boolean","title":"Other"},"other_comments":{"type":"string","title":"Other Comments"}},"type":"object","required":["uuid","dont_need_access_credit","already_have_acredit","preffer_to_go_to_bank","dont_want_access_credit","suspicious_email","other","other_comments"],"title":"ApplicationDeclineFeedbackPayload"},"ApplicationDeclinePayload":{"properties":{"uuid":{"type":"string","title":"Uuid"},"decline_this":{"type":"boolean","title":"Decline This"},"decline_all":{"type":"boolean","title":"Decline All"}},"type":"object","required":["uuid","decline_this","decline_all"],"title":"ApplicationDeclinePayload"},"ApplicationEmailBorrower":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"ApplicationEmailBorrower"},"ApplicationListResponse":{"properties":{"count":{"type":"integer","title":"Count"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"items":{"items":{"$ref":"#/components/schemas/ApplicationWithRelations"},"type":"array","title":"Items"}},"type":"object","required":["count","page","page_size","items"],"title":"ApplicationListResponse"},"ApplicationRead":{"properties":{"uuid":{"type":"string","title":"Uuid"},"primary_email":{"type":"string","title":"Primary Email","default":""},"award_borrower_identifier":{"type":"string","title":"Award Borrower Identifier","default":""},"amount_requested":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Amount Requested"},"currency":{"type":"string","title":"Currency","description":"ISO 4217 currency code","default":"COP"},"repayment_years":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Repayment Years"},"repayment_months":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Repayment Months"},"payment_start_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Payment Start Date"},"calculator_data":{"type":"object","title":"Calculator Data"},"status":{"allOf":[{"$ref":"#/components/schemas/ApplicationStatus"}],"default":"PENDING"},"pending_documents":{"type":"boolean","title":"Pending Documents","default":false},"pending_email_confirmation":{"type":"boolean","title":"Pending Email Confirmation","default":false},"expired_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expired At"},"borrower_declined_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Declined At"},"borrower_declined_preferences_data":{"type":"object","title":"Borrower Declined Preferences Data"},"borrower_declined_data":{"type":"object","title":"Borrower Declined Data"},"borrower_accepted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Accepted At"},"borrower_credit_product_selected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Credit Product Selected At"},"borrower_submitted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Submitted At"},"borrower_accessed_external_onboarding_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Accessed External Onboarding At"},"lender_started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lender Started At"},"information_requested_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Information Requested At"},"lender_rejected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lender Rejected At"},"lender_rejected_data":{"type":"object","title":"Lender Rejected Data"},"lender_approved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lender Approved At"},"lender_approved_data":{"type":"object","title":"Lender Approved Data"},"secop_data_verification":{"type":"object","title":"Secop Data Verification"},"disbursed_final_amount":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Disbursed Final Amount"},"completed_in_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completed In Days"},"overdued_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Overdued At"},"application_lapsed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Application Lapsed At"},"archived_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Archived At"},"award_id":{"type":"integer","title":"Award Id"},"borrower_id":{"type":"integer","title":"Borrower Id"},"lender_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lender Id"},"credit_product_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Credit Product Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-28T21:40:48.403111"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-10-28T21:40:48.403147"},"id":{"type":"integer","title":"Id"}},"type":"object","required":["uuid","amount_requested","repayment_years","repayment_months","payment_start_date","expired_at","borrower_declined_at","borrower_accepted_at","borrower_credit_product_selected_at","borrower_submitted_at","borrower_accessed_external_onboarding_at","lender_started_at","information_requested_at","lender_rejected_at","lender_approved_at","disbursed_final_amount","completed_in_days","overdued_at","application_lapsed_at","archived_at","award_id","borrower_id","lender_id","credit_product_id","id"],"title":"ApplicationRead"},"ApplicationResponse":{"properties":{"application":{"$ref":"#/components/schemas/ApplicationRead"},"borrower":{"$ref":"#/components/schemas/Borrower"},"award":{"$ref":"#/components/schemas/Award"},"lender":{"anyOf":[{"$ref":"#/components/schemas/Lender"},{"type":"null"}]},"documents":{"items":{"$ref":"#/components/schemas/BorrowerDocumentBase"},"type":"array","title":"Documents"},"creditProduct":{"anyOf":[{"$ref":"#/components/schemas/CreditProduct-Output"},{"type":"null"}]}},"type":"object","required":["application","borrower","award"],"title":"ApplicationResponse"},"ApplicationSelectCreditProduct":{"properties":{"uuid":{"type":"string","title":"Uuid"},"borrower_size":{"$ref":"#/components/schemas/BorrowerSize"},"amount_requested":{"anyOf":[{"type":"number"},{"type":"string"}],"title":"Amount Requested"},"sector":{"type":"string","title":"Sector"},"annual_revenue":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}],"title":"Annual Revenue"},"credit_product_id":{"type":"integer","title":"Credit Product Id"},"repayment_years":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Repayment Years"},"repayment_months":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Repayment Months"},"payment_start_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Payment Start Date"}},"type":"object","required":["uuid","borrower_size","amount_requested","sector","credit_product_id"],"title":"ApplicationSelectCreditProduct"},"ApplicationStatus":{"type":"string","enum":["PENDING","DECLINED","ACCEPTED","SUBMITTED","STARTED","REJECTED","INFORMATION_REQUESTED","LAPSED","APPROVED"],"title":"ApplicationStatus","description":"An application status.\n\nThe different workflows are:\n\n- PENDING → LAPSED\n- PENDING → DECLINED\n- PENDING → ACCEPTED → LAPSED\n- PENDING → ACCEPTED → SUBMITTED → STARTED (→ …)\n\nAnd then, from STARTED:\n\n- → INFORMATION_REQUESTED → LAPSED\n- → INFORMATION_REQUESTED → STARTED (→ …)\n- → REJECTED\n- → APPROVED"},"ApplicationWithRelations":{"properties":{"uuid":{"type":"string","title":"Uuid"},"primary_email":{"type":"string","title":"Primary Email","default":""},"award_borrower_identifier":{"type":"string","title":"Award Borrower Identifier","default":""},"amount_requested":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Amount Requested"},"currency":{"type":"string","title":"Currency","description":"ISO 4217 currency code","default":"COP"},"repayment_years":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Repayment Years"},"repayment_months":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Repayment Months"},"payment_start_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Payment Start Date"},"calculator_data":{"type":"object","title":"Calculator Data"},"status":{"allOf":[{"$ref":"#/components/schemas/ApplicationStatus"}],"default":"PENDING"},"pending_documents":{"type":"boolean","title":"Pending Documents","default":false},"pending_email_confirmation":{"type":"boolean","title":"Pending Email Confirmation","default":false},"expired_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expired At"},"borrower_declined_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Declined At"},"borrower_declined_preferences_data":{"type":"object","title":"Borrower Declined Preferences Data"},"borrower_declined_data":{"type":"object","title":"Borrower Declined Data"},"borrower_accepted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Accepted At"},"borrower_credit_product_selected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Credit Product Selected At"},"borrower_submitted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Submitted At"},"borrower_accessed_external_onboarding_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Accessed External Onboarding At"},"lender_started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lender Started At"},"information_requested_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Information Requested At"},"lender_rejected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lender Rejected At"},"lender_rejected_data":{"type":"object","title":"Lender Rejected Data"},"lender_approved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lender Approved At"},"lender_approved_data":{"type":"object","title":"Lender Approved Data"},"secop_data_verification":{"type":"object","title":"Secop Data Verification"},"disbursed_final_amount":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Disbursed Final Amount"},"completed_in_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completed In Days"},"overdued_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Overdued At"},"application_lapsed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Application Lapsed At"},"archived_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Archived At"},"award_id":{"type":"integer","title":"Award Id"},"borrower_id":{"type":"integer","title":"Borrower Id"},"lender_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lender Id"},"credit_product_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Credit Product Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-28T21:40:48.403111"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-10-28T21:40:48.403147"},"id":{"type":"integer","title":"Id"},"borrower":{"anyOf":[{"$ref":"#/components/schemas/BorrowerBase"},{"type":"null"}]},"award":{"anyOf":[{"$ref":"#/components/schemas/AwardBase"},{"type":"null"}]},"lender":{"anyOf":[{"$ref":"#/components/schemas/LenderBase"},{"type":"null"}]},"credit_product":{"anyOf":[{"$ref":"#/components/schemas/CreditProductBase"},{"type":"null"}]},"borrower_documents":{"items":{"$ref":"#/components/schemas/BorrowerDocumentBase"},"type":"array","title":"Borrower Documents"},"modified_data_fields":{"type":"object","title":"Modified Data Fields"}},"type":"object","required":["uuid","amount_requested","repayment_years","repayment_months","payment_start_date","expired_at","borrower_declined_at","borrower_accepted_at","borrower_credit_product_selected_at","borrower_submitted_at","borrower_accessed_external_onboarding_at","lender_started_at","information_requested_at","lender_rejected_at","lender_approved_at","disbursed_final_amount","completed_in_days","overdued_at","application_lapsed_at","archived_at","award_id","borrower_id","lender_id","credit_product_id","id"],"title":"ApplicationWithRelations"},"Award":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"source_contract_id":{"type":"string","title":"Source Contract Id","default":""},"title":{"type":"string","title":"Title","default":""},"description":{"type":"string","title":"Description","default":""},"award_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Award Date"},"award_amount":{"type":"string","title":"Award Amount"},"award_currency":{"type":"string","title":"Award Currency","description":"ISO 4217 currency code","default":"COP"},"contractperiod_startdate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Contractperiod Startdate"},"contractperiod_enddate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Contractperiod Enddate"},"payment_method":{"type":"object","title":"Payment Method"},"buyer_name":{"type":"string","title":"Buyer Name","default":""},"source_url":{"type":"string","title":"Source Url","default":""},"entity_code":{"type":"string","title":"Entity Code","default":""},"contract_status":{"type":"string","title":"Contract Status","default":""},"source_last_updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Source Last Updated At"},"previous":{"type":"boolean","title":"Previous","default":false},"procurement_method":{"type":"string","title":"Procurement Method","default":""},"contracting_process_id":{"type":"string","title":"Contracting Process Id","default":""},"procurement_category":{"type":"string","title":"Procurement Category","default":""},"missing_data":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Missing Data"},"borrower_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Borrower Id"},"source_data_contracts":{"type":"object","title":"Source Data Contracts"},"source_data_awards":{"type":"object","title":"Source Data Awards"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-28T21:40:48.398735"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-10-28T21:40:48.398782"}},"type":"object","required":["award_date","award_amount","contractperiod_startdate","contractperiod_enddate","source_last_updated_at","borrower_id"],"title":"Award","description":"All fields, other than relationships and timestamps, are derived from the data source. In terms of application\nlogic, the fields are (or can be) used in emails to identify the award, like the ``buyer_name`` and ``title``."},"AwardBase":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"source_contract_id":{"type":"string","title":"Source Contract Id","default":""},"title":{"type":"string","title":"Title","default":""},"description":{"type":"string","title":"Description","default":""},"award_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Award Date"},"award_amount":{"type":"string","title":"Award Amount"},"award_currency":{"type":"string","title":"Award Currency","description":"ISO 4217 currency code","default":"COP"},"contractperiod_startdate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Contractperiod Startdate"},"contractperiod_enddate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Contractperiod Enddate"},"payment_method":{"type":"object","title":"Payment Method"},"buyer_name":{"type":"string","title":"Buyer Name","default":""},"source_url":{"type":"string","title":"Source Url","default":""},"entity_code":{"type":"string","title":"Entity Code","default":""},"contract_status":{"type":"string","title":"Contract Status","default":""},"source_last_updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Source Last Updated At"},"previous":{"type":"boolean","title":"Previous","default":false},"procurement_method":{"type":"string","title":"Procurement Method","default":""},"contracting_process_id":{"type":"string","title":"Contracting Process Id","default":""},"procurement_category":{"type":"string","title":"Procurement Category","default":""},"missing_data":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Missing Data"},"borrower_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Borrower Id"}},"type":"object","required":["award_date","award_amount","contractperiod_startdate","contractperiod_enddate","source_last_updated_at","borrower_id"],"title":"AwardBase"},"AwardUpdate":{"properties":{"source_contract_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Contract Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"contracting_process_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contracting Process Id"},"award_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Award Currency"},"award_amount":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}],"title":"Award Amount"},"award_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Award Date"},"payment_method":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Payment Method"},"buyer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Buyer Name"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url"},"entity_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity Code"},"contract_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contract Status"},"contractperiod_startdate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Contractperiod Startdate"},"contractperiod_enddate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Contractperiod Enddate"},"procurement_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Procurement Method"},"procurement_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Procurement Category"}},"type":"object","title":"AwardUpdate"},"BasicUser":{"properties":{"username":{"type":"string","title":"Username"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"password":{"type":"string","title":"Password"},"temp_password":{"type":"string","title":"Temp Password"}},"type":"object","required":["username","password","temp_password"],"title":"BasicUser"},"Body_upload_document_applications_upload_document_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"},"type":{"type":"string","title":"Type"},"uuid":{"type":"string","title":"Uuid"}},"type":"object","required":["file","type","uuid"],"title":"Body_upload_document_applications_upload_document_post"},"Borrower":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"borrower_identifier":{"type":"string","title":"Borrower Identifier","default":""},"declined_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Declined At"},"legal_name":{"type":"string","title":"Legal Name","default":""},"email":{"type":"string","title":"Email","default":""},"address":{"type":"string","title":"Address","default":""},"legal_identifier":{"type":"string","title":"Legal Identifier","default":""},"type":{"type":"string","title":"Type","default":""},"is_msme":{"type":"boolean","title":"Is Msme","default":true},"missing_data":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Missing Data"},"size":{"allOf":[{"$ref":"#/components/schemas/BorrowerSize"}],"default":"NOT_INFORMED"},"sector":{"type":"string","title":"Sector","default":""},"annual_revenue":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Annual Revenue"},"currency":{"type":"string","title":"Currency","description":"ISO 4217 currency code","default":"COP"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-28T21:40:48.391164"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-10-28T21:40:48.391206"},"source_data":{"type":"object","title":"Source Data"},"status":{"allOf":[{"$ref":"#/components/schemas/BorrowerStatus"}],"default":"ACTIVE"}},"type":"object","required":["declined_at","annual_revenue"],"title":"Borrower","description":"Most fields are derived from the data source. In terms of application logic, those fields are (or can be) used in\nemails to the borrower, like the ``legal_identifier`` and ``legal_name``."},"BorrowerBase":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"borrower_identifier":{"type":"string","title":"Borrower Identifier","default":""},"declined_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Declined At"},"legal_name":{"type":"string","title":"Legal Name","default":""},"email":{"type":"string","title":"Email","default":""},"address":{"type":"string","title":"Address","default":""},"legal_identifier":{"type":"string","title":"Legal Identifier","default":""},"type":{"type":"string","title":"Type","default":""},"is_msme":{"type":"boolean","title":"Is Msme","default":true},"missing_data":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Missing Data"},"size":{"allOf":[{"$ref":"#/components/schemas/BorrowerSize"}],"default":"NOT_INFORMED"},"sector":{"type":"string","title":"Sector","default":""},"annual_revenue":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Annual Revenue"},"currency":{"type":"string","title":"Currency","description":"ISO 4217 currency code","default":"COP"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-28T21:40:48.391164"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-10-28T21:40:48.391206"}},"type":"object","required":["declined_at","annual_revenue"],"title":"BorrowerBase"},"BorrowerDocumentBase":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"type":{"$ref":"#/components/schemas/BorrowerDocumentType"},"verified":{"type":"boolean","title":"Verified","default":false},"name":{"type":"string","title":"Name","default":""},"submitted_at":{"type":"string","format":"date-time","title":"Submitted At","default":"2024-10-28T21:40:48.417853"},"application_id":{"type":"integer","title":"Application Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-28T21:40:48.417903"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-10-28T21:40:48.417930"}},"type":"object","required":["type","application_id"],"title":"BorrowerDocumentBase"},"BorrowerDocumentType":{"type":"string","enum":["INCORPORATION_DOCUMENT","SUPPLIER_REGISTRATION_DOCUMENT","BANK_NAME","BANK_CERTIFICATION_DOCUMENT","FINANCIAL_STATEMENT","SIGNED_CONTRACT","SHAREHOLDER_COMPOSITION","CHAMBER_OF_COMMERCE","THREE_LAST_BANK_STATEMENT","INCOME_TAX_RETURN_STATEMENT","CHAMBER_OF_COMMERCE_WITH_TEMPORARY_UNIONS"],"title":"BorrowerDocumentType"},"BorrowerSize":{"type":"string","enum":["NOT_INFORMED","MICRO","SMALL","MEDIUM","BIG"],"title":"BorrowerSize"},"BorrowerStatus":{"type":"string","enum":["ACTIVE","DECLINE_OPPORTUNITIES"],"title":"BorrowerStatus"},"BorrowerUpdate":{"properties":{"legal_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"legal_identifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Identifier"},"type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"sector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sector"},"size":{"anyOf":[{"$ref":"#/components/schemas/BorrowerSize"},{"type":"null"}]}},"type":"object","title":"BorrowerUpdate"},"ChangeEmail":{"properties":{"uuid":{"type":"string","title":"Uuid"},"new_email":{"type":"string","title":"New Email"}},"type":"object","required":["uuid","new_email"],"title":"ChangeEmail"},"ChangePasswordResponse":{"properties":{"detail":{"type":"string","title":"Detail"},"secret_code":{"type":"string","title":"Secret Code"},"session":{"type":"string","title":"Session"},"username":{"type":"string","title":"Username"}},"type":"object","required":["detail","secret_code","session","username"],"title":"ChangePasswordResponse"},"ConfirmNewEmail":{"properties":{"uuid":{"type":"string","title":"Uuid"},"confirmation_email_token":{"type":"string","title":"Confirmation Email Token"}},"type":"object","required":["uuid","confirmation_email_token"],"title":"ConfirmNewEmail"},"CreditProduct-Input":{"properties":{"borrower_size":{"$ref":"#/components/schemas/BorrowerSize"},"borrower_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Borrower Types"},"lower_limit":{"anyOf":[{"type":"number"},{"type":"string"}],"title":"Lower Limit"},"upper_limit":{"anyOf":[{"type":"number"},{"type":"string"}],"title":"Upper Limit"},"procurement_category_to_exclude":{"type":"string","title":"Procurement Category To Exclude","default":""},"type":{"$ref":"#/components/schemas/CreditType"},"required_document_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Required Document Types"},"interest_rate":{"type":"string","title":"Interest Rate","default":""},"additional_information":{"type":"string","title":"Additional Information","default":""},"other_fees_total_amount":{"anyOf":[{"type":"number"},{"type":"string"}],"title":"Other Fees Total Amount"},"other_fees_description":{"type":"string","title":"Other Fees Description","default":""},"more_info_url":{"type":"string","title":"More Info Url","default":""},"lender_id":{"type":"integer","title":"Lender Id"},"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-28T21:40:48.387606"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-10-28T21:40:48.387658"}},"type":"object","required":["borrower_size","lower_limit","upper_limit","type","other_fees_total_amount","lender_id"],"title":"CreditProduct"},"CreditProduct-Output":{"properties":{"borrower_size":{"$ref":"#/components/schemas/BorrowerSize"},"borrower_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Borrower Types"},"lower_limit":{"type":"string","title":"Lower Limit"},"upper_limit":{"type":"string","title":"Upper Limit"},"procurement_category_to_exclude":{"type":"string","title":"Procurement Category To Exclude","default":""},"type":{"$ref":"#/components/schemas/CreditType"},"required_document_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Required Document Types"},"interest_rate":{"type":"string","title":"Interest Rate","default":""},"additional_information":{"type":"string","title":"Additional Information","default":""},"other_fees_total_amount":{"type":"string","title":"Other Fees Total Amount"},"other_fees_description":{"type":"string","title":"Other Fees Description","default":""},"more_info_url":{"type":"string","title":"More Info Url","default":""},"lender_id":{"type":"integer","title":"Lender Id"},"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-28T21:40:48.387606"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-10-28T21:40:48.387658"}},"type":"object","required":["borrower_size","lower_limit","upper_limit","type","other_fees_total_amount","lender_id"],"title":"CreditProduct"},"CreditProductBase":{"properties":{"borrower_size":{"$ref":"#/components/schemas/BorrowerSize"},"borrower_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Borrower Types"},"lower_limit":{"type":"string","title":"Lower Limit"},"upper_limit":{"type":"string","title":"Upper Limit"},"procurement_category_to_exclude":{"type":"string","title":"Procurement Category To Exclude","default":""},"type":{"$ref":"#/components/schemas/CreditType"},"required_document_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Required Document Types"},"interest_rate":{"type":"string","title":"Interest Rate","default":""},"additional_information":{"type":"string","title":"Additional Information","default":""},"other_fees_total_amount":{"type":"string","title":"Other Fees Total Amount"},"other_fees_description":{"type":"string","title":"Other Fees Description","default":""},"more_info_url":{"type":"string","title":"More Info Url","default":""},"lender_id":{"type":"integer","title":"Lender Id"}},"type":"object","required":["borrower_size","lower_limit","upper_limit","type","other_fees_total_amount","lender_id"],"title":"CreditProductBase"},"CreditProductListResponse":{"properties":{"loans":{"items":{"$ref":"#/components/schemas/CreditProductWithLender"},"type":"array","title":"Loans"},"credit_lines":{"items":{"$ref":"#/components/schemas/CreditProductWithLender"},"type":"array","title":"Credit Lines"}},"type":"object","required":["loans","credit_lines"],"title":"CreditProductListResponse"},"CreditProductWithLender":{"properties":{"borrower_size":{"$ref":"#/components/schemas/BorrowerSize"},"borrower_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Borrower Types"},"lower_limit":{"type":"string","title":"Lower Limit"},"upper_limit":{"type":"string","title":"Upper Limit"},"procurement_category_to_exclude":{"type":"string","title":"Procurement Category To Exclude","default":""},"type":{"$ref":"#/components/schemas/CreditType"},"required_document_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Required Document Types"},"interest_rate":{"type":"string","title":"Interest Rate","default":""},"additional_information":{"type":"string","title":"Additional Information","default":""},"other_fees_total_amount":{"type":"string","title":"Other Fees Total Amount"},"other_fees_description":{"type":"string","title":"Other Fees Description","default":""},"more_info_url":{"type":"string","title":"More Info Url","default":""},"lender_id":{"type":"integer","title":"Lender Id"},"id":{"type":"integer","title":"Id"},"lender":{"anyOf":[{"$ref":"#/components/schemas/LenderRead"},{"type":"null"}]}},"type":"object","required":["borrower_size","lower_limit","upper_limit","type","other_fees_total_amount","lender_id","id"],"title":"CreditProductWithLender"},"CreditType":{"type":"string","enum":["LOAN","CREDIT_LINE"],"title":"CreditType"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"Lender":{"properties":{"name":{"type":"string","title":"Name","default":""},"email_group":{"type":"string","title":"Email Group","default":""},"type":{"type":"string","title":"Type","default":""},"logo_filename":{"type":"string","title":"Logo Filename","default":""},"sla_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sla Days"},"external_onboarding_url":{"type":"string","title":"External Onboarding Url","default":""},"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"status":{"type":"string","title":"Status","default":""},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-28T21:40:48.382402"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-10-28T21:40:48.382493"}},"type":"object","required":["sla_days","deleted_at"],"title":"Lender"},"LenderApprovedData":{"properties":{"compliant_checks_completed":{"type":"boolean","title":"Compliant Checks Completed"},"compliant_checks_passed":{"type":"boolean","title":"Compliant Checks Passed"},"disbursed_final_amount":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string"}],"title":"Disbursed Final Amount"}},"type":"object","required":["compliant_checks_completed","compliant_checks_passed","disbursed_final_amount"],"title":"LenderApprovedData"},"LenderBase":{"properties":{"name":{"type":"string","title":"Name","default":""},"email_group":{"type":"string","title":"Email Group","default":""},"type":{"type":"string","title":"Type","default":""},"logo_filename":{"type":"string","title":"Logo Filename","default":""},"sla_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sla Days"},"external_onboarding_url":{"type":"string","title":"External Onboarding Url","default":""}},"type":"object","required":["sla_days"],"title":"LenderBase"},"LenderCreate":{"properties":{"name":{"type":"string","title":"Name","default":""},"email_group":{"type":"string","title":"Email Group","default":""},"type":{"type":"string","title":"Type","default":""},"logo_filename":{"type":"string","title":"Logo Filename","default":""},"sla_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sla Days"},"external_onboarding_url":{"type":"string","title":"External Onboarding Url","default":""},"credit_products":{"anyOf":[{"items":{"$ref":"#/components/schemas/CreditProduct-Input"},"type":"array"},{"type":"null"}],"title":"Credit Products"}},"type":"object","required":["sla_days"],"title":"LenderCreate"},"LenderListResponse":{"properties":{"count":{"type":"integer","title":"Count"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"items":{"items":{"$ref":"#/components/schemas/Lender"},"type":"array","title":"Items"}},"type":"object","required":["count","page","page_size","items"],"title":"LenderListResponse"},"LenderRead":{"properties":{"name":{"type":"string","title":"Name","default":""},"email_group":{"type":"string","title":"Email Group","default":""},"type":{"type":"string","title":"Type","default":""},"logo_filename":{"type":"string","title":"Logo Filename","default":""},"sla_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sla Days"},"external_onboarding_url":{"type":"string","title":"External Onboarding Url","default":""},"id":{"type":"integer","title":"Id"}},"type":"object","required":["sla_days","id"],"title":"LenderRead"},"LenderRejectedApplication":{"properties":{"compliance_checks_failed":{"type":"boolean","title":"Compliance Checks Failed"},"poor_credit_history":{"type":"boolean","title":"Poor Credit History"},"risk_of_fraud":{"type":"boolean","title":"Risk Of Fraud"},"other":{"type":"boolean","title":"Other"},"other_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Other Reason"}},"type":"object","required":["compliance_checks_failed","poor_credit_history","risk_of_fraud","other"],"title":"LenderRejectedApplication"},"LenderWithRelations":{"properties":{"name":{"type":"string","title":"Name","default":""},"email_group":{"type":"string","title":"Email Group","default":""},"type":{"type":"string","title":"Type","default":""},"logo_filename":{"type":"string","title":"Logo Filename","default":""},"sla_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sla Days"},"external_onboarding_url":{"type":"string","title":"External Onboarding Url","default":""},"id":{"type":"integer","title":"Id"},"credit_products":{"anyOf":[{"items":{"$ref":"#/components/schemas/CreditProduct-Output"},"type":"array"},{"type":"null"}],"title":"Credit Products"}},"type":"object","required":["sla_days","id"],"title":"LenderWithRelations"},"LoginResponse":{"properties":{"user":{"$ref":"#/components/schemas/User"},"access_token":{"type":"string","title":"Access Token"},"refresh_token":{"type":"string","title":"Refresh Token"}},"type":"object","required":["user","access_token","refresh_token"],"title":"LoginResponse"},"ResetPassword":{"properties":{"username":{"type":"string","title":"Username"}},"type":"object","required":["username"],"title":"ResetPassword"},"ResponseBase":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"ResponseBase"},"SetupMFA":{"properties":{"temp_password":{"type":"string","title":"Temp Password"},"session":{"type":"string","title":"Session"},"secret":{"type":"string","title":"Secret"}},"type":"object","required":["temp_password","session","secret"],"title":"SetupMFA"},"SortOrder":{"type":"string","enum":["asc","desc"],"title":"SortOrder"},"StatisticOptInResponse":{"properties":{"opt_in_stat":{"type":"object","title":"Opt In Stat"}},"type":"object","required":["opt_in_stat"],"title":"StatisticOptInResponse"},"StatisticRange":{"type":"string","enum":["CUSTOM_RANGE","LAST_WEEK","LAST_MONTH"],"title":"StatisticRange"},"StatisticResponse":{"properties":{"statistics_kpis":{"type":"object","title":"Statistics Kpis"}},"type":"object","required":["statistics_kpis"],"title":"StatisticResponse"},"UpdateDataField":{"properties":{"legal_name":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Legal Name"},"email":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Email"},"address":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Address"},"legal_identifier":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Legal Identifier"},"type":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Type"}},"type":"object","title":"UpdateDataField"},"User":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"type":{"allOf":[{"$ref":"#/components/schemas/UserType"}],"default":"FI"},"language":{"type":"string","title":"Language","description":"ISO 639-1 language code","default":"es"},"email":{"type":"string","title":"Email"},"notification_preferences":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Notification Preferences"},"name":{"type":"string","title":"Name","default":""},"external_id":{"type":"string","title":"External Id","default":""},"lender_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lender Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-28T21:40:48.425726"}},"type":"object","required":["email"],"title":"User"},"UserListResponse":{"properties":{"count":{"type":"integer","title":"Count"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"items":{"items":{"$ref":"#/components/schemas/UserWithLender"},"type":"array","title":"Items"}},"type":"object","required":["count","page","page_size","items"],"title":"UserListResponse"},"UserResponse":{"properties":{"user":{"$ref":"#/components/schemas/User"}},"type":"object","required":["user"],"title":"UserResponse"},"UserType":{"type":"string","enum":["OCP","FI"],"title":"UserType"},"UserWithLender":{"properties":{"id":{"type":"integer","title":"Id"},"type":{"allOf":[{"$ref":"#/components/schemas/UserType"}],"default":"FI"},"language":{"type":"string","title":"Language","description":"ISO 639-1 language code","default":"es"},"email":{"type":"string","title":"Email"},"notification_preferences":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Notification Preferences"},"name":{"type":"string","title":"Name","default":""},"external_id":{"type":"string","title":"External Id","default":""},"lender_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lender Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-28T21:40:48.425726"},"lender":{"anyOf":[{"$ref":"#/components/schemas/LenderBase"},{"type":"null"}]}},"type":"object","required":["id","email"],"title":"UserWithLender"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VerifyBorrowerDocument":{"properties":{"verified":{"type":"boolean","title":"Verified"}},"type":"object","required":["verified"],"title":"VerifyBorrowerDocument"}}}} \ No newline at end of file +{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/users":{"post":{"tags":["users"],"summary":"Create User","description":"Create a new user in Cognito.\n\nEmail the user a temporary password.\n\nAccessible only to users with the OCP role.","operationId":"create_user_users_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["users"],"summary":"Get All Users","description":"Retrieve a list of users.\n\nThis endpoint retrieves a list of users, paginated and sorted based on the provided parameters.","operationId":"get_all_users_users_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"default":10,"title":"Page Size"}},{"name":"sort_field","in":"query","required":false,"schema":{"type":"string","default":"created_at","title":"Sort Field"}},{"name":"sort_order","in":"query","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/SortOrder"}],"default":"asc","title":"Sort Order"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/change-password":{"put":{"tags":["authentication"],"summary":"Change Password","description":"Change user password.\n\nThis endpoint allows users to change their password. It initiates the password change process\nand handles different scenarios such as new password requirement, MFA setup, and error handling.","operationId":"change_password_users_change_password_put","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasicUser"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ChangePasswordResponse"},{"$ref":"#/components/schemas/ResponseBase"}],"title":"Response Change Password Users Change Password Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/setup-mfa":{"put":{"tags":["authentication"],"summary":"Setup Mfa","description":"Set up multi-factor authentication (MFA) for the user.","operationId":"setup_mfa_users_setup_mfa_put","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupMFA"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseBase"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/login":{"post":{"tags":["authentication"],"summary":"Login","description":"Authenticate the user with Multi-Factor Authentication (MFA) and generate access and refresh tokens.\n\nThis endpoint handles user login and authentication with MFA. It initiates the authentication\nprocess using the provided username and password. If the authentication process requires MFA,\nit responds to the MFA challenge by providing the MFA code. If the authentication is successful,\nit returns the user information along with the generated access and refresh tokens.\n\n:param payload: The user data including the username, password, and MFA code.\n:return: The response containing the user information and tokens if the login is successful.","operationId":"login_users_login_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasicUser"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/logout":{"get":{"tags":["authentication"],"summary":"Logout","description":"Logout the user from all devices in Cognito.","operationId":"logout_users_logout_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseBase"}}}}}}},"/users/me":{"get":{"tags":["authentication"],"summary":"Me","description":"Get the details of the currently authenticated user.\n\nThis endpoint retrieves the details of the currently authenticated user.\nIt uses the username extracted from the JWT token to query the database\nand retrieve the user details.","operationId":"me_users_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserResponse"}}}}}}},"/users/forgot-password":{"post":{"tags":["authentication"],"summary":"Forgot Password","description":"Initiate the process of resetting a user's password.\n\nEmail the user a temporary password and a reset link.","operationId":"forgot_password_users_forgot_password_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPassword"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseBase"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/{user_id}":{"get":{"tags":["users"],"summary":"Get User","description":"Retrieve information about a user.\n\nThis endpoint retrieves information about a user based on their user_id.","operationId":"get_user_users__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["users"],"summary":"Update User","description":"Update a user's information.\n\nThis endpoint updates the information of a specific user identified by the provided ID.","operationId":"update_user_users__user_id__put","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserWithLender"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/reject-application":{"post":{"tags":["applications"],"summary":"Reject Application","description":"Reject an application.\n\nChanges application status from \"STARTED\" to \"REJECTED\".\n\n:param payload: The rejected application data.\n:return: The rejected application with its associated relations.","operationId":"reject_application_applications__id__reject_application_post","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LenderRejectedApplication"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/approve-application":{"post":{"tags":["applications"],"summary":"Approve Application","description":"Approve an application.\n\nChange application status from \"STARTED\" to \"APPROVED\". Notify the borrower of the approval.\n\n:param payload: The approved application data.\n:return: The approved application with its associated relations.","operationId":"approve_application_applications__id__approve_application_post","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LenderApprovedData"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/verify-data-field":{"put":{"tags":["applications"],"summary":"Verify Data Field","description":"Verify and update a data field in an application.\n\n:param payload: The data field update payload.\n:return: The updated application with its associated relations.","operationId":"verify_data_field_applications__id__verify_data_field_put","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDataField"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/documents/{document_id}/verify-document":{"put":{"tags":["applications"],"summary":"Verify Document","description":"Verify a borrower document in an application.\n\n:param document_id: The ID of the borrower document.\n:param payload: The document verification payload.\n:return: The updated application with its associated relations.","operationId":"verify_document_applications_documents__document_id__verify_document_put","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"integer","title":"Document Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyBorrowerDocument"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/award":{"put":{"tags":["applications"],"summary":"Update Application Award","description":"Update the award details of an application.\n\n:param payload: The award update payload.\n:return: The updated application with its associated relations.","operationId":"update_application_award_applications__id__award_put","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AwardUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/borrower":{"put":{"tags":["applications"],"summary":"Update Application Borrower","description":"Update the borrower details of an application.\n\n:param payload: The borrower update payload.\n:return: The updated application with its associated relations.","operationId":"update_application_borrower_applications__id__borrower_put","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BorrowerUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/admin-list":{"get":{"tags":["applications"],"summary":"Get Applications List","description":"Get a paginated list of submitted applications for administrative purposes.","operationId":"get_applications_list_applications_admin_list_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"default":10,"title":"Page Size"}},{"name":"sort_field","in":"query","required":false,"schema":{"type":"string","default":"application.borrower_submitted_at","title":"Sort Field"}},{"name":"sort_order","in":"query","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/SortOrder"}],"default":"asc","title":"Sort Order"}},{"name":"search_value","in":"query","required":false,"schema":{"type":"string","default":"","title":"Search Value"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications":{"get":{"tags":["applications"],"summary":"Get Applications","description":"Get a paginated list of submitted applications for a specific lender user.","operationId":"get_applications_applications_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"default":10,"title":"Page Size"}},{"name":"sort_field","in":"query","required":false,"schema":{"type":"string","default":"application.borrower_submitted_at","title":"Sort Field"}},{"name":"sort_order","in":"query","required":false,"schema":{"allOf":[{"$ref":"#/components/schemas/SortOrder"}],"default":"asc","title":"Sort Order"}},{"name":"search_value","in":"query","required":false,"schema":{"type":"string","default":"","title":"Search Value"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/id/{id}":{"get":{"tags":["applications"],"summary":"Get Application","description":"Retrieve an application by its ID.\n\n:return: The application with the specified ID and its associated relations.\n:raise: HTTPException if the user is not authorized to view the application.","operationId":"get_application_applications_id__id__get","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/start":{"post":{"tags":["applications"],"summary":"Start Application","description":"Start an application.\n\nChange application status from \"SUBMITTED\" to \"STARTED\".\n\n:param id: The ID of the application to start.\n:return: The started application with its associated relations.\n:raise: HTTPException if the user is not authorized to start the application.","operationId":"start_application_applications__id__start_post","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/email-sme/{id}":{"post":{"tags":["applications"],"summary":"Email Borrower","description":"Send an email to the borrower and update the application status.\n\nChange application status from \"STARTED\" to \"INFORMATION_REQUESTED\". Notify the borrower of the request.\n\n:param payload: The payload containing the message to send to the borrower.\n:return: The updated application with its associated relations.\n:raises HTTPException: If there's an error in sending the email to the borrower.","operationId":"email_borrower_applications_email_sme__id__post","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationEmailBorrower"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/previous-awards":{"get":{"tags":["applications"],"summary":"Previous Contracts","description":"Get the previous awards associated with an application.\n\n:return: A list of previous awards associated with the application.\n:raise: HTTPException if the user is not authorized to access the application.","operationId":"previous_contracts_applications__id__previous_awards_get","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Award"},"title":"Response Previous Contracts Applications Id Previous Awards Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/lapse":{"post":{"tags":["applications"],"summary":"Lapse Application","description":":param id: The ID of the application to lapse.\n:return: The lapsed application with its associated relations.\n:raise: HTTPException if the user is not authorized to lapse the application.","operationId":"lapse_application_applications__id__lapse_post","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/uuid/{uuid}":{"get":{"tags":["applications"],"summary":"Application By Uuid","description":"Retrieve an application by its UUID.\n\n:return: The application with the specified UUID and its associated entities.\n:raise: HTTPException if the application is expired.","operationId":"application_by_uuid_applications_uuid__uuid__get","parameters":[{"name":"uuid","in":"path","required":true,"schema":{"type":"string","title":"Uuid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/decline":{"post":{"tags":["applications"],"summary":"Decline","description":"Decline an application.\n\nChanges application status from \"PENDING\" to \"DECLINED\".\n\n:param payload: The application decline payload.\n:return: The application response containing the updated application, borrower, and award.\n:raise: HTTPException if the application is not in the PENDING status.","operationId":"decline_applications_decline_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationDeclinePayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/rollback-decline":{"post":{"tags":["applications"],"summary":"Rollback Decline","description":"Rollback the decline of an application.\n\n:param payload: The application base payload.\n:return: The application response containing the updated application, borrower, and award.\n:raise: HTTPException if the application is not in the DECLINED status.","operationId":"rollback_decline_applications_rollback_decline_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/decline-feedback":{"post":{"tags":["applications"],"summary":"Decline Feedback","description":"Provide feedback for a declined application.\n\n:param payload: The application decline feedback payload.\n:return: The application response containing the updated application, borrower, and award.\n:raise: HTTPException if the application is not in the DECLINED status.","operationId":"decline_feedback_applications_decline_feedback_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationDeclineFeedbackPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/access-scheme":{"post":{"tags":["applications"],"summary":"Access Scheme","description":"Access the scheme for an application.\n\nChanges the status from PENDING to ACCEPTED.\n\nSearch for previous awards for the borrower and add them to the application.\n\n:param payload: The application data.\n:return: The application response containing the updated application, borrower, and award.\n:raise: HTTPException if the application is expired or not in the PENDING status.","operationId":"access_scheme_applications_access_scheme_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/credit-product-options":{"post":{"tags":["applications"],"summary":"Credit Product Options","description":"Get the available credit product options for an application.\n\n:param payload: The application credit options.\n:return: The credit product list response containing the available loans and credit lines.\n:raise: HTTPException if the application is expired, not in the ACCEPTED status, or if the\n previous lenders are not found.","operationId":"credit_product_options_applications_credit_product_options_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationCreditOptions"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProductListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/select-credit-product":{"post":{"tags":["applications"],"summary":"Select Credit Product","description":"Select a credit product for an application.\n\n:param payload: The application credit product selection payload.\n:return: The application response containing the updated application, borrower, award, lender, documents, and\n credit product.\n:raise: HTTPException if the application is expired, not in the ACCEPTED status, or if the\n calculator data is invalid.","operationId":"select_credit_product_applications_select_credit_product_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationSelectCreditProduct"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/rollback-select-credit-product":{"post":{"tags":["applications"],"summary":"Rollback Select Credit Product","description":"Rollback the selection of a credit product for an application.\n\n:param payload: The application data.\n:return: The application response containing the updated application, borrower, and award.\n:raise: HTTPException if the credit product is not selected or if the lender is already\n assigned.","operationId":"rollback_select_credit_product_applications_rollback_select_credit_product_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/confirm-credit-product":{"post":{"tags":["applications"],"summary":"Confirm Credit Product","description":"Confirm the selected credit product for an application.\n\n:param payload: The application data.\n:return: The application response containing the updated application, borrower, award, lender, documents, and\n credit product.\n:raise: HTTPException if the credit product is not selected or not found.","operationId":"confirm_credit_product_applications_confirm_credit_product_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/rollback-confirm-credit-product":{"post":{"tags":["applications"],"summary":"Rollback Confirm Credit Product","description":"Rollback the confirmation of the selected credit product for an application.\n\n:param payload: The application data.\n:return: The application response containing the updated application, borrower, award, lender, documents, and\n credit product.\n:raise: HTTPException if the credit product is not selected or not found.","operationId":"rollback_confirm_credit_product_applications_rollback_confirm_credit_product_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/submit":{"post":{"tags":["applications"],"summary":"Update Apps Send Notifications","description":"Change application status from \"'ACCEPTED\" to \"SUBMITTED\". Send a notification to OCP and lender user.\n\nThis operation also ensures that the credit product and lender are selected before updating the status.\n\n:param payload: The application data to update.\n:return: The updated application with borrower, award and lender details.\n:raises HTTPException: If credit product or lender is not selected, or if there's an error in submitting the\n application.","operationId":"update_apps_send_notifications_applications_submit_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/upload-document":{"post":{"tags":["applications"],"summary":"Upload Document","description":"Upload a document for an application.\n\n:param file: The uploaded file.\n:param type: The type of the document.\n:return: The created or updated borrower document.","operationId":"upload_document_applications_upload_document_post","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_document_applications_upload_document_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BorrowerDocumentBase"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/complete-information-request":{"post":{"tags":["applications"],"summary":"Complete Information Request","description":"Complete the information request for an application.\n\nChanges application status from \"INFORMATION REQUESTED\" to \"STARTED\" and update the pending documents status.\n\nThis operation also sends a notification about the uploaded documents to the lender.\n\n:param payload: The application data to update.\n:return: The updated application with borrower, award, lender, and documents details.","operationId":"complete_information_request_applications_complete_information_request_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/find-alternative-credit-option":{"post":{"tags":["applications"],"summary":"Find Alternative Credit Option","description":"Find an alternative credit option for a rejected application by copying it.\n\n:param payload: The payload containing the UUID of the rejected application.\n:param client: The Cognito client for sending notifications.\n:return: The newly created application as an alternative credit option.\n:raise: HTTPException if the application has already been copied.\n:raise: HTTPException if the application is not in the rejected status.","operationId":"find_alternative_credit_option_applications_find_alternative_credit_option_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/uuid/{uuid}/access-external-onboarding":{"get":{"tags":["applications"],"summary":"Access External Onboarding","description":":return: A redirect to the lender.external_onboarding_url.\n:raise: HTTPException if the application has a lender without an external_onboarding_url.","operationId":"access_external_onboarding_applications_uuid__uuid__access_external_onboarding_get","parameters":[{"name":"uuid","in":"path","required":true,"schema":{"type":"string","title":"Uuid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/uuid/{uuid}/accessed-external-onboarding":{"get":{"tags":["applications"],"summary":"Accessed External Onboarding","description":"Report having started external onboarding.\n\n:return: A redirect to the frontend's external-onboarding-completed page.\n:raise: HTTPException if the application has a lender without an external_onboarding_url.","operationId":"accessed_external_onboarding_applications_uuid__uuid__accessed_external_onboarding_get","parameters":[{"name":"uuid","in":"path","required":true,"schema":{"type":"string","title":"Uuid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/change-email":{"post":{"tags":["applications"],"summary":"Change Email","description":"Change the email address for an application.\n\n:param payload: The data for changing the email address.\n:return: The data for changing the email address.","operationId":"change_email_applications_change_email_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeEmail"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeEmail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/confirm-change-email":{"post":{"tags":["applications"],"summary":"Confirm Email","description":"Confirm the email address change for an application.\n\n:param payload: The data for confirming the email address change.\n:return: The data for confirming the email address change.","operationId":"confirm_email_applications_confirm_change_email_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmNewEmail"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeEmail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/meta":{"get":{"tags":["meta"],"summary":"Get Settings By Domain","description":"Get the keys and localized descriptions of constants.\n\nA constant can be:\n- ApplicationStatus\n- BorrowerDocumentType\n- BorrowerSector\n- BorrowerSize\n- BorrowerType\n\n:return: A dict of constants with their keys and localized values.","operationId":"get_settings_by_domain_meta_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"array","items":{"type":"object","additionalProperties":{"type":"string"}}},"title":"Response Get Settings By Domain Meta Get"}}}}}}},"/applications/documents/id/{document_id}":{"get":{"tags":["applications"],"summary":"Get Borrower Document","description":"Retrieve a borrower document by its ID and stream the file content as a response.\n\n:param document_id: The ID of the borrower document to retrieve.\n:return: A streaming response with the borrower document file content.","operationId":"get_borrower_document_applications_documents_id__document_id__get","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"integer","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/{id}/download-application/{lang}":{"get":{"tags":["applications"],"summary":"Download Application","description":"Retrieve all documents related to an application and stream them as a zip file.\n\n:return: A streaming response with a zip file containing the documents.","operationId":"download_application_applications__id__download_application__lang__get","parameters":[{"name":"lang","in":"path","required":true,"schema":{"type":"string","title":"Lang"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/applications/export/{lang}":{"get":{"tags":["applications"],"summary":"Export Applications","operationId":"export_applications_applications_export__lang__get","parameters":[{"name":"lang","in":"path","required":true,"schema":{"type":"string","title":"Lang"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/lenders":{"post":{"tags":["lenders"],"summary":"Create Lender","description":"Create a new lender.\n\n:param payload: The lender data to be created.\n:return: The created lender.\n:raise: lumache.OCPOnlyError if the current user is not authorized.","operationId":"create_lender_lenders_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LenderCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lender"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["lenders"],"summary":"Get Lenders List","description":"Get the list of all lenders.\n\n:return: The list of all lenders.","operationId":"get_lenders_list_lenders_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LenderListResponse"}}}}}}},"/lenders/{lender_id}/credit-products":{"post":{"tags":["lenders"],"summary":"Create Credit Products","description":"Create a new credit product for a specific lender.\n\n:param payload: The credit product data to be created.\n:param lender_id: The ID of the lender for which the credit product will be created.\n:return: The created credit product.\n:raise: lumache.OCPOnlyError if the current user is not authorized.","operationId":"create_credit_products_lenders__lender_id__credit_products_post","parameters":[{"name":"lender_id","in":"path","required":true,"schema":{"type":"integer","title":"Lender Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProduct-Input"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProduct-Output"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/lenders/{lender_id}":{"get":{"tags":["lenders"],"summary":"Get Lender","description":"Retrieve a lender by its ID.\n\n:param lender_id: The ID of the lender to retrieve.\n:return: The lender with the specified ID.\n:raise: HTTPException if the lender is not found.","operationId":"get_lender_lenders__lender_id__get","parameters":[{"name":"lender_id","in":"path","required":true,"schema":{"type":"integer","title":"Lender Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LenderWithRelations"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["lenders"],"summary":"Update Lender","description":"Update an existing lender.\n\n:param lender_id: The ID of the lender to update.\n:param payload: The data to update the lender with.\n:return: The updated lender.\n:raise: lumache.OCPOnlyError if the current user is not authorized.","operationId":"update_lender_lenders__lender_id__put","parameters":[{"name":"lender_id","in":"path","required":true,"schema":{"type":"integer","title":"Lender Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LenderBase"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lender"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/procurement-categories":{"get":{"tags":["lenders"],"summary":"Get Procurement Categories From Source","description":"Get the list of the existing procurement categories from the source.\n\n:return: The list of existing procurement categories.","operationId":"get_procurement_categories_from_source_procurement_categories_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"},"title":"Response Get Procurement Categories From Source Procurement Categories Get"}}}}}}},"/credit-products/{credit_product_id}":{"get":{"tags":["lenders"],"summary":"Get Credit Product","description":"Retrieve a credit product by its ID, including its associated lender information.\n\n:param credit_product_id: The ID of the credit product to retrieve.\n:return: The credit product with the specified ID and its associated lender information.\n:raise: HTTPException if the credit product is not found.","operationId":"get_credit_product_credit_products__credit_product_id__get","parameters":[{"name":"credit_product_id","in":"path","required":true,"schema":{"type":"integer","title":"Credit Product Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProductWithLender"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["lenders"],"summary":"Update Credit Products","description":"Update an existing credit product.\n\n:param payload: The credit product data to update.\n:param credit_product_id: The ID of the credit product to update.\n:return: The updated credit product.\n:raise: lumache.OCPOnlyError if the current user is not authorized.","operationId":"update_credit_products_credit_products__credit_product_id__put","parameters":[{"name":"credit_product_id","in":"path","required":true,"schema":{"type":"integer","title":"Credit Product Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProduct-Input"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProduct-Output"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/statistics-ocp":{"get":{"tags":["statistics"],"summary":"Get Admin Statistics By Lender","description":"Retrieve OCP statistics by lender.\n\nThis secure endpoint is accessible only to users with the OCP role. It retrieves statistics for admins\nbased on the specified filters:\n- initial_date (optional): The initial date to filter the statistics.\n- final_date (optional): The final date to filter the statistics.\n- lender_id (optional): The lender ID to filter the statistics for a specific lender.\n\n:param initial_date: The initial date to filter the statistics (optional).\n:param final_date: The final date to filter the statistics (optional).\n:param lender_id: The lender ID to filter the statistics for a specific lender (optional).\n:return: Response containing the admin statistics.","operationId":"get_admin_statistics_by_lender_statistics_ocp_get","parameters":[{"name":"initial_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Initial Date"}},{"name":"final_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Final Date"}},{"name":"lender_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lender Id"}},{"name":"custom_range","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/StatisticRange"},{"type":"null"}],"title":"Custom Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatisticResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/statistics-ocp/opt-in":{"get":{"tags":["statistics"],"summary":"Get Admin Statistics Opt In","description":"Retrieve OCP statistics for borrower opt-in.\n\nThis secure endpoint is accessible only to users with the admin role. It retrieves\nstatistics related to borrower opt-in and the count of lenders chosen by borrower.\n\n:return: Response containing the admin statistics for borrower opt-in.","operationId":"get_admin_statistics_opt_in_statistics_ocp_opt_in_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatisticOptInResponse"}}}}}}},"/statistics-fi":{"get":{"tags":["statistics"],"summary":"Get Lender Statistics","description":"Retrieve statistics for a lender.\n\nThis endpoint retrieves statistics specific to a lender.\nIt provides general statistics such as the number of applications, awards, and borrowers\nassociated with the lender.\n\n:return: Response containing the statistics for the lender.","operationId":"get_lender_statistics_statistics_fi_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatisticResponse"}}}}}}}},"components":{"schemas":{"ApplicationBase":{"properties":{"uuid":{"type":"string","title":"Uuid"}},"type":"object","required":["uuid"],"title":"ApplicationBase"},"ApplicationCreditOptions":{"properties":{"uuid":{"type":"string","title":"Uuid"},"borrower_size":{"$ref":"#/components/schemas/BorrowerSize"},"amount_requested":{"anyOf":[{"type":"number"},{"type":"string"}],"title":"Amount Requested"}},"type":"object","required":["uuid","borrower_size","amount_requested"],"title":"ApplicationCreditOptions"},"ApplicationDeclineFeedbackPayload":{"properties":{"uuid":{"type":"string","title":"Uuid"},"dont_need_access_credit":{"type":"boolean","title":"Dont Need Access Credit"},"already_have_acredit":{"type":"boolean","title":"Already Have Acredit"},"preffer_to_go_to_bank":{"type":"boolean","title":"Preffer To Go To Bank"},"dont_want_access_credit":{"type":"boolean","title":"Dont Want Access Credit"},"suspicious_email":{"type":"boolean","title":"Suspicious Email"},"other":{"type":"boolean","title":"Other"},"other_comments":{"type":"string","title":"Other Comments"}},"type":"object","required":["uuid","dont_need_access_credit","already_have_acredit","preffer_to_go_to_bank","dont_want_access_credit","suspicious_email","other","other_comments"],"title":"ApplicationDeclineFeedbackPayload"},"ApplicationDeclinePayload":{"properties":{"uuid":{"type":"string","title":"Uuid"},"decline_this":{"type":"boolean","title":"Decline This"},"decline_all":{"type":"boolean","title":"Decline All"}},"type":"object","required":["uuid","decline_this","decline_all"],"title":"ApplicationDeclinePayload"},"ApplicationEmailBorrower":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"ApplicationEmailBorrower"},"ApplicationListResponse":{"properties":{"count":{"type":"integer","title":"Count"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"items":{"items":{"$ref":"#/components/schemas/ApplicationWithRelations"},"type":"array","title":"Items"}},"type":"object","required":["count","page","page_size","items"],"title":"ApplicationListResponse"},"ApplicationRead":{"properties":{"uuid":{"type":"string","title":"Uuid"},"primary_email":{"type":"string","title":"Primary Email","default":""},"award_borrower_identifier":{"type":"string","title":"Award Borrower Identifier","default":""},"amount_requested":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Amount Requested"},"currency":{"type":"string","title":"Currency","description":"ISO 4217 currency code","default":"COP"},"repayment_years":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Repayment Years"},"repayment_months":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Repayment Months"},"payment_start_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Payment Start Date"},"calculator_data":{"type":"object","title":"Calculator Data"},"status":{"allOf":[{"$ref":"#/components/schemas/ApplicationStatus"}],"default":"PENDING"},"pending_documents":{"type":"boolean","title":"Pending Documents","default":false},"pending_email_confirmation":{"type":"boolean","title":"Pending Email Confirmation","default":false},"expired_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expired At"},"borrower_declined_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Declined At"},"borrower_declined_preferences_data":{"type":"object","title":"Borrower Declined Preferences Data"},"borrower_declined_data":{"type":"object","title":"Borrower Declined Data"},"borrower_accepted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Accepted At"},"borrower_credit_product_selected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Credit Product Selected At"},"borrower_submitted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Submitted At"},"borrower_accessed_external_onboarding_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Accessed External Onboarding At"},"lender_started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lender Started At"},"information_requested_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Information Requested At"},"lender_rejected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lender Rejected At"},"lender_rejected_data":{"type":"object","title":"Lender Rejected Data"},"lender_approved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lender Approved At"},"lender_approved_data":{"type":"object","title":"Lender Approved Data"},"secop_data_verification":{"type":"object","title":"Secop Data Verification"},"disbursed_final_amount":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Disbursed Final Amount"},"completed_in_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completed In Days"},"overdued_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Overdued At"},"application_lapsed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Application Lapsed At"},"archived_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Archived At"},"award_id":{"type":"integer","title":"Award Id"},"borrower_id":{"type":"integer","title":"Borrower Id"},"lender_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lender Id"},"credit_product_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Credit Product Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-28T15:05:38.716491"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-11-28T15:05:38.716563"},"id":{"type":"integer","title":"Id"}},"type":"object","required":["uuid","amount_requested","repayment_years","repayment_months","payment_start_date","expired_at","borrower_declined_at","borrower_accepted_at","borrower_credit_product_selected_at","borrower_submitted_at","borrower_accessed_external_onboarding_at","lender_started_at","information_requested_at","lender_rejected_at","lender_approved_at","disbursed_final_amount","completed_in_days","overdued_at","application_lapsed_at","archived_at","award_id","borrower_id","lender_id","credit_product_id","id"],"title":"ApplicationRead"},"ApplicationResponse":{"properties":{"application":{"$ref":"#/components/schemas/ApplicationRead"},"borrower":{"$ref":"#/components/schemas/Borrower"},"award":{"$ref":"#/components/schemas/Award"},"lender":{"anyOf":[{"$ref":"#/components/schemas/Lender"},{"type":"null"}]},"documents":{"items":{"$ref":"#/components/schemas/BorrowerDocumentBase"},"type":"array","title":"Documents"},"creditProduct":{"anyOf":[{"$ref":"#/components/schemas/CreditProduct-Output"},{"type":"null"}]}},"type":"object","required":["application","borrower","award"],"title":"ApplicationResponse"},"ApplicationSelectCreditProduct":{"properties":{"uuid":{"type":"string","title":"Uuid"},"borrower_size":{"$ref":"#/components/schemas/BorrowerSize"},"amount_requested":{"anyOf":[{"type":"number"},{"type":"string"}],"title":"Amount Requested"},"sector":{"type":"string","title":"Sector"},"annual_revenue":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}],"title":"Annual Revenue"},"credit_product_id":{"type":"integer","title":"Credit Product Id"},"repayment_years":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Repayment Years"},"repayment_months":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Repayment Months"},"payment_start_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Payment Start Date"}},"type":"object","required":["uuid","borrower_size","amount_requested","sector","credit_product_id"],"title":"ApplicationSelectCreditProduct"},"ApplicationStatus":{"type":"string","enum":["PENDING","DECLINED","ACCEPTED","SUBMITTED","STARTED","REJECTED","INFORMATION_REQUESTED","LAPSED","APPROVED"],"title":"ApplicationStatus","description":"An application status.\n\n.. seealso:: :ref:`state-machine`"},"ApplicationWithRelations":{"properties":{"uuid":{"type":"string","title":"Uuid"},"primary_email":{"type":"string","title":"Primary Email","default":""},"award_borrower_identifier":{"type":"string","title":"Award Borrower Identifier","default":""},"amount_requested":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Amount Requested"},"currency":{"type":"string","title":"Currency","description":"ISO 4217 currency code","default":"COP"},"repayment_years":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Repayment Years"},"repayment_months":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Repayment Months"},"payment_start_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Payment Start Date"},"calculator_data":{"type":"object","title":"Calculator Data"},"status":{"allOf":[{"$ref":"#/components/schemas/ApplicationStatus"}],"default":"PENDING"},"pending_documents":{"type":"boolean","title":"Pending Documents","default":false},"pending_email_confirmation":{"type":"boolean","title":"Pending Email Confirmation","default":false},"expired_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expired At"},"borrower_declined_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Declined At"},"borrower_declined_preferences_data":{"type":"object","title":"Borrower Declined Preferences Data"},"borrower_declined_data":{"type":"object","title":"Borrower Declined Data"},"borrower_accepted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Accepted At"},"borrower_credit_product_selected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Credit Product Selected At"},"borrower_submitted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Submitted At"},"borrower_accessed_external_onboarding_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Borrower Accessed External Onboarding At"},"lender_started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lender Started At"},"information_requested_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Information Requested At"},"lender_rejected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lender Rejected At"},"lender_rejected_data":{"type":"object","title":"Lender Rejected Data"},"lender_approved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Lender Approved At"},"lender_approved_data":{"type":"object","title":"Lender Approved Data"},"secop_data_verification":{"type":"object","title":"Secop Data Verification"},"disbursed_final_amount":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Disbursed Final Amount"},"completed_in_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completed In Days"},"overdued_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Overdued At"},"application_lapsed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Application Lapsed At"},"archived_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Archived At"},"award_id":{"type":"integer","title":"Award Id"},"borrower_id":{"type":"integer","title":"Borrower Id"},"lender_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lender Id"},"credit_product_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Credit Product Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-28T15:05:38.716491"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-11-28T15:05:38.716563"},"id":{"type":"integer","title":"Id"},"borrower":{"anyOf":[{"$ref":"#/components/schemas/BorrowerBase"},{"type":"null"}]},"award":{"anyOf":[{"$ref":"#/components/schemas/AwardBase"},{"type":"null"}]},"lender":{"anyOf":[{"$ref":"#/components/schemas/LenderBase"},{"type":"null"}]},"credit_product":{"anyOf":[{"$ref":"#/components/schemas/CreditProductBase"},{"type":"null"}]},"borrower_documents":{"items":{"$ref":"#/components/schemas/BorrowerDocumentBase"},"type":"array","title":"Borrower Documents"},"modified_data_fields":{"type":"object","title":"Modified Data Fields"}},"type":"object","required":["uuid","amount_requested","repayment_years","repayment_months","payment_start_date","expired_at","borrower_declined_at","borrower_accepted_at","borrower_credit_product_selected_at","borrower_submitted_at","borrower_accessed_external_onboarding_at","lender_started_at","information_requested_at","lender_rejected_at","lender_approved_at","disbursed_final_amount","completed_in_days","overdued_at","application_lapsed_at","archived_at","award_id","borrower_id","lender_id","credit_product_id","id"],"title":"ApplicationWithRelations"},"Award":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"source_contract_id":{"type":"string","title":"Source Contract Id","default":""},"title":{"type":"string","title":"Title","default":""},"description":{"type":"string","title":"Description","default":""},"award_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Award Date"},"award_amount":{"type":"string","title":"Award Amount"},"award_currency":{"type":"string","title":"Award Currency","description":"ISO 4217 currency code","default":"COP"},"contractperiod_startdate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Contractperiod Startdate"},"contractperiod_enddate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Contractperiod Enddate"},"payment_method":{"type":"object","title":"Payment Method"},"buyer_name":{"type":"string","title":"Buyer Name","default":""},"source_url":{"type":"string","title":"Source Url","default":""},"entity_code":{"type":"string","title":"Entity Code","default":""},"contract_status":{"type":"string","title":"Contract Status","default":""},"source_last_updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Source Last Updated At"},"previous":{"type":"boolean","title":"Previous","default":false},"procurement_method":{"type":"string","title":"Procurement Method","default":""},"contracting_process_id":{"type":"string","title":"Contracting Process Id","default":""},"procurement_category":{"type":"string","title":"Procurement Category","default":""},"missing_data":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Missing Data"},"borrower_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Borrower Id"},"source_data_contracts":{"type":"object","title":"Source Data Contracts"},"source_data_awards":{"type":"object","title":"Source Data Awards"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-28T15:05:38.703637"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-11-28T15:05:38.703742"}},"type":"object","required":["award_date","award_amount","contractperiod_startdate","contractperiod_enddate","source_last_updated_at","borrower_id"],"title":"Award","description":"All fields, other than relationships and timestamps, are derived from the data source. In terms of application\nlogic, the fields are (or can be) used in emails to identify the award, like the ``buyer_name`` and ``title``."},"AwardBase":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"source_contract_id":{"type":"string","title":"Source Contract Id","default":""},"title":{"type":"string","title":"Title","default":""},"description":{"type":"string","title":"Description","default":""},"award_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Award Date"},"award_amount":{"type":"string","title":"Award Amount"},"award_currency":{"type":"string","title":"Award Currency","description":"ISO 4217 currency code","default":"COP"},"contractperiod_startdate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Contractperiod Startdate"},"contractperiod_enddate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Contractperiod Enddate"},"payment_method":{"type":"object","title":"Payment Method"},"buyer_name":{"type":"string","title":"Buyer Name","default":""},"source_url":{"type":"string","title":"Source Url","default":""},"entity_code":{"type":"string","title":"Entity Code","default":""},"contract_status":{"type":"string","title":"Contract Status","default":""},"source_last_updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Source Last Updated At"},"previous":{"type":"boolean","title":"Previous","default":false},"procurement_method":{"type":"string","title":"Procurement Method","default":""},"contracting_process_id":{"type":"string","title":"Contracting Process Id","default":""},"procurement_category":{"type":"string","title":"Procurement Category","default":""},"missing_data":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Missing Data"},"borrower_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Borrower Id"}},"type":"object","required":["award_date","award_amount","contractperiod_startdate","contractperiod_enddate","source_last_updated_at","borrower_id"],"title":"AwardBase"},"AwardUpdate":{"properties":{"source_contract_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Contract Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"contracting_process_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contracting Process Id"},"award_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Award Currency"},"award_amount":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}],"title":"Award Amount"},"award_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Award Date"},"payment_method":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Payment Method"},"buyer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Buyer Name"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url"},"entity_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity Code"},"contract_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contract Status"},"contractperiod_startdate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Contractperiod Startdate"},"contractperiod_enddate":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Contractperiod Enddate"},"procurement_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Procurement Method"},"procurement_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Procurement Category"}},"type":"object","title":"AwardUpdate"},"BasicUser":{"properties":{"username":{"type":"string","title":"Username"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"password":{"type":"string","title":"Password"},"temp_password":{"type":"string","title":"Temp Password"}},"type":"object","required":["username","password","temp_password"],"title":"BasicUser"},"Body_upload_document_applications_upload_document_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"},"type":{"type":"string","title":"Type"},"uuid":{"type":"string","title":"Uuid"}},"type":"object","required":["file","type","uuid"],"title":"Body_upload_document_applications_upload_document_post"},"Borrower":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"borrower_identifier":{"type":"string","title":"Borrower Identifier","default":""},"declined_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Declined At"},"legal_name":{"type":"string","title":"Legal Name","default":""},"email":{"type":"string","title":"Email","default":""},"address":{"type":"string","title":"Address","default":""},"legal_identifier":{"type":"string","title":"Legal Identifier","default":""},"type":{"type":"string","title":"Type","default":""},"is_msme":{"type":"boolean","title":"Is Msme","default":true},"missing_data":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Missing Data"},"size":{"allOf":[{"$ref":"#/components/schemas/BorrowerSize"}],"default":"NOT_INFORMED"},"sector":{"type":"string","title":"Sector","default":""},"annual_revenue":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Annual Revenue"},"currency":{"type":"string","title":"Currency","description":"ISO 4217 currency code","default":"COP"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-28T15:05:38.682227"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-11-28T15:05:38.682336"},"source_data":{"type":"object","title":"Source Data"},"status":{"allOf":[{"$ref":"#/components/schemas/BorrowerStatus"}],"default":"ACTIVE"}},"type":"object","required":["declined_at","annual_revenue"],"title":"Borrower","description":"Most fields are derived from the data source. In terms of application logic, those fields are (or can be) used in\nemails to the borrower, like the ``legal_identifier`` and ``legal_name``."},"BorrowerBase":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"borrower_identifier":{"type":"string","title":"Borrower Identifier","default":""},"declined_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Declined At"},"legal_name":{"type":"string","title":"Legal Name","default":""},"email":{"type":"string","title":"Email","default":""},"address":{"type":"string","title":"Address","default":""},"legal_identifier":{"type":"string","title":"Legal Identifier","default":""},"type":{"type":"string","title":"Type","default":""},"is_msme":{"type":"boolean","title":"Is Msme","default":true},"missing_data":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Missing Data"},"size":{"allOf":[{"$ref":"#/components/schemas/BorrowerSize"}],"default":"NOT_INFORMED"},"sector":{"type":"string","title":"Sector","default":""},"annual_revenue":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Annual Revenue"},"currency":{"type":"string","title":"Currency","description":"ISO 4217 currency code","default":"COP"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-28T15:05:38.682227"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-11-28T15:05:38.682336"}},"type":"object","required":["declined_at","annual_revenue"],"title":"BorrowerBase"},"BorrowerDocumentBase":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"type":{"$ref":"#/components/schemas/BorrowerDocumentType"},"verified":{"type":"boolean","title":"Verified","default":false},"name":{"type":"string","title":"Name","default":""},"submitted_at":{"type":"string","format":"date-time","title":"Submitted At","default":"2024-11-28T15:05:38.756524"},"application_id":{"type":"integer","title":"Application Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-28T15:05:38.756771"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-11-28T15:05:38.756880"}},"type":"object","required":["type","application_id"],"title":"BorrowerDocumentBase"},"BorrowerDocumentType":{"type":"string","enum":["INCORPORATION_DOCUMENT","SUPPLIER_REGISTRATION_DOCUMENT","BANK_NAME","BANK_CERTIFICATION_DOCUMENT","FINANCIAL_STATEMENT","SIGNED_CONTRACT","SHAREHOLDER_COMPOSITION","CHAMBER_OF_COMMERCE","THREE_LAST_BANK_STATEMENT","INCOME_TAX_RETURN_STATEMENT","CHAMBER_OF_COMMERCE_WITH_TEMPORARY_UNIONS"],"title":"BorrowerDocumentType"},"BorrowerSize":{"type":"string","enum":["NOT_INFORMED","MICRO","SMALL","MEDIUM","BIG"],"title":"BorrowerSize"},"BorrowerStatus":{"type":"string","enum":["ACTIVE","DECLINE_OPPORTUNITIES"],"title":"BorrowerStatus"},"BorrowerUpdate":{"properties":{"legal_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"legal_identifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Identifier"},"type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"sector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sector"},"size":{"anyOf":[{"$ref":"#/components/schemas/BorrowerSize"},{"type":"null"}]}},"type":"object","title":"BorrowerUpdate"},"ChangeEmail":{"properties":{"uuid":{"type":"string","title":"Uuid"},"new_email":{"type":"string","title":"New Email"}},"type":"object","required":["uuid","new_email"],"title":"ChangeEmail"},"ChangePasswordResponse":{"properties":{"detail":{"type":"string","title":"Detail"},"secret_code":{"type":"string","title":"Secret Code"},"session":{"type":"string","title":"Session"},"username":{"type":"string","title":"Username"}},"type":"object","required":["detail","secret_code","session","username"],"title":"ChangePasswordResponse"},"ConfirmNewEmail":{"properties":{"uuid":{"type":"string","title":"Uuid"},"confirmation_email_token":{"type":"string","title":"Confirmation Email Token"}},"type":"object","required":["uuid","confirmation_email_token"],"title":"ConfirmNewEmail"},"CreditProduct-Input":{"properties":{"borrower_size":{"$ref":"#/components/schemas/BorrowerSize"},"borrower_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Borrower Types"},"lower_limit":{"anyOf":[{"type":"number"},{"type":"string"}],"title":"Lower Limit"},"upper_limit":{"anyOf":[{"type":"number"},{"type":"string"}],"title":"Upper Limit"},"procurement_category_to_exclude":{"type":"string","title":"Procurement Category To Exclude","default":""},"type":{"$ref":"#/components/schemas/CreditType"},"required_document_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Required Document Types"},"interest_rate":{"type":"string","title":"Interest Rate","default":""},"additional_information":{"type":"string","title":"Additional Information","default":""},"other_fees_total_amount":{"anyOf":[{"type":"number"},{"type":"string"}],"title":"Other Fees Total Amount"},"other_fees_description":{"type":"string","title":"Other Fees Description","default":""},"more_info_url":{"type":"string","title":"More Info Url","default":""},"lender_id":{"type":"integer","title":"Lender Id"},"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-28T15:05:38.671265"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-11-28T15:05:38.671352"}},"type":"object","required":["borrower_size","lower_limit","upper_limit","type","other_fees_total_amount","lender_id"],"title":"CreditProduct"},"CreditProduct-Output":{"properties":{"borrower_size":{"$ref":"#/components/schemas/BorrowerSize"},"borrower_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Borrower Types"},"lower_limit":{"type":"string","title":"Lower Limit"},"upper_limit":{"type":"string","title":"Upper Limit"},"procurement_category_to_exclude":{"type":"string","title":"Procurement Category To Exclude","default":""},"type":{"$ref":"#/components/schemas/CreditType"},"required_document_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Required Document Types"},"interest_rate":{"type":"string","title":"Interest Rate","default":""},"additional_information":{"type":"string","title":"Additional Information","default":""},"other_fees_total_amount":{"type":"string","title":"Other Fees Total Amount"},"other_fees_description":{"type":"string","title":"Other Fees Description","default":""},"more_info_url":{"type":"string","title":"More Info Url","default":""},"lender_id":{"type":"integer","title":"Lender Id"},"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-28T15:05:38.671265"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-11-28T15:05:38.671352"}},"type":"object","required":["borrower_size","lower_limit","upper_limit","type","other_fees_total_amount","lender_id"],"title":"CreditProduct"},"CreditProductBase":{"properties":{"borrower_size":{"$ref":"#/components/schemas/BorrowerSize"},"borrower_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Borrower Types"},"lower_limit":{"type":"string","title":"Lower Limit"},"upper_limit":{"type":"string","title":"Upper Limit"},"procurement_category_to_exclude":{"type":"string","title":"Procurement Category To Exclude","default":""},"type":{"$ref":"#/components/schemas/CreditType"},"required_document_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Required Document Types"},"interest_rate":{"type":"string","title":"Interest Rate","default":""},"additional_information":{"type":"string","title":"Additional Information","default":""},"other_fees_total_amount":{"type":"string","title":"Other Fees Total Amount"},"other_fees_description":{"type":"string","title":"Other Fees Description","default":""},"more_info_url":{"type":"string","title":"More Info Url","default":""},"lender_id":{"type":"integer","title":"Lender Id"}},"type":"object","required":["borrower_size","lower_limit","upper_limit","type","other_fees_total_amount","lender_id"],"title":"CreditProductBase"},"CreditProductListResponse":{"properties":{"loans":{"items":{"$ref":"#/components/schemas/CreditProductWithLender"},"type":"array","title":"Loans"},"credit_lines":{"items":{"$ref":"#/components/schemas/CreditProductWithLender"},"type":"array","title":"Credit Lines"}},"type":"object","required":["loans","credit_lines"],"title":"CreditProductListResponse"},"CreditProductWithLender":{"properties":{"borrower_size":{"$ref":"#/components/schemas/BorrowerSize"},"borrower_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Borrower Types"},"lower_limit":{"type":"string","title":"Lower Limit"},"upper_limit":{"type":"string","title":"Upper Limit"},"procurement_category_to_exclude":{"type":"string","title":"Procurement Category To Exclude","default":""},"type":{"$ref":"#/components/schemas/CreditType"},"required_document_types":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Required Document Types"},"interest_rate":{"type":"string","title":"Interest Rate","default":""},"additional_information":{"type":"string","title":"Additional Information","default":""},"other_fees_total_amount":{"type":"string","title":"Other Fees Total Amount"},"other_fees_description":{"type":"string","title":"Other Fees Description","default":""},"more_info_url":{"type":"string","title":"More Info Url","default":""},"lender_id":{"type":"integer","title":"Lender Id"},"id":{"type":"integer","title":"Id"},"lender":{"anyOf":[{"$ref":"#/components/schemas/LenderRead"},{"type":"null"}]}},"type":"object","required":["borrower_size","lower_limit","upper_limit","type","other_fees_total_amount","lender_id","id"],"title":"CreditProductWithLender"},"CreditType":{"type":"string","enum":["LOAN","CREDIT_LINE"],"title":"CreditType"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"Lender":{"properties":{"name":{"type":"string","title":"Name","default":""},"email_group":{"type":"string","title":"Email Group","default":""},"type":{"type":"string","title":"Type","default":""},"logo_filename":{"type":"string","title":"Logo Filename","default":""},"sla_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sla Days"},"external_onboarding_url":{"type":"string","title":"External Onboarding Url","default":""},"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"status":{"type":"string","title":"Status","default":""},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-28T15:05:38.659354"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-11-28T15:05:38.659695"}},"type":"object","required":["sla_days","deleted_at"],"title":"Lender"},"LenderApprovedData":{"properties":{"compliant_checks_completed":{"type":"boolean","title":"Compliant Checks Completed"},"compliant_checks_passed":{"type":"boolean","title":"Compliant Checks Passed"},"disbursed_final_amount":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string"}],"title":"Disbursed Final Amount"}},"type":"object","required":["compliant_checks_completed","compliant_checks_passed","disbursed_final_amount"],"title":"LenderApprovedData"},"LenderBase":{"properties":{"name":{"type":"string","title":"Name","default":""},"email_group":{"type":"string","title":"Email Group","default":""},"type":{"type":"string","title":"Type","default":""},"logo_filename":{"type":"string","title":"Logo Filename","default":""},"sla_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sla Days"},"external_onboarding_url":{"type":"string","title":"External Onboarding Url","default":""}},"type":"object","required":["sla_days"],"title":"LenderBase"},"LenderCreate":{"properties":{"name":{"type":"string","title":"Name","default":""},"email_group":{"type":"string","title":"Email Group","default":""},"type":{"type":"string","title":"Type","default":""},"logo_filename":{"type":"string","title":"Logo Filename","default":""},"sla_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sla Days"},"external_onboarding_url":{"type":"string","title":"External Onboarding Url","default":""},"credit_products":{"anyOf":[{"items":{"$ref":"#/components/schemas/CreditProduct-Input"},"type":"array"},{"type":"null"}],"title":"Credit Products"}},"type":"object","required":["sla_days"],"title":"LenderCreate"},"LenderListResponse":{"properties":{"count":{"type":"integer","title":"Count"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"items":{"items":{"$ref":"#/components/schemas/Lender"},"type":"array","title":"Items"}},"type":"object","required":["count","page","page_size","items"],"title":"LenderListResponse"},"LenderRead":{"properties":{"name":{"type":"string","title":"Name","default":""},"email_group":{"type":"string","title":"Email Group","default":""},"type":{"type":"string","title":"Type","default":""},"logo_filename":{"type":"string","title":"Logo Filename","default":""},"sla_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sla Days"},"external_onboarding_url":{"type":"string","title":"External Onboarding Url","default":""},"id":{"type":"integer","title":"Id"}},"type":"object","required":["sla_days","id"],"title":"LenderRead"},"LenderRejectedApplication":{"properties":{"compliance_checks_failed":{"type":"boolean","title":"Compliance Checks Failed"},"poor_credit_history":{"type":"boolean","title":"Poor Credit History"},"risk_of_fraud":{"type":"boolean","title":"Risk Of Fraud"},"other":{"type":"boolean","title":"Other"},"other_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Other Reason"}},"type":"object","required":["compliance_checks_failed","poor_credit_history","risk_of_fraud","other"],"title":"LenderRejectedApplication"},"LenderWithRelations":{"properties":{"name":{"type":"string","title":"Name","default":""},"email_group":{"type":"string","title":"Email Group","default":""},"type":{"type":"string","title":"Type","default":""},"logo_filename":{"type":"string","title":"Logo Filename","default":""},"sla_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sla Days"},"external_onboarding_url":{"type":"string","title":"External Onboarding Url","default":""},"id":{"type":"integer","title":"Id"},"credit_products":{"anyOf":[{"items":{"$ref":"#/components/schemas/CreditProduct-Output"},"type":"array"},{"type":"null"}],"title":"Credit Products"}},"type":"object","required":["sla_days","id"],"title":"LenderWithRelations"},"LoginResponse":{"properties":{"user":{"$ref":"#/components/schemas/User"},"access_token":{"type":"string","title":"Access Token"},"refresh_token":{"type":"string","title":"Refresh Token"}},"type":"object","required":["user","access_token","refresh_token"],"title":"LoginResponse"},"ResetPassword":{"properties":{"username":{"type":"string","title":"Username"}},"type":"object","required":["username"],"title":"ResetPassword"},"ResponseBase":{"properties":{"detail":{"type":"string","title":"Detail"}},"type":"object","required":["detail"],"title":"ResponseBase"},"SetupMFA":{"properties":{"temp_password":{"type":"string","title":"Temp Password"},"session":{"type":"string","title":"Session"},"secret":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Secret"}},"type":"object","required":["temp_password","session"],"title":"SetupMFA"},"SortOrder":{"type":"string","enum":["asc","desc"],"title":"SortOrder"},"StatisticOptInResponse":{"properties":{"opt_in_stat":{"type":"object","title":"Opt In Stat"}},"type":"object","required":["opt_in_stat"],"title":"StatisticOptInResponse"},"StatisticRange":{"type":"string","enum":["CUSTOM_RANGE","LAST_WEEK","LAST_MONTH"],"title":"StatisticRange"},"StatisticResponse":{"properties":{"statistics_kpis":{"type":"object","title":"Statistics Kpis"}},"type":"object","required":["statistics_kpis"],"title":"StatisticResponse"},"UpdateDataField":{"properties":{"legal_name":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Legal Name"},"email":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Email"},"address":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Address"},"legal_identifier":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Legal Identifier"},"type":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Type"}},"type":"object","title":"UpdateDataField"},"User":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"type":{"allOf":[{"$ref":"#/components/schemas/UserType"}],"default":"FI"},"language":{"type":"string","title":"Language","description":"ISO 639-1 language code","default":"es"},"email":{"type":"string","title":"Email"},"notification_preferences":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Notification Preferences"},"name":{"type":"string","title":"Name","default":""},"external_id":{"type":"string","title":"External Id","default":""},"lender_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lender Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-28T15:05:38.779770"}},"type":"object","required":["email"],"title":"User"},"UserBase":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"type":{"allOf":[{"$ref":"#/components/schemas/UserType"}],"default":"FI"},"language":{"type":"string","title":"Language","description":"ISO 639-1 language code","default":"es"},"email":{"type":"string","title":"Email"},"notification_preferences":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Notification Preferences"},"name":{"type":"string","title":"Name","default":""},"external_id":{"type":"string","title":"External Id","default":""},"lender_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lender Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-28T15:05:38.779770"}},"type":"object","required":["email"],"title":"UserBase"},"UserListResponse":{"properties":{"count":{"type":"integer","title":"Count"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"items":{"items":{"$ref":"#/components/schemas/UserWithLender"},"type":"array","title":"Items"}},"type":"object","required":["count","page","page_size","items"],"title":"UserListResponse"},"UserResponse":{"properties":{"user":{"$ref":"#/components/schemas/User"}},"type":"object","required":["user"],"title":"UserResponse"},"UserType":{"type":"string","enum":["OCP","FI"],"title":"UserType"},"UserWithLender":{"properties":{"id":{"type":"integer","title":"Id"},"type":{"allOf":[{"$ref":"#/components/schemas/UserType"}],"default":"FI"},"language":{"type":"string","title":"Language","description":"ISO 639-1 language code","default":"es"},"email":{"type":"string","title":"Email"},"notification_preferences":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Notification Preferences"},"name":{"type":"string","title":"Name","default":""},"external_id":{"type":"string","title":"External Id","default":""},"lender_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lender Id"},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-28T15:05:38.779770"},"lender":{"anyOf":[{"$ref":"#/components/schemas/LenderBase"},{"type":"null"}]}},"type":"object","required":["id","email"],"title":"UserWithLender"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VerifyBorrowerDocument":{"properties":{"verified":{"type":"boolean","title":"Verified"}},"type":"object","required":["verified"],"title":"VerifyBorrowerDocument"}}}} \ No newline at end of file diff --git a/docs/_static/orphans.png b/docs/_static/orphans.png index 6d239762..6bae2542 100644 Binary files a/docs/_static/orphans.png and b/docs/_static/orphans.png differ diff --git a/docs/_static/relationships.real.large.png b/docs/_static/relationships.real.large.png index 5de43464..d9b8776b 100644 Binary files a/docs/_static/relationships.real.large.png and b/docs/_static/relationships.real.large.png differ diff --git a/docs/_static/state-machine.png b/docs/_static/state-machine.png index 93325423..301438a0 100644 Binary files a/docs/_static/state-machine.png and b/docs/_static/state-machine.png differ diff --git a/docs/contributing/index.rst b/docs/contributing/index.rst index 8a0856ae..ef148006 100644 --- a/docs/contributing/index.rst +++ b/docs/contributing/index.rst @@ -268,17 +268,18 @@ Application status transitions https://play.d2lang.com https://pincel.app/tools/svg-to-png α -> PENDING: Credere sends an invitation to the borrower - PENDING -> LAPSED: borrower doesn't accept or decline the invitation + PENDING -> LAPSED: borrower doesn't\naccept or decline the invitation PENDING -> DECLINED: borrower declines the invitation PENDING -> ACCEPTED: borrower accepts the invitation - ACCEPTED -> LAPSED: borrower doesn't submit the application + ACCEPTED -> LAPSED: borrower doesn't\nsubmit the application ACCEPTED -> SUBMITTED: borrower submits the application - SUBMITTED -> LAPSED: borrower doesn't start external onboarding {class: external} + SUBMITTED -> LAPSED: borrower doesn't\nstart external onboarding {class: external} SUBMITTED -> STARTED: lender starts application review STARTED -> INFORMATION_REQUESTED: lender requests\nthe borrower to update a document {class: native} STARTED -> REJECTED: lender rejects the application STARTED -> APPROVED: lender approves the application - INFORMATION_REQUESTED -> LAPSED: borrower doesn't submit the information requested {class: native} + STARTED -> LAPSED: lender lapses the application if the borrower\nis unresponsive to external messages + INFORMATION_REQUESTED -> LAPSED: borrower doesn't\nsubmit the information requested {class: native} INFORMATION_REQUESTED -> STARTED: borrower updates the document {class: native} classes: { native.style.stroke: maroon diff --git a/migrations/versions/f4f2b2a76181_add_new_action_type.py b/migrations/versions/f4f2b2a76181_add_new_action_type.py new file mode 100644 index 00000000..a23c4d20 --- /dev/null +++ b/migrations/versions/f4f2b2a76181_add_new_action_type.py @@ -0,0 +1,29 @@ +""" +add new action type + +Revision ID: f4f2b2a76181 +Revises: 867ef39e878c +Create Date: 2024-11-28 11:55:31.469382 + +""" + +from alembic import op + +# revision identifiers, used by Alembic. +revision = "f4f2b2a76181" +down_revision = "867ef39e878c" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + with op.get_context().autocommit_block(): + op.execute( + """ + ALTER TYPE application_action_type ADD VALUE IF NOT EXISTS 'FI_LAPSE_APPLICATION' + """ + ) + + +def downgrade() -> None: + pass diff --git a/tests/routers/test_applications.py b/tests/routers/test_applications.py index aa7499ad..cb76f310 100644 --- a/tests/routers/test_applications.py +++ b/tests/routers/test_applications.py @@ -413,3 +413,16 @@ def test_get_applications(client, session, admin_header, lender_header, pending_ response = client.post("/applications/access-scheme", json={"uuid": "123-456"}) assert response.status_code == status.HTTP_404_NOT_FOUND assert response.json() == {"detail": _("Application not found")} + + +def test_lapse_application(client, session, lender_header, pending_application): + response = client.post(f"/applications/{pending_application.id}/lapse", headers=lender_header) + assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY + assert response.json() == {"detail": _("Application status should not be %(status)s", status=_("PENDING"))} + + pending_application.status = models.ApplicationStatus.STARTED + session.commit() + + response = client.post(f"/applications/{pending_application.id}/lapse", headers=lender_header) + assert_ok(response) + assert response.json()["status"] == models.ApplicationStatus.LAPSED