Skip to content

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:

SettingBehavior
contract_auto_activate: serviceContract created when a Service is provisioned
contract_auto_activate: environmentContract created when an Environment is provisioned
contract_auto_activate: bothContract created for both (default)
contract_auto_activate: noneNo auto-activation -- manual creation only

Contract lifecycle

Contracts move through a defined set of states:

StateWhat it meansVisible to customer?
DraftContract being prepared. Not finalized.No
Pending signatureSent to customer for signing.No
ActiveSigned and in effect.Yes
ExpiringWithin 90 days of the end date. Renewal pipeline active.Yes
ExpiredEnd date has passed. Awaiting renewal or closure.Yes
RenewedLinked to a successor contract. Historical record.Yes
CancelledTerminated.Yes

Renewal pipeline

Contract renewal is a staged process that starts well before the end date:

  1. 90 days before -- status transitions from active to expiring. Admin notified.
  2. 60 days before -- customer notified via portal and email.
  3. 45 days before -- a renewal quote is generated automatically. If an annual adjustment percentage is configured, the new value reflects it.
  4. Customer accepts -- the standard quote-to-order-to-payment pipeline runs, the contract end date is extended, and status returns to active.
  5. 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.

  • 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