@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
package/dist/mock/cli.mjs CHANGED
@@ -3034,6 +3034,8 @@ var ERROR_SUGGESTIONS = {
3034
3034
  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.",
3035
3035
  PAYMENT_FAILED: "Payment provider rejected or failed processing. Show retry/change-method options to the shopper.",
3036
3036
  PAYMENT_CANCELLED: "Payment was cancelled by the shopper or provider flow. Allow a safe retry path.",
3037
+ PAYMENT_CAPABILITY_MISMATCH: "Refresh collection capabilities for the exact tenant and presentment currency before retrying.",
3038
+ UNSUPPORTED_CURRENCY: "Choose a supported presentment currency before loading payment methods or submitting checkout.",
3037
3039
  INSUFFICIENT_FUNDS: "Payment method has insufficient funds. Prompt shopper to use another method.",
3038
3040
  CARD_DECLINED: "Card was declined. Ask shopper to retry or switch payment method.",
3039
3041
  INVALID_OTP: "Authorization code is invalid. Let shopper re-enter OTP/PIN and retry.",
@@ -3182,6 +3184,12 @@ function getQueryNum(c, key) {
3182
3184
  return Number.isFinite(n) ? n : void 0;
3183
3185
  }
3184
3186
 
3187
+ // src/constants.ts
3188
+ var PAYMENT_METHOD = {
3189
+ MOBILE_MONEY: "mobile_money",
3190
+ CARD: "card"
3191
+ };
3192
+
3185
3193
  // src/mock/routes/v1.ts
3186
3194
  function buildV1(deps) {
3187
3195
  const app = new Hono2();
@@ -3198,10 +3206,22 @@ function buildV1(deps) {
3198
3206
  }));
3199
3207
  });
3200
3208
  app.get("/business", (c) => tryRoute(c, () => deps.business.primary()));
3201
- app.get("/business/by-handle/:handle", (c) => tryRoute(c, () => deps.business.byHandle(c.req.param("handle"))));
3202
- app.get("/business/by-domain", (c) => tryRoute(c, () => deps.business.byDomain(c.req.query("domain") ?? "")));
3203
- app.get("/business/settings", (c) => tryRoute(c, () => deps.business.settings(deps.defaultBusinessId)));
3204
- app.get("/business/locations", (c) => tryRoute(c, () => deps.business.locations(deps.defaultBusinessId)));
3209
+ app.get(
3210
+ "/business/by-handle/:handle",
3211
+ (c) => tryRoute(c, () => deps.business.byHandle(c.req.param("handle")))
3212
+ );
3213
+ app.get(
3214
+ "/business/by-domain",
3215
+ (c) => tryRoute(c, () => deps.business.byDomain(c.req.query("domain") ?? ""))
3216
+ );
3217
+ app.get(
3218
+ "/business/settings",
3219
+ (c) => tryRoute(c, () => deps.business.settings(deps.defaultBusinessId))
3220
+ );
3221
+ app.get(
3222
+ "/business/locations",
3223
+ (c) => tryRoute(c, () => deps.business.locations(deps.defaultBusinessId))
3224
+ );
3205
3225
  app.get("/business/hours", (c) => tryRoute(c, () => deps.business.hours(deps.defaultBusinessId)));
3206
3226
  app.get("/catalogue", (c) => tryRoute(c, () => deps.catalogue.snapshot(deps.defaultBusinessId)));
3207
3227
  app.get(
@@ -3216,57 +3236,165 @@ function buildV1(deps) {
3216
3236
  })
3217
3237
  )
3218
3238
  );
3219
- app.get("/catalogue/products/:product_id", (c) => tryRoute(c, () => deps.catalogue.getProduct(c.req.param("product_id"))));
3220
- app.get("/catalogue/products/:product_id/variants", (c) => tryRoute(c, () => deps.catalogue.getProductVariants(c.req.param("product_id"))));
3221
- app.get("/catalogue/products/:product_id/variant-axes", (c) => tryRoute(c, () => deps.catalogue.getProductVariantAxes(c.req.param("product_id"))));
3239
+ app.get(
3240
+ "/catalogue/products/:product_id",
3241
+ (c) => tryRoute(c, () => deps.catalogue.getProduct(c.req.param("product_id")))
3242
+ );
3243
+ app.get(
3244
+ "/catalogue/products/:product_id/variants",
3245
+ (c) => tryRoute(c, () => deps.catalogue.getProductVariants(c.req.param("product_id")))
3246
+ );
3247
+ app.get(
3248
+ "/catalogue/products/:product_id/variant-axes",
3249
+ (c) => tryRoute(c, () => deps.catalogue.getProductVariantAxes(c.req.param("product_id")))
3250
+ );
3222
3251
  app.get(
3223
3252
  "/catalogue/products/:product_id/variants/:variant_id",
3224
- (c) => tryRoute(c, () => deps.catalogue.getProductVariantById(c.req.param("product_id"), c.req.param("variant_id")))
3253
+ (c) => tryRoute(
3254
+ c,
3255
+ () => deps.catalogue.getProductVariantById(c.req.param("product_id"), c.req.param("variant_id"))
3256
+ )
3225
3257
  );
3226
3258
  app.post("/catalogue/products/:product_id/variants/find", async (c) => {
3227
3259
  const body = await c.req.json().catch(() => ({}));
3228
3260
  return tryRoute(
3229
3261
  c,
3230
- () => deps.catalogue.findProductVariant(c.req.param("product_id"), body.axis_selections ?? body.properties ?? {})
3262
+ () => deps.catalogue.findProductVariant(
3263
+ c.req.param("product_id"),
3264
+ body.axis_selections ?? body.properties ?? {}
3265
+ )
3231
3266
  );
3232
3267
  });
