workspace "Loan Management System"{ !decisions doc/adr !docs doc/01-system-context model { operationsUser = person "Operations User" "Operations User" "Person" employee = Person "Employee User" "Employee User" "Person" customer = Person "End Customer User" "End Customer User" "Person" prouctMgmt = softwareSystem "01 Product Management Module" { !docs doc/02-product-management prouctMgmtUI = container "Product Management UI" "UI for the Product lifecycle Management" "ReactJS" "UI" prouctMgmtService = container "Product Management Service" "This service is responsible for the Product lifecycle management" "java" "CONTAINER" prouctMgmtDB = container "Product DB" "Product DB" "postgres" "RELDB" prouctMgmtUI -> prouctMgmtService "calls" "HTTP/JSON" "HTTP" prouctMgmtService -> prouctMgmtDB "read/writes from/to" } loanAccountSetup = softwaresystem "02 Loan Account Setup Module"{ !docs doc/03-loan-account-setup-module loanAccountSetupUI = container "loanAccountSetup UI" "UI for the upload file/handle lifecycle of loanAccountSetup" "ReactJS" "UI" loanAccountSetupService = container "loanAccountSetup Service" "this service will be responsile calling LMS APIs for creating Loan Accounts in LMS" "java" "CONTAINER" loanAccountSetupDB = container "loanAccountSetup DB" "loanAccountSetup DB" "postgres" "RELDB" } customermgmt = softwareSystem "03 Customer Management Module"{ !docs doc/04-customer-management-module customermgmtUI = container "Customer Management UI" "UI for the Customer lifecycle Management" "ReactJS" "UI" customermgmtService = container "customermgmt Service" "This service will be responsible for handling the enterprise customer data" "java" "CONTAINER" customermgmtDB = container "customermgmt DB" "customermgmt DB" "postgres" "RELDB" customermgmtService -> customermgmtDB "reads/writes from/to" customermgmtUI -> customermgmtService "calls" "HTTP/JSON" "HTTP" } loanaccount = softwareSystem "04 Loan Account Management Module"{ !docs doc/05-loan-account-management portalUI = container "Portal UI" "Loan Account Managment UI" "configurator/React" "UI" loanAccountService = container "04.1 LoanAccount Service" "This service will be responsible for handling the loan account lifecycle" "java" "CONTAINER" { !docs doc/05-loan-account-management/05-1-LAM-Disbursement-Flow disbursmentConsumer = component "DisbursementEvent Consumer" "This consumer is responsible for processing Disburment events" "java" "CONTAINER" } loanAccountDB = container "LoanAccount DB" "LoanAccount DB" "postgres" "RELDB" portalUI -> loanAccountService "calls" "HTTP/JSON" "HTTP" loanAccountService -> loanAccountDB "reads/writes from/to" disbursmentConsumer -> loanAccountDB "reads/writes from/to" } amortmodule = softwareSystem "05 Amort Module"{ !docs doc/06-amort-module whatifUI = container "Amort UI" "UI for generating WhatIf Amort Schedule" "ReactJS" "UI" amortmoduleService = container "amortmodule Service" "This service will be responsible for generating amort schedule" "java" "CONTAINER" amortmoduleDB = container "amortmodule DB" "amortmodule DB" "MongoDB" "RELDB" amortmoduleService -> amortmoduleDB "reads/writes from/to" } accounting = softwareSystem "06 Accounting Module"{ !docs doc/07-accounting-module accountingService = container "accounting Service" "This service will be responsible for handling the accouting system" "java" "CONTAINER" accountingDB = container "accounting DB" "accounting DB" "postgres" "RELDB" accountingService -> accountingDB "reads/writes from/to" } mastermodule = softwareSystem "07 Master Module" { !docs doc/08-master-management masterService = container "Master Service" "This service will be handling all master data" "java" "CONTAINER" masterDB = container "Master DB" "Master DB" "postgres" "RELDB" masterService -> masterDB "reads/writes from/to" } eventInterpreter = softwareSystem "08 Event Handler" { !docs doc/09-EventInterpreter } fee = softwareSystem "09 Fee Lib" { !docs doc/10-FeeLib } dbMigration = softwareSystem "10 DB Migration" { !docs doc/11-DBMigration } // External Systems or modules eventbus = softwareSystem "Event Bus" "" "EVENTBUS"{ } payment = softwareSystem "Payment Management Module" "" "EXTERNAL"{ } losExt = softwareSystem "External LOS system Rahi LOS/3rd Party" "" "EXTERNAL"{ losExtService = container "LOS Service of Rahi or 3rd Party LOS" "This service will either uploads batch file/send real time loanAccountSetup request to LMS loanAccountSetup System" "java" "CONTAINER" } // Interactions loanAccountService -> eventbus "publishes/subscribe to events" "MESSAGE" "MESSAGE" accountingService -> eventbus "publishes/subscribe to events" "MESSAGE" "MESSAGE" payment -> eventbus "publishes/subscribe to events" "MESSAGE" "MESSAGE" loanAccountService -> amortmoduleService "calls" "HTTP/JSON" "HTTP" loanAccountService -> customermgmtService "calls" "HTTP/JSON" "HTTP" loanAccountService -> prouctMgmtService "calls" "HTTP/JSON" "HTTP" loanAccountSetupService -> prouctMgmtService "calls" "HTTP/JSON" "HTTP" loanAccountSetupService -> loanAccountService "calls" "HTTP/JSON" "HTTP" loanAccountService -> payment "calls" "HTTP/JSON" "HTTP" loanAccountSetupService -> customermgmtService "calls" "HTTP/JSON" "HTTP" portalUI -> portalUI "calls" losExt -> loanAccountSetupService "calls" "HTTP/JSON" "HTTP" loanAccountService -> masterService "calls" "HTTP/JSON" "HTTP" operationsUser -> portalUI "interactwith" "HCI" "HCI" loanAccountService -> loanAccountService "calls" "HTTP/JSON" "HTTP" accountingService -> accountingService "calls" "HTTP/JSON" "HTTP" payment -> payment "uses" employee -> portalUI "opens" portalUI -> masterService "calls" "HTTP/JSON" "HTTP" } views { systemLandscape { include * autoLayout } systemContext prouctMgmt { include * autoLayout } systemContext loanAccountSetup { include * autoLayout } systemContext loanaccount { include * autoLayout } systemContext amortmodule { include * autoLayout } systemContext accounting { include * autoLayout } systemContext customermgmt { include * autoLayout } container loanAccountSetup { include * autoLayout } container loanaccount { include * autoLayout } container prouctMgmt { include * autoLayout } container amortmodule { include * autoLayout } container accounting { include * autoLayout } container customermgmt { include * autoLayout } // Dynamic flows dynamic loanaccount "DisbCreationFlow" "This flow represents only the first time disbursement creation flow"{ // At this stage, // 1. Loan account setup is already completed // 2. customer is already created // 3. For New Loan Account, no disb has been done till now. Disbursment records are created by the loan account setup service // This flow represents only the first time disbursement authorization flow //operationsUser -> portalUI "Opens port UI" } dynamic loanaccount "DisbAuthorizationFlow" "This flow represents only the first time disbursement authorization flow"{ // At this stage, // 1. Loan account setup is already completed // 2. customer is already created // 3. For New Loan Account, no disb has been done till now. Disbursment records are created by the loan account setup service // 4. Disbursment is already assigned to the Operation user // This flow represents only the first time disbursement authorization flow operationsUser -> portalUI "Opens portal UI and enters login id" portalUI -> portalUI "UI adds userrole,tenantcode based on the userid in the session and sends them in the header" //1. Dibursment Listing //GET /api/v1/loan-account-disbursements portalUI -> loanAccountService "calls Get API to get all Disbursment Listing Details with userid and role in the header" loanAccountService -> loanAccountDB "Get Disbursement Listing Details" loanAccountDB -> loanAccountService "Returns disbursment listing details" loanAccountService -> portalUI "Returns Disbursment Listing Details" portalUI -> operationsUser "Displays Disbursement Listing Details" //2. On Selection of Disbursement Listing Record operationsUser -> portalUI "Select Loan Account Disbursement Record" portalUI -> operationsUser "show error if disbdate > current business date" portalUI -> operationsUser "show error if previous disb is not completed" // component section 1 header (GET /api/v1/loan-accounts/{lan}/disbursements/{disbid}/details) portalUI -> loanAccountService "Get Disbursement Details header info" //loanAccountService -> loanAccountService "validation for the disbdate>currentbizdate and previous disb should not be in pending or created" loanAccountService -> loanAccountDB "Get Disb details" loanAccountService -> customermgmtService "Get customer name" //loanAccountService -> prouctMgmtService "Get Product setup description" loanAccountService -> masterService "Get Branch name using branch code" loanAccountService -> portalUI "Returns Header info" // component section 2 (GET /api/v1/loan-accounts/{lan}/installment-start-dates) portalUI -> loanAccountService "Get cycle date info" loanAccountService -> prouctMgmtService "Get cycle date details" loanAccountService -> loanAccountService "Prepare response details" loanAccountService -> PortalUI "Display cycle date combination with select start date if present along with disb details" //if clicks on the proceed button operationsUser -> portalUI "Updates cycle and click on Proceed" //PUT /api/v1/loan-accounts/{lan}/installment-start-dates // Update cycle date and disb date portalUI -> loanAccountService "Put request with cycle date change" loanAccountService -> loanAccountService "vaildate cycle date combination" loanAccountService -> loanAccountDB "Update cycle date and disb date" loanAccountService -> loanAccountDB "Get Beneficiary Details and Loan Account outstanding amount" loanAccountService -> loanAccountService "compute total disbursment amount" loanAccountService -> loanAccountDB "Get Loan Account Details" loanAccountService -> loanAccountService "Prepare Amort Request" loanAccountService -> amortmoduleService "Call Amort Module for BPI and Installment" loanAccountService -> loanAccountDB "Store BPI and installment amount in the DB" loanAccountService -> loanAccountService "Calculate Main Party and Customer final net disbursment" loanAccountService -> loanAccountDB "Update final disb amount and payout amount for beneficiary " // Component Section 3 // 'GET /api/v1/lan/{lanid}/disbursements/{disbid}/beneficiaries portalUI -> loanAccountService "get Disb summary details along with beneficiary and fee details" loanAccountService -> loanAccountDB "get Disb summary details along with beneficiary and fee details" portalUI -> operationsUser "shows the summary fields including payout details" operationsUser -> portalUI "Selects beneficiary and updates instrument details and clicks on save button" // PUT /api/v1/lans/{lan}/disbursements/{disbid}/beneficiaries/{beneficiaryid} portalUI -> loanAccountService "PUT call with updated beneficiary details" loanAccountService -> loanAccountService "validates payout amount" loanAccountService -> loanAccountDB "save beneficiary details" operationsUser -> portalUI " Ops user clicks on the final submit button" //POST /v1/lans/{LAN}/disbursements/{disbId}/approvals portalUI -> loanAccountService "Sends Post request with approval user details and it's role" loanAccountService -> loanAccountDB "Get current Approval role and required approval role" loanAccountService -> loanAccountDB "If role is MA or OA then mark disb as approved else PENDING_APPROVAL" loanAccountService -> loanAccountDB "Mark all Fees and tax as collected whose amount>0" loanAccountService -> eventbus "publish event DISBURSEMENT_AUTHORIZED with disbursement details if all approval are done" autoLayout } dynamic loanaccount "EmpDrePaymentFlow" "This flow represents employee initiated DRE Payment flow"{ employee -> portalUI "Enters customer's LAN Number" portalUI -> loanAccountService "call Get API to fetch Loan Account Details" loanAccountService -> loanAccountDB "Get Loan Account details" employee -> portalUI "Selects DRE menu and selects user mode and DRE mode" portalUI -> loanAccountService "call Get API to fetch Loan Account Dues GET /api/v1/loan-accounts/{lan}/dues/summary" loanAccountService -> loanAccountDB "Get Loan Account Dues" loanAccountService -> loanAccountDB "Get Loan Account Manual Payments" loanAccountService -> loanAccountDB "Get Loan Account OS principal" loanAccountService -> loanAccountDB "Get excess fund details" loanAccountService -> loanAccountService "Prepare Due response and send to portal" { portalUI -> portalUI "UI validation for dues like can't pay adv installment if any pending dues" portalUI -> loanAccountService "if user has selected DRE advance installment then Fetch PNT installments" portalUI -> portalUI "UI message if any intallment is in PNT then ask user for action" employee -> portalUI "User enters total number of installments" portalUI -> loanAccountService "fetch future pending installments based on the input from the user and give summary" employee -> portalUI "See the final amount and proceed" } { employee -> portalUI "User enters DRE payment Amount" employee -> portalUI "See the final amount and proceed" } { employee -> portalUI "User manually enters DRE payment Amount against each due payment codes" employee -> portalUI "See the final amount and proceed" portalUI -> loanAccountService "post to save details" } portalUI -> masterService "Get Payment modes" employee -> portalUI "Selects paymentmode" employee -> portalUI "Enter's payment details [if mode is DD/Cheque]" employee -> portalUI "Click on Proceed" portalUI -> loanAccountService "call Post API to save cdevent related details" loanAccountService -> loanAccountDB "save details in the cdevent related tables" loanAccountService -> loanAccountDB "if advinstall payment mark relevant installments as ADV in the repay schedule tables" { loanAccountService -> eventbus "if cash based payment then publish PAYMENT_RECEIVED event" } { loanAccountService -> eventbus "if cheque/DD based payment then on Cheque/DD clearance publish PAYMENT_RECEIVED event" } { loanAccountService -> payment "if digital then call payment API" payment -> loanAccountService "payment redirection" loanAccountService -> portalUI "redirect to payment gateway" } autoLayout } styles { element "Element" { color #ffffff } element "Person" { background #A6B7C9 shape Person } element "Software System" { background #1C75BC shape RoundedBox stroke #333B44 strokeWidth 4 } element "Container" { background #1C75BC shape RoundedBox stroke #333B44 strokeWidth 4 } element "Component" { background #1C75BC stroke #ECE5F2 color #ECE5F2 shape component stroke #333B44 strokeWidth 4 } element "RELDB" { shape Cylinder background #C57B57 stroke #333B44 strokeWidth 4 } element "EVENTBUS" { shape Pipe background #00A79D stroke #333B44 strokeWidth 4 } element "EXTERNAL" { background #C9C4CD shape RoundedBox stroke #333B44 strokeWidth 4 } relationship "MESSAGE" { color #333B44 } relationship "HTTP" { color #1C75BC } relationship "HTTPS" { color #00A79D } relationship "HCI" { color #F1BE06 } } } }