@cimplify/sdk 0.110.2 → 0.111.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/CHANGELOG.md +54 -0
- package/README.md +18 -0
- package/dist/advanced.d.mts +4 -4
- package/dist/advanced.d.ts +4 -4
- package/dist/advanced.js +22 -22
- package/dist/advanced.mjs +3 -3
- package/dist/{catalogue-OTuS5zp-.d.ts → catalogue-1QcoGDO6.d.ts} +2 -2
- package/dist/{catalogue-CPTMyBUz.d.mts → catalogue-FdFQiWrU.d.mts} +2 -2
- package/dist/{chunk-SYEO2WV4.mjs → chunk-42JTCWIE.mjs} +3 -3
- package/dist/{chunk-OMTVH334.js → chunk-6QANXRUM.js} +203 -186
- package/dist/{chunk-6ETDAU62.mjs → chunk-B45X3HPO.mjs} +98 -39
- package/dist/{chunk-MKIJQL5Q.js → chunk-CJVEJPIG.js} +69 -69
- package/dist/{chunk-Q2Y3VMKH.js → chunk-ETZDIISN.js} +151 -151
- package/dist/{chunk-GCKWKLZF.mjs → chunk-FT6GFYJL.mjs} +17 -3
- package/dist/{chunk-A36JRXXH.mjs → chunk-KWZHIPRN.mjs} +26 -9
- package/dist/{chunk-SNNEOS5Z.js → chunk-MHDUUSG6.js} +75 -75
- package/dist/{chunk-UCR5HRYM.js → chunk-NFXCKTE2.js} +17 -3
- package/dist/{chunk-DFZWHNRG.js → chunk-QOCHWR4V.js} +105 -42
- package/dist/{chunk-IZDWAL53.mjs → chunk-UJDQQTBS.mjs} +8 -8
- package/dist/{chunk-BTUSVHIE.mjs → chunk-WLSU5QJT.mjs} +2 -2
- package/dist/{client-dqOhP9Nc.d.ts → client-CChON4-x.d.ts} +2 -2
- package/dist/{client-CX_WR0-J.d.mts → client-EeuGm5gj.d.mts} +2 -2
- package/dist/{elements-DdsRig-2.d.mts → elements-ss9xZgRg.d.mts} +27 -1
- package/dist/{elements-DdsRig-2.d.ts → elements-ss9xZgRg.d.ts} +27 -1
- package/dist/index-BB2gjVvA.d.mts +153 -0
- package/dist/index-BEfmBDAH.d.ts +153 -0
- package/dist/{index-B98Xac8e.d.ts → index-DQK8sTfu.d.ts} +2 -2
- package/dist/{index-DbAN_VQE.d.mts → index-DSVkhRmW.d.mts} +2 -2
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +189 -177
- package/dist/index.mjs +8 -8
- package/dist/mock/cli.mjs +25 -10
- package/dist/mock/library.js +25 -10
- package/dist/mock/library.mjs +25 -10
- package/dist/mock/msw.js +25 -10
- package/dist/mock/msw.mjs +25 -10
- package/dist/{price-BOzexBww.d.mts → price-B-w4PwHm.d.mts} +1 -1
- package/dist/{price-C1h9sPxE.d.ts → price-BEvQFNJv.d.ts} +1 -1
- package/dist/react.d.mts +23 -15
- package/dist/react.d.ts +23 -15
- package/dist/react.js +254 -237
- package/dist/react.mjs +128 -111
- package/dist/{scheduling-D2ajXpMC.d.ts → scheduling-D9WwOxbo.d.ts} +1 -1
- package/dist/{scheduling-DSRbbaZb.d.mts → scheduling-DDmrYCr-.d.mts} +1 -1
- package/dist/{server-D29IIuDV.d.ts → server-BiKwxvnf.d.ts} +2 -2
- package/dist/{server-DQMWPnc8.d.mts → server-DPdtl2dd.d.mts} +2 -2
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +10 -10
- package/dist/server.mjs +4 -4
- package/dist/styles.css +1 -1
- package/dist/testing/msw.d.mts +3 -3
- package/dist/testing/msw.d.ts +3 -3
- package/dist/testing/msw.js +3 -3
- package/dist/testing/msw.mjs +2 -2
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +25 -25
- package/dist/testing/suite.mjs +6 -6
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +117 -117
- package/dist/testing.mjs +7 -7
- package/dist/utils.d.mts +3 -3
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +44 -32
- package/dist/utils.mjs +2 -2
- package/package.json +5 -3
- package/registry/cart-summary.json +1 -1
- package/registry/chat-widget.json +1 -1
- package/registry/price.json +1 -1
- package/registry/product-customizer.json +1 -1
- package/registry/search-input.json +1 -1
- package/dist/index-6gkHMGAq.d.mts +0 -86
- package/dist/index-B_ByTtIT.d.ts +0 -86
|
@@ -5,7 +5,7 @@ function money(value) {
|
|
|
5
5
|
function moneyFromNumber(value) {
|
|
6
6
|
return value;
|
|
7
7
|
}
|
|
8
|
-
var ZERO = 0,
|
|
8
|
+
var ZERO = 0, CURRENCY_CODES = [
|
|
9
9
|
"USD",
|
|
10
10
|
"EUR",
|
|
11
11
|
"GBP",
|
|
@@ -54,8 +54,22 @@ var ZERO = 0, SUPPORTED_CURRENCY_CODES = /* @__PURE__ */ new Set([
|
|
|
54
54
|
"TWD",
|
|
55
55
|
"AED",
|
|
56
56
|
"SAR",
|
|
57
|
-
"ILS"
|
|
58
|
-
|
|
57
|
+
"ILS",
|
|
58
|
+
"BHD",
|
|
59
|
+
"IQD",
|
|
60
|
+
"JOD",
|
|
61
|
+
"KWD",
|
|
62
|
+
"LYD",
|
|
63
|
+
"OMR",
|
|
64
|
+
"TND",
|
|
65
|
+
"CLP",
|
|
66
|
+
"DJF",
|
|
67
|
+
"ISK",
|
|
68
|
+
"KMF",
|
|
69
|
+
"PYG",
|
|
70
|
+
"VUV",
|
|
71
|
+
"XPF"
|
|
72
|
+
], SUPPORTED_CURRENCY_CODES = new Set(CURRENCY_CODES);
|
|
59
73
|
function isSupportedCurrency(code) {
|
|
60
74
|
return SUPPORTED_CURRENCY_CODES.has(code);
|
|
61
75
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CHECKOUT_STATUS, SAVE_DETAILS_CONSENT, CHECKOUT_NEXT_ACTION, CHECKOUT_ORDER_RESULT_STATUS, ORDER_TYPE, PAYMENT_METHOD, AUTHORIZATION_TYPE } from './chunk-E6QQKDNE.mjs';
|
|
2
|
-
import { paymentAuthorizationUrl, purchaseIntentMobileMoneyNetwork } from './chunk-
|
|
3
|
-
import { ErrorCode, PURCHASE_INTENT_RESOLVE_STATUS, CimplifyError, PAYMENT_OPTION_STATUS, CHECKOUT_TERMS_DELTA_KIND, isSupportedCurrency, PURCHASE_INTENT_CONFIRM_STATUS, PURCHASE_INTENT_ACTION_DECISION, PURCHASE_INTENT_RESOLUTION_KIND, PURCHASE_INTENT_ERROR_CODE, enrichError, LEGACY_CHECKOUT_PAYMENT_METHOD_ALIAS, PURCHASE_INTENT_PAYMENT_METHOD, PURCHASE_INTENT_SOURCE_KIND, LEGACY_CHECKOUT_PAYMENT_STATUS, getErrorHint, MOBILE_MONEY_TENDER_AUTHORITY_KIND } from './chunk-
|
|
2
|
+
import { paymentAuthorizationUrl, purchaseIntentMobileMoneyNetwork } from './chunk-B45X3HPO.mjs';
|
|
3
|
+
import { ErrorCode, PURCHASE_INTENT_RESOLVE_STATUS, CimplifyError, PAYMENT_OPTION_STATUS, CHECKOUT_TERMS_DELTA_KIND, isSupportedCurrency, PURCHASE_INTENT_CONFIRM_STATUS, PURCHASE_INTENT_ACTION_DECISION, PURCHASE_INTENT_RESOLUTION_KIND, PURCHASE_INTENT_ERROR_CODE, enrichError, LEGACY_CHECKOUT_PAYMENT_METHOD_ALIAS, PURCHASE_INTENT_PAYMENT_METHOD, PURCHASE_INTENT_SOURCE_KIND, LEGACY_CHECKOUT_PAYMENT_STATUS, getErrorHint, MOBILE_MONEY_TENDER_AUTHORITY_KIND } from './chunk-FT6GFYJL.mjs';
|
|
4
4
|
|
|
5
5
|
// src/types/result.ts
|
|
6
6
|
function ok(value) {
|
|
@@ -131,6 +131,12 @@ function withQuery(path, params) {
|
|
|
131
131
|
function isRecord(value) {
|
|
132
132
|
return typeof value == "object" && value !== null;
|
|
133
133
|
}
|
|
134
|
+
function isProductPayload(value) {
|
|
135
|
+
return isRecord(value) && typeof value.id == "string" && typeof value.name == "string";
|
|
136
|
+
}
|
|
137
|
+
function isCategoryPayload(value) {
|
|
138
|
+
return isRecord(value) && typeof value.id == "string" && typeof value.name == "string" && typeof value.slug == "string";
|
|
139
|
+
}
|
|
134
140
|
function readFinalPrice(value) {
|
|
135
141
|
if (!isRecord(value)) return;
|
|
136
142
|
let finalPrice = value.final_price;
|
|
@@ -160,15 +166,17 @@ function normalizeAddOnPayload(addOn) {
|
|
|
160
166
|
}), normalizedAddOn;
|
|
161
167
|
}
|
|
162
168
|
function normalizeCatalogueProductPayload(product) {
|
|
163
|
-
|
|
169
|
+
if (!isRecord(product))
|
|
170
|
+
return product;
|
|
171
|
+
let defaultPrice = product.default_price, addOns = product.add_ons, needsPriceFix = needsDefaultPriceNormalization(defaultPrice), needsAddOnFix = Array.isArray(addOns) && addOns.some((addOn) => addOnNeedsNormalization(addOn));
|
|
164
172
|
if (!needsPriceFix && !needsAddOnFix)
|
|
165
173
|
return product;
|
|
166
|
-
let normalized = {
|
|
174
|
+
let normalized = {};
|
|
167
175
|
if (needsPriceFix) {
|
|
168
|
-
let derivedDefaultPrice = readFinalPrice(
|
|
169
|
-
normalized.default_price = derivedDefaultPrice
|
|
176
|
+
let derivedDefaultPrice = readFinalPrice(product.default_price_info) || readFinalPrice(product.price_info) || (typeof product.final_price == "string" || typeof product.final_price == "number" ? product.final_price : void 0);
|
|
177
|
+
derivedDefaultPrice !== void 0 && (normalized.default_price = derivedDefaultPrice);
|
|
170
178
|
}
|
|
171
|
-
return needsAddOnFix && Array.isArray(addOns) && (normalized.add_ons = addOns.map((addOn) => normalizeAddOnPayload(addOn))), normalized;
|
|
179
|
+
return needsAddOnFix && Array.isArray(addOns) && (normalized.add_ons = addOns.map((addOn) => normalizeAddOnPayload(addOn))), Object.assign({}, product, normalized);
|
|
172
180
|
}
|
|
173
181
|
function toFiniteNumber(value) {
|
|
174
182
|
if (typeof value == "number" && Number.isFinite(value))
|
|
@@ -267,8 +275,17 @@ var CatalogueQueries = class {
|
|
|
267
275
|
this.client.get(`/api/v1/catalogue/products/${encodedId}`, opts)
|
|
268
276
|
);
|
|
269
277
|
if (!result.ok) return result;
|
|
270
|
-
let payload = result.value, rawProduct = isRecord(payload.item) ? payload.item : payload
|
|
271
|
-
|
|
278
|
+
let payload = result.value, rawProduct = isRecord(payload) && isRecord(payload.item) ? payload.item : payload;
|
|
279
|
+
if (!isProductPayload(rawProduct))
|
|
280
|
+
return err(
|
|
281
|
+
new CimplifyError(
|
|
282
|
+
ErrorCode.UNKNOWN_ERROR,
|
|
283
|
+
`Product ${id} came back without an id or name`,
|
|
284
|
+
false
|
|
285
|
+
)
|
|
286
|
+
);
|
|
287
|
+
let product = normalizeCatalogueProductPayload(rawProduct);
|
|
288
|
+
isRecord(payload) && isCategoryPayload(payload.category) && (product.category = payload.category);
|
|
272
289
|
let addOnIds = rawProduct.add_on_ids;
|
|
273
290
|
if (Array.isArray(addOnIds) && addOnIds.length > 0) {
|
|
274
291
|
let addOnsResult = await this.getAddOns(product.id, opts);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var chunkAWPV33OO_js = require('./chunk-AWPV33OO.js');
|
|
4
4
|
var chunkWOF3AD3J_js = require('./chunk-WOF3AD3J.js');
|
|
5
5
|
var chunkGTJWQAGU_js = require('./chunk-GTJWQAGU.js');
|
|
6
|
-
var
|
|
6
|
+
var chunkNFXCKTE2_js = require('./chunk-NFXCKTE2.js');
|
|
7
7
|
var chunkJGBCIKJV_js = require('./chunk-JGBCIKJV.js');
|
|
8
8
|
|
|
9
9
|
// ../node_modules/.bun/hono@4.13.2/node_modules/hono/dist/compose.js
|
|
@@ -1545,7 +1545,7 @@ var MockError = class extends Error {
|
|
|
1545
1545
|
context: this.context
|
|
1546
1546
|
};
|
|
1547
1547
|
}
|
|
1548
|
-
}, notFound = (msg) => new MockError(
|
|
1548
|
+
}, notFound = (msg) => new MockError(chunkNFXCKTE2_js.ErrorCode.NOT_FOUND, msg, 404), validation = (msg, ctx) => new MockError(chunkNFXCKTE2_js.ErrorCode.VALIDATION_ERROR, msg, 400, ctx), unauthorized = (msg = "Unauthorized") => new MockError(chunkNFXCKTE2_js.ErrorCode.UNAUTHORIZED, msg, 401);
|
|
1549
1549
|
|
|
1550
1550
|
// src/mock/routes/_helpers.ts
|
|
1551
1551
|
function authMiddleware(deps) {
|
|
@@ -1620,7 +1620,7 @@ function getQueryNum(c, key) {
|
|
|
1620
1620
|
}
|
|
1621
1621
|
|
|
1622
1622
|
// src/mock/routes/v1.ts
|
|
1623
|
-
var PURCHASE_INTENT_ROUTE = {
|
|
1623
|
+
var MOBILE_MONEY_FIXTURE_CURRENCY = "GHS", PURCHASE_INTENT_ROUTE = {
|
|
1624
1624
|
COLLECTION: "/purchase-intents",
|
|
1625
1625
|
MEMBER: "/purchase-intents/:intent_id",
|
|
1626
1626
|
REFRESH: "/purchase-intents/:intent_id/refresh",
|
|
@@ -1918,19 +1918,19 @@ function buildV1(deps) {
|
|
|
1918
1918
|
let currency = c.req.query("currency")?.trim().toUpperCase();
|
|
1919
1919
|
return !currency || !/^[A-Z]{3}$/.test(currency) ? fail(c, validation("currency must be a canonical three-letter code")) : tryRoute(c, () => ({
|
|
1920
1920
|
presentment_currency: currency,
|
|
1921
|
-
options: currency ===
|
|
1921
|
+
options: currency === MOBILE_MONEY_FIXTURE_CURRENCY ? [
|
|
1922
1922
|
{ method: chunkGTJWQAGU_js.PAYMENT_METHOD.CARD, network: null },
|
|
1923
1923
|
{
|
|
1924
1924
|
method: chunkGTJWQAGU_js.PAYMENT_METHOD.MOBILE_MONEY,
|
|
1925
|
-
network:
|
|
1925
|
+
network: chunkNFXCKTE2_js.PURCHASE_INTENT_MOBILE_MONEY_NETWORK.MTN
|
|
1926
1926
|
},
|
|
1927
1927
|
{
|
|
1928
1928
|
method: chunkGTJWQAGU_js.PAYMENT_METHOD.MOBILE_MONEY,
|
|
1929
|
-
network:
|
|
1929
|
+
network: chunkNFXCKTE2_js.PURCHASE_INTENT_MOBILE_MONEY_NETWORK.TELECEL
|
|
1930
1930
|
},
|
|
1931
1931
|
{
|
|
1932
1932
|
method: chunkGTJWQAGU_js.PAYMENT_METHOD.MOBILE_MONEY,
|
|
1933
|
-
network:
|
|
1933
|
+
network: chunkNFXCKTE2_js.PURCHASE_INTENT_MOBILE_MONEY_NETWORK.AIRTEL
|
|
1934
1934
|
}
|
|
1935
1935
|
] : currency === "USD" ? [{ method: chunkGTJWQAGU_js.PAYMENT_METHOD.CARD, network: null }] : []
|
|
1936
1936
|
}));
|
|
@@ -4481,7 +4481,7 @@ function createPaymentService(options) {
|
|
|
4481
4481
|
order_number: order.user_friendly_id,
|
|
4482
4482
|
payment_id: body.payment_id,
|
|
4483
4483
|
payment_reference: order.payment_reference,
|
|
4484
|
-
payment_status:
|
|
4484
|
+
payment_status: chunkNFXCKTE2_js.LEGACY_CHECKOUT_PAYMENT_STATUS.SUCCEEDED,
|
|
4485
4485
|
requires_authorization: false,
|
|
4486
4486
|
next_action: { type: chunkGTJWQAGU_js.CHECKOUT_NEXT_ACTION.NONE }
|
|
4487
4487
|
};
|
|
@@ -4491,10 +4491,10 @@ function createPaymentService(options) {
|
|
|
4491
4491
|
|
|
4492
4492
|
// src/mock/domain/purchase-intent.ts
|
|
4493
4493
|
var INTENT_LIFETIME_MS = 900 * 1e3, ZERO_MONEY = "0.00", MOCK_PROTECTION = {
|
|
4494
|
-
status:
|
|
4494
|
+
status: chunkNFXCKTE2_js.CHECKOUT_PROTECTION_STATUS.PROTECTED,
|
|
4495
4495
|
message: "Covered by Cimplify Protection"
|
|
4496
4496
|
}, PURCHASE_INTENT_MOBILE_MONEY_NETWORKS = new Set(
|
|
4497
|
-
Object.values(
|
|
4497
|
+
Object.values(chunkNFXCKTE2_js.PURCHASE_INTENT_MOBILE_MONEY_NETWORK)
|
|
4498
4498
|
), MOCK_PURCHASE_INTENT = {
|
|
4499
4499
|
OWNER_KIND: { ACCOUNT: "account", STOREFRONT_SESSION: "storefront_session" },
|
|
4500
4500
|
CART_STATUS: { ACTIVE: "active", CONVERTED: "converted" },
|
|
@@ -4537,36 +4537,36 @@ function decimal(value) {
|
|
|
4537
4537
|
return wireMoney(value.toFixed(2));
|
|
4538
4538
|
}
|
|
4539
4539
|
function paymentOptions(intentId, currency, amount, expiresAt) {
|
|
4540
|
-
let normalizedCurrency =
|
|
4540
|
+
let normalizedCurrency = chunkNFXCKTE2_js.currencyCode(currency), normalizedAmount = wireMoney(amount);
|
|
4541
4541
|
return [
|
|
4542
4542
|
{
|
|
4543
|
-
id: `${intentId}:${
|
|
4543
|
+
id: `${intentId}:${chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_METHOD.CARD}`,
|
|
4544
4544
|
rank: 0,
|
|
4545
|
-
method_kind:
|
|
4546
|
-
collection_mode:
|
|
4547
|
-
provider:
|
|
4545
|
+
method_kind: chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_METHOD.CARD,
|
|
4546
|
+
collection_mode: chunkNFXCKTE2_js.PAYMENT_COLLECTION_MODE.CREDENTIAL_CHARGE,
|
|
4547
|
+
provider: chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_PROVIDER.PAYSTACK,
|
|
4548
4548
|
principal_amount: normalizedAmount,
|
|
4549
4549
|
fee_amount: wireMoney(ZERO_MONEY),
|
|
4550
4550
|
customer_debit_amount: normalizedAmount,
|
|
4551
4551
|
currency: normalizedCurrency,
|
|
4552
4552
|
protection: MOCK_PROTECTION,
|
|
4553
|
-
status:
|
|
4554
|
-
expected_next_action:
|
|
4553
|
+
status: chunkNFXCKTE2_js.PAYMENT_OPTION_STATUS.ELIGIBLE,
|
|
4554
|
+
expected_next_action: chunkNFXCKTE2_js.PAYMENT_OPTION_NEXT_ACTION.PROVIDER_APPROVAL,
|
|
4555
4555
|
expires_at: expiresAt
|
|
4556
4556
|
},
|
|
4557
4557
|
{
|
|
4558
|
-
id: `${intentId}:${
|
|
4558
|
+
id: `${intentId}:${chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_METHOD.MOBILE_MONEY}`,
|
|
4559
4559
|
rank: 1,
|
|
4560
|
-
method_kind:
|
|
4561
|
-
collection_mode:
|
|
4562
|
-
provider:
|
|
4560
|
+
method_kind: chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_METHOD.MOBILE_MONEY,
|
|
4561
|
+
collection_mode: chunkNFXCKTE2_js.PAYMENT_COLLECTION_MODE.REQUEST_TO_PAY,
|
|
4562
|
+
provider: chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_PROVIDER.PAYSTACK,
|
|
4563
4563
|
principal_amount: normalizedAmount,
|
|
4564
4564
|
fee_amount: wireMoney(ZERO_MONEY),
|
|
4565
4565
|
customer_debit_amount: normalizedAmount,
|
|
4566
4566
|
currency: normalizedCurrency,
|
|
4567
4567
|
protection: MOCK_PROTECTION,
|
|
4568
|
-
status:
|
|
4569
|
-
expected_next_action:
|
|
4568
|
+
status: chunkNFXCKTE2_js.PAYMENT_OPTION_STATUS.ELIGIBLE,
|
|
4569
|
+
expected_next_action: chunkNFXCKTE2_js.PAYMENT_OPTION_NEXT_ACTION.PROVIDER_APPROVAL,
|
|
4570
4570
|
expires_at: expiresAt
|
|
4571
4571
|
}
|
|
4572
4572
|
];
|
|
@@ -4579,7 +4579,7 @@ function termsForCart(input) {
|
|
|
4579
4579
|
terms_version: input.version,
|
|
4580
4580
|
terms_digest: `mock:${input.intentId}:${input.revision}:${input.version}`,
|
|
4581
4581
|
money: {
|
|
4582
|
-
currency:
|
|
4582
|
+
currency: chunkNFXCKTE2_js.currencyCode(input.currency),
|
|
4583
4583
|
subtotal: wireMoney(input.subtotal),
|
|
4584
4584
|
discount_total: wireMoney(input.discount),
|
|
4585
4585
|
tax_total: wireMoney(input.tax),
|
|
@@ -4601,8 +4601,8 @@ function termsForCart(input) {
|
|
|
4601
4601
|
compliance: {
|
|
4602
4602
|
policy_name: MOCK_PURCHASE_INTENT.COMPLIANCE.POLICY_NAME,
|
|
4603
4603
|
policy_version: 1,
|
|
4604
|
-
lane:
|
|
4605
|
-
reason_code:
|
|
4604
|
+
lane: chunkNFXCKTE2_js.CHECKOUT_COMPLIANCE_LANE.NATIVE,
|
|
4605
|
+
reason_code: chunkNFXCKTE2_js.CHECKOUT_COMPLIANCE_REASON.PHYSICAL_GOODS_NATIVE,
|
|
4606
4606
|
evidence_digest: `mock-compliance:${input.intentId}`
|
|
4607
4607
|
},
|
|
4608
4608
|
payment_options: isExactlyZero(input.total) ? [] : paymentOptions(input.intentId, input.currency, input.total, input.validUntil),
|
|
@@ -4621,19 +4621,19 @@ function intentView(intent) {
|
|
|
4621
4621
|
}
|
|
4622
4622
|
function purchasingPrincipal(session) {
|
|
4623
4623
|
if (!session.is_authenticated)
|
|
4624
|
-
return { kind:
|
|
4624
|
+
return { kind: chunkNFXCKTE2_js.PURCHASING_PRINCIPAL_KIND.GUEST };
|
|
4625
4625
|
if (!session.account_id) throw validation("Authenticated mock session has no account authority");
|
|
4626
4626
|
return {
|
|
4627
|
-
kind:
|
|
4627
|
+
kind: chunkNFXCKTE2_js.PURCHASING_PRINCIPAL_KIND.ACCOUNT,
|
|
4628
4628
|
account_id: session.account_id
|
|
4629
4629
|
};
|
|
4630
4630
|
}
|
|
4631
4631
|
function assertSupportedTenderPreference(request) {
|
|
4632
|
-
if (request.source.kind !==
|
|
4632
|
+
if (request.source.kind !== chunkNFXCKTE2_js.PURCHASE_INTENT_SOURCE_KIND.CART) return;
|
|
4633
4633
|
let checkout = request.checkout;
|
|
4634
4634
|
if (!checkout) throw validation("Cart checkout input is required");
|
|
4635
4635
|
let preference = checkout.tender_preference;
|
|
4636
|
-
if (!(preference?.method_kind !==
|
|
4636
|
+
if (!(preference?.method_kind !== chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_METHOD.MOBILE_MONEY || preference.authority.authority_kind !== chunkNFXCKTE2_js.MOBILE_MONEY_TENDER_AUTHORITY_KIND.TRANSIENT) && !PURCHASE_INTENT_MOBILE_MONEY_NETWORKS.has(preference.authority.network))
|
|
4637
4637
|
throw validation("Mobile Money network is not available for PurchaseIntent checkout");
|
|
4638
4638
|
}
|
|
4639
4639
|
function intentOwner(session) {
|
|
@@ -4646,12 +4646,12 @@ function createPurchaseIntentMockService(options) {
|
|
|
4646
4646
|
let { registry, clock, ids, bus, mobileMoney } = options;
|
|
4647
4647
|
function recordMobileMoneyPayment(intent, order) {
|
|
4648
4648
|
let preference = intent.mint_request.checkout?.tender_preference;
|
|
4649
|
-
if (preference?.method_kind !==
|
|
4649
|
+
if (preference?.method_kind !== chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_METHOD.MOBILE_MONEY || !order.customer_id)
|
|
4650
4650
|
return;
|
|
4651
4651
|
let authority = preference.authority;
|
|
4652
4652
|
mobileMoney.recordMobileMoneyPayment(
|
|
4653
4653
|
order.customer_id,
|
|
4654
|
-
authority.authority_kind ===
|
|
4654
|
+
authority.authority_kind === chunkNFXCKTE2_js.MOBILE_MONEY_TENDER_AUTHORITY_KIND.SAVED_REFERENCE ? { id: authority.stored_instrument_id } : { phone_number: authority.phone_number }
|
|
4655
4655
|
);
|
|
4656
4656
|
}
|
|
4657
4657
|
function stored(session, intentId) {
|
|
@@ -4675,7 +4675,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
4675
4675
|
order.business_id
|
|
4676
4676
|
), bus.emit(MOCK_PURCHASE_INTENT.EVENT.ORDER_CONFIRMED, { order_id: order.id }, order.business_id);
|
|
4677
4677
|
let completed = {
|
|
4678
|
-
status:
|
|
4678
|
+
status: chunkNFXCKTE2_js.PURCHASE_INTENT_CONFIRM_STATUS.ORDER_CREATED,
|
|
4679
4679
|
intent_id: intent.id,
|
|
4680
4680
|
attempt_id: attemptId,
|
|
4681
4681
|
order_id: order.id,
|
|
@@ -4691,7 +4691,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
4691
4691
|
return {
|
|
4692
4692
|
mint(session, request) {
|
|
4693
4693
|
if (!request.client_intent_key.trim()) throw validation("client_intent_key required");
|
|
4694
|
-
if (request.source.kind !==
|
|
4694
|
+
if (request.source.kind !== chunkNFXCKTE2_js.PURCHASE_INTENT_SOURCE_KIND.CART)
|
|
4695
4695
|
throw validation("The mock currently prepares cart purchase intents only");
|
|
4696
4696
|
let checkoutInput = request.checkout;
|
|
4697
4697
|
if (!checkoutInput) throw validation("Cart checkout input is required");
|
|
@@ -4700,7 +4700,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
4700
4700
|
let cart = registry.carts.get(request.source.cart_id);
|
|
4701
4701
|
if (!cart) throw notFound(`Cart ${request.source.cart_id} not found`);
|
|
4702
4702
|
if (cart.items.length === 0)
|
|
4703
|
-
throw validation("Cart is empty", { code:
|
|
4703
|
+
throw validation("Cart is empty", { code: chunkNFXCKTE2_js.ErrorCode.CART_EMPTY });
|
|
4704
4704
|
let principal = purchasingPrincipal(session), owner = intentOwner(session), existing = registry.purchaseIntents.list(
|
|
4705
4705
|
(candidate) => candidate.mint_request.client_intent_key === request.client_intent_key && candidate.intent_owner.kind === owner.kind && candidate.intent_owner.id === owner.id
|
|
4706
4706
|
)[0];
|
|
@@ -4722,14 +4722,14 @@ function createPurchaseIntentMockService(options) {
|
|
|
4722
4722
|
seller_business_id: cart.business_id,
|
|
4723
4723
|
principal,
|
|
4724
4724
|
revision: 1,
|
|
4725
|
-
status:
|
|
4725
|
+
status: chunkNFXCKTE2_js.PURCHASE_INTENT_STATUS.OPEN,
|
|
4726
4726
|
source: {
|
|
4727
|
-
kind:
|
|
4727
|
+
kind: chunkNFXCKTE2_js.PURCHASE_INTENT_SOURCE_KIND.CART,
|
|
4728
4728
|
source_id: cart.id,
|
|
4729
4729
|
source_version: cart.updated_at,
|
|
4730
4730
|
seller_business_id: cart.business_id,
|
|
4731
4731
|
subject: {
|
|
4732
|
-
kind:
|
|
4732
|
+
kind: chunkNFXCKTE2_js.PURCHASING_PRINCIPAL_KIND.BUSINESS,
|
|
4733
4733
|
business_id: cart.business_id
|
|
4734
4734
|
},
|
|
4735
4735
|
binding_digest: `mock-cart:${cart.id}:${cart.updated_at}`
|
|
@@ -4738,14 +4738,14 @@ function createPurchaseIntentMockService(options) {
|
|
|
4738
4738
|
id: line.id,
|
|
4739
4739
|
ordinal,
|
|
4740
4740
|
sellable: {
|
|
4741
|
-
kind: line.variant_id ?
|
|
4741
|
+
kind: line.variant_id ? chunkNFXCKTE2_js.PURCHASE_INTENT_SELLABLE_KIND.VARIANT : chunkNFXCKTE2_js.PURCHASE_INTENT_SELLABLE_KIND.PRODUCT,
|
|
4742
4742
|
product_id: line.item_id,
|
|
4743
4743
|
variant_id: line.variant_id,
|
|
4744
4744
|
location_id: checkoutInput.location_id || MOCK_PURCHASE_INTENT.DEFAULT_LOCATION_ID
|
|
4745
4745
|
},
|
|
4746
4746
|
quantity: line.quantity,
|
|
4747
4747
|
configuration: {
|
|
4748
|
-
kind:
|
|
4748
|
+
kind: chunkNFXCKTE2_js.PURCHASE_INTENT_LINE_CONFIGURATION_KIND.SIMPLE,
|
|
4749
4749
|
variant_id: line.variant_id,
|
|
4750
4750
|
customer_inputs: line.customer_inputs
|
|
4751
4751
|
}
|
|
@@ -4757,7 +4757,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
4757
4757
|
quantity: line.quantity,
|
|
4758
4758
|
unit_price: decimal(unitPrice),
|
|
4759
4759
|
line_subtotal: decimal(lineSubtotal),
|
|
4760
|
-
currency:
|
|
4760
|
+
currency: chunkNFXCKTE2_js.currencyCode(cart.currency)
|
|
4761
4761
|
};
|
|
4762
4762
|
}),
|
|
4763
4763
|
current_terms: terms,
|
|
@@ -4794,31 +4794,31 @@ function createPurchaseIntentMockService(options) {
|
|
|
4794
4794
|
},
|
|
4795
4795
|
confirm(session, intentId, request) {
|
|
4796
4796
|
let intent = stored(session, intentId);
|
|
4797
|
-
if (intent.status ===
|
|
4797
|
+
if (intent.status === chunkNFXCKTE2_js.PURCHASE_INTENT_STATUS.CONVERTED && intent.last_confirmation) {
|
|
4798
4798
|
let orderId2 = "order_id" in intent.last_confirmation ? intent.last_confirmation.order_id : void 0, order2 = orderId2 ? registry.orders.get(orderId2) : void 0;
|
|
4799
4799
|
return order2?.payment_state === MOCK_PURCHASE_INTENT.PAYMENT_STATE.PAID ? {
|
|
4800
|
-
status:
|
|
4800
|
+
status: chunkNFXCKTE2_js.PURCHASE_INTENT_CONFIRM_STATUS.ORDER_CREATED,
|
|
4801
4801
|
intent_id: intent.id,
|
|
4802
4802
|
attempt_id: "attempt_id" in intent.last_confirmation ? intent.last_confirmation.attempt_id : ids.raw(MOCK_PURCHASE_INTENT.ID_PREFIX.ATTEMPT),
|
|
4803
4803
|
order_id: order2.id
|
|
4804
|
-
} : order2?.payment_id && intent.last_confirmation.status ===
|
|
4804
|
+
} : order2?.payment_id && intent.last_confirmation.status === chunkNFXCKTE2_js.PURCHASE_INTENT_CONFIRM_STATUS.CARD_POPUP_REQUIRED ? completeProviderOrder(intent, order2, intent.last_confirmation.attempt_id) : intent.last_confirmation;
|
|
4805
4805
|
}
|
|
4806
4806
|
let terms = intent.current_terms;
|
|
4807
4807
|
if (!terms) throw validation("Purchase intent has no current terms");
|
|
4808
4808
|
let zeroRail = isExactlyZero(terms.money.rail_amount), option = request.payment_option_id ? terms.payment_options.find(
|
|
4809
|
-
(candidate) => candidate.id === request.payment_option_id && candidate.status ===
|
|
4809
|
+
(candidate) => candidate.id === request.payment_option_id && candidate.status === chunkNFXCKTE2_js.PAYMENT_OPTION_STATUS.ELIGIBLE
|
|
4810
4810
|
) : void 0, acceptedBaseTermsChanged = !sameDecimal(request.accepted_due_now, terms.money.due_now) || request.currency !== terms.money.currency;
|
|
4811
4811
|
if (request.accepted_intent_revision !== intent.revision || request.accepted_terms_version !== terms.terms_version || acceptedBaseTermsChanged) {
|
|
4812
4812
|
let deltas = acceptedBaseTermsChanged ? [
|
|
4813
4813
|
{
|
|
4814
|
-
kind:
|
|
4815
|
-
component:
|
|
4814
|
+
kind: chunkNFXCKTE2_js.CHECKOUT_TERMS_DELTA_KIND.MONEY,
|
|
4815
|
+
component: chunkNFXCKTE2_js.CHECKOUT_TERMS_COMPONENT.DUE_NOW,
|
|
4816
4816
|
accepted: request.accepted_due_now,
|
|
4817
4817
|
replacement: terms.money.due_now
|
|
4818
4818
|
}
|
|
4819
4819
|
] : [
|
|
4820
4820
|
{
|
|
4821
|
-
kind:
|
|
4821
|
+
kind: chunkNFXCKTE2_js.CHECKOUT_TERMS_DELTA_KIND.PAYMENT_OPTION,
|
|
4822
4822
|
accepted_option_id: request.payment_option_id ?? null,
|
|
4823
4823
|
accepted_customer_debit_amount: request.accepted_customer_debit_amount,
|
|
4824
4824
|
replacement_option_id: option?.id ?? null,
|
|
@@ -4826,7 +4826,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
4826
4826
|
}
|
|
4827
4827
|
];
|
|
4828
4828
|
return {
|
|
4829
|
-
status:
|
|
4829
|
+
status: chunkNFXCKTE2_js.PURCHASE_INTENT_CONFIRM_STATUS.TERMS_CHANGED,
|
|
4830
4830
|
intent_id: intent.id,
|
|
4831
4831
|
replacement: terms,
|
|
4832
4832
|
deltas
|
|
@@ -4834,21 +4834,21 @@ function createPurchaseIntentMockService(options) {
|
|
|
4834
4834
|
}
|
|
4835
4835
|
if (!zeroRail && !option || zeroRail && request.payment_option_id != null)
|
|
4836
4836
|
return {
|
|
4837
|
-
status:
|
|
4837
|
+
status: chunkNFXCKTE2_js.PURCHASE_INTENT_CONFIRM_STATUS.SELECTION_UNAVAILABLE,
|
|
4838
4838
|
intent_id: intent.id,
|
|
4839
4839
|
lines: intent.lines.map((line) => ({
|
|
4840
4840
|
line_id: line.id,
|
|
4841
|
-
reason:
|
|
4841
|
+
reason: chunkNFXCKTE2_js.CHECKOUT_INVALIDATION_REASON.PAYMENT_OPTION_CHANGED
|
|
4842
4842
|
}))
|
|
4843
4843
|
};
|
|
4844
4844
|
if (!(zeroRail ? isExactlyZero(request.accepted_customer_debit_amount) : !!(option && sameDecimal(request.accepted_customer_debit_amount, option.customer_debit_amount))))
|
|
4845
4845
|
return {
|
|
4846
|
-
status:
|
|
4846
|
+
status: chunkNFXCKTE2_js.PURCHASE_INTENT_CONFIRM_STATUS.TERMS_CHANGED,
|
|
4847
4847
|
intent_id: intent.id,
|
|
4848
4848
|
replacement: terms,
|
|
4849
4849
|
deltas: [
|
|
4850
4850
|
{
|
|
4851
|
-
kind:
|
|
4851
|
+
kind: chunkNFXCKTE2_js.CHECKOUT_TERMS_DELTA_KIND.PAYMENT_OPTION,
|
|
4852
4852
|
accepted_option_id: request.payment_option_id ?? null,
|
|
4853
4853
|
accepted_customer_debit_amount: request.accepted_customer_debit_amount,
|
|
4854
4854
|
replacement_option_id: option?.id ?? null,
|
|
@@ -4856,24 +4856,24 @@ function createPurchaseIntentMockService(options) {
|
|
|
4856
4856
|
}
|
|
4857
4857
|
]
|
|
4858
4858
|
};
|
|
4859
|
-
if (intent.mint_request.source.kind !==
|
|
4859
|
+
if (intent.mint_request.source.kind !== chunkNFXCKTE2_js.PURCHASE_INTENT_SOURCE_KIND.CART)
|
|
4860
4860
|
throw validation("The mock currently confirms cart purchase intents only");
|
|
4861
4861
|
let checkoutInput = intent.mint_request.checkout;
|
|
4862
4862
|
if (!checkoutInput) throw validation("Cart checkout input is required");
|
|
4863
4863
|
let cart = registry.carts.get(intent.mint_request.source.cart_id);
|
|
4864
4864
|
if (!cart)
|
|
4865
4865
|
return {
|
|
4866
|
-
status:
|
|
4866
|
+
status: chunkNFXCKTE2_js.PURCHASE_INTENT_CONFIRM_STATUS.SOURCE_UNAVAILABLE,
|
|
4867
4867
|
intent_id: intent.id,
|
|
4868
|
-
reason:
|
|
4868
|
+
reason: chunkNFXCKTE2_js.SOURCE_REFUSAL.SOURCE_NOT_FOUND
|
|
4869
4869
|
};
|
|
4870
4870
|
if (cart.status !== MOCK_PURCHASE_INTENT.CART_STATUS.ACTIVE)
|
|
4871
4871
|
return {
|
|
4872
|
-
status:
|
|
4872
|
+
status: chunkNFXCKTE2_js.PURCHASE_INTENT_CONFIRM_STATUS.SOURCE_UNAVAILABLE,
|
|
4873
4873
|
intent_id: intent.id,
|
|
4874
|
-
reason:
|
|
4874
|
+
reason: chunkNFXCKTE2_js.SOURCE_REFUSAL.CART_NOT_ACTIVE
|
|
4875
4875
|
};
|
|
4876
|
-
let attemptId = ids.raw(MOCK_PURCHASE_INTENT.ID_PREFIX.ATTEMPT), orderId = ids.order(), orderNumber = ids.orderNumber(), paymentId = zeroRail ? void 0 : ids.payment(), paymentReference = zeroRail ? void 0 : ids.payment(), needsProvider = option?.method_kind ===
|
|
4876
|
+
let attemptId = ids.raw(MOCK_PURCHASE_INTENT.ID_PREFIX.ATTEMPT), orderId = ids.order(), orderNumber = ids.orderNumber(), paymentId = zeroRail ? void 0 : ids.payment(), paymentReference = zeroRail ? void 0 : ids.payment(), needsProvider = option?.method_kind === chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_METHOD.CARD || option?.method_kind === chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_METHOD.MOBILE_MONEY, paid = zeroRail, order = {
|
|
4877
4877
|
id: orderId,
|
|
4878
4878
|
business_id: cart.business_id,
|
|
4879
4879
|
user_friendly_id: orderNumber,
|
|
@@ -4920,23 +4920,23 @@ function createPurchaseIntentMockService(options) {
|
|
|
4920
4920
|
cart.business_id
|
|
4921
4921
|
));
|
|
4922
4922
|
let confirmation;
|
|
4923
|
-
if (option?.method_kind ===
|
|
4924
|
-
status:
|
|
4923
|
+
if (option?.method_kind === chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_METHOD.MOBILE_MONEY ? confirmation = {
|
|
4924
|
+
status: chunkNFXCKTE2_js.PURCHASE_INTENT_CONFIRM_STATUS.AUTHORIZATION_REQUIRED,
|
|
4925
4925
|
intent_id: intent.id,
|
|
4926
4926
|
attempt_id: attemptId,
|
|
4927
4927
|
order_id: orderId,
|
|
4928
4928
|
authorization_type: chunkGTJWQAGU_js.AUTHORIZATION_TYPE.OTP,
|
|
4929
4929
|
display_text: "Approve on your mobile money app"
|
|
4930
|
-
} : option?.method_kind ===
|
|
4931
|
-
status:
|
|
4930
|
+
} : option?.method_kind === chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_METHOD.CARD ? confirmation = {
|
|
4931
|
+
status: chunkNFXCKTE2_js.PURCHASE_INTENT_CONFIRM_STATUS.CARD_POPUP_REQUIRED,
|
|
4932
4932
|
intent_id: intent.id,
|
|
4933
4933
|
attempt_id: attemptId,
|
|
4934
4934
|
order_id: orderId,
|
|
4935
|
-
provider:
|
|
4935
|
+
provider: chunkNFXCKTE2_js.PURCHASE_INTENT_PAYMENT_PROVIDER.PAYSTACK,
|
|
4936
4936
|
client_secret: `access_${paymentReference}`,
|
|
4937
4937
|
public_key: MOCK_PURCHASE_INTENT.MOCK_PAYSTACK_PUBLIC_KEY
|
|
4938
4938
|
} : confirmation = {
|
|
4939
|
-
status:
|
|
4939
|
+
status: chunkNFXCKTE2_js.PURCHASE_INTENT_CONFIRM_STATUS.ORDER_CREATED,
|
|
4940
4940
|
intent_id: intent.id,
|
|
4941
4941
|
attempt_id: attemptId,
|
|
4942
4942
|
order_id: orderId
|
|
@@ -4944,7 +4944,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
4944
4944
|
throw validation("Provider-backed purchase intent has no payment authority");
|
|
4945
4945
|
return registry.purchaseIntents.put(intent.id, {
|
|
4946
4946
|
...intent,
|
|
4947
|
-
status:
|
|
4947
|
+
status: chunkNFXCKTE2_js.PURCHASE_INTENT_STATUS.CONVERTED,
|
|
4948
4948
|
converted_order_id: orderId,
|
|
4949
4949
|
updated_at: clock.iso(),
|
|
4950
4950
|
last_confirmation: confirmation
|
|
@@ -4952,7 +4952,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
4952
4952
|
},
|
|
4953
4953
|
submitAction(session, intentId, attemptId, request) {
|
|
4954
4954
|
let intent = stored(session, intentId), previous = intent.last_confirmation;
|
|
4955
|
-
if (!previous || previous.status !==
|
|
4955
|
+
if (!previous || previous.status !== chunkNFXCKTE2_js.PURCHASE_INTENT_CONFIRM_STATUS.AUTHORIZATION_REQUIRED || previous.attempt_id !== attemptId)
|
|
4956
4956
|
throw validation("Purchase-intent attempt is not awaiting authorization");
|
|
4957
4957
|
if (!request.authorization) throw validation("authorization required");
|
|
4958
4958
|
let order = registry.orders.get(previous.order_id);
|
|
@@ -5091,7 +5091,7 @@ function parseInstant(value, field) {
|
|
|
5091
5091
|
return ms;
|
|
5092
5092
|
}
|
|
5093
5093
|
function cannotReschedule(message) {
|
|
5094
|
-
return new MockError(
|
|
5094
|
+
return new MockError(chunkNFXCKTE2_js.ErrorCode.CANNOT_RESCHEDULE, message, (409));
|
|
5095
5095
|
}
|
|
5096
5096
|
function createSchedulingService(opts) {
|
|
5097
5097
|
let { registry, clock, bus } = opts;
|
|
@@ -5177,7 +5177,7 @@ function createSchedulingService(opts) {
|
|
|
5177
5177
|
if (bookedStaffId && registry.bookings.list(
|
|
5178
5178
|
(other) => other.id !== b.id && other.staff_id === bookedStaffId && !CLOSED_BOOKING_STATUSES.has(other.status) && Date.parse(other.start_time) < newEnd && Date.parse(other.end_time) > newStart
|
|
5179
5179
|
).length > 0)
|
|
5180
|
-
throw new MockError(
|
|
5180
|
+
throw new MockError(chunkNFXCKTE2_js.ErrorCode.STAFF_UNAVAILABLE, STAFF_BUSY_MESSAGE, (409));
|
|
5181
5181
|
let newStartIso = new Date(newStart).toISOString(), newEndIso = new Date(newEnd).toISOString(), updated = {
|
|
5182
5182
|
...b,
|
|
5183
5183
|
start_time: newStartIso,
|
|
@@ -5567,7 +5567,7 @@ var HTTP_FORBIDDEN = 403, HTTP_NOT_FOUND = 404, HTTP_CONFLICT2 = 409, MOBILE_MON
|
|
|
5567
5567
|
retryable: false
|
|
5568
5568
|
};
|
|
5569
5569
|
}, NOT_FOUND = (kind, id) => {
|
|
5570
|
-
throw new MockError(
|
|
5570
|
+
throw new MockError(chunkNFXCKTE2_js.ErrorCode.NOT_FOUND, `${kind} not found: ${id}`, (404), { id });
|
|
5571
5571
|
};
|
|
5572
5572
|
function createLinkService({ clock, ids }) {
|
|
5573
5573
|
let customers = /* @__PURE__ */ new Map();
|
|
@@ -5770,7 +5770,7 @@ function createLinkService({ clock, ids }) {
|
|
|
5770
5770
|
for (let other of customers.values())
|
|
5771
5771
|
if (other.mobileMoney.has(id))
|
|
5772
5772
|
throw new MockError(
|
|
5773
|
-
|
|
5773
|
+
chunkNFXCKTE2_js.ErrorCode.FORBIDDEN,
|
|
5774
5774
|
MOBILE_MONEY_NOT_OWNED_MESSAGE,
|
|
5775
5775
|
(403)
|
|
5776
5776
|
);
|
|
@@ -7757,10 +7757,10 @@ function seedRetail(registry) {
|
|
|
7757
7757
|
updated_at: ISO5
|
|
7758
7758
|
};
|
|
7759
7759
|
registry.variantAxes.put(ramAxis.id, ramAxis), registry.variantAxes.put(ssdAxis.id, ssdAxis);
|
|
7760
|
-
let
|
|
7760
|
+
let ramAdjWhole = { 16: 0, 32: 2500 }, ssdAdjWhole = { 512: 0, "1tb": 1500, "2tb": 3500 }, laptopVariantIds = [], firstLaptop = true;
|
|
7761
7761
|
for (let r of ramAxis.values)
|
|
7762
7762
|
for (let s of ssdAxis.values) {
|
|
7763
|
-
let ramKey = r.id.replace("axv_ram_", ""), ssdKey = s.id.replace("axv_ssd_", ""), id = `var_laptop_${ramKey}_${ssdKey}`, adj = (
|
|
7763
|
+
let ramKey = r.id.replace("axv_ram_", ""), ssdKey = s.id.replace("axv_ssd_", ""), id = `var_laptop_${ramKey}_${ssdKey}`, adj = `${(ramAdjWhole[ramKey] ?? 0) + (ssdAdjWhole[ssdKey] ?? 0)}.00`, variant = {
|
|
7764
7764
|
id,
|
|
7765
7765
|
product_id: "prod_laptop-pro",
|
|
7766
7766
|
business_id: businessId,
|
|
@@ -9966,7 +9966,7 @@ var SEED_ISO = "2026-01-01T00:00:00.000Z", ID_PREFIX = {
|
|
|
9966
9966
|
collection: "col_",
|
|
9967
9967
|
product: "prod_",
|
|
9968
9968
|
service: "svc_"
|
|
9969
|
-
},
|
|
9969
|
+
}, SEED_BUSINESS_CURRENCY = "GHS";
|
|
9970
9970
|
function slugify(value) {
|
|
9971
9971
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
9972
9972
|
}
|
|
@@ -9990,7 +9990,7 @@ function makeSeedContext(registry) {
|
|
|
9990
9990
|
let handle = input.handle ?? slugify(input.name), id = `${ID_PREFIX.business}${slugify(handle)}`, business = {
|
|
9991
9991
|
business_type: "other",
|
|
9992
9992
|
email: `hello@${handle}.test`,
|
|
9993
|
-
default_currency:
|
|
9993
|
+
default_currency: SEED_BUSINESS_CURRENCY,
|
|
9994
9994
|
default_offers_table_service: false,
|
|
9995
9995
|
default_accepts_online_orders: true,
|
|
9996
9996
|
status: "active",
|
|
@@ -7,7 +7,7 @@ function money(value) {
|
|
|
7
7
|
function moneyFromNumber(value) {
|
|
8
8
|
return value;
|
|
9
9
|
}
|
|
10
|
-
var ZERO = 0,
|
|
10
|
+
var ZERO = 0, CURRENCY_CODES = [
|
|
11
11
|
"USD",
|
|
12
12
|
"EUR",
|
|
13
13
|
"GBP",
|
|
@@ -56,8 +56,22 @@ var ZERO = 0, SUPPORTED_CURRENCY_CODES = /* @__PURE__ */ new Set([
|
|
|
56
56
|
"TWD",
|
|
57
57
|
"AED",
|
|
58
58
|
"SAR",
|
|
59
|
-
"ILS"
|
|
60
|
-
|
|
59
|
+
"ILS",
|
|
60
|
+
"BHD",
|
|
61
|
+
"IQD",
|
|
62
|
+
"JOD",
|
|
63
|
+
"KWD",
|
|
64
|
+
"LYD",
|
|
65
|
+
"OMR",
|
|
66
|
+
"TND",
|
|
67
|
+
"CLP",
|
|
68
|
+
"DJF",
|
|
69
|
+
"ISK",
|
|
70
|
+
"KMF",
|
|
71
|
+
"PYG",
|
|
72
|
+
"VUV",
|
|
73
|
+
"XPF"
|
|
74
|
+
], SUPPORTED_CURRENCY_CODES = new Set(CURRENCY_CODES);
|
|
61
75
|
function isSupportedCurrency(code) {
|
|
62
76
|
return SUPPORTED_CURRENCY_CODES.has(code);
|
|
63
77
|
}
|