3233
- app.get("/catalogue/products/:product_id/add-ons", (c) => tryRoute(c, () => deps.catalogue.getProductAddOns(c.req.param("product_id"))));
3234
- app.get("/catalogue/categories", (c) => tryRoute(c, () => deps.catalogue.listCategories(deps.defaultBusinessId)));
3235
- app.get("/catalogue/categories/:category_id", (c) => tryRoute(c, () => deps.catalogue.getCategory(c.req.param("category_id"))));
3236
- app.get("/catalogue/categories/:category_id/products", (c) => tryRoute(c, () => deps.catalogue.getCategoryProducts(c.req.param("category_id"))));
3237
- app.get("/catalogue/categories/:category_id/attributes", (c) => tryRoute(c, () => deps.catalogue.getCategoryAttributes(c.req.param("category_id"))));
3238
- app.get("/catalogue/categories/:category_id/deals", (c) => tryRoute(c, () => deps.catalogue.getCategoryDeals(c.req.param("category_id"))));
3239
- app.get("/catalogue/collections", (c) => tryRoute(c, () => deps.catalogue.listCollections(deps.defaultBusinessId)));
3240
- app.get("/catalogue/collections/:collection_id", (c) => tryRoute(c, () => deps.catalogue.getCollection(c.req.param("collection_id"))));
3241
- app.get("/catalogue/collections/:collection_id/products", (c) => tryRoute(c, () => deps.catalogue.getCollectionProducts(c.req.param("collection_id"))));
3242
- app.get("/catalogue/collections/:collection_id/attributes", (c) => tryRoute(c, () => deps.catalogue.getCollectionAttributes(c.req.param("collection_id"))));
3243
- app.get("/catalogue/collections/:collection_id/deals", (c) => tryRoute(c, () => deps.catalogue.getCollectionDeals(c.req.param("collection_id"))));
3244
- app.get("/catalogue/bundles", (c) => tryRoute(c, () => deps.catalogue.listBundles(deps.defaultBusinessId)));
3245
- app.get("/catalogue/bundles/:bundle_id", (c) => tryRoute(c, () => deps.catalogue.getBundle(c.req.param("bundle_id"))));
3246
- app.get("/catalogue/composites", (c) => tryRoute(c, () => deps.catalogue.listComposites(deps.defaultBusinessId)));
3247
- app.get("/catalogue/composites/by-product/:product_id", (c) => tryRoute(c, () => deps.catalogue.getCompositeByProduct(c.req.param("product_id"))));
3248
- app.get("/catalogue/composites/:composite_id", (c) => tryRoute(c, () => deps.catalogue.getComposite(c.req.param("composite_id"))));
3268
+ app.get(
3269
+ "/catalogue/products/:product_id/add-ons",
3270
+ (c) => tryRoute(c, () => deps.catalogue.getProductAddOns(c.req.param("product_id")))
3271
+ );
3272
+ app.get(
3273
+ "/catalogue/categories",
3274
+ (c) => tryRoute(c, () => deps.catalogue.listCategories(deps.defaultBusinessId))
3275
+ );
3276
+ app.get(
3277
+ "/catalogue/categories/:category_id",
3278
+ (c) => tryRoute(c, () => deps.catalogue.getCategory(c.req.param("category_id")))
3279
+ );
3280
+ app.get(
3281
+ "/catalogue/categories/:category_id/products",
3282
+ (c) => tryRoute(c, () => deps.catalogue.getCategoryProducts(c.req.param("category_id")))
3283
+ );
3284
+ app.get(
3285
+ "/catalogue/categories/:category_id/attributes",
3286
+ (c) => tryRoute(c, () => deps.catalogue.getCategoryAttributes(c.req.param("category_id")))
3287
+ );
3288
+ app.get(
3289
+ "/catalogue/categories/:category_id/deals",
3290
+ (c) => tryRoute(c, () => deps.catalogue.getCategoryDeals(c.req.param("category_id")))
3291
+ );
3292
+ app.get(
3293
+ "/catalogue/collections",
3294
+ (c) => tryRoute(c, () => deps.catalogue.listCollections(deps.defaultBusinessId))
3295
+ );
3296
+ app.get(
3297
+ "/catalogue/collections/:collection_id",
3298
+ (c) => tryRoute(c, () => deps.catalogue.getCollection(c.req.param("collection_id")))
3299
+ );
3300
+ app.get(
3301
+ "/catalogue/collections/:collection_id/products",
3302
+ (c) => tryRoute(c, () => deps.catalogue.getCollectionProducts(c.req.param("collection_id")))
3303
+ );
3304
+ app.get(
3305
+ "/catalogue/collections/:collection_id/attributes",
3306
+ (c) => tryRoute(c, () => deps.catalogue.getCollectionAttributes(c.req.param("collection_id")))
3307
+ );
3308
+ app.get(
3309
+ "/catalogue/collections/:collection_id/deals",
3310
+ (c) => tryRoute(c, () => deps.catalogue.getCollectionDeals(c.req.param("collection_id")))
3311
+ );
3312
+ app.get(
3313
+ "/catalogue/bundles",
3314
+ (c) => tryRoute(c, () => deps.catalogue.listBundles(deps.defaultBusinessId))
3315
+ );
3316
+ app.get(
3317
+ "/catalogue/bundles/:bundle_id",
3318
+ (c) => tryRoute(c, () => deps.catalogue.getBundle(c.req.param("bundle_id")))
3319
+ );
3320
+ app.get(
3321
+ "/catalogue/composites",
3322
+ (c) => tryRoute(c, () => deps.catalogue.listComposites(deps.defaultBusinessId))
3323
+ );
3324
+ app.get(
3325
+ "/catalogue/composites/by-product/:product_id",
3326
+ (c) => tryRoute(c, () => deps.catalogue.getCompositeByProduct(c.req.param("product_id")))
3327
+ );
3328
+ app.get(
3329
+ "/catalogue/composites/:composite_id",
3330
+ (c) => tryRoute(c, () => deps.catalogue.getComposite(c.req.param("composite_id")))
3331
+ );
3249
3332
  app.post("/catalogue/composites/:composite_id/calculate-price", async (c) => {
3250
3333
  const body = await c.req.json().catch(() => ({}));
3251
- return tryRoute(c, () => deps.catalogue.calculateCompositePrice(c.req.param("composite_id"), body));
3334
+ return tryRoute(
3335
+ c,
3336
+ () => deps.catalogue.calculateCompositePrice(c.req.param("composite_id"), body)
3337
+ );
3252
3338
  });
