Skip to content

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

StatusMeaning
draftCreated by admin, not yet visible to the customer
pending_signatureSent to the customer for review and signature
activeSigned and in effect
expiringWithin 30 days of the end date
expiredEnd date has passed
renewedReplaced by a new contract (linked)
cancelledTerminated 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:

TriggerAction
30 days before endEmail to primary contact (informational). Contract status transitions to expiring.
15 days before endSecond reminder email (attention level).
7 days before endFinal reminder email (urgent level).
End date reachedContract 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:

  1. The admin creates a new contract with updated terms, dates, and pricing.
  2. The new contract references the previous contract, preserving the renewal chain.
  3. The previous contract is marked as renewed.
  4. The entitlement's contract reference is updated to the new contract.
  5. 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:

  1. The status transitions to expired.
  2. The customer is notified.
  3. Service requests against the contract's entitlement may be blocked depending on configuration.
  4. The contract remains visible in the portal for reference.
  5. 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.