Skip to content
Launch GitLab Knowledge Graph

Implement order processing workflow

Build complete order processing workflow with state machine.

Order States:

  • PENDING → CONFIRMED → PROCESSING → SHIPPED → DELIVERED
  • Error states: CANCELLED, FAILED, REFUNDED

Implementation:

  • Design state machine
  • Implement state transitions with validation
  • Add idempotency for API calls
  • Implement order validation rules
  • Add inventory checks
  • Integrate payment processing
  • Add order notifications (email/SMS)

Business Rules:

  • Orders can only be cancelled before PROCESSING
  • Refunds allowed for DELIVERED orders within 30 days
  • Automatic cancellation after 24h if not confirmed