3253
- app.get("/catalogue/taxonomies", (c) => tryRoute(c, () => deps.catalogue.listTaxonomies(deps.defaultBusinessId)));
3254
- app.get("/catalogue/taxonomies/search", (c) => tryRoute(c, () => deps.catalogue.searchTaxonomies(deps.defaultBusinessId, c.req.query("q") ?? "")));
3255
- app.get("/catalogue/taxonomies/:taxonomy_id", (c) => tryRoute(c, () => deps.catalogue.getTaxonomy(c.req.param("taxonomy_id"))));
3256
- app.get("/catalogue/taxonomies/:taxonomy_id/attributes", (c) => tryRoute(c, () => deps.catalogue.getTaxonomyAttributes(c.req.param("taxonomy_id"))));
3257
- app.get("/catalogue/taxonomies/:taxonomy_id/path", (c) => tryRoute(c, () => deps.catalogue.getTaxonomyPath(c.req.param("taxonomy_id"))));
3258
- app.get("/catalogue/attributes", (c) => tryRoute(c, () => deps.catalogue.listAttributes(deps.defaultBusinessId)));
3259
- app.get("/catalogue/properties/facets", (c) => tryRoute(c, () => deps.catalogue.listPropertyFacets(deps.defaultBusinessId)));
3260
- app.get("/catalogue/tags", (c) => tryRoute(c, () => deps.catalogue.listTags(deps.defaultBusinessId)));
3339
+ app.get(
3340
+ "/catalogue/taxonomies",
3341
+ (c) => tryRoute(c, () => deps.catalogue.listTaxonomies(deps.defaultBusinessId))
3342
+ );
3343
+ app.get(
3344
+ "/catalogue/taxonomies/search",
3345
+ (c) => tryRoute(
3346
+ c,
3347
+ () => deps.catalogue.searchTaxonomies(deps.defaultBusinessId, c.req.query("q") ?? "")
3348
+ )
3349
+ );
3350
+ app.get(
3351
+ "/catalogue/taxonomies/:taxonomy_id",
3352
+ (c) => tryRoute(c, () => deps.catalogue.getTaxonomy(c.req.param("taxonomy_id")))
3353
+ );
3354
+ app.get(
3355
+ "/catalogue/taxonomies/:taxonomy_id/attributes",
3356
+ (c) => tryRoute(c, () => deps.catalogue.getTaxonomyAttributes(c.req.param("taxonomy_id")))
3357
+ );
3358
+ app.get(
3359
+ "/catalogue/taxonomies/:taxonomy_id/path",
3360
+ (c) => tryRoute(c, () => deps.catalogue.getTaxonomyPath(c.req.param("taxonomy_id")))
3361
+ );
3362
+ app.get(
3363
+ "/catalogue/attributes",
3364
+ (c) => tryRoute(c, () => deps.catalogue.listAttributes(deps.defaultBusinessId))
3365
+ );
3366
+ app.get(
3367
+ "/catalogue/properties/facets",
3368
+ (c) => tryRoute(c, () => deps.catalogue.listPropertyFacets(deps.defaultBusinessId))
3369
+ );
3370
+ app.get(
3371
+ "/catalogue/tags",
3372
+ (c) => tryRoute(c, () => deps.catalogue.listTags(deps.defaultBusinessId))
3373
+ );
3261
3374
  app.get("/catalogue/menu", (c) => tryRoute(c, () => deps.lite.getMenu(deps.defaultBusinessId)));
