Skip to content

Sequence Diagrams

One sequence diagram per API endpoint — showing the call flow from client through controller, service, repository, and database.


Customer Service

POST /api/v1/customers — Create Customer

sequenceDiagram
    participant Client
    participant Controller as CustomerController
    participant Service as CustomerService
    participant Repository as CustomerRepository
    participant DB as customer_db
    Client->>Controller: POST CreateCustomerRequest
    Controller->>Service: createCustomer
    Service->>Repository: save
    Repository->>DB: INSERT
    DB-->>Repository: Saved
    Repository-->>Service: Customer
    Service-->>Controller: CreateCustomerResponse
    Controller-->>Client: 201 Created

GET /api/v1/customers/{custId} — Get Customer

sequenceDiagram
    participant Client
    participant Controller as CustomerController
    participant Service as CustomerService
    participant Repository as CustomerRepository
    participant DB as customer_db
    Client->>Controller: GET custId
    Controller->>Service: getCustomer
    Service->>Repository: findByCustId
    Repository->>DB: SELECT
    DB-->>Repository: Customer row
    Repository-->>Service: Customer
    Service-->>Controller: CustomerDetailsResponse
    Controller-->>Client: 200 OK

PUT /api/v1/customers/{custId} — Update Customer

sequenceDiagram
    participant Client
    participant Controller as CustomerController
    participant Service as CustomerService
    participant Repository as CustomerRepository
    participant DB as customer_db
    Client->>Controller: PUT UpdateCustomerRequest
    Controller->>Service: updateCustomer
    Service->>Repository: findByCustId
    Repository->>DB: SELECT
    DB-->>Repository: Customer
    Service->>Repository: save
    Repository->>DB: UPDATE
    DB-->>Repository: OK
    Service-->>Controller: CustomerDetailsResponse
    Controller-->>Client: 200 OK

Deposit Service

POST /api/v1/deposits/term-deposits — Create Term Deposit

sequenceDiagram
    participant Client
    participant Controller as TermDepositController
    participant Service as TermDepositService
    participant Mapper as TermDepositMapper
    participant Repository as TermDepositRepository
    participant EventPub as EventPublisher
    participant DB as deposit_db
    Client->>Controller: POST CreateTermDepositRequest
    Controller->>Service: createTermDeposit
    Service->>Mapper: toEntity
    Mapper-->>Service: TermDeposit
    Service->>Service: generateDepositNumber calculateMaturityDetails
    Service->>Repository: save
    Repository->>DB: INSERT term_deposit
    DB-->>Repository: OK
    Service->>EventPub: publish deposit-created
    EventPub-->>Service: OK
    Service->>Mapper: toCreateResponse
    Mapper-->>Service: CreateTermDepositResponse
    Service-->>Controller: CreateTermDepositResponse
    Controller-->>Client: 201 Created

POST /{depositNumber}/authorize — Authorize Deposit

sequenceDiagram
    participant Client
    participant Controller as DepositAuthorizeController
    participant Service as DepositAuthorizeService
    participant AuthRepo as DepositAuthorizeRepository
    participant TxnClient as TransactionServiceClient
    participant DB as deposit_db
    Client->>Controller: POST DepositAuthorizeRequest
    Controller->>Service: authorizeDeposit
    Service->>AuthRepo: findByDepositNumber
    AuthRepo->>DB: SELECT deposit_authorize
    DB-->>AuthRepo: DepositAuthorize
    Service->>Service: validateAuthorizerPermission
    Service->>TxnClient: postAuthorizationTransaction
    TxnClient-->>Service: TransactionRef
    Service->>AuthRepo: save (status=AUTHORIZED)
    AuthRepo->>DB: UPDATE deposit_authorize
    Service-->>Controller: DepositAuthorizeResponse
    Controller-->>Client: 200 OK

POST /{depositNumber}/close — Close Deposit

