Full source
El código de cada capítulo de arriba es un extracto real de estos archivos — nunca una "versión
para la documentación" mantenida por separado. Viven en examples/marketplace-mercatto/ dentro
del repositorio de la plataforma Ishtaran.
examples/marketplace-mercatto/
├── fixtures.ts # the story's fixed constants
├── client.ts # env-aware client factory (Sandbox, or a local stack)
├── setup.ts # Chapter 2 — Setup
├── seller-onboarding.ts # Chapter 3 — Seller onboarding
├── create-order.ts # Chapter 4 — Creating an order
├── pay-order.ts # Chapters 5-6 — Accepting payment / Holding funds
├── confirm-delivery.ts # Chapter 7 — Confirming delivery
├── release-order.ts # Chapter 8 — Settlement and Split
├── withdraw.ts # Chapters 10-11 — Seller balance / Withdrawal
├── GAPS.md # every real platform limitation this case ran into
├── README.md # how the pieces fit together
├── scenarios/ # Chapter 12 — the 11 real failure/alternative paths
│ ├── settlement-partial.ts # Chapter 9 — Partial Settlement
│ └── … (10 more, see Chapter 12)
└── tests/
├── happy-path.e2e.ts # the exact sequence this tutorial walks through
└── scenarios.e2e.ts # runs and reports on all 11 scenarios
Nada aquí es un relato simplificado: tests/happy-path.e2e.ts literalmente importa y llama a
setup(), onboardParticipants(), createOrder(), payOrder(), confirmDelivery(),
releaseOrder(), checkSellerBalance(), y attemptWithdraw() — las mismas funciones mostradas
en los Capítulos 2 al 11 — y luego verifica invariantes financieros reales sobre el resultado
(Gross = Fee + distribuciones, montos exactos del Split, balances reales, estados correctos de la
Transaction). Si un cambio en la plataforma rompe esta historia, esa prueba falla y el release se
bloquea.