3262
- app.get("/catalogue/menu/categories/:category_id", (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id"))));
3263
- app.get("/catalogue/menu/items/:item_id", (c) => tryRoute(c, () => deps.catalogue.getProduct(c.req.param("item_id"))));
3264
- app.get("/catalogue/knowledge-base/articles", (c) => tryRoute(c, () => ({ articles: deps.catalogue.listKnowledgeArticles(deps.defaultBusinessId) })));
3375
+ app.get(
3376
+ "/catalogue/menu/categories/:category_id",
3377
+ (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id")))
3378
+ );
3379
+ app.get(
3380
+ "/catalogue/menu/items/:item_id",
3381
+ (c) => tryRoute(c, () => deps.catalogue.getProduct(c.req.param("item_id")))
3382
+ );
3383
+ app.get(
3384
+ "/catalogue/knowledge-base/articles",
3385
+ (c) => tryRoute(c, () => ({ articles: deps.catalogue.listKnowledgeArticles(deps.defaultBusinessId) }))
3386
+ );
3265
3387
  app.get(
3266
3388
  "/catalogue/knowledge-base/search",
3267
- (c) => tryRoute(c, () => ({ results: deps.catalogue.searchKnowledgeBase(deps.defaultBusinessId, c.req.query("q") ?? ""), query: c.req.query("q") ?? "" }))
3389
+ (c) => tryRoute(c, () => ({
3390
+ results: deps.catalogue.searchKnowledgeBase(deps.defaultBusinessId, c.req.query("q") ?? ""),
3391
+ query: c.req.query("q") ?? ""
3392
+ }))
3393
+ );
3394
+ app.get(
3395
+ "/catalogue/products/:product_id/attributes",
3396
+ (c) => tryRoute(c, () => deps.catalogue.getProductAttributes(c.req.param("product_id")))
3268
3397
  );
3269
- app.get("/catalogue/products/:product_id/attributes", (c) => tryRoute(c, () => deps.catalogue.getProductAttributes(c.req.param("product_id"))));
3270
3398
  app.get(
3271
3399
  "/catalogue/products/:product_id/available-now",
3272
3400
  (c) => tryRoute(c, () => {
@@ -3285,22 +3413,45 @@ function buildV1(deps) {
3285
3413
  "/catalogue/products/:product_id/schedules",
3286
3414
  (c) => tryRoute(c, () => {
3287
3415
  const p = deps.registry.products.get(c.req.param("product_id"));
3288
- return { schedules: p?.metadata?.["time_profiles"] ?? [] };
3416
+ return {
3417
+ schedules: p?.metadata?.["time_profiles"] ?? []
3418
+ };
3289
3419
  })
3290
3420
  );
3291
- app.get("/catalogue/deals", (c) => tryRoute(c, () => deps.catalogue.listDeals(deps.defaultBusinessId)));
3292
- app.get("/catalogue/deals/on-sale", (c) => tryRoute(c, () => deps.catalogue.listOnSale(deps.defaultBusinessId)));
3421
+ app.get(
3422
+ "/catalogue/deals",
3423
+ (c) => tryRoute(c, () => deps.catalogue.listDeals(deps.defaultBusinessId))
3424
+ );
3425
+ app.get(
3426
+ "/catalogue/deals/on-sale",
3427
+ (c) => tryRoute(c, () => deps.catalogue.listOnSale(deps.defaultBusinessId))
3428
+ );
3293
3429
  app.post("/catalogue/deals/validate", async (c) => {
3294
3430
  const body = await c.req.json().catch(() => ({}));
3295
- return tryRoute(c, () => deps.catalogue.validateDiscount(body.discount_code ?? body.code ?? "", deps.defaultBusinessId));
3431
+ return tryRoute(
3432
+ c,
3433
+ () => deps.catalogue.validateDiscount(
3434
+ body.discount_code ?? body.code ?? "",
3435
+ deps.defaultBusinessId
3436
+ )
3437
+ );
3296
3438
  });
3297
- app.get("/catalogue/products/:product_id/deals", (c) => tryRoute(c, () => deps.catalogue.getProductDeals(c.req.param("product_id"))));
3439
+ app.get(
3440
+ "/catalogue/products/:product_id/deals",
3441
+ (c) => tryRoute(c, () => deps.catalogue.getProductDeals(c.req.param("product_id")))
3442
+ );
3298
3443
  app.post("/catalogue/quotes", async (c) => {
3299
3444
  const body = await c.req.json().catch(() => ({}));
3300
3445
  return tryRoute(c, () => deps.catalogue.createQuote(deps.defaultBusinessId, body));
3301
3446
  });
3302
- app.get("/catalogue/quotes/:quote_id", (c) => tryRoute(c, () => deps.catalogue.getQuote(c.req.param("quote_id"))));
3303
- app.post("/catalogue/quotes/:quote_id/refresh", (c) => tryRoute(c, () => deps.catalogue.refreshQuote(c.req.param("quote_id"))));
3447
+ app.get(
3448
+ "/catalogue/quotes/:quote_id",
3449
+ (c) => tryRoute(c, () => deps.catalogue.getQuote(c.req.param("quote_id")))
3450
+ );
3451
+ app.post(
3452
+ "/catalogue/quotes/:quote_id/refresh",
3453
+ (c) => tryRoute(c, () => deps.catalogue.refreshQuote(c.req.param("quote_id")))
3454
+ );
3304
3455
  app.get("/cart", (c) => tryRoute(c, () => deps.cart.toUICart(deps.cart.get(c.var.session))));
3305
3456
  app.delete("/cart", (c) => tryRoute(c, () => deps.cart.clear(c.var.session)));
3306
3457
  app.get("/cart/items", (c) => tryRoute(c, () => deps.cart.getItems(c.var.session)));
@@ -3311,9 +3462,15 @@ function buildV1(deps) {
3311
3462
  app.patch("/cart/items/:cart_item_id", async (c) => {
3312
3463
  const body = await c.req.json().catch(() => ({}));
3313
3464
  if (typeof body.quantity !== "number") return fail(c, validation("quantity required"));
3314
- return tryRoute(c, () => deps.cart.updateQuantity(c.var.session, c.req.param("cart_item_id"), body.quantity));
3465
+ return tryRoute(
3466
+ c,
3467
+ () => deps.cart.updateQuantity(c.var.session, c.req.param("cart_item_id"), body.quantity)
3468
+ );
3315
3469
  });
3316
- app.delete("/cart/items/:cart_item_id", (c) => tryRoute(c, () => deps.cart.removeItem(c.var.session, c.req.param("cart_item_id"))));
3470
+ app.delete(
3471
+ "/cart/items/:cart_item_id",
3472
+ (c) => tryRoute(c, () => deps.cart.removeItem(c.var.session, c.req.param("cart_item_id")))
3473
+ );
3317
3474
  app.get("/cart/count", (c) => tryRoute(c, () => deps.cart.getCount(c.var.session)));
3318
3475
  app.get("/cart/total", (c) => tryRoute(c, () => deps.cart.getTotal(c.var.session)));
3319
3476
  app.post("/cart/destination-quote", async (c) => {
@@ -3324,10 +3481,25 @@ function buildV1(deps) {
3324
3481
  const body = await c.req.json().catch(() => ({}));
3325
3482
  return tryRoute(c, () => deps.cart.applyCoupon(c.var.session, body.coupon_code ?? ""));
3326
3483
  });
3327
- app.delete("/cart/coupons/current", (c) => tryRoute(c, () => deps.cart.removeCoupon(c.var.session)));
3328
- app.get("/orders", (c) => tryRoute(c, () => deps.orders.list(c.var.session, { limit: getQueryNum(c, "limit"), status: c.req.query("status") })));
3484
+ app.delete(
3485
+ "/cart/coupons/current",
3486
+ (c) => tryRoute(c, () => deps.cart.removeCoupon(c.var.session))
3487
+ );
3488
+ app.get(
3489
+ "/orders",
3490
+ (c) => tryRoute(
3491
+ c,
3492
+ () => deps.orders.list(c.var.session, {
3493
+ limit: getQueryNum(c, "limit"),
3494
+ status: c.req.query("status")
3495
+ })
3496
+ )
3497
+ );
3329
3498
  app.get("/orders/:order_id", (c) => tryRoute(c, () => deps.orders.get(c.req.param("order_id"))));
3330
- app.get("/orders/:order_id/payment-status", (c) => tryRoute(c, () => deps.orders.getPaymentStatus(c.req.param("order_id"))));
3499
+ app.get(
3500
+ "/orders/:order_id/payment-status",
3501
+ (c) => tryRoute(c, () => deps.orders.getPaymentStatus(c.req.param("order_id")))
3502
+ );
3331
3503
  app.post("/orders/:order_id/cancel", async (c) => {
3332
3504
  const body = await c.req.json().catch(() => ({}));
3333
3505
  return tryRoute(c, () => deps.orders.cancel(c.req.param("order_id"), body.reason));
@@ -3336,13 +3508,46 @@ function buildV1(deps) {
3336
3508
  const body = await c.req.json().catch(() => ({}));
3337
3509
  return tryRoute(c, () => deps.orders.updateCustomer(c.req.param("order_id"), body));
3338
3510
  });
3339
- app.post("/orders/:order_id/verify-payment", (c) => tryRoute(c, () => deps.orders.verifyPayment(c.req.param("order_id"))));
3511
+ app.post(
3512
+ "/orders/:order_id/verify-payment",
3513
+ (c) => tryRoute(c, () => deps.orders.verifyPayment(c.req.param("order_id")))
3514
+ );
3340
3515
  app.get("/subscriptions", (c) => tryRoute(c, () => deps.subscriptions.list(c.var.session)));
3341
- app.get("/subscriptions/:subscription_id", (c) => tryRoute(c, () => deps.subscriptions.get(c.req.param("subscription_id"))));
3342
- app.post("/subscriptions/:subscription_id/cancel", (c) => tryRoute(c, () => deps.subscriptions.cancel(c.req.param("subscription_id"))));
3343
- app.post("/subscriptions/:subscription_id/pause", (c) => tryRoute(c, () => deps.subscriptions.pause(c.req.param("subscription_id"))));
3344
- app.post("/subscriptions/:subscription_id/resume", (c) => tryRoute(c, () => deps.subscriptions.resume(c.req.param("subscription_id"))));
3345
- app.post("/subscriptions/:subscription_id/skip", (c) => tryRoute(c, () => deps.subscriptions.skipNext(c.req.param("subscription_id"))));
3516
+ app.get(
3517
+ "/subscriptions/:subscription_id",
3518
+ (c) => tryRoute(c, () => deps.subscriptions.get(c.req.param("subscription_id")))
3519
+ );
3520
+ app.post(
3521
+ "/subscriptions/:subscription_id/cancel",
3522
+ (c) => tryRoute(c, () => deps.subscriptions.cancel(c.req.param("subscription_id")))
3523
+ );
3524
+ app.post(
3525
+ "/subscriptions/:subscription_id/pause",
3526
+ (c) => tryRoute(c, () => deps.subscriptions.pause(c.req.param("subscription_id")))
3527
+ );
3528
+ app.post(
3529
+ "/subscriptions/:subscription_id/resume",
3530
+ (c) => tryRoute(c, () => deps.subscriptions.resume(c.req.param("subscription_id")))
3531
+ );
3532
+ app.post(
3533
+ "/subscriptions/:subscription_id/skip",
3534
+ (c) => tryRoute(c, () => deps.subscriptions.skipNext(c.req.param("subscription_id")))
3535
+ );
3536
+ app.get("/payments/collection-options", (c) => {
3537
+ const currency = c.req.query("currency")?.trim().toUpperCase();
3538
+ if (!currency || !/^[A-Z]{3}$/.test(currency)) {
3539
+ return fail(c, validation("currency must be a canonical three-letter code"));
3540
+ }
3541
+ return tryRoute(c, () => ({
3542
+ presentment_currency: currency,
3543
+ options: currency === "GHS" ? [
3544
+ { method: PAYMENT_METHOD.CARD, network: null },
3545
+ { method: PAYMENT_METHOD.MOBILE_MONEY, network: "mtn" },
3546
+ { method: PAYMENT_METHOD.MOBILE_MONEY, network: "telecel" },
3547
+ { method: PAYMENT_METHOD.MOBILE_MONEY, network: "airteltigo" }
3548
+ ] : currency === "USD" ? [{ method: PAYMENT_METHOD.CARD, network: null }] : []
3549
+ }));
3550
+ });
3346
3551
  app.post("/checkout", async (c) => {
3347
3552
  const body = await c.req.json().catch(() => ({}));
3348
3553
  return tryRoute(c, () => deps.checkout.process(c.var.session, body));
@@ -3396,15 +3601,33 @@ function buildV1(deps) {
3396
3601
  return { success: true, message: "Profile updated successfully" };
3397
3602
  });
3398
3603
  });
3399
- app.get("/inventory/products/:product_id/stock", (c) => tryRoute(c, () => deps.inventory.productStock(c.req.param("product_id"))));
3400
- app.get("/inventory/variants/:variant_id/stock", (c) => tryRoute(c, () => deps.inventory.variantStock(c.req.param("variant_id"))));
3604
+ app.get(
3605
+ "/inventory/products/:product_id/stock",
3606
+ (c) => tryRoute(c, () => deps.inventory.productStock(c.req.param("product_id")))
3607
+ );
3608
+ app.get(
3609
+ "/inventory/variants/:variant_id/stock",
3610
+ (c) => tryRoute(c, () => deps.inventory.variantStock(c.req.param("variant_id")))
3611
+ );
3401
3612
  app.get(
3402
3613
  "/inventory/products/:product_id/availability",
3403
- (c) => tryRoute(c, () => deps.inventory.productAvailability(c.req.param("product_id"), getQueryNum(c, "quantity") ?? 1))
3614
+ (c) => tryRoute(
3615
+ c,
3616
+ () => deps.inventory.productAvailability(
3617
+ c.req.param("product_id"),
3618
+ getQueryNum(c, "quantity") ?? 1
3619
+ )
3620
+ )
3404
3621
  );
3405
3622
  app.get(
3406
3623
  "/inventory/variants/:variant_id/availability",
3407
- (c) => tryRoute(c, () => deps.inventory.variantAvailability(c.req.param("variant_id"), getQueryNum(c, "quantity") ?? 1))
3624
+ (c) => tryRoute(
3625
+ c,
3626
+ () => deps.inventory.variantAvailability(
3627
+ c.req.param("variant_id"),
3628
+ getQueryNum(c, "quantity") ?? 1
3629
+ )
3630
+ )
3408
3631
  );
3409
3632
  app.get(
3410
3633
  "/delivery/fee",
@@ -3431,35 +3654,75 @@ function buildV1(deps) {
3431
3654
  );
3432
3655
  app.post("/places/autocomplete", async (c) => {
3433
3656
  const body = await c.req.json().catch(() => ({}));
3434
- return tryRoute(c, () => deps.places.autocomplete({ query: body.input ?? body.query ?? "", country: body.country }));
3657
+ return tryRoute(
3658
+ c,
3659
+ () => deps.places.autocomplete({ query: body.input ?? body.query ?? "", country: body.country })
3660
+ );
3435
3661
  });
3436
3662
  app.post("/places/details", async (c) => {
3437
3663
  const body = await c.req.json().catch(() => ({}));
3438
3664
  return tryRoute(c, () => deps.places.details({ place_id: body.place_id ?? "" }));
3439
3665
  });
3440
- app.get("/scheduling/services", (c) => tryRoute(c, () => deps.scheduling.listServices(deps.defaultBusinessId)));
3441
- app.get("/scheduling/services/:service_id", (c) => tryRoute(c, () => deps.scheduling.getService(c.req.param("service_id"))));
3442
- app.get("/scheduling/slots", (c) => tryRoute(c, () => deps.scheduling.getSlots(c.req.query("service_id") ?? "", { date: c.req.query("date") })));
3666
+ app.get(
3667
+ "/scheduling/services",
3668
+ (c) => tryRoute(c, () => deps.scheduling.listServices(deps.defaultBusinessId))
3669
+ );
3670
+ app.get(
3671
+ "/scheduling/services/:service_id",
3672
+ (c) => tryRoute(c, () => deps.scheduling.getService(c.req.param("service_id")))
3673
+ );
3674
+ app.get(
3675
+ "/scheduling/slots",
3676
+ (c) => tryRoute(
3677
+ c,
3678
+ () => deps.scheduling.getSlots(c.req.query("service_id") ?? "", { date: c.req.query("date") })
3679
+ )
3680
+ );
3443
3681
  app.get(
3444
3682
  "/scheduling/slots/check",
3445
- (c) => tryRoute(c, () => deps.scheduling.checkSlot(c.req.query("service_id") ?? "", c.req.query("start") ?? "", c.req.query("end") ?? ""))
3683
+ (c) => tryRoute(
3684
+ c,
3685
+ () => deps.scheduling.checkSlot(
3686
+ c.req.query("service_id") ?? "",
3687
+ c.req.query("start") ?? "",
3688
+ c.req.query("end") ?? ""
3689
+ )
3690
+ )
3691
+ );
3692
+ app.get(
3693
+ "/scheduling/availability",
3694
+ (c) => tryRoute(c, () => deps.scheduling.getServiceAvailability(c.req.query("service_id") ?? ""))
3695
+ );
3696
+ app.get(
3697
+ "/scheduling/bookings",
3698
+ (c) => tryRoute(c, () => deps.scheduling.getCustomerBookings(c.var.session))
3446
3699
  );
3447
- app.get("/scheduling/availability", (c) => tryRoute(c, () => deps.scheduling.getServiceAvailability(c.req.query("service_id") ?? "")));
3448
- app.get("/scheduling/bookings", (c) => tryRoute(c, () => deps.scheduling.getCustomerBookings(c.var.session)));
3449
3700
  app.post("/scheduling/bookings/reschedule", async (c) => {
3450
3701
  const body = await c.req.json().catch(() => ({}));
3451
3702
  return tryRoute(c, () => deps.scheduling.rescheduleBooking(body));
3452
3703
  });
3453
- app.get("/scheduling/bookings/:booking_id", (c) => tryRoute(c, () => deps.scheduling.getBooking(c.req.param("booking_id"))));
3704
+ app.get(
3705
+ "/scheduling/bookings/:booking_id",
3706
+ (c) => tryRoute(c, () => deps.scheduling.getBooking(c.req.param("booking_id")))
3707
+ );
3454
3708
  app.post("/scheduling/bookings/:booking_id/cancel", async (c) => {
3455
3709
  const body = await c.req.json().catch(() => ({}));
3456
3710
  return tryRoute(c, () => deps.scheduling.cancelBooking(c.req.param("booking_id"), body.reason));
3457
3711
  });
3458
3712
  app.get("/lite/bootstrap", (c) => tryRoute(c, () => deps.lite.bootstrap(deps.defaultBusinessId)));
3459
- app.get("/lite/resources/:resource_id", (c) => tryRoute(c, () => deps.lite.getResource(c.req.param("resource_id"))));
3713
+ app.get(
3714
+ "/lite/resources/:resource_id",
3715
+ (c) => tryRoute(c, () => deps.lite.getResource(c.req.param("resource_id")))
3716
+ );
3460
3717
  app.get("/lite/menu", (c) => tryRoute(c, () => deps.lite.getMenu(deps.defaultBusinessId)));
3461
- app.get("/lite/menu/categories/:category_id", (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id"))));
3462
- app.get("/fx/rate", (c) => tryRoute(c, () => deps.fx.getRate(c.req.query("from") ?? "USD", c.req.query("to") ?? "GHS")));
3718
+ app.get(
3719
+ "/lite/menu/categories/:category_id",
3720
+ (c) => tryRoute(c, () => deps.lite.getMenuCategory(c.req.param("category_id")))
3721
+ );
3722
+ app.get(
3723
+ "/fx/rate",
3724
+ (c) => tryRoute(c, () => deps.fx.getRate(c.req.query("from") ?? "USD", c.req.query("to") ?? "GHS"))
3725
+ );
3463
3726
  app.post("/fx/quotes", async (c) => {
3464
3727
  const body = await c.req.json().catch(() => ({}));
3465
3728
  return tryRoute(c, () => deps.fx.lockQuote(body));
@@ -3472,31 +3735,47 @@ function buildV1(deps) {
3472
3735
  const body = await c.req.json().catch(() => ({}));
3473
3736
  return tryRoute(c, () => deps.uploads.confirm(body));
3474
3737
  });
3475
- app.get(
3476
- "/store-credit/balance",
3477
- (c) => c.json({ data: { balance: "0.00", currency: "USD" } })
3478
- );
3738
+ app.get("/store-credit/balance", (c) => c.json({ data: { balance: "0.00", currency: "USD" } }));
3479
3739
  app.post("/activity/session", async (c) => {
3480
3740
  await c.req.json().catch(() => ({}));
3481
3741
  return c.json({ data: { recorded: true } });
3482
3742
  });
3483
3743
  app.post("/activity/events", async (c) => {
3484
3744
  const body = await c.req.json().catch(() => ({}));
3485
- return tryRoute(c, () => deps.activity.recordEvents(deps.defaultBusinessId, body.analytics_session_id ?? c.var.session.id, body.events ?? []));
3745
+ return tryRoute(
3746
+ c,
3747
+ () => deps.activity.recordEvents(
3748
+ deps.defaultBusinessId,
3749
+ body.analytics_session_id ?? c.var.session.id,
3750
+ body.events ?? []
3751
+ )
3752
+ );
3486
3753
  });
3487
- app.get("/activity/state", (c) => tryRoute(c, () => deps.activity.getState(deps.defaultBusinessId, c.var.session.id)));
3488
- app.get("/activity/recommendations", (c) => tryRoute(c, () => deps.activity.getRecommendations(deps.defaultBusinessId)));
3754
+ app.get(
3755
+ "/activity/state",
3756
+ (c) => tryRoute(c, () => deps.activity.getState(deps.defaultBusinessId, c.var.session.id))
3757
+ );
3758
+ app.get(
3759
+ "/activity/recommendations",
3760
+ (c) => tryRoute(c, () => deps.activity.getRecommendations(deps.defaultBusinessId))
3761
+ );
3489
3762
  app.post("/activity/messages/dismiss", async (c) => {
3490
3763
  const body = await c.req.json().catch(() => ({}));
3491
3764
  return tryRoute(c, () => deps.activity.dismissMessage(body.code ?? body.message_id ?? ""));
3492
3765
  });
3493
3766
  app.post(
3494
3767
  "/support/conversation",
3495
- (c) => tryRoute(c, () => deps.support.openConversation(deps.defaultBusinessId, c.var.session.customer_id))
3768
+ (c) => tryRoute(
3769
+ c,
3770
+ () => deps.support.openConversation(deps.defaultBusinessId, c.var.session.customer_id)
3771
+ )
3496
3772
  );
3497
3773
  app.get(
3498
3774
  "/support/conversation",
3499
- (c) => tryRoute(c, () => deps.support.peekConversation(deps.defaultBusinessId, c.var.session.customer_id))
3775
+ (c) => tryRoute(
3776
+ c,
3777
+ () => deps.support.peekConversation(deps.defaultBusinessId, c.var.session.customer_id)
3778
+ )
3500
3779
  );
3501
3780
  app.post("/support/conversation/messages", async (c) => {
3502
3781
  const body = await c.req.json().catch(() => ({}));
@@ -3512,7 +3791,12 @@ function buildV1(deps) {
3512
3791
  });
3513
3792
  app.get(
3514
3793
  "/support/conversation/messages",
3515
- (c) => tryRoute(c, () => deps.support.listMessages(c.req.query("conversation_id") ?? "", { limit: getQueryNum(c, "limit") }))
3794
+ (c) => tryRoute(
3795
+ c,
3796
+ () => deps.support.listMessages(c.req.query("conversation_id") ?? "", {
3797
+ limit: getQueryNum(c, "limit")
3798
+ })
3799
+ )
3516
3800
  );
3517
3801
  app.post("/support/conversation/messages/:messageId/reactions", async (c) => {
3518
3802
  const body = await c.req.json().catch(() => ({}));
@@ -3533,7 +3817,10 @@ function buildV1(deps) {
3533
3817
  });
3534
3818
  app.get(
3535
3819
  "/support/conversation/ws",
3536
- (c) => c.json({ note: "WebSocket connection \u2014 connect via ws:// at the same path", supported: false }, 426)
3820
+ (c) => c.json(
3821
+ { note: "WebSocket connection \u2014 connect via ws:// at the same path", supported: false },
3822
+ 426
3823
+ )
3537
3824
  );
3538
3825
  return app;
3539
3826
  }
@@ -5985,9 +6272,11 @@ function createCheckoutService(opts) {
5985
6272
  if (c.items.length === 0) throw validation("Cart is empty", { code: "CART_EMPTY" });
5986
6273
  const orderId = ids.order();
5987
6274
  const orderNumber = ids.orderNumber();
6275
+ const paymentId = ids.payment();
5988
6276
  const reference = ids.payment();
5989
6277
  const requiresAuth = body.payment_method === "mobile_money";
5990
6278
  const isCard = body.payment_method === "card" || body.payment_method === "stripe";
6279
+ const cardProvider = body.payment_method === "stripe" || body.pay_currency?.toUpperCase() === "USD" ? "stripe" : "paystack";
5991
6280
  const order = {
5992
6281
  id: orderId,
5993
6282
  business_id: c.business_id,
@@ -6011,6 +6300,7 @@ function createCheckoutService(opts) {
6011
6300
  items: c.items,
6012
6301
  applied_discount_ids: c.applied_discount_ids,
6013
6302
  applied_discount_codes: c.applied_discount_codes,
6303
+ payment_id: paymentId,
6014
6304
  payment_reference: reference,
6015
6305
  metadata: body.metadata,
6016
6306
  created_at: clock.iso(),
@@ -6027,31 +6317,57 @@ function createCheckoutService(opts) {
6027
6317
  const result = {
6028
6318
  order_id: orderId,
6029
6319
  order_number: orderNumber,
6030
- payment_status: requiresAuth ? "pending" : "succeeded",
6320
+ payment_id: paymentId,
6321
+ payment_status: requiresAuth || isCard ? "pending" : "succeeded",
6031
6322
  payment_reference: reference,
6032
6323
  requires_authorization: requiresAuth,
6033
6324
  authorization_type: requiresAuth ? "otp" : void 0,
6034
- next_action: requiresAuth ? { type: "authorization", authorization_type: "otp", display_text: "Approve on your mobile money app" } : { type: "none" },
6035
- provider: body.payment_method,
6325
+ next_action: requiresAuth ? {
6326
+ type: "authorization",
6327
+ authorization_type: "otp",
6328
+ display_text: "Approve on your mobile money app"
6329
+ } : { type: "none" },
6330
+ provider: isCard ? cardProvider : body.payment_method,
6036
6331
  bill_token: billToken
6037
6332
  };
6038
6333
  if (isCard) {
6039
- result.next_action = { type: "redirect", authorization_url: `https://mock.cimplify.io/pay/${reference}` };
6040
- result.authorization_url = `https://mock.cimplify.io/pay/${reference}`;
6041
- result.client_secret = `pi_${orderId.slice(-12)}_secret_${Math.random().toString(36).slice(2, 18)}`;
6042
6334
  const proc = globalThis.process;
6043
- result.public_key = proc?.env?.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY ?? "pk_test_mock_publishable_key";
6335
+ result.client_secret = cardProvider === "stripe" ? `pi_${orderId.slice(-12)}_secret_${Math.random().toString(36).slice(2, 18)}` : `access_${reference}`;
6336
+ 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";
6337
+ result.next_action = {
6338
+ type: "card_popup",
6339
+ provider: cardProvider,
6340
+ client_secret: result.client_secret,
6341
+ public_key: result.public_key
6342
+ };
6044
6343
  }
6045
6344
  return result;
6046
6345
  },
6047
6346
  authorize(body) {
6048
- const order = registry.orders.get(body.order_id);
6049
- if (!order) throw notFound(`Order ${body.order_id} not found`);
6050
- const updated = { ...order, payment_state: "paid", status: "confirmed", updated_at: clock.iso() };
6347
+ if (!body.payment_id?.trim()) throw validation("payment_id required");
6348
+ if (!body.authorization) throw validation("authorization required");
6349
+ const order = registry.orders.list(
6350
+ (candidate) => candidate.payment_id === body.payment_id
6351
+ )[0];
6352
+ if (!order) throw notFound(`Payment ${body.payment_id} not found`);
6353
+ const updated = {
6354
+ ...order,
6355
+ payment_state: "paid",
6356
+ status: "confirmed",
6357
+ updated_at: clock.iso()
6358
+ };
6051
6359
  registry.orders.put(order.id, updated);
6052
6360
  bus.emit("order.payment.captured", { order_id: order.id }, order.business_id);
6053
6361
  bus.emit("order.confirmed", { order_id: order.id }, order.business_id);
6054
- return { status: "succeeded", order_id: order.id };
6362
+ return {
6363
+ order_id: order.id,
6364
+ order_number: order.user_friendly_id,
6365
+ payment_id: body.payment_id,
6366
+ payment_reference: order.payment_reference,
6367
+ payment_status: "succeeded",
6368
+ requires_authorization: false,
6369
+ next_action: { type: "none" }
6370
+ };
6055
6371
  }
6056
6372
  };
6057
6373
  }