sequenceDiagram
    participant Client
    participant Controller as DepositClosingController
    participant Service as DepositClosingService
    participant ClosingRepo as DepositClosingRepository
    participant TxnClient as TransactionServiceClient
    participant PerActClient as PeriodicActivityServiceClient
    participant DB as deposit_db
    Client->>Controller: POST DepositClosingSaveRequest
    Controller->>Service: closeDeposit
    Service->>ClosingRepo: findByDepositNumber
    ClosingRepo->>DB: SELECT deposit_closing
    Service->>PerActClient: getAccruedInterest(depositNumber, closingDate)
    PerActClient-->>Service: ClosingPositionResponse
    Service->>Service: calculateClosingAmount (principal + interest - TDS - penalty)
    Service->>TxnClient: postClosingTransaction
    TxnClient-->>Service: TransactionRef
    Service->>ClosingRepo: save (status=CLOSED)
    ClosingRepo->>DB: UPDATE deposit_closing
    Service-->>Controller: DepositAuthorizeResponse
    Controller-->>Client: 200 OK

POST /{depositNumber}/renew — Renew Deposit

sequenceDiagram
    participant Client
    participant Controller as DepositRenewalController
    participant Service as DepositRenewalService
    participant TDRepo as TermDepositRepository
    participant SubRepo as DepositSubAcinfoRepository
    participant EventPub as EventPublisher
    participant DB as deposit_db
    Client->>Controller: POST DepositRenewalSaveRequest
    Controller->>Service: renewDeposit
    Service->>TDRepo: findByDepositNumber
    TDRepo->>DB: SELECT term_deposit (matured)
    Service->>Service: generateNewDepositNumber calculateNewMaturityDate
    Service->>TDRepo: save (new TermDeposit with RENEWAL status)
    TDRepo->>DB: INSERT term_deposit
    Service->>SubRepo: save (sub-account link)
    SubRepo->>DB: INSERT deposit_sub_acinfo
    Service->>EventPub: publish deposit-created (renewed)
    EventPub-->>Service: OK
    Service-->>Controller: CreateTermDepositResponse
    Controller-->>Client: 201 Created

POST /calculate-tds — Calculate TDS

sequenceDiagram
    participant Client
    participant Controller as TermDepositController
    participant Service as TermDepositService
    participant Repository as TermDepositRepository
    participant DB as deposit_db
    Client->>Controller: POST CalculateTDSRequest
    Controller->>Service: calculateTDS
    Service->>Repository: findByDepositNumber
    Repository->>DB: SELECT
    DB-->>Repository: TermDeposit
    Service->>Service: getTDSRate calculateTDSAmount getTDSExemptionLimit
    Service-->>Controller: TDSCalculationResponse
    Controller-->>Client: 200 OK

Transaction Service

POST /api/v1/transactions — Create Transaction

sequenceDiagram
    participant Client
    participant Controller as TransactionController
    participant Service as TransactionService
    participant Mapper as TransactionMapper
    participant Repository as TransactionRepository
    participant EventPub as EventPublisher
    participant DB as transaction_db
    Client->>Controller: POST CreateTransactionRequest
    Controller->>Service: createTransaction
    Service->>Mapper: toEntity
    Service->>Repository: save
    Repository->>DB: INSERT
    DB-->>Repository: OK
    Service->>EventPub: publish transaction-created
    Service->>Mapper: toCreateResponse
    Service-->>Controller: CreateTransactionResponse
    Controller-->>Client: 201 Created

Periodic Activity Service

GET /interest-rate-groups — Search Groups

sequenceDiagram
    participant Client
    participant Controller as InterestRateGroupController
    participant Service as InterestRateGroupService
    participant Repository as DepositRoiGroupRepository
    participant DB as periodicactivity_db
    Client->>Controller: GET search params
    Controller->>Service: searchGroups
    Service->>Repository: findByCriteria
    Repository->>DB: SELECT with filters
    DB-->>Repository: Page of groups
    Repository-->>Service: Page
    Service-->>Controller: Page of InterestRateGroupResponse
    Controller-->>Client: 200 OK

System Setup Service

POST /configuration — Save Branch Configuration

sequenceDiagram
    participant Client
    participant Controller as SystemConfigurationController
    participant Service as SystemConfigurationService
    participant Repository as BranchConfigurationRepository
    participant DB as system_setup_db
    Client->>Controller: POST BranchConfigurationRequest
    Controller->>Service: saveBranchConfiguration
    Service->>Service: validateConfigParams
    Service->>Repository: save
    Repository->>DB: INSERT / UPDATE branch_configuration
    DB-->>Repository: OK
    Service-->>Controller: BranchConfigurationResponse
    Controller-->>Client: 200 OK