@cimplify/sdk 0.102.0 → 0.103.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/advanced.d.mts +3 -3
  2. package/dist/advanced.d.ts +3 -3
  3. package/dist/advanced.js +23 -22
  4. package/dist/advanced.mjs +4 -3
  5. package/dist/{chunk-DCMXUKDQ.mjs → chunk-C2JSNJUC.mjs} +404 -95
  6. package/dist/chunk-CNN7Z2IP.js +125 -0
  7. package/dist/{chunk-DKLHCZ5M.mjs → chunk-GERXZQSX.mjs} +487 -11
  8. package/dist/chunk-GOHSXBKW.mjs +105 -0
  9. package/dist/{chunk-4KNFBPV2.mjs → chunk-H7ACMHM3.mjs} +32 -14
  10. package/dist/{chunk-Z3K2D3TE.mjs → chunk-J6PNHDHL.mjs} +453 -483
  11. package/dist/{chunk-NIOUSKQQ.js → chunk-JG5CQNCB.js} +5 -0
  12. package/dist/{chunk-YER7DIOM.js → chunk-JSWJ4XDE.js} +471 -519
  13. package/dist/{chunk-DLW3RWRK.mjs → chunk-M4URVKHE.mjs} +46 -12
  14. package/dist/{chunk-WMEC5JWN.js → chunk-NNG6IFFX.js} +50 -13
  15. package/dist/{chunk-LOWSMGRT.js → chunk-QOWPGS7Z.js} +34 -16
  16. package/dist/{chunk-YDA46OZ6.js → chunk-R6OLQ33I.js} +560 -80
  17. package/dist/{chunk-EAZGA7LD.js → chunk-VIL6IQCG.js} +406 -97
  18. package/dist/{chunk-O3YUHLZL.mjs → chunk-VNPEYLB2.mjs} +5 -0
  19. package/dist/{client-B40KFazg.d.ts → client-BfpNjJ_a.d.mts} +90 -299
  20. package/dist/{client-BizGfqB7.d.mts → client-DHBwvh7U.d.ts} +90 -299
  21. package/dist/{client-BdErclfU.d.mts → client-DpqRobY9.d.mts} +2 -2
  22. package/dist/{client-nsiMwuC1.d.ts → client-Dqg2mc-7.d.ts} +2 -2
  23. package/dist/{index-DpmnI__D.d.mts → index-C8uDqLwJ.d.ts} +14 -4
  24. package/dist/{index-nEyXWIyR.d.ts → index-e2y6AK70.d.mts} +14 -4
  25. package/dist/index.d.mts +81 -8
  26. package/dist/index.d.ts +81 -8
  27. package/dist/index.js +202 -169
  28. package/dist/index.mjs +6 -5
  29. package/dist/link-cuNVYc2s.d.mts +297 -0
  30. package/dist/link-cuNVYc2s.d.ts +297 -0
  31. package/dist/mock/cli.mjs +410 -94
  32. package/dist/mock/library.js +410 -94
  33. package/dist/mock/library.mjs +410 -94
  34. package/dist/mock/msw.js +410 -94
  35. package/dist/mock/msw.mjs +410 -94
  36. package/dist/{product-Byf0unSy.d.mts → payment-H5LoIvXU.d.mts} +189 -7
  37. package/dist/{product-Byf0unSy.d.ts → payment-H5LoIvXU.d.ts} +189 -7
  38. package/dist/{price-CS4E5zLS.d.mts → price-BvePgDXe.d.mts} +1 -1
  39. package/dist/{price-BstChV9a.d.ts → price-C2RqscMY.d.ts} +1 -1
  40. package/dist/react.d.mts +4 -4
  41. package/dist/react.d.ts +4 -4
  42. package/dist/react.js +141 -140
  43. package/dist/react.mjs +5 -4
  44. package/dist/{server-DqbZh8Bk.d.mts → server-C7FyLdrz.d.mts} +11 -9
  45. package/dist/{server-Cj40R2ZD.d.ts → server-DoXIpSd7.d.ts} +11 -9
  46. package/dist/server.d.mts +4 -4
  47. package/dist/server.d.ts +4 -4
  48. package/dist/server.js +11 -10
  49. package/dist/server.mjs +5 -4
  50. package/dist/testing/msw.d.mts +2 -2
  51. package/dist/testing/msw.d.ts +2 -2
  52. package/dist/testing/msw.js +4 -3
  53. package/dist/testing/msw.mjs +3 -2
  54. package/dist/testing/suite.d.mts +6 -6
  55. package/dist/testing/suite.d.ts +6 -6
  56. package/dist/testing/suite.js +26 -25
  57. package/dist/testing/suite.mjs +7 -6
  58. package/dist/testing.d.mts +154 -55
  59. package/dist/testing.d.ts +154 -55
  60. package/dist/testing.js +83 -82
  61. package/dist/testing.mjs +8 -7
  62. package/dist/utils.d.mts +4 -4
  63. package/dist/utils.d.ts +4 -4
  64. package/dist/utils.js +37 -29
  65. package/dist/utils.mjs +2 -2
  66. package/package.json +7 -1
  67. package/dist/payment-l0rkieEQ.d.mts +0 -113
  68. package/dist/payment-vzNnIi1n.d.ts +0 -113
@@ -2096,6 +2096,8 @@ var ERROR_SUGGESTIONS = {
2096
2096
  PRICE_CHANGED: "Prices changed since the quote was created. Refresh pricing, show the new total to the shopper, and require explicit confirmation before re-submitting.",
2097
2097
  PAYMENT_FAILED: "Payment provider rejected or failed processing. Show retry/change-method options to the shopper.",
2098
2098
  PAYMENT_CANCELLED: "Payment was cancelled by the shopper or provider flow. Allow a safe retry path.",
2099
+ PAYMENT_CAPABILITY_MISMATCH: "Refresh collection capabilities for the exact tenant and presentment currency before retrying.",
2100
+ UNSUPPORTED_CURRENCY: "Choose a supported presentment currency before loading payment methods or submitting checkout.",
2099
2101
  INSUFFICIENT_FUNDS: "Payment method has insufficient funds. Prompt shopper to use another method.",
2100
2102
  CARD_DECLINED: "Card was declined. Ask shopper to retry or switch payment method.",
2101
2103
  INVALID_OTP: "Authorization code is invalid. Let shopper re-enter OTP/PIN and retry.",
@@ -2244,6 +2246,12 @@ function getQueryNum(c, key) {
2244
2246
  return Number.isFinite(n) ? n : void 0;
2245
2247
  }
2246
2248
 
2249
+ // src/constants.ts
2250
+ var PAYMENT_METHOD = {
2251
+ MOBILE_MONEY: "mobile_money",
2252
+ CARD: "card"
2253
+ };
2254
+
2247
2255
  // src/mock/routes/v1.ts
2248
2256
  function buildV1(deps) {
2249
2257
  const app = new Hono2();
@@ -2260,10 +2268,22 @@ function buildV1(deps) {
2260
2268
  }));
