Commit Graph

11 Commits

Author SHA1 Message Date
Mike Kell 86c630d670 feat(stage-11a): custom order domain and data
Adds the custom/made-to-order commission workflow to feature_orders at the
domain and data layers. No UI in this slice — Stage 11B/11C cover the
CustomOrderFormPage, confirmation, and tracking surfaces.

Custom orders extend the existing Order aggregate rather than forming a
parallel system, so they flow through the same repository contract and the
same order management pipeline as standard orders.

Domain:

- OrderType enum (standard, custom) with wireValue/fromWire; fromWire defaults
  to standard so an order written by an older client is never mis-classified
  as a commission.
- CustomOrderSpec value object — material, color, size, dimensions,
  unmodifiable reference image URLs, free-text notes, estimated completion.
  Immutable with copyWith, list-aware ==/hashCode, and a toString that reports
  the reference image count rather than the URLs.
- DepositInfo value object — all money as integer cents, consistent with
  PaymentResult.amountCents, so repeated deposit/balance/settlement arithmetic
  cannot drift. Derived balanceDueCents clamps at zero rather than reporting a
  credit when a deposit exceeds the total.
- FulfillmentStatus pipeline: quoted -> depositReceived -> inProduction ->
  qualityCheck -> readyForPickup -> completed, plus cancelled from any
  non-terminal stage. FulfillmentTransition enforces legality in the domain —
  illegal jumps, same-stage advances, and any move out of a terminal stage are
  rejected with an explanatory reason rather than silently applied.
  qualityCheck -> inProduction is permitted: failed inspection sending a piece
  back to the bench is a real workshop operation.
- Order extended with orderType (defaults to standard), nullable
  customOrderSpec, depositInfo, and fulfillmentStatus, plus isCustom,
  hasDeposit, and balanceDueCents. Every existing field, default, and copyWith
  semantic is preserved.
- OrdersRepository extended with createCustomOrder, updateCustomOrderSpec,
  recordDeposit, and advanceFulfillmentStatus.

Data:

- FakeOrdersRepository implements all four methods and seeds five custom
  orders (KC-C2001..KC-C2005) covering every non-terminal pipeline stage. The
  six standard orders are unchanged.
- WooCommerceOrdersRepository implements all four methods. Custom order state
  round-trips through 13 _kc_-prefixed order meta keys; the full mapping table
  is documented on WooCommerceOrderMapper. Spec edits and stage advances PUT
  only meta, so they can never mutate a price, a line item, or a customer
  record. balanceDueCents is derived on read, never persisted, to avoid a
  second source of truth.
- WooCommerceApiClient.updateOrder added in feature_wordpress — only
  updateOrderStatus existed, which cannot carry meta.

Observability (Stage 16A layer):

- KcLogger injected into both repositories, defaulting to KcLogger.silent().
  Domain rejections log at warning; API failures log at error with the status
  code and originating exception.
- No silent catch (_) {} blocks — every swallowed error produces both a log
  record and a failure result.
- Log context is limited to identifiers, operation names, and status names.
  Customer identity, addresses, money amounts, and payment identifiers are
  never logged, and all context additionally passes through KcRedactor.
- The deposit transaction ID is deliberately absent from both DepositInfo and
  the WooCommerce meta mapping — it lives on PaymentResult alone, because
  order meta is readable by any store administrator. Asserted by tests on both
  the object and the outgoing request body.

Also closes P3.8: adds .metadata, CHANGELOG.md, LICENSE, and README.md to
feature_orders so it matches every other package (.gitignore already existed).
The README documents the pipeline, the meta mapping, and the privacy rules.

Deviations from the brief, recorded in the Stage 11A section:

- estimatedCompletionDate lives on CustomOrderSpec rather than Order, and
  there is no separate updateEstimatedCompletion — a date revision goes
  through updateCustomOrderSpec. Deferred for review in Stage 11C.
- internalNotes not added; Order.notes already serves that purpose.

Validation:

- 423 new tests in feature_orders (234 -> 657), including an exhaustive 7x7
  legal/illegal transition matrix and coverage of every new repository method
  on both implementations.
