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