Custom Contract Management Module
Description
The Custom Contract Management module provides administrators with the ability to create, manage, and track custom pricing plans for groups. This module enables flexible pricing arrangements outside of standard package plans, with custom amounts, billing intervals, and usage limits tailored to specific business needs.
Custom contracts allow administrators to:
- Create unique pricing agreements for individual groups
- Set custom billing amounts and intervals (monthly or yearly)
- Define specific usage limits (members, product groups, products, categories, etc.)
- Send payment links via email for contract activation
- Track contract status throughout its lifecycle
- Manage contract-based subscriptions independently from standard plans
Overview Activity Diagram
---
config:
theme: base
layout: dagre
flowchart:
curve: linear
htmlLabels: true
themeVariables:
edgeLabelBackground: "transparent"
---
flowchart TB
%% Main components
Admin[Admin User]
DB[(Database)]
Stripe((Stripe API))
Email((Email Service))
subgraph Controllers
ContractController[CustomContractController]
end
subgraph Services
ContractService(CustomContractService)
StripeService(CheckoutStripeService)
EmailService(SendGridEmailService)
end
subgraph Models
CustomContractModel[[CustomContract]]
SubscriptionModel[[Subscription]]
GroupModel[[Group]]
end
%% Create Contract Flow (Blue - 1A-6A)
ContractController --- Step1A[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>1A</span>
<p style='margin-top: 8px'>Create Contract Request</p>
</div>
]
Step1A --> ContractService
ContractController --- Step2A[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>2A</span>
<p style='margin-top: 8px'>Validate Group & Subscription</p>
</div>
]
Step2A --> DB
ContractController --- Step3A[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3A</span>
<p style='margin-top: 8px'>Create Contract Record</p>
</div>
]
Step3A --> DB
ContractController --- Step4A[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4A</span>
<p style='margin-top: 8px'>Update Subscription Type</p>
</div>
]
Step4A --> DB
%% Send Payment Link Flow (Green - 1B-6B)
ContractController --- Step1B[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #99cc66 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>1B</span>
<p style='margin-top: 8px'>Send Payment Link Request</p>
</div>
]
Step1B --> ContractService
ContractController --- Step2B[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #99cc66 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>2B</span>
<p style='margin-top: 8px'>Create Stripe Checkout Session</p>
</div>
]
Step2B --> Stripe
ContractController --- Step3B[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #99cc66 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3B</span>
<p style='margin-top: 8px'>Save Session ID & Update Status</p>
</div>
]
Step3B --> DB
ContractController --- Step4B[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #99cc66 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4B</span>
<p style='margin-top: 8px'>Send Email with Payment Link</p>
</div>
]
Step4B --> Email
%% List Contracts Flow (Purple - 1C-3C)
ContractController --- Step1C[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #cc66cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>1C</span>
<p style='margin-top: 8px'>List Contracts Request</p>
</div>
]
Step1C --> ContractService
ContractController --- Step2C[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #cc66cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>2C</span>
<p style='margin-top: 8px'>Query with Filters & Pagination</p>
</div>
]
Step2C --> DB
ContractController --- Step3C[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #cc66cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3C</span>
<p style='margin-top: 8px'>Return Paginated Results</p>
</div>
]
Step3C --> Admin
%% Service to Model relationships
ContractService -.-> CustomContractModel
ContractService -.-> SubscriptionModel
ContractService -.-> GroupModel
StripeService -.-> Stripe
EmailService -.-> Email
%% Model to Database relationships
CustomContractModel -.-> DB
SubscriptionModel -.-> DB
GroupModel -.-> DB
%% Styling
style DB fill:#ffe6cc,stroke:#ff9900,stroke-width:2px
style Stripe fill:#fcd9d9,stroke:#cc3333,stroke-width:2px
style Email fill:#fcd9d9,stroke:#cc3333,stroke-width:2px
style Admin fill:#e6f3ff,stroke:#0066cc,stroke-width:2px
style Controllers fill:#e6f3ff
style Services fill:#f0f8e6
style Models fill:#fff0f5
style Step1A fill:transparent,stroke:transparent,stroke-width:1px
style Step2A fill:transparent,stroke:transparent,stroke-width:1px
style Step3A fill:transparent,stroke:transparent,stroke-width:1px
style Step4A fill:transparent,stroke:transparent,stroke-width:1px
style Step1B fill:transparent,stroke:transparent,stroke-width:1px
style Step2B fill:transparent,stroke:transparent,stroke-width:1px
style Step3B fill:transparent,stroke:transparent,stroke-width:1px
style Step4B fill:transparent,stroke:transparent,stroke-width:1px
style Step1C fill:transparent,stroke:transparent,stroke-width:1px
style Step2C fill:transparent,stroke:transparent,stroke-width:1px
style Step3C fill:transparent,stroke:transparent,stroke-width:1px
Feature List
| Name | Overview Link | Description |
|---|---|---|
| Create Custom Contract | Create Contract | Create a new custom pricing contract for a group with custom terms |
| Send Payment Link | Send Payment Link | Generate and send Stripe payment link via email to activate contract |
| List Custom Contracts | List Contracts | View and search custom contracts with filtering and pagination |
| View Contract Detail | Contract Detail | View detailed information about a specific custom contract |