Business Services Overview
The Business Services layer is the heart of the SureInk Platform. It orchestrates the complex relationships between customers, the products they buy, and the rules that govern their usage.
Summary
This section details the core domain models and workflows that drive the platform's revenue and entitlement engines. It covers the lifecycle from an initial Quote to a finalized Agreement, the provisioning of Subscriptions and Licenses, and the ongoing tracking of Usage and Invoices.
Business Services Model and Hierarchy
The platform's business logic is structured around several key hierarchies that define how entities interact.
Entity Relationships
Core Hierarchies
-
Entitlement Hierarchy:
- Agreements (Contracts): The root legal document governing the relationship.
- Subscriptions: Specific instances of products purchased under an agreement.
- Products: The definition of what is being sold.
- Licenses: The technical artifact granting access.
-
Commerce Hierarchy:
- Quotes: Initial proposals.
- Sales Orders: Confirmed intent to purchase.
- Invoices: Requests for payment.
-
Identity Hierarchy:
-
Governance Hierarchy:
- Agreements: Define the high-level terms.
- Policies: Specific constraints derived from agreements.
- Rules: Logic that enforces policies.
- Resources: Assets protected by rules.
- Usage: Consumption of resources.
Functional Overview (Cloud MSA)
-
Subscription Management: Handling creation, updates, and cancellations of Master Subscription Agreements.
-
License Lifecycle: Generating, signing (
.p12keys), and managing software licenses. -
Order Processing: Calculating totals, handling carts, and processing payments via Stripe.
-
Business Rules: Applying logic for pricing, discounts, and feature accessibility.
-
Reporting: Generating metrics for revenue, license conversion, and subscriber growth.
Major Code Modules (com.sureink.cloudmsa)
controller: Exposes REST endpoints forCart,License,Order,Product,Subscription, andReport.service: Implements core business logic (e.g.,SubscriptionService,ProjectService,MasterSubscriptionAgreementService).repository: JPA repositories for persisting entities in thecloudmsadatabase schema.event: Publishers and listeners for Kafka events (e.g.,LicenseCreatedEvent,OrderProcessedEvent).client: Feign clients for interacting withsureink-customerandsureink-usage-data.util: Helper classes likeOrderCalculatorandProductCodeGenerator.
Linkages and References
- Central Role: This service serves as the primary backend for the SureMSA Angular UI.
- Downstream Links:
- Uses Connector for Salesforce/Stripe sync.
- Uses Customer for tenant and contact details.
- Uses Usage Data to validate license consumption.
- Security: Secured via Keycloak with role-based access control (
@RolesAllowed("user")).