Skip to content

Funding Module Specification

Purpose

The funding module implements the Funding Domain inside the Spring Boot Modulith. It owns funding needs, working capital assessments, funding products, funding partners, funding applications, funding readiness, eligibility assessments, cash-flow risks, repayment tracking, and funding recommendation records.

Owned Domain

Funding owns funding workflow state and funding recommendation records. It references Organization, Contract, Marketplace, and Intelligence records by ID and does not own organization financial profile facts, contract facts, marketplace display state, or AI reasoning sessions.

Owned Aggregates

Aggregate Responsibility
Funding Need Root aggregate for funding source context, amount, purpose, and linked opportunity, bid, or contract.
Funding Product Catalogue Product type, applicability criteria, and partner availability.
Funding Partner Profile Funding partner relationship context, status, product support, and marketplace display reference.
Funding Application Application workflow, documents, partner, product, status, and outcome.
Funding Readiness Assessment Readiness score, gaps, eligibility factors, and explanations.
Cash-Flow Risk Assessment Cash-flow risk level, cause, mitigation, and linked contract or payment context.
Repayment Tracker Repayment schedule, due dates, entries, and repayment state.

Owned Entities

Funding Need, Funding Product, Funding Partner, Funding Application, Readiness Assessment, Eligibility Assessment, Cash-Flow Risk, Repayment Schedule, Repayment Entry, and Funding Recommendation.

Owned Value Objects

FundingNeedId, FundingProductType, FundingAmount, FundingPurpose, FundingReadinessScore, EligibilityResult, ApplicationStatus, CashFlowRiskLevel, RepaymentStatus, FundingRecommendationDecision, and FundingPartnerType.

Commands

Command Responsibility
IdentifyFundingNeed Capture funding need and business context.
CompleteWorkingCapitalAssessment Record readiness score and gaps.
AddFundingProduct Add or update governed funding product catalogue entry.
AddFundingPartner Add or update funding partner profile.
AssessFundingEligibility Record product or partner eligibility outcome.
CreateFundingRecommendation Record decision-support recommendation.
CreateFundingApplication Start funding application workflow.
SubmitFundingApplication Record submission to partner or workflow.
ChangeFundingApplicationStatus Update application state and audit reason.
IdentifyCashFlowRisk Capture cash-flow risk, cause, owner, and mitigation.
CreateRepaymentSchedule Record repayment plan for approved workflow.
RecordRepayment Update repayment entry state.
CloseFundingWorkflow Close need or application with reason.

Queries

Query Responsibility
GetFundingNeed Return funding need and source context.
GetFundingProducts Return product catalogue and applicability summary.
GetFundingPartners Return partner profiles and supported products.
GetWorkingCapitalAssessment Return readiness score, gaps, and explanation.
GetEligibilityAssessment Return eligibility outcome and assumptions.
GetFundingRecommendations Return decision-support recommendations.
GetFundingApplication Return application workflow state.
GetCashFlowRisks Return cash-flow risks by organization or contract reference.
GetRepaymentSchedule Return repayment plan and entry state.

Application Services

FundingNeedApplicationService, WorkingCapitalAssessmentApplicationService, FundingProductApplicationService, FundingPartnerApplicationService, EligibilityAssessmentApplicationService, FundingRecommendationApplicationService, FundingApplicationApplicationService, CashFlowRiskApplicationService, and RepaymentApplicationService.

Domain Services

FundingNeedIntakeService, WorkingCapitalAssessmentService, ProductMatchingService, PartnerMatchingService, ApplicationWorkflowService, CashFlowRiskService, RepaymentTrackingService, and IntelligenceRecommendationReviewService.

Policies

Funding Need Intake Policy, Working Capital Assessment Policy, Product Matching Policy, Partner Matching Policy, Application Workflow Policy, Cash-Flow Risk Policy, Repayment Tracking Policy, and Intelligence Recommendation Review Policy.

Repositories

FundingNeedRepository, FundingProductRepository, FundingPartnerRepository, WorkingCapitalAssessmentRepository, EligibilityAssessmentRepository, FundingRecommendationRepository, FundingApplicationRepository, CashFlowRiskRepository, RepaymentScheduleRepository, RepaymentEntryRepository, and FundingAuditRepository.

Events Published

FundingNeedIdentified, WorkingCapitalAssessmentCompleted, FundingRecommendationCreated, FundingApplicationCreated, FundingApplicationSubmitted, FundingApplicationStatusChanged, CashFlowRiskIdentified, RepaymentScheduleCreated, RepaymentRecorded, and FundingWorkflowClosed.

Events Consumed

ContractWorkspaceCreated, VariationApproved, InvoiceRecorded, PaymentRecorded, ContractRiskIdentified, OrganizationProfileUpdated, MarketplaceMatchCreated, RecommendationDisplayed, AIRecommendationProduced, SubscriptionSuspended, and AdministrativePolicyChanged.

REST API Responsibility

The module owns API responsibilities for funding needs, working capital assessments, funding products, funding partners, funding recommendations, funding applications, cash-flow risks, repayment schedules, and repayment entries. Final endpoint specifications are deferred.

Database Ownership

Funding owns conceptual persistence for funding needs, funding products, funding partners, working capital assessments, eligibility assessments, funding recommendations, funding applications, cash-flow risks, repayment schedules, repayment entries, and funding audit logs.

Module Dependencies

Allowed dependencies are shared kernel identifiers, identity authorization context, organization profile and financial-context references, contract invoice/payment/variation signals, marketplace funding partner display references, notification application and repayment triggers, analytics projections, and intelligence recommendation boundaries.

Forbidden Dependencies

Funding must not mutate Organization financial profile facts, Contract delivery or payment facts, Marketplace display state, Intelligence reasoning records, Notification delivery records, Analytics projections, or Payment Provider settlement records. Funding recommendations must not be presented as final regulated financial advice.

AIOS Interaction Boundary

AIOS may estimate funding needs, summarize cash-flow risk, suggest products, explain eligibility gaps, and recommend partner matches. Funding records accepted recommendations as decision support only after governed review.

Security And Tenant Rules

  • Funding needs, applications, risks, and repayment records are organization-scoped sensitive financial data.
  • Funding partner display can be marketplace-visible, but application state is tenant-private.
  • Financial recommendations must preserve assumptions, source context, and decision-support disclaimers.
  • Partner submissions require explicit authorization, audit logging, and tenant context.
  • Repayment and cash-flow risk data require least-privilege access.

Test Strategy

Tests must cover funding need intake, assessment scoring, eligibility outcomes, recommendation framing, application workflow transitions, cash-flow risk identification, repayment tracking, event publication, idempotent event consumption, tenant filtering, authorization, and Spring Modulith boundary verification.

Future Microservice Extraction Notes

Funding can be extracted when partner workflows and finance integrations mature. Extraction requires stable contracts with Contract, Marketplace, and Organization, secure partner integration boundaries, tenant-aware financial data migration, and independent audit retention.

Mermaid Component Diagram

flowchart TD
    Api[funding.api.rest]
    App[funding.application.service]
    Command[funding.application.command]
    Query[funding.application.query]
    Domain[funding.domain.model]
    Policy[funding.domain.policy]
    Repo[funding.infrastructure.persistence]
    Integration[funding.infrastructure.integration]
    Messaging[funding.infrastructure.messaging]
    Organization[organization context]
    Contract[contract finance signals]
    Marketplace[marketplace partner display]
    Intelligence[intelligence recommendations]
    Notification[notification triggers]

    Api --> App
    App --> Command
    App --> Query
    App --> Domain
    Domain --> Policy
    App --> Repo
    App --> Integration
    App --> Messaging
    App --> Organization
    App --> Contract
    App --> Marketplace
    App --> Intelligence
    Messaging --> Notification