feat: add Printify order submission and fulfilment tracking

Submit paid orders to Printify via provider API with idempotent
guards, Stripe address mapping, and error handling. Track fulfilment
status through submitted → processing → shipped → delivered via
webhook-driven updates (primary) and Oban Cron polling fallback.

- 9 fulfilment fields on orders (status, provider IDs, tracking, timestamps)
- OrderSubmissionWorker with retry logic, auto-enqueued after Stripe payment
- FulfilmentStatusWorker polls every 30 mins for missed webhook events
- Printify order webhook handlers (sent-to-production, shipment, delivered)
- Admin UI: fulfilment column in table, fulfilment card with tracking info,
  submit/retry and refresh buttons on order detail
- Mox provider mocking for test isolation (Provider.for_type configurable)
- 33 new tests (555 total), verified against real Printify API

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-08 09:51:51 +00:00
parent 02cdc810f2
commit 3e19887499
22 changed files with 1318 additions and 54 deletions

View File

@@ -92,7 +92,11 @@ config :simpleshop_theme, Oban,
repo: SimpleshopTheme.Repo,
plugins: [
{Oban.Plugins.Pruner, max_age: 60},
{Oban.Plugins.Lifeline, rescue_after: :timer.minutes(5)}
{Oban.Plugins.Lifeline, rescue_after: :timer.minutes(5)},
{Oban.Plugins.Cron,
crontab: [
{"*/30 * * * *", SimpleshopTheme.Orders.FulfilmentStatusWorker}
]}
],
queues: [images: 2, sync: 1, checkout: 1]