- 1,898/1,898 passing across all packages; no regression from the 1,475
  baseline at 666abd2.
- dart analyze --fatal-infos clean across all 11 packages and apps.
- dart format --line-length 100 clean on every file touched by this slice.

Closes: P2.2 (domain + data portion), P3.8
2026-08-29 15:19:29 -04:00
Mike Kell 0a45ecb1c0 feat(wc-catalog-expansion): Stage 9C — WooCommerce catalog expansion
- Add ProductCategory domain model (id, name, slug, parentId, count) with copyWith, equality, toString
- Add ProductImage domain model (id, url, alt, position) with copyWith, equality
- Extend ProductPublishingRepository contract: createProduct, deleteProduct, updateProductImages, getProductImages, getCategories, createCategory, updateCategory, deleteCategory
- Implement all 8 new methods in FakeProductPublishingRepository with seed categories
- Implement all 8 new methods in WordPressProductPublishingRepository
- Add WooCommerceApiClient methods: createProduct, deleteProduct, getCategories (paginated), createCategory, updateCategory, deleteCategory, getProductImages, setProductImages
- Add use cases: CreateProduct, DeleteProduct, GetCategories, CreateCategory, UpdateProductImages
- Update feature_wordpress.dart barrel exports
- Update test stubs in dashboard_controller_test.dart and product_publishing_page_test.dart
- Add 69 new tests in wc_catalog_expansion_test.dart (388 total feature_wordpress, 24 kell_web — all passing)
- Update master_development_brief.md and build_execution_tracker.md
2026-07-11 10:23:31 -04:00
Mike Kell 5df3d8beac feat(inventory): Stage 9B — WooCommerce stock/inventory sync 2026-07-11 10:00:55 -04:00
Mike Kell e92788038a feat(orders): Stage 9A - WooCommerce Orders API integration
- Extend OrderStatus with onHold, refunded, failed
- Extend OrderItem with productId, variationId, customizations
- Extend Order with paymentMethod, source, customFields
- Add OrderSource enum (online, market, manual)
- Add getOrder(id) to OrdersRepository contract and FakeOrdersRepository
- Add WooCommerceOrderMapper (WooCommerce JSON <-> Order domain)
- Add WooCommerceOrdersRepository implementing full OrdersRepository
- Add orders API methods to WooCommerceApiClient (getOrders, getOrder,
  updateOrderStatus, createOrder, addOrderNote)
- Export WooCommerceApiClient/WooCommerceApiException from feature_wordpress
- Add feature_wordpress + http dev deps to feature_orders pubspec
- 83 new tests: mapper (25), repository+API client (23), FakeRepo.getOrder (3),
  plus existing suite grows to 198/198 feature_orders
- All packages analyze clean; 847/847 total tests passing
- Update master_development_brief.md and build_execution_tracker.md
2026-07-11 09:45:36 -04:00
Mike Kell b2bec44fcb feat/orders-domain: expand orders domain with write operations and 90 tests 2026-07-10 19:04:39 -04:00
Mike Kell d36c2d1e73 feat(inventory): Stage 5A — inventory domain expansion with write actions 2026-07-10 18:33:02 -04:00
Mike Kell b69edd3e4a feat(wordpress): add category-only product edit (Stage 1B)
Validate Docs / validate-docs (push) Successful in 1m3s Details
2026-04-11 15:54:51 -04:00
Mike Kell 8d1a01581a tage 1A — Description-only product edit implemented
Validate Docs / validate-docs (push) Successful in 56s Details
2026-04-11 11:07:36 -04:00
Mike Kell ae9c1dd90c feat(feature_wordpress): add name-only product update
Publish Docs / publish-docs (push) Successful in 57s Details
2026-04-11 10:36:00 -04:00
Mike Kell 039612cb6e Update main with product publishing
Publish Docs / publish-docs (push) Successful in 1m57s Details
2026-04-05 20:03:10 -04:00
Mike Kell 00a667d19e feat(dashboard): compose live summary data across features
Validate Docs / validate-docs (push) Successful in 59s Details
2026-04-04 14:07:21 -04:00