Skip to content

AutoFinance-Ingeco/autofinance-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vehicle Loan API (Peru) - DDD + Bounded Contexts

This project is a .NET 9 Web API for vehicle loan origination using the French amortization method (ordinary vencido, 30-day months), including smart purchase balloon payment, grace periods, VAN (NPV), and TIR (IRR) from the debtor perspective.

Tech Stack

  • .NET 9 (ASP.NET Core Web API)
  • MongoDB (MongoDB.Driver)
  • JWT authentication (Microsoft.AspNetCore.Authentication.JwtBearer)
  • Swagger/OpenAPI (Swashbuckle.AspNetCore)

Bounded Contexts

  • Identity: login, registration, password hashing, JWT issuance
  • CustomerManagement: customer registration and updates
  • VehicleCatalog: vehicle catalog management
  • LoanManagement: core loan domain (schedule generation, VAN, TIR, totals)
  • SystemConfiguration: global financial defaults and grace policy limits
  • SharedKernel: shared enums, base entity, and infrastructure helpers

Project Structure

WebApplication4/ keeps DDD-style folders for each bounded context:

  • Domain (entities, domain services)
  • Application (DTOs, interfaces, use cases)
  • Infrastructure (Mongo repositories, security services)
  • Interfaces (controllers)

Required Configuration

Configuration is in:

  • WebApplication4/appsettings.json
  • WebApplication4/appsettings.Development.json

Required sections:

  • MongoDb:ConnectionString
  • MongoDb:DatabaseName
  • Jwt:Issuer
  • Jwt:Audience
  • Jwt:SecretKey
  • Jwt:ExpirationMinutes

For production, use environment variables or a secure secret provider for JWT key material.

Quick Start

dotnet restore "C:\Users\PC\RiderProjects\WebApplication4\WebApplication4.sln"
dotnet build "C:\Users\PC\RiderProjects\WebApplication4\WebApplication4.sln"
dotnet run --project "C:\Users\PC\RiderProjects\WebApplication4\WebApplication4\WebApplication4.csproj"

Swagger is enabled in development at /swagger.

API Flow (Smoke Test)

You can use WebApplication4/WebApplication4.http as a request collection.

  1. POST /api/identity/register
  2. POST /api/identity/login
  3. Copy returned token into @token
  4. Call protected endpoints such as:
    • POST /api/customers
    • GET /api/system-configuration
    • POST /api/vehicles
    • POST /api/loans

Notes on Financial Logic

  • Supports PEN and USD
  • Supports Effective and Nominal annual rates
  • Nominal rates require capitalization frequency (CapitalizationPerYear)
  • Supports Total and Partial grace periods
  • Supports smart purchase balloon payment (BalloonPercent)
  • Computes monthly schedule, total interest, total payment, NPV, IRR, and annual cost proxy (AnnualCostRate)

Current Scope

This is an MVP baseline focused on modular architecture and core loan calculations. Typical next iterations:

  • richer validation and value objects
  • borrower disclosure indicators required by local regulation
  • auditing and loan lifecycle states
  • automated tests for schedule and VAN/TIR scenarios

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages