Contracts
A Contract is a service agreement tied to an entitlement. It defines the terms, duration, SLA commitments, and financial conditions of a service relationship between MIDDAG and a customer organization. Contracts are the formal backbone of ongoing service delivery.
How contracts are created
Contracts can be created automatically or manually:
- Auto-activation -- when a SVC or ENV entitlement is provisioned, the system can automatically create a contract based on a configurable policy. The default is to create contracts for both Service and Environment entitlements.
- Manual creation -- admins create contracts directly in the WordPress admin, filling in terms, dates, and uploading the signed PDF.
The auto-activation behavior is controlled by a policy setting:
| Setting | Behavior |
|---|---|
contract_auto_activate: service | Contract created when a Service is provisioned |
contract_auto_activate: environment | Contract created when an Environment is provisioned |
contract_auto_activate: both | Contract created for both (default) |
contract_auto_activate: none | No auto-activation -- manual creation only |
Contract lifecycle
Contracts move through a defined set of states:
| State | What it means | Visible to customer? |
|---|---|---|
| Draft | Contract being prepared. Not finalized. | No |
| Pending signature | Sent to customer for signing. | No |
| Active | Signed and in effect. | Yes |
| Expiring | Within 90 days of the end date. Renewal pipeline active. | Yes |
| Expired | End date has passed. Awaiting renewal or closure. | Yes |
| Renewed | Linked to a successor contract. Historical record. | Yes |
| Cancelled | Terminated. | Yes |
Renewal pipeline
Contract renewal is a staged process that starts well before the end date:
- 90 days before -- status transitions from
activetoexpiring. Admin notified. - 60 days before -- customer notified via portal and email.
- 45 days before -- a renewal quote is generated automatically. If an annual adjustment percentage is configured, the new value reflects it.
- Customer accepts -- the standard quote-to-order-to-payment pipeline runs, the contract end date is extended, and status returns to
active. - Customer does not act -- additional reminders at 30, 15, and 7 days. If the end date passes, the contract transitions to
expired.
Each notification is sent at most once per milestone to avoid spam.
Loyalty period and early cancellation
Contracts can include a loyalty period (default: 12 months). During this period:
- Cancellation is allowed with 30 days notice plus an early termination fee (configurable per contract as a percentage of remaining value).
- After the loyalty period ends, the contract becomes month-to-month with no termination fee.
- Admins can waive the loyalty requirement on a case-by-case basis.
Annual adjustment
Contracts can have an annual price adjustment percentage (adjustment_pct). On renewal, the new value is calculated as:
new_value = previous_value * (1 + adjustment_pct)The adjustment is reflected in the renewal quote. Admins can override it with a fixed value if needed.
SLA terms
Each contract stores its SLA terms, typically determined by the service class assigned to the parent entitlement (Free, Basic, Flex, Business, Enterprise, or Government). SLA terms define response times, resolution times, and uptime targets.
Document attachments
Contracts support two PDF attachments stored in Cloudflare R2:
- Original PDF -- the unsigned contract document
- Signed PDF -- the fully executed version with signatures
Downloads use signed URLs with short expiration for security. The admin uploads documents through the WordPress admin interface.
What admins see
In the WordPress admin, the contract list shows:
- Contract number and title
- Organization
- Entitlement code (SVC-xxx or ENV-xxx)
- Status (with color indicators)
- Start date, end date, and renewal date
- Monthly or annual value
Clicking a contract opens its detail view with SLA terms, renewal history, linked documents, and the full state transition log.
Related pages
- Entitlements -- the parent record that owns the contract
- Services -- the work delivered under the contract
- Service Requests -- tasks tracked against the contract's SLA
- Documents -- file management for signed agreements
- Policies -- SLA and cancellation policies that govern contracts