Contract Lifecycle
Contracts formalize the agreement between MIDDAG and a customer Organization for services or managed environments. This page explains how contracts are created, managed through their active period, renewed, amended, and eventually archived.
Contract states
| Status | Meaning |
|---|---|
draft | Created by admin, not yet visible to the customer |
pending_signature | Sent to the customer for review and signature |
active | Signed and in effect |
expiring | Within 30 days of the end date |
expired | End date has passed |
renewed | Replaced by a new contract (linked) |
cancelled | Terminated early or not renewed |
Contract creation
Contracts are created in two ways:
- Automatically -- When an SVC entitlement is provisioned and the ProvisioningPolicy has auto-contract creation enabled, the system creates a contract linked to the entitlement.
- Manually -- The admin creates a contract from the admin panel, selecting the Organization, filling in terms, value, dates, and uploading the PDF.
In both cases, the contract record includes:
- Title and contract number
- Parties (MIDDAG as provider, Organization as client)
- Value and payment terms
- Start date and end date
- SLA terms and conditions
- Link to the entitlement (ENV or SVC), if applicable
The signed PDF document is uploaded to Cloudflare R2 storage. The contract record stores the file reference along with metadata.
Active period
During the active period:
- The customer can view the contract in the portal, see its terms, and download the PDF.
- Service requests are opened against the contract's entitlement.
- The CreditBalance is consumed as work is performed.
- The contract's SLA terms govern response and resolution targets.
Renewal notifications
The system sends renewal reminders automatically:
| Trigger | Action |
|---|---|
| 30 days before end | Email to primary contact (informational). Contract status transitions to expiring. |
| 15 days before end | Second reminder email (attention level). |
| 7 days before end | Final reminder email (urgent level). |
| End date reached | Contract transitions to expired. Notification sent. |
Each reminder is sent at most once per contract. If the contract is renewed before a reminder triggers, that reminder is skipped.
Renewal process
Contract renewal creates a new contract linked to the previous one:
- The admin creates a new contract with updated terms, dates, and pricing.
- The new contract references the previous contract, preserving the renewal chain.
- The previous contract is marked as
renewed. - The entitlement's contract reference is updated to the new contract.
- Reminders for the old contract cease.
The customer can see the full renewal history in the portal -- each contract in the chain is accessible.
Amendment handling
When contract terms need to change mid-period:
- The admin updates the contract record with the new terms.
- A new PDF is uploaded if the signed document has changed.
- The amendment is logged with a timestamp and the admin's identity.
- The customer is notified of the change.
For major changes, the admin may choose to cancel the current contract and create a new one rather than amending in place.
Expiration and archival
When a contract expires without renewal:
- The status transitions to
expired. - The customer is notified.
- Service requests against the contract's entitlement may be blocked depending on configuration.
- The contract remains visible in the portal for reference.
- If not renewed within the configured period, the admin can mark it as
cancelled.
Archived contracts (renewed or cancelled) remain accessible in the portal for the duration set by the CancellationPolicy's data_retention_days (default: 365 days).
Documents attached to contracts
Contracts are closely linked to the Document domain:
- Signed PDFs are stored in Cloudflare R2 under the organization's folder structure.
- Signed URLs with 5-minute expiration are generated for secure downloads.
- Additional documents (amendments, appendices, service reports) can be attached via the Document domain and linked to the contract.
Related pages
- Service Provisioning -- How contracts are created from SVC entitlements
- Suspension and Recovery -- What happens when the underlying entitlement is suspended
- Billing and Finance -- Financial aspects of contracts