# `applications/routes.py` ## Overview This file contains the main Flask blueprint `emi_api`, mounted at the URL prefix `/api`. It exposes the primary core API endpoints for EMI checkout workflows. The routes are primarily protected by `EMICheckoutMiddleware.main` and utilize `EMIService` for core business operations via Dependency Injection. ## Endpoints All endpoints below are prefixed with `/api`. ### Customer & Core Journey - **`/create-customer`** `[POST]`: Main endpoint to create an EMI customer application. Performs de-duplication checks. - **`/customer-details`** `[POST]`: Updates PAN and DOB for a given application ID. - **`/get-user-details`** `[POST]`: Fetches a user's journey progress using their mobile number. ### Application Status & Lifecycle - **`/get-status/`** `[GET]`: Fetches the current application state/status for polling. - **`/cancellation-request`** `[GET]`: Initiates an application cancellation request for a given application ID. - **`/create-loan`** `[POST]`: Finalizes the creation of a loan, linking the customer's application details, address, and processing validation. ### Authentication & OTP - **`/initiate-otp`** / **`/otp`** `[POST]`: Both endpoints generate an OTP for the given mobile number. - **`/confirm-otp`** / **`/verify-otp`** `[POST]`: Validate the generated OTP. ### KYC, Digio & Bureau - **`/ckyc`** `[POST]`: Triggers a Central KYC check. - **`/digio_vkyc`** `[POST]`: Initiates the Digio Video KYC process, returning an access link. - **`/digio_generate_token`** `[POST]`: Generates a Digio token for signing or interacting with existing KYC entities. - **`/check-bureau`** `[POST]`: Performs a bureau score check. ### Documents & Validations - **`/upload-document`** `[POST]`: Generic endpoint to upload documents securely. Supports doc passwords. - **`/electricity-bill`** `[POST]`: Submits electricity bill data for validation. - **`/employement-details`** `[POST]`: Saves employment details including type, net monthly income, and GST info. ### Products, Offers & Config - **`/product-list`** `[GET]`: Fetches the list of products associated with a `merchant_id`. - **`/product-details`** `[POST]`: Handles detailed product inputs, especially relating to solar loans (kW, inverters, panels). - **`/get-config`** `[POST]`: Fetches backend schema configuration files. - **`/get-serviceprovider-list`** `[POST]`: Lists service providers (e.g. electricity boards). - **`/get-inverters-list`** `[POST]`: Lists inverter details. - **`/save-offer`** `[POST]`: Persists a selected loan offer to the application. ### Merchants - **`/get-merchant-details`** `[POST]`: Retrieves detailed information for a list of merchants based on category. - **`/get-merchant-name`** `[POST]`: Fetches the merchant's name via their URL slug. - **`/get-merchant-center-name`** `[POST]`: Fetches the merchant center's details via its slug. ## Dependencies - `flask` (Blueprint, request) - `dependency_injector` (inject, Provide) - `bugsnag` (Error logging) - `EMICheckoutMiddleware.main` (Authentication Decorator) - `EMIService` (Business Logic)