2261
2269
  });
2262
2270
  app.get("/business", (c) => tryRoute(c, () => deps.business.primary()));
2263
- app.get("/business/by-handle/:handle", (c) => tryRoute(c, () => deps.business.byHandle(c.req.param("handle"))));
2264
- app.get("/business/by-domain", (c) => tryRoute(c, () => deps.business.byDomain(c.req.query("domain") ?? "")));
2265
- app.get("/business/settings", (c) => tryRoute(c, () => deps.business.settings(deps.defaultBusinessId)));
2266
- app.get("/business/locations", (c) => tryRoute(c, () => deps.business.locations(deps.defaultBusinessId)));
2271
+ app.get(
2272
+ "/business/by-handle/:handle",
2273
+ (c) => tryRoute(c, () => deps.business.byHandle(c.req.param("handle")))
2274
+ );
2275
+ app.get(
2276
+ "/business/by-domain",
2277
+ (c) => tryRoute(c, () => deps.business.byDomain(c.req.query("domain") ?? ""))
2278
+ );
2279
+ app.get(
2280
+ "/business/settings",
2281
+ (c) => tryRoute(c, () => deps.business.settings(deps.defaultBusinessId))
2282
+ );
2283
+ app.get(
2284
+ "/business/locations",
2285
+ (c) => tryRoute(c, () => deps.business.locations(deps.defaultBusinessId))
2286
+ );
2267
2287
  app.get("/business/hours", (c) => tryRoute(c, () => deps.business.hours(deps.defaultBusinessId)));
2268
2288
  app.get("/catalogue", (c) => tryRoute(c, () => deps.catalogue.snapshot(deps.defaultBusinessId)));
2269
2289
  app.get(
@@ -2278,57 +2298,165 @@ function buildV1(deps) {
2278
2298
  })
2279
2299
  )
2280
2300
  );
2281
- app.get("/catalogue/products/:product_id", (c) => tryRoute(c, () => deps.catalogue.getProduct(c.req.param("product_id"))));
2282
- app.get("/catalogue/products/:product_id/variants", (c) => tryRoute(c, () => deps.catalogue.getProductVariants(c.req.param("product_id"))));
2283
- app.get("/catalogue/products/:product_id/variant-axes", (c) => tryRoute(c, () => deps.catalogue.getProductVariantAxes(c.req.param("product_id"))));
2301
+ app.get(
2302
+ "/catalogue/products/:product_id",
2303
+ (c) => tryRoute(c, () => deps.catalogue.getProduct(c.req.param("product_id")))
2304
+ );
2305
+ app.get(
2306
+ "/catalogue/products/:product_id/variants",
2307
+ (c) => tryRoute(c, () => deps.catalogue.getProductVariants(c.req.param("product_id")))
2308
+ );
2309
+ app.get(
2310
+ "/catalogue/products/:product_id/variant-axes",
2311
+ (c) => tryRoute(c, () => deps.catalogue.getProductVariantAxes(c.req.param("product_id")))
2312
+ );
2284
2313
  app.get(
2285
2314
  "/catalogue/products/:product_id/variants/:variant_id",
2286
- (c) => tryRoute(c, () => deps.catalogue.getProductVariantById(c.req.param("product_id"), c.req.param("variant_id")))
2315
+ (c) => tryRoute(
2316
+ c,
2317
+ () => deps.catalogue.getProductVariantById(c.req.param("product_id"), c.req.param("variant_id"))
2318
+ )
2287
2319
  );
2288
2320
  app.post("/catalogue/products/:product_id/variants/find", async (c) => {
2289
2321
  const body = await c.req.json().catch(() => ({}));
2290
2322
  return tryRoute(
2291
2323
  c,
2292
- () => deps.catalogue.findProductVariant(c.req.param("product_id"), body.axis_selections ?? body.properties ?? {})
2324
+ () => deps.catalogue.findProductVariant(
2325
+ c.req.param("product_id"),
2326
+ body.axis_selections ?? body.properties ?? {}
2327
+ )
2293
2328
  );
2294
2329
  });
