kell_creations/kell_creations_apps/packages/feature_orders
Mike Kell a2354ccd36 chore: update tracker - feat/custom-order-domain merged to main (Stage 11A complete) 2026-08-29 15:20:19 -04:00
..
build feat(orders): Stage 9A - WooCommerce Orders API integration 2026-07-11 09:45:36 -04:00
lib feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00
test feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00
.gitignore chore(feature_orders): add .gitignore, untrack .dart_tool and pubspec.lock 2026-05-30 10:09:40 -04:00
.metadata feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00
CHANGELOG.md feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00
LICENSE feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00
README.md feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00
analysis_options.yaml chore: update tracker - feat/custom-order-domain merged to main (Stage 11A complete) 2026-08-29 15:20:19 -04:00
pubspec.yaml feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00

README.md

Order management for the Kell Creations operations platform. Covers both standard catalogue orders and made-to-order custom commissions behind a single Order aggregate and one OrdersRepository contract.

Features

  • Domain model — Order, OrderItem, OrderStatus, OrderSource, OrderType, PaymentMethod, PaymentResult.
  • Custom orders — CustomOrderSpec (material, colour, size, dimensions, reference images, notes, estimated completion) and DepositInfo (deposit and total amounts in integer cents, deposit/settlement dates, derived balance).
  • Fulfillment pipeline — FulfillmentStatus with enforced transitions: quoted → depositReceived → inProduction → qualityCheck → readyForPickup → completed, plus cancelled from any non-terminal stage and a qualityCheck → inProduction rework path. Illegal jumps are rejected by the domain, not silently applied.
  • Repository contract — OrdersRepository with read, status, note, and create operations plus createCustomOrder, updateCustomOrderSpec, recordDeposit, and advanceFulfillmentStatus.
  • Implementations — FakeOrdersRepository (seeded standard and custom orders across every pipeline stage) and WooCommerceOrdersRepository (REST API v3, custom order state round-tripped through _kc_-prefixed order meta-data).
  • Application layer — OrdersController, CheckoutController, and the GetOrders / UpdateOrderStatus / AddOrderNote / CreateOrder use cases.
  • Presentation — OrdersPage, OrderCard, OrderDetailPanel, OrderStatusChip.

Getting started

Add the package as a path dependency and import the barrel:

dependencies:
  feature_orders:
    path: ../feature_orders
import 'package:feature_orders/feature_orders.dart';

Usage

final repository = FakeOrdersRepository(logger: observability.logger);

final result = await repository.createCustomOrder(
  order,
  spec: CustomOrderSpec(
    material: 'Organic cotton',
    color: 'Sage green',
    size: 'Large',
  ),
  deposit: const DepositInfo.quoted(
    totalAmountCents: 7200,
    depositAmountCents: 2400,
  ),
);

// Advance through the pipeline — illegal jumps are rejected.
await repository.recordDeposit(
  order.id,
  amountCents: 2400,
  paidAt: DateTime.now(),
);
await repository.advanceFulfillmentStatus(order.id, FulfillmentStatus.inProduction);

Observability and privacy

Repository implementations accept an optional KcLogger from core. Failed and rejected write operations are logged with the operation name, order ID, and status names only. Customer identity, addresses, money amounts, and deposit payment identifiers are never logged, and every context map is additionally passed through KcRedactor. There are no silent catch (_) {} blocks.

The WooCommerce meta-data mapping deliberately excludes the deposit transaction ID — it lives on PaymentResult alone. See the class-level documentation on WooCommerceOrderMapper for the complete key table.

Additional information

Part of the kell_creations_apps monorepo. Run the package tests with flutter test from this directory, or the whole suite with ./tools/run_all_tests.sh --analyze from kell_creations_apps/.