@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
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkXREIZ56K_js = require('./chunk-XREIZ56K.js');
4
- var chunkNIOUSKQQ_js = require('./chunk-NIOUSKQQ.js');
4
+ var chunkCNN7Z2IP_js = require('./chunk-CNN7Z2IP.js');
5
+ var chunkJG5CQNCB_js = require('./chunk-JG5CQNCB.js');
5
6
  var chunkOWW5GUSB_js = require('./chunk-OWW5GUSB.js');
6
7
 
7
8
  // ../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/compose.js
@@ -2077,8 +2078,8 @@ var MockError = class extends Error {
2077
2078
  };
2078
2079
  }
2079
2080
  };
2080
- var notFound = (msg) => new MockError(chunkNIOUSKQQ_js.ErrorCode.NOT_FOUND, msg, 404);
2081
- var validation = (msg, ctx) => new MockError(chunkNIOUSKQQ_js.ErrorCode.VALIDATION_ERROR, msg, 400, ctx);
2081
+ var notFound = (msg) => new MockError(chunkJG5CQNCB_js.ErrorCode.NOT_FOUND, msg, 404);
2082
+ var validation = (msg, ctx) => new MockError(chunkJG5CQNCB_js.ErrorCode.VALIDATION_ERROR, msg, 400, ctx);
2082
2083
 
2083
2084
  // src/mock/routes/_helpers.ts
2084
2085
  function authMiddleware(deps) {
@@ -2190,10 +2191,22 @@ function buildV1(deps) {
2190
2191
  }));
2191
2192
  });
2192
2193
  app.get("/business", (c) => tryRoute(c, () => deps.business.primary()));
2193
- app.get("/business/by-handle/:handle", (c) => tryRoute(c, () => deps.business.byHandle(c.req.param("handle"))));
2194
- app.get("/business/by-domain", (c) => tryRoute(c, () => deps.business.byDomain(c.req.query("domain") ?? "")));
2195
- app.get("/business/settings", (c) => tryRoute(c, () => deps.business.settings(deps.defaultBusinessId)));
2196
- app.get("/business/locations", (c) => tryRoute(c, () => deps.business.locations(deps.defaultBusinessId)));
2194
+ app.get(
2195
+ "/business/by-handle/:handle",
2196
+ (c) => tryRoute(c, () => deps.business.byHandle(c.req.param("handle")))
2197
+ );
2198
+ app.get(
2199
+ "/business/by-domain",
2200
+ (c) => tryRoute(c, () => deps.business.byDomain(c.req.query("domain") ?? ""))
2201
+ );
2202
+ app.get(
2203
+ "/business/settings",
2204
+ (c) => tryRoute(c, () => deps.business.settings(deps.defaultBusinessId))
2205
+ );
2206
+ app.get(
2207
+ "/business/locations",
2208
+ (c) => tryRoute(c, () => deps.business.locations(deps.defaultBusinessId))
2209
+ );
2197
2210
  app.get("/business/hours", (c) => tryRoute(c, () => deps.business.hours(deps.defaultBusinessId)));
2198
2211
  app.get("/catalogue", (c) => tryRoute(c, () => deps.catalogue.snapshot(deps.defaultBusinessId)));
2199
2212
  app.get(
@@ -2208,57 +2221,165 @@ function buildV1(deps) {
2208
2221
  })
2209
2222
  )
2210
2223
  );
2211
- app.get("/catalogue/products/:product_id", (c) => tryRoute(c, () => deps.catalogue.getProduct(c.req.param("product_id"))));
2212
- app.get("/catalogue/products/:product_id/variants", (c) => tryRoute(c, () => deps.catalogue.getProductVariants(c.req.param("product_id"))));
2213
- app.get("/catalogue/products/:product_id/variant-axes", (c) => tryRoute(c, () => deps.catalogue.getProductVariantAxes(c.req.param("product_id"))));
2224
+ app.get(
2225
+ "/catalogue/products/:product_id",
2226
+ (c) => tryRoute(c, () => deps.catalogue.getProduct(c.req.param("product_id")))
2227
+ );
2228
+ app.get(
2229
+ "/catalogue/products/:product_id/variants",
2230
+ (c) => tryRoute(c, () => deps.catalogue.getProductVariants(c.req.param("product_id")))
2231
+ );
2232
+ app.get(
2233
+ "/catalogue/products/:product_id/variant-axes",
2234
+ (c) => tryRoute(c, () => deps.catalogue.getProductVariantAxes(c.req.param("product_id")))
2235
+ );
2214
2236
  app.get(
2215
2237
  "/catalogue/products/:product_id/variants/:variant_id",
2216
- (c) => tryRoute(c, () => deps.catalogue.getProductVariantById(c.req.param("product_id"), c.req.param("variant_id")))
2238
+ (c) => tryRoute(
2239
+ c,
2240
+ () => deps.catalogue.getProductVariantById(c.req.param("product_id"), c.req.param("variant_id"))
2241
+ )
2217
2242
  );
2218
2243
  app.post("/catalogue/products/:product_id/variants/find", async (c) => {
2219
2244
  const body = await c.req.json().catch(() => ({}));
2220
2245
  return tryRoute(
2221
2246
  c,
2222
- () => deps.catalogue.findProductVariant(c.req.param("product_id"), body.axis_selections ?? body.properties ?? {})
2247
+ () => deps.catalogue.findProductVariant(
2248
+ c.req.param("product_id"),
2249
+ body.axis_selections ?? body.properties ?? {}
2250
+ )
2223
2251
  );
2224
2252
  });
2225
- app.get("/catalogue/products/:product_id/add-ons", (c) => tryRoute(c, () => deps.catalogue.getProductAddOns(c.req.param("product_id"))));
2226
- app.get("/catalogue/categories", (c) => tryRoute(c, () => deps.catalogue.listCategories(deps.defaultBusinessId)));
2227
- app.get("/catalogue/categories/:category_id", (c) => tryRoute(c, () => deps.catalogue.getCategory(c.req.param("category_id"))));
2228
- app.get("/catalogue/categories/:category_id/products", (c) => tryRoute(c, () => deps.catalogue.getCategoryProducts(c.req.param("category_id"))));
2229
- app.get("/catalogue/categories/:category_id/attributes", (c) => tryRoute(c, () => deps.catalogue.getCategoryAttributes(c.req.param("category_id"))));
2230
- app.get("/catalogue/categories/:category_id/deals", (c) => tryRoute(c, () => deps.catalogue.getCategoryDeals(c.req.param("category_id"))));
2231
- app.get("/catalogue/collections", (c) => tryRoute(c, () => deps.catalogue.listCollections(deps.defaultBusinessId)));
2232
- app.get("/catalogue/collections/:collection_id", (c) => tryRoute(c, () => deps.catalogue.getCollection(c.req.param("collection_id"))));
2233
- app.get("/catalogue/collections/:collection_id/products", (c) => tryRoute(c, () => deps.catalogue.getCollectionProducts(c.req.param("collection_id"))));
2234
- app.get("/catalogue/collections/:collection_id/attributes", (c) => tryRoute(c, () => deps.catalogue.getCollectionAttributes(c.req.param("collection_id"))));
2235
- app.get("/catalogue/collections/:collection_id/deals", (c) => tryRoute(c, () => deps.catalogue.getCollectionDeals(c.req.param("collection_id"))));
2236
- app.get("/catalogue/bundles", (c) => tryRoute(c, () => deps.catalogue.listBundles(deps.defaultBusinessId)));
2237
- app.get("/catalogue/bundles/:bundle_id", (c) => tryRoute(c, () => deps.catalogue.getBundle(c.req.param("bundle_id"))));
2238
- app.get("/catalogue/composites", (c) => tryRoute(c, () => deps.catalogue.listComposites(deps.defaultBusinessId)));
2239
- app.get("/catalogue/composites/by-product/:product_id", (c) => tryRoute(c, () => deps.catalogue.getCompositeByProduct(c.req.param("product_id"))));
2240
- app.get("/catalogue/composites/:composite_id", (c) => tryRoute(c, () => deps.catalogue.getComposite(c.req.param("composite_id"))));
2253
+ app.get(
2254
+ "/catalogue/products/:product_id/add-ons",
2255
+ (c) => tryRoute(c, () => deps.catalogue.getProductAddOns(c.req.param("product_id")))
2256
+ );
2257
+ app.get(
2258
+ "/catalogue/categories",
2259
+ (c) => tryRoute(c, () => deps.catalogue.listCategories(deps.defaultBusinessId))
2260
+ );
2261
+ app.get(
2262
+ "/catalogue/categories/:category_id",
2263
+ (c) => tryRoute(c, () => deps.catalogue.getCategory(c.req.param("category_id")))
2264
+ );
2265
+ app.get(
2266
+ "/catalogue/categories/:category_id/products",
2267
+ (c) => tryRoute(c, () => deps.catalogue.getCategoryProducts(c.req.param("category_id")))
2268
+ );
2269
+ app.get(
2270
+ "/catalogue/categories/:category_id/attributes",
2271
+ (c) => tryRoute(c, () => deps.catalogue.getCategoryAttributes(c.req.param("category_id")))
2272
+ );
2273
+ app.get(
2274
+ "/catalogue/categories/:category_id/deals",
2275
+ (c) => tryRoute(c, () => deps.catalogue.getCategoryDeals(c.req.param("category_id")))
2276
+ );
2277
+ app.get(
2278
+ "/catalogue/collections",
2279
+ (c) => tryRoute(c, () => deps.catalogue.listCollections(deps.defaultBusinessId))
2280
+ );
2281
+ app.get(
2282
+ "/catalogue/collections/:collection_id",
2283
+ (c) => tryRoute(c, () => deps.catalogue.getCollection(c.req.param("collection_id")))
2284
+ );
2285
+ app.get(
2286
+ "/catalogue/collections/:collection_id/products",
2287
+ (c) => tryRoute(c, () => deps.catalogue.getCollectionProducts(c.req.param("collection_id")))
2288
+ );
2289
+ app.get(
2290
+ "/catalogue/collections/:collection_id/attributes",
2291
+ (c) => tryRoute(c, () => deps.catalogue.getCollectionAttributes(c.req.param("collection_id")))
2292
+ );
2293
+ app.get(
2294
+ "/catalogue/collections/:collection_id/deals",
2295
+ (c) => tryRoute(c, () => deps.catalogue.getCollectionDeals(c.req.param("collection_id")))
2296
+ );
2297
+ app.get(
2298
+ "/catalogue/bundles",
2299
+ (c) => tryRoute(c, () => deps.catalogue.listBundles(deps.defaultBusinessId))
2300
+ );
2301
+ app.get(
2302
+ "/catalogue/bundles/:bundle_id",
2303
+ (c) => tryRoute(c, () => deps.catalogue.getBundle(c.req.param("bundle_id")))
2304
+ );
2305
+ app.get(
2306
+ "/catalogue/composites",
2307
+ (c) => tryRoute(c, () => deps.catalogue.listComposites(deps.defaultBusinessId))
2308
+ );
2309
+ app.get(
2310
+ "/catalogue/composites/by-product/:product_id",
2311
+ (c) => tryRoute(c, () => deps.catalogue.getCompositeByProduct(c.req.param("product_id")))
2312
+ );
2313
+ app.get(
2314
+ "/catalogue/composites/:composite_id",
2315
+ (c) => tryRoute(c, () => deps.catalogue.getComposite(c.req.param("composite_id")))
2316
+ );
2241
2317
  app.post("/catalogue/composites/:composite_id/calculate-price", async (c) => {
2242
2318
  const body = await c.req.json().catch(() => ({}));
2243
- return tryRoute(c, () => deps.catalogue.calculateCompositePrice(c.req.param("composite_id"), body));
2319
+ return tryRoute(
2320
+ c,
2321
+ () => deps.catalogue.calculateCompositePrice(c.req.param("composite_id"), body)
2322
+ );
2244
2323
  });
2245
- app.get("/catalogue/taxonomies", (c) => tryRoute(c, () => deps.catalogue.listTaxonomies(deps.defaultBusinessId)));
2246
- app.get("/catalogue/taxonomies/search", (c) => tryRoute(c, () => deps.catalogue.searchTaxonomies(deps.defaultBusinessId, c.req.query("q") ?? "")));
2247
- app.get("/catalogue/taxonomies/:taxonomy_id", (c) => tryRoute(c, () => deps.catalogue.getTaxonomy(c.req.param("taxonomy_id"))));
2248
- app.get("/catalogue/taxonomies/:taxonomy_id/attributes", (c) => tryRoute(c, () => deps.catalogue.getTaxonomyAttributes(c.req.param("taxonomy_id"))));
2249
- app.get("/catalogue/taxonomies/:taxonomy_id/path", (c) => tryRoute(c, () => deps.catalogue.getTaxonomyPath(c.req.param("taxonomy_id"))));
2250
- app.get("/catalogue/attributes", (c) => tryRoute(c, () => deps.catalogue.listAttributes(deps.defaultBusinessId)));
2251
- app.get("/catalogue/properties/facets", (c) => tryRoute(c, () => deps.catalogue.listPropertyFacets(deps.defaultBusinessId)));
2252
- app.get("/catalogue/tags", (c) => tryRoute(c, () => deps.catalogue.listTags(deps.defaultBusinessId)));
2324
+ app.get(
2325
+ "/catalogue/taxonomies",
2326
+ (c) => tryRoute(c, () => deps.catalogue.listTaxonomies(deps.defaultBusinessId))
2327
+ );
2328
+ app.get(
2329
+ "/catalogue/taxonomies/search",
2330
+ (c) => tryRoute(
2331
+ c,
2332
+ () => deps.catalogue.searchTaxonomies(deps.defaultBusinessId, c.req.query("q") ?? "")
2333
+ )
2334
+ );
2335
+ app.get(
2336
+ "/catalogue/taxonomies/:taxonomy_id",
2337
+ (c) => tryRoute(c, () => deps.catalogue.getTaxonomy(c.req.param("taxonomy_id")))
2338
+ );
2339
+ app.get(
2340
+ "/catalogue/taxonomies/:taxonomy_id/attributes",
2341
+ (c) => tryRoute(c, () => deps.catalogue.getTaxonomyAttributes(c.req.param("taxonomy_id")))
2342
+ );
2343
+ app.get(
2344
+ "/catalogue/taxonomies/:taxonomy_id/path",
2345
+ (c) => tryRoute(c, () => deps.catalogue.getTaxonomyPath(c.req.param("taxonomy_id")))
2346
+ );
2347
+ app.get(
2348
+ "/catalogue/attributes",
2349
+ (c) => tryRoute(c, () => deps.catalogue.listAttributes(deps.defaultBusinessId))
2350
+ );
2351
+ app.get(
2352
+ "/catalogue/properties/facets",
2353
+ (c) => tryRoute(c, () => deps.catalogue.listPropertyFacets(deps.defaultBusinessId))
2354
+ );
2355
+ app.get(
2356
+ "/catalogue/tags",
2357
+ (c) => tryRoute(c, () => deps.catalogue.listTags(deps.defaultBusinessId))
2358
+ );
2253
2359
  app.get("/catalogue/menu", (c) => tryRoute(c, () => deps.lite.getMenu(deps.defaultBusinessId)));
2254
- app.get("/catalogue/menu/categories/:category_id", (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id"))));
2255
- app.get("/catalogue/menu/items/:item_id", (c) => tryRoute(c, () => deps.catalogue.getProduct(c.req.param("item_id"))));
2256
- app.get("/catalogue/knowledge-base/articles", (c) => tryRoute(c, () => ({ articles: deps.catalogue.listKnowledgeArticles(deps.defaultBusinessId) })));
2360
+ app.get(
2361
+ "/catalogue/menu/categories/:category_id",
2362
+ (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id")))
2363
+ );
2364
+ app.get(
2365
+ "/catalogue/menu/items/:item_id",
2366
+ (c) => tryRoute(c, () => deps.catalogue.getProduct(c.req.param("item_id")))
2367
+ );
2368
+ app.get(
2369
+ "/catalogue/knowledge-base/articles",
2370
+ (c) => tryRoute(c, () => ({ articles: deps.catalogue.listKnowledgeArticles(deps.defaultBusinessId) }))
2371
+ );
2257
2372
  app.get(
2258
2373
  "/catalogue/knowledge-base/search",
2259
- (c) => tryRoute(c, () => ({ results: deps.catalogue.searchKnowledgeBase(deps.defaultBusinessId, c.req.query("q") ?? ""), query: c.req.query("q") ?? "" }))
2374
+ (c) => tryRoute(c, () => ({
2375
+ results: deps.catalogue.searchKnowledgeBase(deps.defaultBusinessId, c.req.query("q") ?? ""),
2376
+ query: c.req.query("q") ?? ""
2377
+ }))
2378
+ );
2379
+ app.get(
2380
+ "/catalogue/products/:product_id/attributes",
2381
+ (c) => tryRoute(c, () => deps.catalogue.getProductAttributes(c.req.param("product_id")))
2260
2382
  );
2261
- app.get("/catalogue/products/:product_id/attributes", (c) => tryRoute(c, () => deps.catalogue.getProductAttributes(c.req.param("product_id"))));
2262
2383
  app.get(
2263
2384
  "/catalogue/products/:product_id/available-now",
2264
2385
  (c) => tryRoute(c, () => {
@@ -2277,22 +2398,45 @@ function buildV1(deps) {
2277
2398
  "/catalogue/products/:product_id/schedules",
2278
2399
  (c) => tryRoute(c, () => {
2279
2400
  const p = deps.registry.products.get(c.req.param("product_id"));
2280
- return { schedules: p?.metadata?.["time_profiles"] ?? [] };
2401
+ return {
2402
+ schedules: p?.metadata?.["time_profiles"] ?? []
2403
+ };
2281
2404
  })
2282
2405
  );
2283
- app.get("/catalogue/deals", (c) => tryRoute(c, () => deps.catalogue.listDeals(deps.defaultBusinessId)));
2284
- app.get("/catalogue/deals/on-sale", (c) => tryRoute(c, () => deps.catalogue.listOnSale(deps.defaultBusinessId)));
2406
+ app.get(
2407
+ "/catalogue/deals",
2408
+ (c) => tryRoute(c, () => deps.catalogue.listDeals(deps.defaultBusinessId))
2409
+ );
2410
+ app.get(
2411
+ "/catalogue/deals/on-sale",
2412
+ (c) => tryRoute(c, () => deps.catalogue.listOnSale(deps.defaultBusinessId))
2413
+ );
2285
2414
  app.post("/catalogue/deals/validate", async (c) => {
2286
2415
  const body = await c.req.json().catch(() => ({}));
2287
- return tryRoute(c, () => deps.catalogue.validateDiscount(body.discount_code ?? body.code ?? "", deps.defaultBusinessId));
2416
+ return tryRoute(
2417
+ c,
2418
+ () => deps.catalogue.validateDiscount(
2419
+ body.discount_code ?? body.code ?? "",
2420
+ deps.defaultBusinessId
2421
+ )
2422
+ );
2288
2423
  });
2289
- app.get("/catalogue/products/:product_id/deals", (c) => tryRoute(c, () => deps.catalogue.getProductDeals(c.req.param("product_id"))));
2424
+ app.get(
2425
+ "/catalogue/products/:product_id/deals",
2426
+ (c) => tryRoute(c, () => deps.catalogue.getProductDeals(c.req.param("product_id")))
2427
+ );
2290
2428
  app.post("/catalogue/quotes", async (c) => {
2291
2429
  const body = await c.req.json().catch(() => ({}));
2292
2430
  return tryRoute(c, () => deps.catalogue.createQuote(deps.defaultBusinessId, body));
2293
2431
  });
2294
- app.get("/catalogue/quotes/:quote_id", (c) => tryRoute(c, () => deps.catalogue.getQuote(c.req.param("quote_id"))));
2295
- app.post("/catalogue/quotes/:quote_id/refresh", (c) => tryRoute(c, () => deps.catalogue.refreshQuote(c.req.param("quote_id"))));
2432
+ app.get(
2433
+ "/catalogue/quotes/:quote_id",
2434
+ (c) => tryRoute(c, () => deps.catalogue.getQuote(c.req.param("quote_id")))
2435
+ );
2436
+ app.post(
2437
+ "/catalogue/quotes/:quote_id/refresh",
2438
+ (c) => tryRoute(c, () => deps.catalogue.refreshQuote(c.req.param("quote_id")))
2439
+ );
2296
2440
  app.get("/cart", (c) => tryRoute(c, () => deps.cart.toUICart(deps.cart.get(c.var.session))));
2297
2441
  app.delete("/cart", (c) => tryRoute(c, () => deps.cart.clear(c.var.session)));
2298
2442
  app.get("/cart/items", (c) => tryRoute(c, () => deps.cart.getItems(c.var.session)));
@@ -2303,9 +2447,15 @@ function buildV1(deps) {
2303
2447
  app.patch("/cart/items/:cart_item_id", async (c) => {
2304
2448
  const body = await c.req.json().catch(() => ({}));
2305
2449
  if (typeof body.quantity !== "number") return fail(c, validation("quantity required"));
2306
- return tryRoute(c, () => deps.cart.updateQuantity(c.var.session, c.req.param("cart_item_id"), body.quantity));
2450
+ return tryRoute(
2451
+ c,
2452
+ () => deps.cart.updateQuantity(c.var.session, c.req.param("cart_item_id"), body.quantity)
2453
+ );
2307
2454
  });
2308
- app.delete("/cart/items/:cart_item_id", (c) => tryRoute(c, () => deps.cart.removeItem(c.var.session, c.req.param("cart_item_id"))));
2455
+ app.delete(
2456
+ "/cart/items/:cart_item_id",
2457
+ (c) => tryRoute(c, () => deps.cart.removeItem(c.var.session, c.req.param("cart_item_id")))
2458
+ );
2309
2459
  app.get("/cart/count", (c) => tryRoute(c, () => deps.cart.getCount(c.var.session)));
2310
2460
  app.get("/cart/total", (c) => tryRoute(c, () => deps.cart.getTotal(c.var.session)));
2311
2461
  app.post("/cart/destination-quote", async (c) => {
@@ -2316,10 +2466,25 @@ function buildV1(deps) {
2316
2466
  const body = await c.req.json().catch(() => ({}));
2317
2467
  return tryRoute(c, () => deps.cart.applyCoupon(c.var.session, body.coupon_code ?? ""));
2318
2468
  });
2319
- app.delete("/cart/coupons/current", (c) => tryRoute(c, () => deps.cart.removeCoupon(c.var.session)));
2320
- app.get("/orders", (c) => tryRoute(c, () => deps.orders.list(c.var.session, { limit: getQueryNum(c, "limit"), status: c.req.query("status") })));
2469
+ app.delete(
2470
+ "/cart/coupons/current",
2471
+ (c) => tryRoute(c, () => deps.cart.removeCoupon(c.var.session))
2472
+ );
2473
+ app.get(
2474
+ "/orders",
2475
+ (c) => tryRoute(
2476
+ c,
2477
+ () => deps.orders.list(c.var.session, {
2478
+ limit: getQueryNum(c, "limit"),
2479
+ status: c.req.query("status")
2480
+ })
2481
+ )
2482
+ );
2321
2483
  app.get("/orders/:order_id", (c) => tryRoute(c, () => deps.orders.get(c.req.param("order_id"))));
2322
- app.get("/orders/:order_id/payment-status", (c) => tryRoute(c, () => deps.orders.getPaymentStatus(c.req.param("order_id"))));
2484
+ app.get(
2485
+ "/orders/:order_id/payment-status",
2486
+ (c) => tryRoute(c, () => deps.orders.getPaymentStatus(c.req.param("order_id")))
2487
+ );
2323
2488
  app.post("/orders/:order_id/cancel", async (c) => {
2324
2489
  const body = await c.req.json().catch(() => ({}));
2325
2490
  return tryRoute(c, () => deps.orders.cancel(c.req.param("order_id"), body.reason));
@@ -2328,13 +2493,46 @@ function buildV1(deps) {
2328
2493
  const body = await c.req.json().catch(() => ({}));
2329
2494
  return tryRoute(c, () => deps.orders.updateCustomer(c.req.param("order_id"), body));
2330
2495
  });
2331
- app.post("/orders/:order_id/verify-payment", (c) => tryRoute(c, () => deps.orders.verifyPayment(c.req.param("order_id"))));
2496
+ app.post(
2497
+ "/orders/:order_id/verify-payment",
2498
+ (c) => tryRoute(c, () => deps.orders.verifyPayment(c.req.param("order_id")))
2499
+ );
2332
2500
  app.get("/subscriptions", (c) => tryRoute(c, () => deps.subscriptions.list(c.var.session)));
2333
- app.get("/subscriptions/:subscription_id", (c) => tryRoute(c, () => deps.subscriptions.get(c.req.param("subscription_id"))));
2334
- app.post("/subscriptions/:subscription_id/cancel", (c) => tryRoute(c, () => deps.subscriptions.cancel(c.req.param("subscription_id"))));
2335
- app.post("/subscriptions/:subscription_id/pause", (c) => tryRoute(c, () => deps.subscriptions.pause(c.req.param("subscription_id"))));
2336
- app.post("/subscriptions/:subscription_id/resume", (c) => tryRoute(c, () => deps.subscriptions.resume(c.req.param("subscription_id"))));
2337
- app.post("/subscriptions/:subscription_id/skip", (c) => tryRoute(c, () => deps.subscriptions.skipNext(c.req.param("subscription_id"))));
2501
+ app.get(
2502
+ "/subscriptions/:subscription_id",
2503
+ (c) => tryRoute(c, () => deps.subscriptions.get(c.req.param("subscription_id")))
2504
+ );
2505
+ app.post(
2506
+ "/subscriptions/:subscription_id/cancel",
2507
+ (c) => tryRoute(c, () => deps.subscriptions.cancel(c.req.param("subscription_id")))
2508
+ );
2509
+ app.post(
2510
+ "/subscriptions/:subscription_id/pause",
2511
+ (c) => tryRoute(c, () => deps.subscriptions.pause(c.req.param("subscription_id")))
2512
+ );
2513
+ app.post(
2514
+ "/subscriptions/:subscription_id/resume",
2515
+ (c) => tryRoute(c, () => deps.subscriptions.resume(c.req.param("subscription_id")))
2516
+ );
2517
+ app.post(
2518
+ "/subscriptions/:subscription_id/skip",
2519
+ (c) => tryRoute(c, () => deps.subscriptions.skipNext(c.req.param("subscription_id")))
2520
+ );
2521
+ app.get("/payments/collection-options", (c) => {
2522
+ const currency = c.req.query("currency")?.trim().toUpperCase();
2523
+ if (!currency || !/^[A-Z]{3}$/.test(currency)) {
2524
+ return fail(c, validation("currency must be a canonical three-letter code"));
2525
+ }
2526
+ return tryRoute(c, () => ({
2527
+ presentment_currency: currency,
2528
+ options: currency === "GHS" ? [
2529
+ { method: chunkCNN7Z2IP_js.PAYMENT_METHOD.CARD, network: null },
2530
+ { method: chunkCNN7Z2IP_js.PAYMENT_METHOD.MOBILE_MONEY, network: "mtn" },
2531
+ { method: chunkCNN7Z2IP_js.PAYMENT_METHOD.MOBILE_MONEY, network: "telecel" },
2532
+ { method: chunkCNN7Z2IP_js.PAYMENT_METHOD.MOBILE_MONEY, network: "airteltigo" }
2533
+ ] : currency === "USD" ? [{ method: chunkCNN7Z2IP_js.PAYMENT_METHOD.CARD, network: null }] : []
2534
+ }));
2535
+ });
2338
2536
  app.post("/checkout", async (c) => {
2339
2537
  const body = await c.req.json().catch(() => ({}));
2340
2538
  return tryRoute(c, () => deps.checkout.process(c.var.session, body));
@@ -2388,15 +2586,33 @@ function buildV1(deps) {
2388
2586
  return { success: true, message: "Profile updated successfully" };
2389
2587
  });
2390
2588
  });
2391
- app.get("/inventory/products/:product_id/stock", (c) => tryRoute(c, () => deps.inventory.productStock(c.req.param("product_id"))));
2392
- app.get("/inventory/variants/:variant_id/stock", (c) => tryRoute(c, () => deps.inventory.variantStock(c.req.param("variant_id"))));
2589
+ app.get(
2590
+ "/inventory/products/:product_id/stock",
2591
+ (c) => tryRoute(c, () => deps.inventory.productStock(c.req.param("product_id")))
2592
+ );
2593
+ app.get(
2594
+ "/inventory/variants/:variant_id/stock",
2595
+ (c) => tryRoute(c, () => deps.inventory.variantStock(c.req.param("variant_id")))
2596
+ );
2393
2597
  app.get(
2394
2598
  "/inventory/products/:product_id/availability",
2395
- (c) => tryRoute(c, () => deps.inventory.productAvailability(c.req.param("product_id"), getQueryNum(c, "quantity") ?? 1))
2599
+ (c) => tryRoute(
2600
+ c,
2601
+ () => deps.inventory.productAvailability(
2602
+ c.req.param("product_id"),
2603
+ getQueryNum(c, "quantity") ?? 1
2604
+ )
2605
+ )
2396
2606
  );
2397
2607
  app.get(
2398
2608
  "/inventory/variants/:variant_id/availability",
2399
- (c) => tryRoute(c, () => deps.inventory.variantAvailability(c.req.param("variant_id"), getQueryNum(c, "quantity") ?? 1))
2609
+ (c) => tryRoute(
2610
+ c,
2611
+ () => deps.inventory.variantAvailability(
2612
+ c.req.param("variant_id"),
2613
+ getQueryNum(c, "quantity") ?? 1
2614
+ )
2615
+ )
2400
2616
  );
2401
2617
  app.get(
2402
2618
  "/delivery/fee",
@@ -2423,35 +2639,75 @@ function buildV1(deps) {
2423
2639
  );
2424
2640
  app.post("/places/autocomplete", async (c) => {
2425
2641
  const body = await c.req.json().catch(() => ({}));
2426
- return tryRoute(c, () => deps.places.autocomplete({ query: body.input ?? body.query ?? "", country: body.country }));
2642
+ return tryRoute(
2643
+ c,
2644
+ () => deps.places.autocomplete({ query: body.input ?? body.query ?? "", country: body.country })
2645
+ );
2427
2646
  });
2428
2647
  app.post("/places/details", async (c) => {
2429
2648
  const body = await c.req.json().catch(() => ({}));
2430
2649
  return tryRoute(c, () => deps.places.details({ place_id: body.place_id ?? "" }));
2431
2650
  });
2432
- app.get("/scheduling/services", (c) => tryRoute(c, () => deps.scheduling.listServices(deps.defaultBusinessId)));
2433
- app.get("/scheduling/services/:service_id", (c) => tryRoute(c, () => deps.scheduling.getService(c.req.param("service_id"))));
2434
- app.get("/scheduling/slots", (c) => tryRoute(c, () => deps.scheduling.getSlots(c.req.query("service_id") ?? "", { date: c.req.query("date") })));
2651
+ app.get(
2652
+ "/scheduling/services",
2653
+ (c) => tryRoute(c, () => deps.scheduling.listServices(deps.defaultBusinessId))
2654
+ );
2655
+ app.get(
2656
+ "/scheduling/services/:service_id",
2657
+ (c) => tryRoute(c, () => deps.scheduling.getService(c.req.param("service_id")))
2658
+ );
2659
+ app.get(
2660
+ "/scheduling/slots",
2661
+ (c) => tryRoute(
2662
+ c,
2663
+ () => deps.scheduling.getSlots(c.req.query("service_id") ?? "", { date: c.req.query("date") })
2664
+ )
2665
+ );
2435
2666
  app.get(
2436
2667
  "/scheduling/slots/check",
2437
- (c) => tryRoute(c, () => deps.scheduling.checkSlot(c.req.query("service_id") ?? "", c.req.query("start") ?? "", c.req.query("end") ?? ""))
2668
+ (c) => tryRoute(
2669
+ c,
2670
+ () => deps.scheduling.checkSlot(
2671
+ c.req.query("service_id") ?? "",
2672
+ c.req.query("start") ?? "",
2673
+ c.req.query("end") ?? ""
2674
+ )
2675
+ )
2676
+ );
2677
+ app.get(
2678
+ "/scheduling/availability",
2679
+ (c) => tryRoute(c, () => deps.scheduling.getServiceAvailability(c.req.query("service_id") ?? ""))
2680
+ );
2681
+ app.get(
2682
+ "/scheduling/bookings",
2683
+ (c) => tryRoute(c, () => deps.scheduling.getCustomerBookings(c.var.session))
2438
2684
  );
2439
- app.get("/scheduling/availability", (c) => tryRoute(c, () => deps.scheduling.getServiceAvailability(c.req.query("service_id") ?? "")));
2440
- app.get("/scheduling/bookings", (c) => tryRoute(c, () => deps.scheduling.getCustomerBookings(c.var.session)));
2441
2685
  app.post("/scheduling/bookings/reschedule", async (c) => {
2442
2686
  const body = await c.req.json().catch(() => ({}));
2443
2687
  return tryRoute(c, () => deps.scheduling.rescheduleBooking(body));
2444
2688
  });
2445
- app.get("/scheduling/bookings/:booking_id", (c) => tryRoute(c, () => deps.scheduling.getBooking(c.req.param("booking_id"))));
2689
+ app.get(
2690
+ "/scheduling/bookings/:booking_id",
2691
+ (c) => tryRoute(c, () => deps.scheduling.getBooking(c.req.param("booking_id")))
2692
+ );
2446
2693
  app.post("/scheduling/bookings/:booking_id/cancel", async (c) => {
2447
2694
  const body = await c.req.json().catch(() => ({}));
2448
2695
  return tryRoute(c, () => deps.scheduling.cancelBooking(c.req.param("booking_id"), body.reason));
2449
2696
  });
2450
2697
  app.get("/lite/bootstrap", (c) => tryRoute(c, () => deps.lite.bootstrap(deps.defaultBusinessId)));
2451
- app.get("/lite/resources/:resource_id", (c) => tryRoute(c, () => deps.lite.getResource(c.req.param("resource_id"))));
2698
+ app.get(
2699
+ "/lite/resources/:resource_id",
2700
+ (c) => tryRoute(c, () => deps.lite.getResource(c.req.param("resource_id")))
2701
+ );
2452
2702
  app.get("/lite/menu", (c) => tryRoute(c, () => deps.lite.getMenu(deps.defaultBusinessId)));
2453
- app.get("/lite/menu/categories/:category_id", (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id"))));
2454
- app.get("/fx/rate", (c) => tryRoute(c, () => deps.fx.getRate(c.req.query("from") ?? "USD", c.req.query("to") ?? "GHS")));
2703
+ app.get(
2704
+ "/lite/menu/categories/:category_id",
2705
+ (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id")))
2706
+ );
2707
+ app.get(
2708
+ "/fx/rate",
2709
+ (c) => tryRoute(c, () => deps.fx.getRate(c.req.query("from") ?? "USD", c.req.query("to") ?? "GHS"))
2710
+ );
2455
2711
  app.post("/fx/quotes", async (c) => {
2456
2712
  const body = await c.req.json().catch(() => ({}));
2457
2713
  return tryRoute(c, () => deps.fx.lockQuote(body));
@@ -2464,31 +2720,47 @@ function buildV1(deps) {
2464
2720
  const body = await c.req.json().catch(() => ({}));
2465
2721
  return tryRoute(c, () => deps.uploads.confirm(body));
2466
2722
  });
2467
- app.get(
2468
- "/store-credit/balance",
2469
- (c) => c.json({ data: { balance: "0.00", currency: "USD" } })
2470
- );
2723
+ app.get("/store-credit/balance", (c) => c.json({ data: { balance: "0.00", currency: "USD" } }));
2471
2724
  app.post("/activity/session", async (c) => {
2472
2725
  await c.req.json().catch(() => ({}));
2473
2726
  return c.json({ data: { recorded: true } });
2474
2727
  });
2475
2728
  app.post("/activity/events", async (c) => {
2476
2729
  const body = await c.req.json().catch(() => ({}));
2477
- return tryRoute(c, () => deps.activity.recordEvents(deps.defaultBusinessId, body.analytics_session_id ?? c.var.session.id, body.events ?? []));
2730
+ return tryRoute(
2731
+ c,
2732
+ () => deps.activity.recordEvents(
2733
+ deps.defaultBusinessId,
2734
+ body.analytics_session_id ?? c.var.session.id,
2735
+ body.events ?? []
2736
+ )
2737
+ );
2478
2738
  });
2479
- app.get("/activity/state", (c) => tryRoute(c, () => deps.activity.getState(deps.defaultBusinessId, c.var.session.id)));
2480
- app.get("/activity/recommendations", (c) => tryRoute(c, () => deps.activity.getRecommendations(deps.defaultBusinessId)));
2739
+ app.get(
2740
+ "/activity/state",
2741
+ (c) => tryRoute(c, () => deps.activity.getState(deps.defaultBusinessId, c.var.session.id))
2742
+ );
2743
+ app.get(
2744
+ "/activity/recommendations",
2745
+ (c) => tryRoute(c, () => deps.activity.getRecommendations(deps.defaultBusinessId))
2746
+ );
2481
2747
  app.post("/activity/messages/dismiss", async (c) => {
2482
2748
  const body = await c.req.json().catch(() => ({}));
2483
2749
  return tryRoute(c, () => deps.activity.dismissMessage(body.code ?? body.message_id ?? ""));
2484
2750
  });
2485
2751
  app.post(
2486
2752
  "/support/conversation",
2487
- (c) => tryRoute(c, () => deps.support.openConversation(deps.defaultBusinessId, c.var.session.customer_id))
2753
+ (c) => tryRoute(
2754
+ c,
2755
+ () => deps.support.openConversation(deps.defaultBusinessId, c.var.session.customer_id)
2756
+ )
2488
2757
  );
2489
2758
  app.get(
2490
2759
  "/support/conversation",
2491
- (c) => tryRoute(c, () => deps.support.peekConversation(deps.defaultBusinessId, c.var.session.customer_id))
2760
+ (c) => tryRoute(
2761
+ c,
2762
+ () => deps.support.peekConversation(deps.defaultBusinessId, c.var.session.customer_id)
2763
+ )
2492
2764
  );
2493
2765
  app.post("/support/conversation/messages", async (c) => {
2494
2766
  const body = await c.req.json().catch(() => ({}));
@@ -2504,7 +2776,12 @@ function buildV1(deps) {
2504
2776
  });
2505
2777
  app.get(
2506
2778
  "/support/conversation/messages",
2507
- (c) => tryRoute(c, () => deps.support.listMessages(c.req.query("conversation_id") ?? "", { limit: getQueryNum(c, "limit") }))
2779
+ (c) => tryRoute(
2780
+ c,
2781
+ () => deps.support.listMessages(c.req.query("conversation_id") ?? "", {
2782
+ limit: getQueryNum(c, "limit")
2783
+ })
2784
+ )
2508
2785
  );
2509
2786
  app.post("/support/conversation/messages/:messageId/reactions", async (c) => {
2510
2787
  const body = await c.req.json().catch(() => ({}));
@@ -2525,7 +2802,10 @@ function buildV1(deps) {
2525
2802
  });
2526
2803
  app.get(
2527
2804
  "/support/conversation/ws",
2528
- (c) => c.json({ note: "WebSocket connection \u2014 connect via ws:// at the same path", supported: false }, 426)
2805
+ (c) => c.json(
2806
+ { note: "WebSocket connection \u2014 connect via ws:// at the same path", supported: false },
2807
+ 426
2808
+ )
2529
2809
  );
2530
2810
  return app;
2531
2811
  }
@@ -4977,9 +5257,11 @@ function createCheckoutService(opts) {
4977
5257
  if (c.items.length === 0) throw validation("Cart is empty", { code: "CART_EMPTY" });
4978
5258
  const orderId = ids.order();
4979
5259
  const orderNumber = ids.orderNumber();
5260
+ const paymentId = ids.payment();
4980
5261
  const reference = ids.payment();
4981
5262
  const requiresAuth = body.payment_method === "mobile_money";
4982
5263
  const isCard = body.payment_method === "card" || body.payment_method === "stripe";
5264
+ const cardProvider = body.payment_method === "stripe" || body.pay_currency?.toUpperCase() === "USD" ? "stripe" : "paystack";
4983
5265
  const order = {
4984
5266
  id: orderId,
4985
5267
  business_id: c.business_id,
@@ -5003,6 +5285,7 @@ function createCheckoutService(opts) {
5003
5285
  items: c.items,
5004
5286
  applied_discount_ids: c.applied_discount_ids,
5005
5287
  applied_discount_codes: c.applied_discount_codes,
5288
+ payment_id: paymentId,
5006
5289
  payment_reference: reference,
5007
5290
  metadata: body.metadata,
5008
5291
  created_at: clock.iso(),
@@ -5019,31 +5302,57 @@ function createCheckoutService(opts) {
5019
5302
  const result = {
5020
5303
  order_id: orderId,
5021
5304
  order_number: orderNumber,
5022
- payment_status: requiresAuth ? "pending" : "succeeded",
5305
+ payment_id: paymentId,
5306
+ payment_status: requiresAuth || isCard ? "pending" : "succeeded",
5023
5307
  payment_reference: reference,
5024
5308
  requires_authorization: requiresAuth,
5025
5309
  authorization_type: requiresAuth ? "otp" : void 0,
5026
- next_action: requiresAuth ? { type: "authorization", authorization_type: "otp", display_text: "Approve on your mobile money app" } : { type: "none" },
5027
- provider: body.payment_method,
5310
+ next_action: requiresAuth ? {
5311
+ type: "authorization",
5312
+ authorization_type: "otp",
5313
+ display_text: "Approve on your mobile money app"
5314
+ } : { type: "none" },
5315
+ provider: isCard ? cardProvider : body.payment_method,
5028
5316
  bill_token: billToken
5029
5317
  };
5030
5318
  if (isCard) {
5031
- result.next_action = { type: "redirect", authorization_url: `https://mock.cimplify.io/pay/${reference}` };
5032
- result.authorization_url = `https://mock.cimplify.io/pay/${reference}`;
5033
- result.client_secret = `pi_${orderId.slice(-12)}_secret_${Math.random().toString(36).slice(2, 18)}`;
5034
5319
  const proc = globalThis.process;
5035
- result.public_key = proc?.env?.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY ?? "pk_test_mock_publishable_key";
5320
+ result.client_secret = cardProvider === "stripe" ? `pi_${orderId.slice(-12)}_secret_${Math.random().toString(36).slice(2, 18)}` : `access_${reference}`;
5321
+ 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";
5322
+ result.next_action = {
5323
+ type: "card_popup",
5324
+ provider: cardProvider,
5325
+ client_secret: result.client_secret,
5326
+ public_key: result.public_key
5327
+ };
5036
5328
  }
5037
5329
  return result;
5038
5330
  },
5039
5331
  authorize(body) {
5040
- const order = registry.orders.get(body.order_id);
5041
- if (!order) throw notFound(`Order ${body.order_id} not found`);
5042
- const updated = { ...order, payment_state: "paid", status: "confirmed", updated_at: clock.iso() };
5332
+ if (!body.payment_id?.trim()) throw validation("payment_id required");
5333
+ if (!body.authorization) throw validation("authorization required");
5334
+ const order = registry.orders.list(
5335
+ (candidate) => candidate.payment_id === body.payment_id
5336
+ )[0];
5337
+ if (!order) throw notFound(`Payment ${body.payment_id} not found`);
5338
+ const updated = {
5339
+ ...order,
5340
+ payment_state: "paid",
5341
+ status: "confirmed",
5342
+ updated_at: clock.iso()
5343
+ };
5043
5344
  registry.orders.put(order.id, updated);
5044
5345
  bus.emit("order.payment.captured", { order_id: order.id }, order.business_id);
5045
5346
  bus.emit("order.confirmed", { order_id: order.id }, order.business_id);
5046
- return { status: "succeeded", order_id: order.id };
5347
+ return {
5348
+ order_id: order.id,
5349
+ order_number: order.user_friendly_id,
5350
+ payment_id: body.payment_id,
5351
+ payment_reference: order.payment_reference,
5352
+ payment_status: "succeeded",
5353
+ requires_authorization: false,
5354
+ next_action: { type: "none" }
5355
+ };
5047
5356
  }
5048
5357
  };
5049
5358
  }