@cimplify/sdk 0.101.1 → 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.
- package/dist/advanced.d.mts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/advanced.js +23 -22
- package/dist/advanced.mjs +4 -3
- package/dist/{chunk-QPRI2NII.js → chunk-2P4KXFB6.js} +6 -0
- package/dist/{chunk-4G5UWFC3.mjs → chunk-3V4DVXV3.mjs} +6 -1
- package/dist/{chunk-YHPMFTMN.mjs → chunk-C2JSNJUC.mjs} +406 -95
- package/dist/chunk-CNN7Z2IP.js +125 -0
- package/dist/{chunk-DKLHCZ5M.mjs → chunk-GERXZQSX.mjs} +487 -11
- package/dist/chunk-GOHSXBKW.mjs +105 -0
- package/dist/{chunk-7H6IL7CX.mjs → chunk-H7ACMHM3.mjs} +40 -15
- package/dist/{chunk-Z3K2D3TE.mjs → chunk-J6PNHDHL.mjs} +453 -483
- package/dist/{chunk-NIOUSKQQ.js → chunk-JG5CQNCB.js} +5 -0
- package/dist/{chunk-YER7DIOM.js → chunk-JSWJ4XDE.js} +471 -519
- package/dist/{chunk-DLW3RWRK.mjs → chunk-M4URVKHE.mjs} +46 -12
- package/dist/{chunk-WMEC5JWN.js → chunk-NNG6IFFX.js} +50 -13
- package/dist/{chunk-ICCCSVN3.js → chunk-QOWPGS7Z.js} +42 -16
- package/dist/{chunk-YDA46OZ6.js → chunk-R6OLQ33I.js} +560 -80
- package/dist/{chunk-H5SSGN7W.js → chunk-VIL6IQCG.js} +408 -97
- package/dist/{chunk-O3YUHLZL.mjs → chunk-VNPEYLB2.mjs} +5 -0
- package/dist/{client-Db554902.d.ts → client-BfpNjJ_a.d.mts} +93 -299
- package/dist/{client-CdTx7X_X.d.mts → client-DHBwvh7U.d.ts} +93 -299
- package/dist/{client-WkUcvRvO.d.mts → client-DpqRobY9.d.mts} +2 -2
- package/dist/{client-D40kI8z2.d.ts → client-Dqg2mc-7.d.ts} +2 -2
- package/dist/{index-D3UXgAYl.d.ts → index-C8uDqLwJ.d.ts} +14 -4
- package/dist/{index-BjWUkYgY.d.mts → index-e2y6AK70.d.mts} +14 -4
- package/dist/index.d.mts +92 -8
- package/dist/index.d.ts +92 -8
- package/dist/index.js +225 -188
- package/dist/index.mjs +7 -6
- package/dist/link-cuNVYc2s.d.mts +297 -0
- package/dist/link-cuNVYc2s.d.ts +297 -0
- package/dist/mock/cli.mjs +412 -94
- package/dist/mock/library.js +412 -94
- package/dist/mock/library.mjs +412 -94
- package/dist/mock/msw.js +412 -94
- package/dist/mock/msw.mjs +412 -94
- package/dist/{product-DwKdC_to.d.mts → payment-H5LoIvXU.d.mts} +207 -7
- package/dist/{product-DwKdC_to.d.ts → payment-H5LoIvXU.d.ts} +207 -7
- package/dist/{price-CiQUd_XX.d.mts → price-BvePgDXe.d.mts} +1 -1
- package/dist/{price-D9EOj8y8.d.ts → price-C2RqscMY.d.ts} +1 -1
- package/dist/react.d.mts +6 -4
- package/dist/react.d.ts +6 -4
- package/dist/react.js +203 -198
- package/dist/react.mjs +11 -6
- package/dist/{server-CeDb93WA.d.ts → server-C7FyLdrz.d.mts} +11 -9
- package/dist/{server-D-nSkrUr.d.mts → server-DoXIpSd7.d.ts} +11 -9
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +11 -10
- package/dist/server.mjs +5 -4
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +4 -3
- package/dist/testing/msw.mjs +3 -2
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +26 -25
- package/dist/testing/suite.mjs +7 -6
- package/dist/testing.d.mts +175 -45
- package/dist/testing.d.ts +175 -45
- package/dist/testing.js +86 -81
- package/dist/testing.mjs +8 -7
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/dist/utils.js +37 -29
- package/dist/utils.mjs +2 -2
- package/package.json +7 -1
- package/dist/payment-CRqjGrx6.d.mts +0 -113
- package/dist/payment-DO1Z1Ip6.d.ts +0 -113
package/dist/mock/library.mjs
CHANGED
|
@@ -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(
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
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(
|
|
2280
|
-
|
|
2281
|
-
|
|
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(
|
|
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(
|
|
2322
|
+
() => deps.catalogue.findProductVariant(
|
|
2323
|
+
c.req.param("product_id"),
|
|
2324
|
+
body.axis_selections ?? body.properties ?? {}
|
|
2325
|
+
)
|
|
2291
2326
|
);
|
|
2292
2327
|
});
|
|
2293
|
-
app.get(
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
app.get(
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
app.get(
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
app.get(
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
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(
|
|
2394
|
+
return tryRoute(
|
|
2395
|
+
c,
|
|
2396
|
+
() => deps.catalogue.calculateCompositePrice(c.req.param("composite_id"), body)
|
|
2397
|
+
);
|
|
2312
2398
|
});
|
|
2313
|
-
app.get(
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
app.get(
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
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(
|
|
2323
|
-
|
|
2324
|
-
|
|
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, () => ({
|
|
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 {
|
|
2476
|
+
return {
|
|
2477
|
+
schedules: p?.metadata?.["time_profiles"] ?? []
|
|
2478
|
+
};
|
|
2349
2479
|
})
|
|
2350
2480
|
);
|
|
2351
|
-
app.get(
|
|
2352
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
2363
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
2388
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
app.post(
|
|
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(
|
|
2460
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
2501
|
-
|
|
2502
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
2522
|
-
|
|
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(
|
|
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(
|
|
2548
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
}
|
|
@@ -4729,6 +5016,7 @@ function toUICart(registry, cart) {
|
|
|
4729
5016
|
tax_rate: cart.tax_rate,
|
|
4730
5017
|
service_charge_rate: cart.service_charge_rate,
|
|
4731
5018
|
tax_inclusive: false,
|
|
5019
|
+
price_display_mode: "unspecified",
|
|
4732
5020
|
deposit_required: false,
|
|
4733
5021
|
deposit_amount: "0.00"
|
|
4734
5022
|
},
|
|
@@ -4888,6 +5176,7 @@ function createCartService(opts) {
|
|
|
4888
5176
|
tax_jurisdiction_label: label,
|
|
4889
5177
|
tax_inclusive: false,
|
|
4890
5178
|
tax_rate: cart.tax_rate,
|
|
5179
|
+
price_display_mode: "unspecified",
|
|
4891
5180
|
delivery_fee_details: null,
|
|
4892
5181
|
address_info: body.address_info
|
|
4893
5182
|
};
|
|
@@ -5043,9 +5332,11 @@ function createCheckoutService(opts) {
|
|
|
5043
5332
|
if (c.items.length === 0) throw validation("Cart is empty", { code: "CART_EMPTY" });
|
|
5044
5333
|
const orderId = ids.order();
|
|
5045
5334
|
const orderNumber = ids.orderNumber();
|
|
5335
|
+
const paymentId = ids.payment();
|
|
5046
5336
|
const reference = ids.payment();
|
|
5047
5337
|
const requiresAuth = body.payment_method === "mobile_money";
|
|
5048
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";
|
|
5049
5340
|
const order = {
|
|
5050
5341
|
id: orderId,
|
|
5051
5342
|
business_id: c.business_id,
|
|
@@ -5069,6 +5360,7 @@ function createCheckoutService(opts) {
|
|
|
5069
5360
|
items: c.items,
|
|
5070
5361
|
applied_discount_ids: c.applied_discount_ids,
|
|
5071
5362
|
applied_discount_codes: c.applied_discount_codes,
|
|
5363
|
+
payment_id: paymentId,
|
|
5072
5364
|
payment_reference: reference,
|
|
5073
5365
|
metadata: body.metadata,
|
|
5074
5366
|
created_at: clock.iso(),
|
|
@@ -5085,31 +5377,57 @@ function createCheckoutService(opts) {
|
|
|
5085
5377
|
const result = {
|
|
5086
5378
|
order_id: orderId,
|
|
5087
5379
|
order_number: orderNumber,
|
|
5088
|
-
|
|
5380
|
+
payment_id: paymentId,
|
|
5381
|
+
payment_status: requiresAuth || isCard ? "pending" : "succeeded",
|
|
5089
5382
|
payment_reference: reference,
|
|
5090
5383
|
requires_authorization: requiresAuth,
|
|
5091
5384
|
authorization_type: requiresAuth ? "otp" : void 0,
|
|
5092
|
-
next_action: requiresAuth ? {
|
|
5093
|
-
|
|
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,
|
|
5094
5391
|
bill_token: billToken
|
|
5095
5392
|
};
|
|
5096
5393
|
if (isCard) {
|
|
5097
|
-
result.next_action = { type: "redirect", authorization_url: `https://mock.cimplify.io/pay/${reference}` };
|
|
5098
|
-
result.authorization_url = `https://mock.cimplify.io/pay/${reference}`;
|
|
5099
|
-
result.client_secret = `pi_${orderId.slice(-12)}_secret_${Math.random().toString(36).slice(2, 18)}`;
|
|
5100
5394
|
const proc = globalThis.process;
|
|
5101
|
-
result.
|
|
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
|
+
};
|
|
5102
5403
|
}
|
|
5103
5404
|
return result;
|
|
5104
5405
|
},
|
|
5105
5406
|
authorize(body) {
|
|
5106
|
-
|
|
5107
|
-
if (!
|
|
5108
|
-
const
|
|
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
|
+
};
|
|
5109
5419
|
registry.orders.put(order.id, updated);
|
|
5110
5420
|
bus.emit("order.payment.captured", { order_id: order.id }, order.business_id);
|
|
5111
5421
|
bus.emit("order.confirmed", { order_id: order.id }, order.business_id);
|
|
5112
|
-
return {
|
|
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
|
+
};
|
|
5113
5431
|
}
|
|
5114
5432
|
};
|
|
5115
5433
|
}
|