2295
- app.get("/catalogue/products/:product_id/add-ons", (c) => tryRoute(c, () => deps.catalogue.getProductAddOns(c.req.param("product_id"))));
2296
- app.get("/catalogue/categories", (c) => tryRoute(c, () => deps.catalogue.listCategories(deps.defaultBusinessId)));
2297
- app.get("/catalogue/categories/:category_id", (c) => tryRoute(c, () => deps.catalogue.getCategory(c.req.param("category_id"))));
2298
- app.get("/catalogue/categories/:category_id/products", (c) => tryRoute(c, () => deps.catalogue.getCategoryProducts(c.req.param("category_id"))));
2299
- app.get("/catalogue/categories/:category_id/attributes", (c) => tryRoute(c, () => deps.catalogue.getCategoryAttributes(c.req.param("category_id"))));
2300
- app.get("/catalogue/categories/:category_id/deals", (c) => tryRoute(c, () => deps.catalogue.getCategoryDeals(c.req.param("category_id"))));
2301
- app.get("/catalogue/collections", (c) => tryRoute(c, () => deps.catalogue.listCollections(deps.defaultBusinessId)));
2302
- app.get("/catalogue/collections/:collection_id", (c) => tryRoute(c, () => deps.catalogue.getCollection(c.req.param("collection_id"))));
2303
- app.get("/catalogue/collections/:collection_id/products", (c) => tryRoute(c, () => deps.catalogue.getCollectionProducts(c.req.param("collection_id"))));
2304
- app.get("/catalogue/collections/:collection_id/attributes", (c) => tryRoute(c, () => deps.catalogue.getCollectionAttributes(c.req.param("collection_id"))));
2305
- app.get("/catalogue/collections/:collection_id/deals", (c) => tryRoute(c, () => deps.catalogue.getCollectionDeals(c.req.param("collection_id"))));
2306
- app.get("/catalogue/bundles", (c) => tryRoute(c, () => deps.catalogue.listBundles(deps.defaultBusinessId)));
2307
- app.get("/catalogue/bundles/:bundle_id", (c) => tryRoute(c, () => deps.catalogue.getBundle(c.req.param("bundle_id"))));
2308
- app.get("/catalogue/composites", (c) => tryRoute(c, () => deps.catalogue.listComposites(deps.defaultBusinessId)));
2309
- app.get("/catalogue/composites/by-product/:product_id", (c) => tryRoute(c, () => deps.catalogue.getCompositeByProduct(c.req.param("product_id"))));
2310
- app.get("/catalogue/composites/:composite_id", (c) => tryRoute(c, () => deps.catalogue.getComposite(c.req.param("composite_id"))));
2330
+ app.get(
2331
+ "/catalogue/products/:product_id/add-ons",
2332
+ (c) => tryRoute(c, () => deps.catalogue.getProductAddOns(c.req.param("product_id")))
2333
+ );
2334
+ app.get(
2335
+ "/catalogue/categories",
2336
+ (c) => tryRoute(c, () => deps.catalogue.listCategories(deps.defaultBusinessId))
2337
+ );
2338
+ app.get(
2339
+ "/catalogue/categories/:category_id",
2340
+ (c) => tryRoute(c, () => deps.catalogue.getCategory(c.req.param("category_id")))
2341
+ );
2342
+ app.get(
2343
+ "/catalogue/categories/:category_id/products",
2344
+ (c) => tryRoute(c, () => deps.catalogue.getCategoryProducts(c.req.param("category_id")))
2345
+ );
2346
+ app.get(
2347
+ "/catalogue/categories/:category_id/attributes",
2348
+ (c) => tryRoute(c, () => deps.catalogue.getCategoryAttributes(c.req.param("category_id")))
2349
+ );
2350
+ app.get(
2351
+ "/catalogue/categories/:category_id/deals",
2352
+ (c) => tryRoute(c, () => deps.catalogue.getCategoryDeals(c.req.param("category_id")))
2353
+ );
2354
+ app.get(
2355
+ "/catalogue/collections",
2356
+ (c) => tryRoute(c, () => deps.catalogue.listCollections(deps.defaultBusinessId))
2357
+ );
2358
+ app.get(
2359
+ "/catalogue/collections/:collection_id",
2360
+ (c) => tryRoute(c, () => deps.catalogue.getCollection(c.req.param("collection_id")))
2361
+ );
2362
+ app.get(
2363
+ "/catalogue/collections/:collection_id/products",
2364
+ (c) => tryRoute(c, () => deps.catalogue.getCollectionProducts(c.req.param("collection_id")))
2365
+ );
2366
+ app.get(
2367
+ "/catalogue/collections/:collection_id/attributes",
2368
+ (c) => tryRoute(c, () => deps.catalogue.getCollectionAttributes(c.req.param("collection_id")))
2369
+ );
2370
+ app.get(
2371
+ "/catalogue/collections/:collection_id/deals",
2372
+ (c) => tryRoute(c, () => deps.catalogue.getCollectionDeals(c.req.param("collection_id")))
2373
+ );
2374
+ app.get(
2375
+ "/catalogue/bundles",
2376
+ (c) => tryRoute(c, () => deps.catalogue.listBundles(deps.defaultBusinessId))
2377
+ );
2378
+ app.get(
2379
+ "/catalogue/bundles/:bundle_id",
2380
+ (c) => tryRoute(c, () => deps.catalogue.getBundle(c.req.param("bundle_id")))
2381
+ );
2382
+ app.get(
2383
+ "/catalogue/composites",
2384
+ (c) => tryRoute(c, () => deps.catalogue.listComposites(deps.defaultBusinessId))
2385
+ );
2386
+ app.get(
2387
+ "/catalogue/composites/by-product/:product_id",
2388
+ (c) => tryRoute(c, () => deps.catalogue.getCompositeByProduct(c.req.param("product_id")))
2389
+ );
2390
+ app.get(
2391
+ "/catalogue/composites/:composite_id",
2392
+ (c) => tryRoute(c, () => deps.catalogue.getComposite(c.req.param("composite_id")))
2393
+ );
2311
2394
  app.post("/catalogue/composites/:composite_id/calculate-price", async (c) => {
2312
2395
  const body = await c.req.json().catch(() => ({}));
2313
- return tryRoute(c, () => deps.catalogue.calculateCompositePrice(c.req.param("composite_id"), body));
2396
+ return tryRoute(
2397
+ c,
2398
+ () => deps.catalogue.calculateCompositePrice(c.req.param("composite_id"), body)
2399
+ );
2314
2400
  });
2315
- app.get("/catalogue/taxonomies", (c) => tryRoute(c, () => deps.catalogue.listTaxonomies(deps.defaultBusinessId)));
2316
- app.get("/catalogue/taxonomies/search", (c) => tryRoute(c, () => deps.catalogue.searchTaxonomies(deps.defaultBusinessId, c.req.query("q") ?? "")));
2317
- app.get("/catalogue/taxonomies/:taxonomy_id", (c) => tryRoute(c, () => deps.catalogue.getTaxonomy(c.req.param("taxonomy_id"))));
2318
- app.get("/catalogue/taxonomies/:taxonomy_id/attributes", (c) => tryRoute(c, () => deps.catalogue.getTaxonomyAttributes(c.req.param("taxonomy_id"))));
2319
- app.get("/catalogue/taxonomies/:taxonomy_id/path", (c) => tryRoute(c, () => deps.catalogue.getTaxonomyPath(c.req.param("taxonomy_id"))));
2320
- app.get("/catalogue/attributes", (c) => tryRoute(c, () => deps.catalogue.listAttributes(deps.defaultBusinessId)));
2321
- app.get("/catalogue/properties/facets", (c) => tryRoute(c, () => deps.catalogue.listPropertyFacets(deps.defaultBusinessId)));
2322
- app.get("/catalogue/tags", (c) => tryRoute(c, () => deps.catalogue.listTags(deps.defaultBusinessId)));
2401
+ app.get(
2402
+ "/catalogue/taxonomies",
2403
+ (c) => tryRoute(c, () => deps.catalogue.listTaxonomies(deps.defaultBusinessId))
2404
+ );
2405
+ app.get(
2406
+ "/catalogue/taxonomies/search",
2407
+ (c) => tryRoute(
2408
+ c,
2409
+ () => deps.catalogue.searchTaxonomies(deps.defaultBusinessId, c.req.query("q") ?? "")
2410
+ )
2411
+ );
2412
+ app.get(
2413
+ "/catalogue/taxonomies/:taxonomy_id",
2414
+ (c) => tryRoute(c, () => deps.catalogue.getTaxonomy(c.req.param("taxonomy_id")))
2415
+ );
2416
+ app.get(
2417
+ "/catalogue/taxonomies/:taxonomy_id/attributes",
2418
+ (c) => tryRoute(c, () => deps.catalogue.getTaxonomyAttributes(c.req.param("taxonomy_id")))
2419
+ );
2420
+ app.get(
2421
+ "/catalogue/taxonomies/:taxonomy_id/path",
2422
+ (c) => tryRoute(c, () => deps.catalogue.getTaxonomyPath(c.req.param("taxonomy_id")))
2423
+ );
2424
+ app.get(
2425
+ "/catalogue/attributes",
2426
+ (c) => tryRoute(c, () => deps.catalogue.listAttributes(deps.defaultBusinessId))
2427
+ );
2428
+ app.get(
2429
+ "/catalogue/properties/facets",
2430
+ (c) => tryRoute(c, () => deps.catalogue.listPropertyFacets(deps.defaultBusinessId))
2431
+ );
2432
+ app.get(
2433
+ "/catalogue/tags",
2434
+ (c) => tryRoute(c, () => deps.catalogue.listTags(deps.defaultBusinessId))
2435
+ );
2323
2436
  app.get("/catalogue/menu", (c) => tryRoute(c, () => deps.lite.getMenu(deps.defaultBusinessId)));
2324
- app.get("/catalogue/menu/categories/:category_id", (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id"))));
2325
- app.get("/catalogue/menu/items/:item_id", (c) => tryRoute(c, () => deps.catalogue.getProduct(c.req.param("item_id"))));
2326
- app.get("/catalogue/knowledge-base/articles", (c) => tryRoute(c, () => ({ articles: deps.catalogue.listKnowledgeArticles(deps.defaultBusinessId) })));
2437
+ app.get(
2438
+ "/catalogue/menu/categories/:category_id",
2439
+ (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id")))
2440
+ );
2441
+ app.get(
2442
+ "/catalogue/menu/items/:item_id",
2443
+ (c) => tryRoute(c, () => deps.catalogue.getProduct(c.req.param("item_id")))
2444
+ );
2445
+ app.get(
2446
+ "/catalogue/knowledge-base/articles",
2447
+ (c) => tryRoute(c, () => ({ articles: deps.catalogue.listKnowledgeArticles(deps.defaultBusinessId) }))
2448
+ );
2327
2449
  app.get(
2328
2450
  "/catalogue/knowledge-base/search",
2329
- (c) => tryRoute(c, () => ({ results: deps.catalogue.searchKnowledgeBase(deps.defaultBusinessId, c.req.query("q") ?? ""), query: c.req.query("q") ?? "" }))
2451
+ (c) => tryRoute(c, () => ({
2452
+ results: deps.catalogue.searchKnowledgeBase(deps.defaultBusinessId, c.req.query("q") ?? ""),
2453
+ query: c.req.query("q") ?? ""
2454
+ }))
2455
+ );
2456
+ app.get(
2457
+ "/catalogue/products/:product_id/attributes",
2458
+ (c) => tryRoute(c, () => deps.catalogue.getProductAttributes(c.req.param("product_id")))
2330
2459
  );
2331
- app.get("/catalogue/products/:product_id/attributes", (c) => tryRoute(c, () => deps.catalogue.getProductAttributes(c.req.param("product_id"))));
2332
2460
  app.get(
2333
2461
  "/catalogue/products/:product_id/available-now",
2334
2462
  (c) => tryRoute(c, () => {
@@ -2347,22 +2475,45 @@ function buildV1(deps) {
2347
2475
  "/catalogue/products/:product_id/schedules",
2348
2476
  (c) => tryRoute(c, () => {
2349
2477
  const p = deps.registry.products.get(c.req.param("product_id"));
2350
- return { schedules: p?.metadata?.["time_profiles"] ?? [] };
2478
+ return {
2479
+ schedules: p?.metadata?.["time_profiles"] ?? []
2480
+ };
2351
2481
  })
2352
2482
  );
2353
- app.get("/catalogue/deals", (c) => tryRoute(c, () => deps.catalogue.listDeals(deps.defaultBusinessId)));
2354
- app.get("/catalogue/deals/on-sale", (c) => tryRoute(c, () => deps.catalogue.listOnSale(deps.defaultBusinessId)));
2483
+ app.get(
2484
+ "/catalogue/deals",
2485
+ (c) => tryRoute(c, () => deps.catalogue.listDeals(deps.defaultBusinessId))
2486
+ );
2487
+ app.get(
2488
+ "/catalogue/deals/on-sale",
2489
+ (c) => tryRoute(c, () => deps.catalogue.listOnSale(deps.defaultBusinessId))
2490
+ );
2355
2491
  app.post("/catalogue/deals/validate", async (c) => {
2356
2492
  const body = await c.req.json().catch(() => ({}));
2357
- return tryRoute(c, () => deps.catalogue.validateDiscount(body.discount_code ?? body.code ?? "", deps.defaultBusinessId));
2493
+ return tryRoute(
2494
+ c,
2495
+ () => deps.catalogue.validateDiscount(
2496
+ body.discount_code ?? body.code ?? "",
2497
+ deps.defaultBusinessId
2498
+ )
2499
+ );
2358
2500
  });
2359
- app.get("/catalogue/products/:product_id/deals", (c) => tryRoute(c, () => deps.catalogue.getProductDeals(c.req.param("product_id"))));
2501
+ app.get(
2502
+ "/catalogue/products/:product_id/deals",
2503
+ (c) => tryRoute(c, () => deps.catalogue.getProductDeals(c.req.param("product_id")))
2504
+ );
2360
2505
  app.post("/catalogue/quotes", async (c) => {
2361
2506
  const body = await c.req.json().catch(() => ({}));
2362
2507
  return tryRoute(c, () => deps.catalogue.createQuote(deps.defaultBusinessId, body));
2363
2508
  });
2364
- app.get("/catalogue/quotes/:quote_id", (c) => tryRoute(c, () => deps.catalogue.getQuote(c.req.param("quote_id"))));
2365
- app.post("/catalogue/quotes/:quote_id/refresh", (c) => tryRoute(c, () => deps.catalogue.refreshQuote(c.req.param("quote_id"))));
2509
+ app.get(
2510
+ "/catalogue/quotes/:quote_id",
2511
+ (c) => tryRoute(c, () => deps.catalogue.getQuote(c.req.param("quote_id")))
2512
+ );
2513
+ app.post(
2514
+ "/catalogue/quotes/:quote_id/refresh",
2515
+ (c) => tryRoute(c, () => deps.catalogue.refreshQuote(c.req.param("quote_id")))
2516
+ );
2366
2517
  app.get("/cart", (c) => tryRoute(c, () => deps.cart.toUICart(deps.cart.get(c.var.session))));
2367
2518
  app.delete("/cart", (c) => tryRoute(c, () => deps.cart.clear(c.var.session)));
2368
2519
  app.get("/cart/items", (c) => tryRoute(c, () => deps.cart.getItems(c.var.session)));
@@ -2373,9 +2524,15 @@ function buildV1(deps) {
2373
2524
  app.patch("/cart/items/:cart_item_id", async (c) => {
2374
2525
  const body = await c.req.json().catch(() => ({}));
2375
2526
  if (typeof body.quantity !== "number") return fail(c, validation("quantity required"));
2376
- return tryRoute(c, () => deps.cart.updateQuantity(c.var.session, c.req.param("cart_item_id"), body.quantity));
2527
+ return tryRoute(
2528
+ c,
2529
+ () => deps.cart.updateQuantity(c.var.session, c.req.param("cart_item_id"), body.quantity)
2530
+ );
2377
2531
  });
2378
- app.delete("/cart/items/:cart_item_id", (c) => tryRoute(c, () => deps.cart.removeItem(c.var.session, c.req.param("cart_item_id"))));
2532
+ app.delete(
2533
+ "/cart/items/:cart_item_id",
2534
+ (c) => tryRoute(c, () => deps.cart.removeItem(c.var.session, c.req.param("cart_item_id")))
2535
+ );
2379
2536
  app.get("/cart/count", (c) => tryRoute(c, () => deps.cart.getCount(c.var.session)));
2380
2537
  app.get("/cart/total", (c) => tryRoute(c, () => deps.cart.getTotal(c.var.session)));
2381
2538
  app.post("/cart/destination-quote", async (c) => {
@@ -2386,10 +2543,25 @@ function buildV1(deps) {
2386
2543
  const body = await c.req.json().catch(() => ({}));
2387
2544
  return tryRoute(c, () => deps.cart.applyCoupon(c.var.session, body.coupon_code ?? ""));
2388
2545
  });
2389
- app.delete("/cart/coupons/current", (c) => tryRoute(c, () => deps.cart.removeCoupon(c.var.session)));
2390
- app.get("/orders", (c) => tryRoute(c, () => deps.orders.list(c.var.session, { limit: getQueryNum(c, "limit"), status: c.req.query("status") })));
2546
+ app.delete(
2547
+ "/cart/coupons/current",
2548
+ (c) => tryRoute(c, () => deps.cart.removeCoupon(c.var.session))
2549
+ );
2550
+ app.get(
2551
+ "/orders",
2552
+ (c) => tryRoute(
2553
+ c,
2554
+ () => deps.orders.list(c.var.session, {
2555
+ limit: getQueryNum(c, "limit"),
2556
+ status: c.req.query("status")
2557
+ })
2558
+ )
2559
+ );
2391
2560
  app.get("/orders/:order_id", (c) => tryRoute(c, () => deps.orders.get(c.req.param("order_id"))));
2392
- app.get("/orders/:order_id/payment-status", (c) => tryRoute(c, () => deps.orders.getPaymentStatus(c.req.param("order_id"))));
2561
+ app.get(
2562
+ "/orders/:order_id/payment-status",
2563
+ (c) => tryRoute(c, () => deps.orders.getPaymentStatus(c.req.param("order_id")))
2564
+ );
2393
2565
  app.post("/orders/:order_id/cancel", async (c) => {
2394
2566
  const body = await c.req.json().catch(() => ({}));
2395
2567
  return tryRoute(c, () => deps.orders.cancel(c.req.param("order_id"), body.reason));
@@ -2398,13 +2570,46 @@ function buildV1(deps) {
2398
2570
  const body = await c.req.json().catch(() => ({}));
2399
2571
  return tryRoute(c, () => deps.orders.updateCustomer(c.req.param("order_id"), body));
2400
2572
  });
2401
- app.post("/orders/:order_id/verify-payment", (c) => tryRoute(c, () => deps.orders.verifyPayment(c.req.param("order_id"))));
2573
+ app.post(
2574
+ "/orders/:order_id/verify-payment",
2575
+ (c) => tryRoute(c, () => deps.orders.verifyPayment(c.req.param("order_id")))
2576
+ );
2402
2577
  app.get("/subscriptions", (c) => tryRoute(c, () => deps.subscriptions.list(c.var.session)));
2403
- app.get("/subscriptions/:subscription_id", (c) => tryRoute(c, () => deps.subscriptions.get(c.req.param("subscription_id"))));
2404
- app.post("/subscriptions/:subscription_id/cancel", (c) => tryRoute(c, () => deps.subscriptions.cancel(c.req.param("subscription_id"))));
2405
- app.post("/subscriptions/:subscription_id/pause", (c) => tryRoute(c, () => deps.subscriptions.pause(c.req.param("subscription_id"))));
2406
- app.post("/subscriptions/:subscription_id/resume", (c) => tryRoute(c, () => deps.subscriptions.resume(c.req.param("subscription_id"))));
2407
- app.post("/subscriptions/:subscription_id/skip", (c) => tryRoute(c, () => deps.subscriptions.skipNext(c.req.param("subscription_id"))));
2578
+ app.get(
2579
+ "/subscriptions/:subscription_id",
2580
+ (c) => tryRoute(c, () => deps.subscriptions.get(c.req.param("subscription_id")))
2581
+ );
2582
+ app.post(
2583
+ "/subscriptions/:subscription_id/cancel",
2584
+ (c) => tryRoute(c, () => deps.subscriptions.cancel(c.req.param("subscription_id")))
2585
+ );
2586
+ app.post(
2587
+ "/subscriptions/:subscription_id/pause",
2588
+ (c) => tryRoute(c, () => deps.subscriptions.pause(c.req.param("subscription_id")))
2589
+ );
2590
+ app.post(
2591
+ "/subscriptions/:subscription_id/resume",
2592
+ (c) => tryRoute(c, () => deps.subscriptions.resume(c.req.param("subscription_id")))
2593
+ );
2594
+ app.post(
2595
+ "/subscriptions/:subscription_id/skip",
2596
+ (c) => tryRoute(c, () => deps.subscriptions.skipNext(c.req.param("subscription_id")))
2597
+ );
2598
+ app.get("/payments/collection-options", (c) => {
2599
+ const currency = c.req.query("currency")?.trim().toUpperCase();
2600
+ if (!currency || !/^[A-Z]{3}$/.test(currency)) {
2601
+ return fail(c, validation("currency must be a canonical three-letter code"));
2602
+ }
2603
+ return tryRoute(c, () => ({
2604
+ presentment_currency: currency,
2605
+ options: currency === "GHS" ? [
2606
+ { method: PAYMENT_METHOD.CARD, network: null },
2607
+ { method: PAYMENT_METHOD.MOBILE_MONEY, network: "mtn" },
2608
+ { method: PAYMENT_METHOD.MOBILE_MONEY, network: "telecel" },
2609
+ { method: PAYMENT_METHOD.MOBILE_MONEY, network: "airteltigo" }
2610
+ ] : currency === "USD" ? [{ method: PAYMENT_METHOD.CARD, network: null }] : []
2611
+ }));
2612
+ });
2408
2613
  app.post("/checkout", async (c) => {
2409
2614
  const body = await c.req.json().catch(() => ({}));
2410
2615
  return tryRoute(c, () => deps.checkout.process(c.var.session, body));
@@ -2458,15 +2663,33 @@ function buildV1(deps) {
2458
2663
  return { success: true, message: "Profile updated successfully" };
2459
2664
  });
2460
2665
  });
2461
- app.get("/inventory/products/:product_id/stock", (c) => tryRoute(c, () => deps.inventory.productStock(c.req.param("product_id"))));
2462
- app.get("/inventory/variants/:variant_id/stock", (c) => tryRoute(c, () => deps.inventory.variantStock(c.req.param("variant_id"))));
2666
+ app.get(
2667
+ "/inventory/products/:product_id/stock",
2668
+ (c) => tryRoute(c, () => deps.inventory.productStock(c.req.param("product_id")))
2669
+ );
2670
+ app.get(
2671
+ "/inventory/variants/:variant_id/stock",
2672
+ (c) => tryRoute(c, () => deps.inventory.variantStock(c.req.param("variant_id")))
2673
+ );
2463
2674
  app.get(
2464
2675
  "/inventory/products/:product_id/availability",
2465
- (c) => tryRoute(c, () => deps.inventory.productAvailability(c.req.param("product_id"), getQueryNum(c, "quantity") ?? 1))
2676
+ (c) => tryRoute(
2677
+ c,
2678
+ () => deps.inventory.productAvailability(
2679
+ c.req.param("product_id"),
2680
+ getQueryNum(c, "quantity") ?? 1
2681
+ )
2682
+ )
2466
2683
  );
2467
2684
  app.get(
2468
2685
  "/inventory/variants/:variant_id/availability",
2469
- (c) => tryRoute(c, () => deps.inventory.variantAvailability(c.req.param("variant_id"), getQueryNum(c, "quantity") ?? 1))
2686
+ (c) => tryRoute(
2687
+ c,
2688
+ () => deps.inventory.variantAvailability(
2689
+ c.req.param("variant_id"),
2690
+ getQueryNum(c, "quantity") ?? 1
2691
+ )
2692
+ )
2470
2693
  );
2471
2694
  app.get(
2472
2695
  "/delivery/fee",
@@ -2493,35 +2716,75 @@ function buildV1(deps) {
2493
2716
  );
2494
2717
  app.post("/places/autocomplete", async (c) => {
2495
2718
  const body = await c.req.json().catch(() => ({}));
2496
- return tryRoute(c, () => deps.places.autocomplete({ query: body.input ?? body.query ?? "", country: body.country }));
2719
+ return tryRoute(
2720
+ c,
2721
+ () => deps.places.autocomplete({ query: body.input ?? body.query ?? "", country: body.country })
2722
+ );
2497
2723
  });
2498
2724
  app.post("/places/details", async (c) => {
2499
2725
  const body = await c.req.json().catch(() => ({}));
2500
2726
  return tryRoute(c, () => deps.places.details({ place_id: body.place_id ?? "" }));
2501
2727
  });
2502
- app.get("/scheduling/services", (c) => tryRoute(c, () => deps.scheduling.listServices(deps.defaultBusinessId)));
2503
- app.get("/scheduling/services/:service_id", (c) => tryRoute(c, () => deps.scheduling.getService(c.req.param("service_id"))));
2504
- app.get("/scheduling/slots", (c) => tryRoute(c, () => deps.scheduling.getSlots(c.req.query("service_id") ?? "", { date: c.req.query("date") })));
2728
+ app.get(
2729
+ "/scheduling/services",
2730
+ (c) => tryRoute(c, () => deps.scheduling.listServices(deps.defaultBusinessId))
2731
+ );
2732
+ app.get(
2733
+ "/scheduling/services/:service_id",
2734
+ (c) => tryRoute(c, () => deps.scheduling.getService(c.req.param("service_id")))
2735
+ );
2736
+ app.get(
2737
+ "/scheduling/slots",
2738
+ (c) => tryRoute(
2739
+ c,
2740
+ () => deps.scheduling.getSlots(c.req.query("service_id") ?? "", { date: c.req.query("date") })
2741
+ )
2742
+ );
2505
2743
  app.get(
2506
2744
  "/scheduling/slots/check",
2507
- (c) => tryRoute(c, () => deps.scheduling.checkSlot(c.req.query("service_id") ?? "", c.req.query("start") ?? "", c.req.query("end") ?? ""))
2745
+ (c) => tryRoute(
2746
+ c,
2747
+ () => deps.scheduling.checkSlot(
2748
+ c.req.query("service_id") ?? "",
2749
+ c.req.query("start") ?? "",
2750
+ c.req.query("end") ?? ""
2751
+ )
2752
+ )
2753
+ );
2754
+ app.get(
2755
+ "/scheduling/availability",
2756
+ (c) => tryRoute(c, () => deps.scheduling.getServiceAvailability(c.req.query("service_id") ?? ""))
2757
+ );
2758
+ app.get(
2759
+ "/scheduling/bookings",
2760
+ (c) => tryRoute(c, () => deps.scheduling.getCustomerBookings(c.var.session))
2508
2761
  );
2509
- app.get("/scheduling/availability", (c) => tryRoute(c, () => deps.scheduling.getServiceAvailability(c.req.query("service_id") ?? "")));
2510
- app.get("/scheduling/bookings", (c) => tryRoute(c, () => deps.scheduling.getCustomerBookings(c.var.session)));
2511
2762
  app.post("/scheduling/bookings/reschedule", async (c) => {
2512
2763
  const body = await c.req.json().catch(() => ({}));
2513
2764
  return tryRoute(c, () => deps.scheduling.rescheduleBooking(body));
2514
2765
  });
2515
- app.get("/scheduling/bookings/:booking_id", (c) => tryRoute(c, () => deps.scheduling.getBooking(c.req.param("booking_id"))));
2766
+ app.get(
2767
+ "/scheduling/bookings/:booking_id",
2768
+ (c) => tryRoute(c, () => deps.scheduling.getBooking(c.req.param("booking_id")))
2769
+ );
2516
2770
  app.post("/scheduling/bookings/:booking_id/cancel", async (c) => {
2517
2771
  const body = await c.req.json().catch(() => ({}));
2518
2772
  return tryRoute(c, () => deps.scheduling.cancelBooking(c.req.param("booking_id"), body.reason));
2519
2773
  });
2520
2774
  app.get("/lite/bootstrap", (c) => tryRoute(c, () => deps.lite.bootstrap(deps.defaultBusinessId)));
2521
- app.get("/lite/resources/:resource_id", (c) => tryRoute(c, () => deps.lite.getResource(c.req.param("resource_id"))));
2775
+ app.get(
2776
+ "/lite/resources/:resource_id",
2777
+ (c) => tryRoute(c, () => deps.lite.getResource(c.req.param("resource_id")))
2778
+ );
2522
2779
  app.get("/lite/menu", (c) => tryRoute(c, () => deps.lite.getMenu(deps.defaultBusinessId)));
2523
- app.get("/lite/menu/categories/:category_id", (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id"))));
2524
- app.get("/fx/rate", (c) => tryRoute(c, () => deps.fx.getRate(c.req.query("from") ?? "USD", c.req.query("to") ?? "GHS")));
2780
+ app.get(
2781
+ "/lite/menu/categories/:category_id",
2782
+ (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id")))
2783
+ );
2784
+ app.get(
2785
+ "/fx/rate",
2786
+ (c) => tryRoute(c, () => deps.fx.getRate(c.req.query("from") ?? "USD", c.req.query("to") ?? "GHS"))
2787
+ );
2525
2788
  app.post("/fx/quotes", async (c) => {
2526
2789
  const body = await c.req.json().catch(() => ({}));
2527
2790
  return tryRoute(c, () => deps.fx.lockQuote(body));
@@ -2534,31 +2797,47 @@ function buildV1(deps) {
2534
2797
  const body = await c.req.json().catch(() => ({}));
2535
2798
  return tryRoute(c, () => deps.uploads.confirm(body));
2536
2799
  });
2537
- app.get(
2538
- "/store-credit/balance",
2539
- (c) => c.json({ data: { balance: "0.00", currency: "USD" } })
2540
- );
2800
+ app.get("/store-credit/balance", (c) => c.json({ data: { balance: "0.00", currency: "USD" } }));
2541
2801
  app.post("/activity/session", async (c) => {
2542
2802
  await c.req.json().catch(() => ({}));
2543
2803
  return c.json({ data: { recorded: true } });
2544
2804
  });
2545
2805
  app.post("/activity/events", async (c) => {
2546
2806
  const body = await c.req.json().catch(() => ({}));
2547
- return tryRoute(c, () => deps.activity.recordEvents(deps.defaultBusinessId, body.analytics_session_id ?? c.var.session.id, body.events ?? []));
2807
+ return tryRoute(
2808
+ c,
2809
+ () => deps.activity.recordEvents(
2810
+ deps.defaultBusinessId,
2811
+ body.analytics_session_id ?? c.var.session.id,
2812
+ body.events ?? []
2813
+ )
2814
+ );
2548
2815
  });
2549
- app.get("/activity/state", (c) => tryRoute(c, () => deps.activity.getState(deps.defaultBusinessId, c.var.session.id)));
2550
- app.get("/activity/recommendations", (c) => tryRoute(c, () => deps.activity.getRecommendations(deps.defaultBusinessId)));
2816
+ app.get(
2817
+ "/activity/state",
2818
+ (c) => tryRoute(c, () => deps.activity.getState(deps.defaultBusinessId, c.var.session.id))
2819
+ );
2820
+ app.get(
2821
+ "/activity/recommendations",
2822
+ (c) => tryRoute(c, () => deps.activity.getRecommendations(deps.defaultBusinessId))
2823
+ );
2551
2824
  app.post("/activity/messages/dismiss", async (c) => {
2552
2825
  const body = await c.req.json().catch(() => ({}));
2553
2826
  return tryRoute(c, () => deps.activity.dismissMessage(body.code ?? body.message_id ?? ""));
2554
2827
  });
2555
2828
  app.post(
2556
2829
  "/support/conversation",
2557
- (c) => tryRoute(c, () => deps.support.openConversation(deps.defaultBusinessId, c.var.session.customer_id))
2830
+ (c) => tryRoute(
2831
+ c,
2832
+ () => deps.support.openConversation(deps.defaultBusinessId, c.var.session.customer_id)
2833
+ )
2558
2834
  );
2559
2835
  app.get(
2560
2836
  "/support/conversation",
2561
- (c) => tryRoute(c, () => deps.support.peekConversation(deps.defaultBusinessId, c.var.session.customer_id))
2837
+ (c) => tryRoute(
2838
+ c,
2839
+ () => deps.support.peekConversation(deps.defaultBusinessId, c.var.session.customer_id)
2840
+ )
2562
2841
  );
2563
2842
  app.post("/support/conversation/messages", async (c) => {
2564
2843
  const body = await c.req.json().catch(() => ({}));
@@ -2574,7 +2853,12 @@ function buildV1(deps) {
2574
2853
  });
2575
2854
  app.get(
2576
2855
  "/support/conversation/messages",
2577
- (c) => tryRoute(c, () => deps.support.listMessages(c.req.query("conversation_id") ?? "", { limit: getQueryNum(c, "limit") }))
2856
+ (c) => tryRoute(
2857
+ c,
2858
+ () => deps.support.listMessages(c.req.query("conversation_id") ?? "", {
2859
+ limit: getQueryNum(c, "limit")
2860
+ })
2861
+ )
2578
2862
  );
2579
2863
  app.post("/support/conversation/messages/:messageId/reactions", async (c) => {
2580
2864
  const body = await c.req.json().catch(() => ({}));
@@ -2595,7 +2879,10 @@ function buildV1(deps) {
2595
2879
  });
2596
2880
  app.get(
2597
2881
  "/support/conversation/ws",
2598
- (c) => c.json({ note: "WebSocket connection \u2014 connect via ws:// at the same path", supported: false }, 426)
2882
+ (c) => c.json(
2883
+ { note: "WebSocket connection \u2014 connect via ws:// at the same path", supported: false },
2884
+ 426
2885
+ )
2599
2886
  );
2600
2887
  return app;
2601
2888
  }
@@ -5047,9 +5334,11 @@ function createCheckoutService(opts) {
5047
5334
  if (c.items.length === 0) throw validation("Cart is empty", { code: "CART_EMPTY" });
5048
5335
  const orderId = ids.order();
5049
5336
  const orderNumber = ids.orderNumber();
5337
+ const paymentId = ids.payment();
5050
5338
  const reference = ids.payment();
5051
5339
  const requiresAuth = body.payment_method === "mobile_money";
5052
5340
  const isCard = body.payment_method === "card" || body.payment_method === "stripe";
5341
+ const cardProvider = body.payment_method === "stripe" || body.pay_currency?.toUpperCase() === "USD" ? "stripe" : "paystack";
5053
5342
  const order = {
5054
5343
  id: orderId,
5055
5344
  business_id: c.business_id,
@@ -5073,6 +5362,7 @@ function createCheckoutService(opts) {
5073
5362
  items: c.items,
5074
5363
  applied_discount_ids: c.applied_discount_ids,
5075
5364
  applied_discount_codes: c.applied_discount_codes,
5365
+ payment_id: paymentId,
5076
5366
  payment_reference: reference,
5077
5367
  metadata: body.metadata,
5078
5368
  created_at: clock.iso(),
@@ -5089,31 +5379,57 @@ function createCheckoutService(opts) {
5089
5379
  const result = {
5090
5380
  order_id: orderId,
5091
5381
  order_number: orderNumber,
5092
- payment_status: requiresAuth ? "pending" : "succeeded",
5382
+ payment_id: paymentId,
5383
+ payment_status: requiresAuth || isCard ? "pending" : "succeeded",
5093
5384
  payment_reference: reference,
5094
5385
  requires_authorization: requiresAuth,
5095
5386
  authorization_type: requiresAuth ? "otp" : void 0,
5096
- next_action: requiresAuth ? { type: "authorization", authorization_type: "otp", display_text: "Approve on your mobile money app" } : { type: "none" },
5097
- provider: body.payment_method,
5387
+ next_action: requiresAuth ? {
5388
+ type: "authorization",
5389
+ authorization_type: "otp",
5390
+ display_text: "Approve on your mobile money app"
5391
+ } : { type: "none" },
5392
+ provider: isCard ? cardProvider : body.payment_method,
5098
5393
  bill_token: billToken
5099
5394
  };
5100
5395
  if (isCard) {
5101
- result.next_action = { type: "redirect", authorization_url: `https://mock.cimplify.io/pay/${reference}` };
5102
- result.authorization_url = `https://mock.cimplify.io/pay/${reference}`;
5103
- result.client_secret = `pi_${orderId.slice(-12)}_secret_${Math.random().toString(36).slice(2, 18)}`;
5104
5396
  const proc = globalThis.process;
5105
- result.public_key = proc?.env?.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY ?? "pk_test_mock_publishable_key";
5397
+ result.client_secret = cardProvider === "stripe" ? `pi_${orderId.slice(-12)}_secret_${Math.random().toString(36).slice(2, 18)}` : `access_${reference}`;
5398
+ result.public_key = cardProvider === "stripe" ? proc?.env?.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY ?? "pk_test_mock_stripe" : proc?.env?.NEXT_PUBLIC_PAYSTACK_PUBLIC_KEY ?? "pk_test_mock_paystack";
5399
+ result.next_action = {
5400
+ type: "card_popup",
5401
+ provider: cardProvider,
5402
+ client_secret: result.client_secret,
5403
+ public_key: result.public_key
5404
+ };
5106
5405
  }
5107
5406
  return result;
5108
5407
  },
5109
5408
  authorize(body) {
5110
- const order = registry.orders.get(body.order_id);
5111
- if (!order) throw notFound(`Order ${body.order_id} not found`);
5112
- const updated = { ...order, payment_state: "paid", status: "confirmed", updated_at: clock.iso() };
5409
+ if (!body.payment_id?.trim()) throw validation("payment_id required");
5410
+ if (!body.authorization) throw validation("authorization required");
5411
+ const order = registry.orders.list(
5412
+ (candidate) => candidate.payment_id === body.payment_id
5413
+ )[0];
5414
+ if (!order) throw notFound(`Payment ${body.payment_id} not found`);
5415
+ const updated = {
5416
+ ...order,
5417
+ payment_state: "paid",
5418
+ status: "confirmed",
5419
+ updated_at: clock.iso()
5420
+ };
5113
5421
  registry.orders.put(order.id, updated);
5114
5422
  bus.emit("order.payment.captured", { order_id: order.id }, order.business_id);
5115
5423
  bus.emit("order.confirmed", { order_id: order.id }, order.business_id);
5116
- return { status: "succeeded", order_id: order.id };
5424
+ return {
5425
+ order_id: order.id,
5426
+ order_number: order.user_friendly_id,
5427
+ payment_id: body.payment_id,
5428
+ payment_reference: order.payment_reference,
5429
+ payment_status: "succeeded",
5430
+ requires_authorization: false,
5431
+ next_action: { type: "none" }
5432
+ };
5117
5433
  }
5118
5434
  };
5119
5435
  }