@cimplify/sdk 0.107.0 → 0.107.1
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 +22 -22
- package/dist/advanced.mjs +3 -3
- package/dist/{catalogue-C4xKpirp.d.ts → catalogue-AmW4XjaN.d.ts} +2 -1
- package/dist/{catalogue-BohD-jU_.d.mts → catalogue-rWd71Xi-.d.mts} +2 -1
- package/dist/{chunk-AVXA4F6G.js → chunk-ANT574FD.js} +29 -0
- package/dist/{chunk-W4ZFZPPY.js → chunk-CEML2737.js} +152 -147
- package/dist/{chunk-NYDVVNZI.mjs → chunk-JRGK3NXR.mjs} +1 -1
- package/dist/{chunk-NJYR6GGM.mjs → chunk-KG3WT4PR.mjs} +29 -1
- package/dist/{chunk-IWZKCL3P.mjs → chunk-NZMU7UUA.mjs} +3 -3
- package/dist/{chunk-HKCB73AJ.js → chunk-ONII7K3T.js} +177 -177
- package/dist/{chunk-2I6YKE6Q.mjs → chunk-OTPLI3JY.mjs} +2 -2
- package/dist/{chunk-P4HYAV3L.mjs → chunk-T4OU77DM.mjs} +7 -2
- package/dist/{chunk-73HY36Z7.js → chunk-THSYGWUA.js} +70 -70
- package/dist/{chunk-NX5YBQZP.js → chunk-UVRPC2P7.js} +73 -62
- package/dist/{chunk-UYFTOIFW.js → chunk-V32BCG7M.js} +6 -6
- package/dist/{chunk-MKZXZDHE.mjs → chunk-XBL3TMPC.mjs} +14 -3
- package/dist/{client-BBFfAtn4.d.mts → client-DlTJ2hUM.d.mts} +2 -2
- package/dist/{client-ByURQZM9.d.ts → client-ni-CfOSO.d.ts} +2 -2
- package/dist/{elements-Dtqe9Ekd.d.mts → elements-BF1Y4aOi.d.mts} +92 -6
- package/dist/{elements-Dtqe9Ekd.d.ts → elements-BF1Y4aOi.d.ts} +92 -6
- package/dist/{index-DFqDU6yU.d.ts → index-CZ0bJm6k.d.ts} +2 -2
- package/dist/{index-B6mukQYB.d.mts → index-DML_W635.d.mts} +2 -2
- package/dist/{index-CvLuAMjQ.d.ts → index-DU7vffby.d.ts} +2 -2
- package/dist/{index-7oz-hVVA.d.mts → index-DopYJKDL.d.mts} +2 -2
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +156 -152
- package/dist/index.mjs +5 -5
- package/dist/mock/cli.mjs +16 -2
- package/dist/mock/library.js +16 -2
- package/dist/mock/library.mjs +16 -2
- package/dist/mock/msw.js +16 -2
- package/dist/mock/msw.mjs +16 -2
- package/dist/{price-B4jL81ef.d.ts → price-B5t2mpsE.d.ts} +1 -1
- package/dist/{price-Pyq-vlrm.d.mts → price-DI_U5oXU.d.mts} +1 -1
- package/dist/react.d.mts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +151 -151
- package/dist/react.mjs +4 -4
- package/dist/{server-Cowuvfbr.d.ts → server-BItJAUTD.d.ts} +1 -1
- package/dist/{server-KilvZJU0.d.mts → server-Dq70vD7z.d.mts} +1 -1
- package/dist/server.d.mts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/server.js +10 -10
- package/dist/server.mjs +4 -4
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +3 -3
- package/dist/testing/msw.mjs +2 -2
- package/dist/testing/suite.d.mts +5 -5
- package/dist/testing/suite.d.ts +5 -5
- package/dist/testing/suite.js +26 -26
- package/dist/testing/suite.mjs +6 -6
- package/dist/testing.d.mts +4 -4
- package/dist/testing.d.ts +4 -4
- package/dist/testing.js +118 -118
- package/dist/testing.mjs +7 -7
- package/dist/utils.d.mts +3 -3
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +32 -32
- package/dist/utils.mjs +2 -2
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkXREIZ56K_js = require('./chunk-XREIZ56K.js');
|
|
4
4
|
var chunkEV2EVOYS_js = require('./chunk-EV2EVOYS.js');
|
|
5
|
-
var
|
|
5
|
+
var chunkANT574FD_js = require('./chunk-ANT574FD.js');
|
|
6
6
|
var chunkOWW5GUSB_js = require('./chunk-OWW5GUSB.js');
|
|
7
7
|
|
|
8
8
|
// ../node_modules/.bun/hono@4.13.2/node_modules/hono/dist/compose.js
|
|
@@ -2100,8 +2100,8 @@ var MockError = class extends Error {
|
|
|
2100
2100
|
};
|
|
2101
2101
|
}
|
|
2102
2102
|
};
|
|
2103
|
-
var notFound = (msg) => new MockError(
|
|
2104
|
-
var validation = (msg, ctx) => new MockError(
|
|
2103
|
+
var notFound = (msg) => new MockError(chunkANT574FD_js.ErrorCode.NOT_FOUND, msg, 404);
|
|
2104
|
+
var validation = (msg, ctx) => new MockError(chunkANT574FD_js.ErrorCode.VALIDATION_ERROR, msg, 400, ctx);
|
|
2105
2105
|
|
|
2106
2106
|
// src/mock/routes/_helpers.ts
|
|
2107
2107
|
function authMiddleware(deps) {
|
|
@@ -2597,15 +2597,15 @@ function buildV1(deps) {
|
|
|
2597
2597
|
{ method: chunkEV2EVOYS_js.PAYMENT_METHOD.CARD, network: null },
|
|
2598
2598
|
{
|
|
2599
2599
|
method: chunkEV2EVOYS_js.PAYMENT_METHOD.MOBILE_MONEY,
|
|
2600
|
-
network:
|
|
2600
|
+
network: chunkANT574FD_js.PURCHASE_INTENT_MOBILE_MONEY_NETWORK.MTN
|
|
2601
2601
|
},
|
|
2602
2602
|
{
|
|
2603
2603
|
method: chunkEV2EVOYS_js.PAYMENT_METHOD.MOBILE_MONEY,
|
|
2604
|
-
network:
|
|
2604
|
+
network: chunkANT574FD_js.PURCHASE_INTENT_MOBILE_MONEY_NETWORK.TELECEL
|
|
2605
2605
|
},
|
|
2606
2606
|
{
|
|
2607
2607
|
method: chunkEV2EVOYS_js.PAYMENT_METHOD.MOBILE_MONEY,
|
|
2608
|
-
network:
|
|
2608
|
+
network: chunkANT574FD_js.PURCHASE_INTENT_MOBILE_MONEY_NETWORK.AIRTEL
|
|
2609
2609
|
}
|
|
2610
2610
|
] : currency === "USD" ? [{ method: chunkEV2EVOYS_js.PAYMENT_METHOD.CARD, network: null }] : []
|
|
2611
2611
|
}));
|
|
@@ -5545,7 +5545,7 @@ function createPaymentService(options) {
|
|
|
5545
5545
|
order_number: order.user_friendly_id,
|
|
5546
5546
|
payment_id: body.payment_id,
|
|
5547
5547
|
payment_reference: order.payment_reference,
|
|
5548
|
-
payment_status:
|
|
5548
|
+
payment_status: chunkANT574FD_js.LEGACY_CHECKOUT_PAYMENT_STATUS.SUCCEEDED,
|
|
5549
5549
|
requires_authorization: false,
|
|
5550
5550
|
next_action: { type: chunkEV2EVOYS_js.CHECKOUT_NEXT_ACTION.NONE }
|
|
5551
5551
|
};
|
|
@@ -5557,11 +5557,11 @@ function createPaymentService(options) {
|
|
|
5557
5557
|
var INTENT_LIFETIME_MS = 15 * 60 * 1e3;
|
|
5558
5558
|
var ZERO_MONEY = "0.00";
|
|
5559
5559
|
var MOCK_PROTECTION = {
|
|
5560
|
-
status:
|
|
5560
|
+
status: chunkANT574FD_js.CHECKOUT_PROTECTION_STATUS.PROTECTED,
|
|
5561
5561
|
message: "Covered by Cimplify Protection"
|
|
5562
5562
|
};
|
|
5563
5563
|
var PURCHASE_INTENT_MOBILE_MONEY_NETWORKS = new Set(
|
|
5564
|
-
Object.values(
|
|
5564
|
+
Object.values(chunkANT574FD_js.PURCHASE_INTENT_MOBILE_MONEY_NETWORK)
|
|
5565
5565
|
);
|
|
5566
5566
|
var MOCK_PURCHASE_INTENT = {
|
|
5567
5567
|
OWNER_KIND: { ACCOUNT: "account", STOREFRONT_SESSION: "storefront_session" },
|
|
@@ -5611,37 +5611,37 @@ function decimal(value) {
|
|
|
5611
5611
|
return wireMoney(value.toFixed(2));
|
|
5612
5612
|
}
|
|
5613
5613
|
function paymentOptions(intentId, currency, amount, expiresAt) {
|
|
5614
|
-
const normalizedCurrency =
|
|
5614
|
+
const normalizedCurrency = chunkANT574FD_js.currencyCode(currency);
|
|
5615
5615
|
const normalizedAmount = wireMoney(amount);
|
|
5616
5616
|
return [
|
|
5617
5617
|
{
|
|
5618
|
-
id: `${intentId}:${
|
|
5618
|
+
id: `${intentId}:${chunkANT574FD_js.PURCHASE_INTENT_PAYMENT_METHOD.CARD}`,
|
|
5619
5619
|
rank: 0,
|
|
5620
|
-
method_kind:
|
|
5621
|
-
collection_mode:
|
|
5622
|
-
provider:
|
|
5620
|
+
method_kind: chunkANT574FD_js.PURCHASE_INTENT_PAYMENT_METHOD.CARD,
|
|
5621
|
+
collection_mode: chunkANT574FD_js.PAYMENT_COLLECTION_MODE.CREDENTIAL_CHARGE,
|
|
5622
|
+
provider: chunkANT574FD_js.PURCHASE_INTENT_PAYMENT_PROVIDER.PAYSTACK,
|
|
5623
5623
|
principal_amount: normalizedAmount,
|
|
5624
5624
|
fee_amount: wireMoney(ZERO_MONEY),
|
|
5625
5625
|
customer_debit_amount: normalizedAmount,
|
|
5626
5626
|
currency: normalizedCurrency,
|
|
5627
5627
|
protection: MOCK_PROTECTION,
|
|
5628
|
-
status:
|
|
5629
|
-
expected_next_action:
|
|
5628
|
+
status: chunkANT574FD_js.PAYMENT_OPTION_STATUS.ELIGIBLE,
|
|
5629
|
+
expected_next_action: chunkANT574FD_js.PAYMENT_OPTION_NEXT_ACTION.PROVIDER_APPROVAL,
|
|
5630
5630
|
expires_at: expiresAt
|
|
5631
5631
|
},
|
|
5632
5632
|
{
|
|
5633
|
-
id: `${intentId}:${
|
|
5633
|
+
id: `${intentId}:${chunkANT574FD_js.PURCHASE_INTENT_PAYMENT_METHOD.MOBILE_MONEY}`,
|
|
5634
5634
|
rank: 1,
|
|
5635
|
-
method_kind:
|
|
5636
|
-
collection_mode:
|
|
5637
|
-
provider:
|
|
5635
|
+
method_kind: chunkANT574FD_js.PURCHASE_INTENT_PAYMENT_METHOD.MOBILE_MONEY,
|
|
5636
|
+
collection_mode: chunkANT574FD_js.PAYMENT_COLLECTION_MODE.REQUEST_TO_PAY,
|
|
5637
|
+
provider: chunkANT574FD_js.PURCHASE_INTENT_PAYMENT_PROVIDER.PAYSTACK,
|
|
5638
5638
|
principal_amount: normalizedAmount,
|
|
5639
5639
|
fee_amount: wireMoney(ZERO_MONEY),
|
|
5640
5640
|
customer_debit_amount: normalizedAmount,
|
|
5641
5641
|
currency: normalizedCurrency,
|
|
5642
5642
|
protection: MOCK_PROTECTION,
|
|
5643
|
-
status:
|
|
5644
|
-
expected_next_action:
|
|
5643
|
+
status: chunkANT574FD_js.PAYMENT_OPTION_STATUS.ELIGIBLE,
|
|
5644
|
+
expected_next_action: chunkANT574FD_js.PAYMENT_OPTION_NEXT_ACTION.PROVIDER_APPROVAL,
|
|
5645
5645
|
expires_at: expiresAt
|
|
5646
5646
|
}
|
|
5647
5647
|
];
|
|
@@ -5654,7 +5654,7 @@ function termsForCart(input) {
|
|
|
5654
5654
|
terms_version: input.version,
|
|
5655
5655
|
terms_digest: `mock:${input.intentId}:${input.revision}:${input.version}`,
|
|
5656
5656
|
money: {
|
|
5657
|
-
currency:
|
|
5657
|
+
currency: chunkANT574FD_js.currencyCode(input.currency),
|
|
5658
5658
|
subtotal: wireMoney(input.subtotal),
|
|
5659
5659
|
discount_total: wireMoney(input.discount),
|
|
5660
5660
|
tax_total: wireMoney(input.tax),
|
|
@@ -5676,8 +5676,8 @@ function termsForCart(input) {
|
|
|
5676
5676
|
compliance: {
|
|
5677
5677
|
policy_name: MOCK_PURCHASE_INTENT.COMPLIANCE.POLICY_NAME,
|
|
5678
5678
|
policy_version: 1,
|
|
5679
|
-
lane:
|
|
5680
|
-
reason_code:
|
|
5679
|
+
lane: chunkANT574FD_js.CHECKOUT_COMPLIANCE_LANE.NATIVE,
|
|
5680
|
+
reason_code: chunkANT574FD_js.CHECKOUT_COMPLIANCE_REASON.PHYSICAL_GOODS_NATIVE,
|
|
5681
5681
|
evidence_digest: `mock-compliance:${input.intentId}`
|
|
5682
5682
|
},
|
|
5683
5683
|
payment_options: isExactlyZero(input.total) ? [] : paymentOptions(input.intentId, input.currency, input.total, input.validUntil),
|
|
@@ -5696,20 +5696,20 @@ function intentView(intent) {
|
|
|
5696
5696
|
}
|
|
5697
5697
|
function purchasingPrincipal(session) {
|
|
5698
5698
|
if (!session.is_authenticated) {
|
|
5699
|
-
return { kind:
|
|
5699
|
+
return { kind: chunkANT574FD_js.PURCHASING_PRINCIPAL_KIND.GUEST };
|
|
5700
5700
|
}
|
|
5701
5701
|
if (!session.account_id) throw validation("Authenticated mock session has no account authority");
|
|
5702
5702
|
return {
|
|
5703
|
-
kind:
|
|
5703
|
+
kind: chunkANT574FD_js.PURCHASING_PRINCIPAL_KIND.ACCOUNT,
|
|
5704
5704
|
account_id: session.account_id
|
|
5705
5705
|
};
|
|
5706
5706
|
}
|
|
5707
5707
|
function assertSupportedTenderPreference(request) {
|
|
5708
|
-
if (request.source.kind !==
|
|
5708
|
+
if (request.source.kind !== chunkANT574FD_js.PURCHASE_INTENT_SOURCE_KIND.CART) return;
|
|
5709
5709
|
const checkout = request.checkout;
|
|
5710
5710
|
if (!checkout) throw validation("Cart checkout input is required");
|
|
5711
5711
|
const preference = checkout.tender_preference;
|
|
5712
|
-
if (preference?.method_kind !==
|
|
5712
|
+
if (preference?.method_kind !== chunkANT574FD_js.PURCHASE_INTENT_PAYMENT_METHOD.MOBILE_MONEY || preference.authority.authority_kind !== chunkANT574FD_js.MOBILE_MONEY_TENDER_AUTHORITY_KIND.TRANSIENT) {
|
|
5713
5713
|
return;
|
|
5714
5714
|
}
|
|
5715
5715
|
if (!PURCHASE_INTENT_MOBILE_MONEY_NETWORKS.has(preference.authority.network)) {
|
|
@@ -5749,7 +5749,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
5749
5749
|
);
|
|
5750
5750
|
bus.emit(MOCK_PURCHASE_INTENT.EVENT.ORDER_CONFIRMED, { order_id: order.id }, order.business_id);
|
|
5751
5751
|
const completed = {
|
|
5752
|
-
status:
|
|
5752
|
+
status: chunkANT574FD_js.PURCHASE_INTENT_CONFIRM_STATUS.ORDER_CREATED,
|
|
5753
5753
|
intent_id: intent.id,
|
|
5754
5754
|
attempt_id: attemptId,
|
|
5755
5755
|
order_id: order.id,
|
|
@@ -5766,7 +5766,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
5766
5766
|
return {
|
|
5767
5767
|
mint(session, request) {
|
|
5768
5768
|
if (!request.client_intent_key.trim()) throw validation("client_intent_key required");
|
|
5769
|
-
if (request.source.kind !==
|
|
5769
|
+
if (request.source.kind !== chunkANT574FD_js.PURCHASE_INTENT_SOURCE_KIND.CART) {
|
|
5770
5770
|
throw validation("The mock currently prepares cart purchase intents only");
|
|
5771
5771
|
}
|
|
5772
5772
|
const checkoutInput = request.checkout;
|
|
@@ -5776,7 +5776,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
5776
5776
|
const cart = registry.carts.get(request.source.cart_id);
|
|
5777
5777
|
if (!cart) throw notFound(`Cart ${request.source.cart_id} not found`);
|
|
5778
5778
|
if (cart.items.length === 0) {
|
|
5779
|
-
throw validation("Cart is empty", { code:
|
|
5779
|
+
throw validation("Cart is empty", { code: chunkANT574FD_js.ErrorCode.CART_EMPTY });
|
|
5780
5780
|
}
|
|
5781
5781
|
const principal = purchasingPrincipal(session);
|
|
5782
5782
|
const owner = intentOwner(session);
|
|
@@ -5805,14 +5805,14 @@ function createPurchaseIntentMockService(options) {
|
|
|
5805
5805
|
seller_business_id: cart.business_id,
|
|
5806
5806
|
principal,
|
|
5807
5807
|
revision: 1,
|
|
5808
|
-
status:
|
|
5808
|
+
status: chunkANT574FD_js.PURCHASE_INTENT_STATUS.OPEN,
|
|
5809
5809
|
source: {
|
|
5810
|
-
kind:
|
|
5810
|
+
kind: chunkANT574FD_js.PURCHASE_INTENT_SOURCE_KIND.CART,
|
|
5811
5811
|
source_id: cart.id,
|
|
5812
5812
|
source_version: cart.updated_at,
|
|
5813
5813
|
seller_business_id: cart.business_id,
|
|
5814
5814
|
subject: {
|
|
5815
|
-
kind:
|
|
5815
|
+
kind: chunkANT574FD_js.PURCHASING_PRINCIPAL_KIND.BUSINESS,
|
|
5816
5816
|
business_id: cart.business_id
|
|
5817
5817
|
},
|
|
5818
5818
|
binding_digest: `mock-cart:${cart.id}:${cart.updated_at}`
|
|
@@ -5821,14 +5821,14 @@ function createPurchaseIntentMockService(options) {
|
|
|
5821
5821
|
id: line.id,
|
|
5822
5822
|
ordinal,
|
|
5823
5823
|
sellable: {
|
|
5824
|
-
kind: line.variant_id ?
|
|
5824
|
+
kind: line.variant_id ? chunkANT574FD_js.PURCHASE_INTENT_SELLABLE_KIND.VARIANT : chunkANT574FD_js.PURCHASE_INTENT_SELLABLE_KIND.PRODUCT,
|
|
5825
5825
|
product_id: line.item_id,
|
|
5826
5826
|
variant_id: line.variant_id,
|
|
5827
5827
|
location_id: checkoutInput.location_id || MOCK_PURCHASE_INTENT.DEFAULT_LOCATION_ID
|
|
5828
5828
|
},
|
|
5829
5829
|
quantity: line.quantity,
|
|
5830
5830
|
configuration: {
|
|
5831
|
-
kind:
|
|
5831
|
+
kind: chunkANT574FD_js.PURCHASE_INTENT_LINE_CONFIGURATION_KIND.SIMPLE,
|
|
5832
5832
|
variant_id: line.variant_id,
|
|
5833
5833
|
customer_inputs: line.customer_inputs
|
|
5834
5834
|
}
|
|
@@ -5841,7 +5841,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
5841
5841
|
quantity: line.quantity,
|
|
5842
5842
|
unit_price: decimal(unitPrice),
|
|
5843
5843
|
line_subtotal: decimal(lineSubtotal),
|
|
5844
|
-
currency:
|
|
5844
|
+
currency: chunkANT574FD_js.currencyCode(cart.currency)
|
|
5845
5845
|
};
|
|
5846
5846
|
}),
|
|
5847
5847
|
current_terms: terms,
|
|
@@ -5886,18 +5886,18 @@ function createPurchaseIntentMockService(options) {
|
|
|
5886
5886
|
},
|
|
5887
5887
|
confirm(session, intentId, request) {
|
|
5888
5888
|
const intent = stored(session, intentId);
|
|
5889
|
-
if (intent.status ===
|
|
5889
|
+
if (intent.status === chunkANT574FD_js.PURCHASE_INTENT_STATUS.CONVERTED && intent.last_confirmation) {
|
|
5890
5890
|
const orderId2 = "order_id" in intent.last_confirmation ? intent.last_confirmation.order_id : void 0;
|
|
5891
5891
|
const order2 = orderId2 ? registry.orders.get(orderId2) : void 0;
|
|
5892
5892
|
if (order2?.payment_state === MOCK_PURCHASE_INTENT.PAYMENT_STATE.PAID) {
|
|
5893
5893
|
return {
|
|
5894
|
-
status:
|
|
5894
|
+
status: chunkANT574FD_js.PURCHASE_INTENT_CONFIRM_STATUS.ORDER_CREATED,
|
|
5895
5895
|
intent_id: intent.id,
|
|
5896
5896
|
attempt_id: "attempt_id" in intent.last_confirmation ? intent.last_confirmation.attempt_id : ids.raw(MOCK_PURCHASE_INTENT.ID_PREFIX.ATTEMPT),
|
|
5897
5897
|
order_id: order2.id
|
|
5898
5898
|
};
|
|
5899
5899
|
}
|
|
5900
|
-
if (order2?.payment_id && intent.last_confirmation.status ===
|
|
5900
|
+
if (order2?.payment_id && intent.last_confirmation.status === chunkANT574FD_js.PURCHASE_INTENT_CONFIRM_STATUS.CARD_POPUP_REQUIRED) {
|
|
5901
5901
|
return completeProviderOrder(intent, order2, intent.last_confirmation.attempt_id);
|
|
5902
5902
|
}
|
|
5903
5903
|
return intent.last_confirmation;
|
|
@@ -5906,20 +5906,20 @@ function createPurchaseIntentMockService(options) {
|
|
|
5906
5906
|
if (!terms) throw validation("Purchase intent has no current terms");
|
|
5907
5907
|
const zeroRail = isExactlyZero(terms.money.rail_amount);
|
|
5908
5908
|
const option = request.payment_option_id ? terms.payment_options.find(
|
|
5909
|
-
(candidate) => candidate.id === request.payment_option_id && candidate.status ===
|
|
5909
|
+
(candidate) => candidate.id === request.payment_option_id && candidate.status === chunkANT574FD_js.PAYMENT_OPTION_STATUS.ELIGIBLE
|
|
5910
5910
|
) : void 0;
|
|
5911
5911
|
const acceptedBaseTermsChanged = !sameDecimal(request.accepted_due_now, terms.money.due_now) || request.currency !== terms.money.currency;
|
|
5912
5912
|
if (request.accepted_intent_revision !== intent.revision || request.accepted_terms_version !== terms.terms_version || acceptedBaseTermsChanged) {
|
|
5913
5913
|
const deltas = acceptedBaseTermsChanged ? [
|
|
5914
5914
|
{
|
|
5915
|
-
kind:
|
|
5916
|
-
component:
|
|
5915
|
+
kind: chunkANT574FD_js.CHECKOUT_TERMS_DELTA_KIND.MONEY,
|
|
5916
|
+
component: chunkANT574FD_js.CHECKOUT_TERMS_COMPONENT.DUE_NOW,
|
|
5917
5917
|
accepted: request.accepted_due_now,
|
|
5918
5918
|
replacement: terms.money.due_now
|
|
5919
5919
|
}
|
|
5920
5920
|
] : [
|
|
5921
5921
|
{
|
|
5922
|
-
kind:
|
|
5922
|
+
kind: chunkANT574FD_js.CHECKOUT_TERMS_DELTA_KIND.PAYMENT_OPTION,
|
|
5923
5923
|
accepted_option_id: request.payment_option_id ?? null,
|
|
5924
5924
|
accepted_customer_debit_amount: request.accepted_customer_debit_amount,
|
|
5925
5925
|
replacement_option_id: option?.id ?? null,
|
|
@@ -5927,7 +5927,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
5927
5927
|
}
|
|
5928
5928
|
];
|
|
5929
5929
|
return {
|
|
5930
|
-
status:
|
|
5930
|
+
status: chunkANT574FD_js.PURCHASE_INTENT_CONFIRM_STATUS.TERMS_CHANGED,
|
|
5931
5931
|
intent_id: intent.id,
|
|
5932
5932
|
replacement: terms,
|
|
5933
5933
|
deltas
|
|
@@ -5935,11 +5935,11 @@ function createPurchaseIntentMockService(options) {
|
|
|
5935
5935
|
}
|
|
5936
5936
|
if (!zeroRail && !option || zeroRail && request.payment_option_id != null) {
|
|
5937
5937
|
return {
|
|
5938
|
-
status:
|
|
5938
|
+
status: chunkANT574FD_js.PURCHASE_INTENT_CONFIRM_STATUS.SELECTION_UNAVAILABLE,
|
|
5939
5939
|
intent_id: intent.id,
|
|
5940
5940
|
lines: intent.lines.map((line) => ({
|
|
5941
5941
|
line_id: line.id,
|
|
5942
|
-
reason:
|
|
5942
|
+
reason: chunkANT574FD_js.CHECKOUT_INVALIDATION_REASON.PAYMENT_OPTION_CHANGED
|
|
5943
5943
|
}))
|
|
5944
5944
|
};
|
|
5945
5945
|
}
|
|
@@ -5948,12 +5948,12 @@ function createPurchaseIntentMockService(options) {
|
|
|
5948
5948
|
);
|
|
5949
5949
|
if (!acceptedCustomerDebitMatches) {
|
|
5950
5950
|
return {
|
|
5951
|
-
status:
|
|
5951
|
+
status: chunkANT574FD_js.PURCHASE_INTENT_CONFIRM_STATUS.TERMS_CHANGED,
|
|
5952
5952
|
intent_id: intent.id,
|
|
5953
5953
|
replacement: terms,
|
|
5954
5954
|
deltas: [
|
|
5955
5955
|
{
|
|
5956
|
-
kind:
|
|
5956
|
+
kind: chunkANT574FD_js.CHECKOUT_TERMS_DELTA_KIND.PAYMENT_OPTION,
|
|
5957
5957
|
accepted_option_id: request.payment_option_id ?? null,
|
|
5958
5958
|
accepted_customer_debit_amount: request.accepted_customer_debit_amount,
|
|
5959
5959
|
replacement_option_id: option?.id ?? null,
|
|
@@ -5962,21 +5962,32 @@ function createPurchaseIntentMockService(options) {
|
|
|
5962
5962
|
]
|
|
5963
5963
|
};
|
|
5964
5964
|
}
|
|
5965
|
-
if (intent.mint_request.source.kind !==
|
|
5965
|
+
if (intent.mint_request.source.kind !== chunkANT574FD_js.PURCHASE_INTENT_SOURCE_KIND.CART) {
|
|
5966
5966
|
throw validation("The mock currently confirms cart purchase intents only");
|
|
5967
5967
|
}
|
|
5968
5968
|
const checkoutInput = intent.mint_request.checkout;
|
|
5969
5969
|
if (!checkoutInput) throw validation("Cart checkout input is required");
|
|
5970
5970
|
const cart = registry.carts.get(intent.mint_request.source.cart_id);
|
|
5971
|
-
if (!cart
|
|
5972
|
-
return {
|
|
5971
|
+
if (!cart) {
|
|
5972
|
+
return {
|
|
5973
|
+
status: chunkANT574FD_js.PURCHASE_INTENT_CONFIRM_STATUS.SOURCE_UNAVAILABLE,
|
|
5974
|
+
intent_id: intent.id,
|
|
5975
|
+
reason: chunkANT574FD_js.SOURCE_REFUSAL.SOURCE_NOT_FOUND
|
|
5976
|
+
};
|
|
5977
|
+
}
|
|
5978
|
+
if (cart.status !== MOCK_PURCHASE_INTENT.CART_STATUS.ACTIVE) {
|
|
5979
|
+
return {
|
|
5980
|
+
status: chunkANT574FD_js.PURCHASE_INTENT_CONFIRM_STATUS.SOURCE_UNAVAILABLE,
|
|
5981
|
+
intent_id: intent.id,
|
|
5982
|
+
reason: chunkANT574FD_js.SOURCE_REFUSAL.CART_NOT_ACTIVE
|
|
5983
|
+
};
|
|
5973
5984
|
}
|
|
5974
5985
|
const attemptId = ids.raw(MOCK_PURCHASE_INTENT.ID_PREFIX.ATTEMPT);
|
|
5975
5986
|
const orderId = ids.order();
|
|
5976
5987
|
const orderNumber = ids.orderNumber();
|
|
5977
5988
|
const paymentId = zeroRail ? void 0 : ids.payment();
|
|
5978
5989
|
const paymentReference = zeroRail ? void 0 : ids.payment();
|
|
5979
|
-
const needsProvider = option?.method_kind ===
|
|
5990
|
+
const needsProvider = option?.method_kind === chunkANT574FD_js.PURCHASE_INTENT_PAYMENT_METHOD.CARD || option?.method_kind === chunkANT574FD_js.PURCHASE_INTENT_PAYMENT_METHOD.MOBILE_MONEY;
|
|
5980
5991
|
const paid = zeroRail;
|
|
5981
5992
|
const order = {
|
|
5982
5993
|
id: orderId,
|
|
@@ -6033,28 +6044,28 @@ function createPurchaseIntentMockService(options) {
|
|
|
6033
6044
|
);
|
|
6034
6045
|
}
|
|
6035
6046
|
let confirmation;
|
|
6036
|
-
if (option?.method_kind ===
|
|
6047
|
+
if (option?.method_kind === chunkANT574FD_js.PURCHASE_INTENT_PAYMENT_METHOD.MOBILE_MONEY) {
|
|
6037
6048
|
confirmation = {
|
|
6038
|
-
status:
|
|
6049
|
+
status: chunkANT574FD_js.PURCHASE_INTENT_CONFIRM_STATUS.AUTHORIZATION_REQUIRED,
|
|
6039
6050
|
intent_id: intent.id,
|
|
6040
6051
|
attempt_id: attemptId,
|
|
6041
6052
|
order_id: orderId,
|
|
6042
6053
|
authorization_type: chunkEV2EVOYS_js.AUTHORIZATION_TYPE.OTP,
|
|
6043
6054
|
display_text: "Approve on your mobile money app"
|
|
6044
6055
|
};
|
|
6045
|
-
} else if (option?.method_kind ===
|
|
6056
|
+
} else if (option?.method_kind === chunkANT574FD_js.PURCHASE_INTENT_PAYMENT_METHOD.CARD) {
|
|
6046
6057
|
confirmation = {
|
|
6047
|
-
status:
|
|
6058
|
+
status: chunkANT574FD_js.PURCHASE_INTENT_CONFIRM_STATUS.CARD_POPUP_REQUIRED,
|
|
6048
6059
|
intent_id: intent.id,
|
|
6049
6060
|
attempt_id: attemptId,
|
|
6050
6061
|
order_id: orderId,
|
|
6051
|
-
provider:
|
|
6062
|
+
provider: chunkANT574FD_js.PURCHASE_INTENT_PAYMENT_PROVIDER.PAYSTACK,
|
|
6052
6063
|
client_secret: `access_${paymentReference}`,
|
|
6053
6064
|
public_key: MOCK_PURCHASE_INTENT.MOCK_PAYSTACK_PUBLIC_KEY
|
|
6054
6065
|
};
|
|
6055
6066
|
} else {
|
|
6056
6067
|
confirmation = {
|
|
6057
|
-
status:
|
|
6068
|
+
status: chunkANT574FD_js.PURCHASE_INTENT_CONFIRM_STATUS.ORDER_CREATED,
|
|
6058
6069
|
intent_id: intent.id,
|
|
6059
6070
|
attempt_id: attemptId,
|
|
6060
6071
|
order_id: orderId
|
|
@@ -6065,7 +6076,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
6065
6076
|
}
|
|
6066
6077
|
registry.purchaseIntents.put(intent.id, {
|
|
6067
6078
|
...intent,
|
|
6068
|
-
status:
|
|
6079
|
+
status: chunkANT574FD_js.PURCHASE_INTENT_STATUS.CONVERTED,
|
|
6069
6080
|
converted_order_id: orderId,
|
|
6070
6081
|
updated_at: clock.iso(),
|
|
6071
6082
|
last_confirmation: confirmation
|
|
@@ -6075,7 +6086,7 @@ function createPurchaseIntentMockService(options) {
|
|
|
6075
6086
|
submitAction(session, intentId, attemptId, request) {
|
|
6076
6087
|
const intent = stored(session, intentId);
|
|
6077
6088
|
const previous = intent.last_confirmation;
|
|
6078
|
-
if (!previous || previous.status !==
|
|
6089
|
+
if (!previous || previous.status !== chunkANT574FD_js.PURCHASE_INTENT_CONFIRM_STATUS.AUTHORIZATION_REQUIRED || previous.attempt_id !== attemptId) {
|
|
6079
6090
|
throw validation("Purchase-intent attempt is not awaiting authorization");
|
|
6080
6091
|
}
|
|
6081
6092
|
if (!request.authorization) throw validation("authorization required");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkANT574FD_js = require('./chunk-ANT574FD.js');
|
|
4
4
|
|
|
5
5
|
// src/utils/price.ts
|
|
6
6
|
var CURRENCY_SYMBOLS = {
|
|
@@ -468,14 +468,14 @@ function normalizeStatusResponse(response) {
|
|
|
468
468
|
return {
|
|
469
469
|
status: "pending",
|
|
470
470
|
paid: false,
|
|
471
|
-
amount:
|
|
471
|
+
amount: chunkANT574FD_js.moneyFromNumber(0),
|
|
472
472
|
currency: "",
|
|
473
473
|
message: "No status available"
|
|
474
474
|
};
|
|
475
475
|
}
|
|
476
476
|
const res = response;
|
|
477
477
|
const normalizedStatus = normalizePaymentStatusValue(res.status ?? void 0);
|
|
478
|
-
const normalizedAmount = typeof res.amount === "string" ?
|
|
478
|
+
const normalizedAmount = typeof res.amount === "string" ? chunkANT574FD_js.money(res.amount) : typeof res.amount === "number" && Number.isFinite(res.amount) ? chunkANT574FD_js.moneyFromNumber(res.amount) : chunkANT574FD_js.moneyFromNumber(0);
|
|
479
479
|
const normalizedCurrency = typeof res.currency === "string" && res.currency.trim().length > 0 ? res.currency : "";
|
|
480
480
|
const paidValue = res.paid === true && normalizedStatus !== "authorized" && !PAYMENT_REQUIRES_ACTION_STATUSES.has(normalizedStatus) && !PAYMENT_FAILURE_STATUSES.has(normalizedStatus);
|
|
481
481
|
const derivedPaid = paidValue || PAYMENT_SUCCESS_STATUSES.has(normalizedStatus);
|
|
@@ -514,9 +514,9 @@ function canonicalMobileMoneyProvider(provider) {
|
|
|
514
514
|
return MOBILE_MONEY_PROVIDER_ALIASES[normalized] ?? null;
|
|
515
515
|
}
|
|
516
516
|
var PURCHASE_INTENT_NETWORK_BY_PROVIDER = {
|
|
517
|
-
mtn:
|
|
518
|
-
telecel:
|
|
519
|
-
airteltigo:
|
|
517
|
+
mtn: chunkANT574FD_js.PURCHASE_INTENT_MOBILE_MONEY_NETWORK.MTN,
|
|
518
|
+
telecel: chunkANT574FD_js.PURCHASE_INTENT_MOBILE_MONEY_NETWORK.TELECEL,
|
|
519
|
+
airteltigo: chunkANT574FD_js.PURCHASE_INTENT_MOBILE_MONEY_NETWORK.AIRTEL
|
|
520
520
|
};
|
|
521
521
|
function purchaseIntentMobileMoneyNetwork(provider) {
|
|
522
522
|
const canonical = canonicalMobileMoneyProvider(provider);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { messagePreview } from './chunk-U4MW6PYU.mjs';
|
|
2
2
|
import { AUTHORIZATION_TYPE, CHECKOUT_ORDER_RESULT_STATUS, CHECKOUT_NEXT_ACTION, PAYMENT_METHOD, DEFAULT_CURRENCY } from './chunk-33VCYWVL.mjs';
|
|
3
|
-
import { CHECKOUT_PROTECTION_STATUS, PURCHASE_INTENT_MOBILE_MONEY_NETWORK, ErrorCode, PURCHASE_INTENT_CONFIRM_STATUS, PURCHASE_INTENT_STATUS, PAYMENT_OPTION_STATUS, CHECKOUT_TERMS_COMPONENT, CHECKOUT_TERMS_DELTA_KIND, CHECKOUT_INVALIDATION_REASON, PURCHASE_INTENT_SOURCE_KIND, PURCHASE_INTENT_PAYMENT_METHOD, PURCHASE_INTENT_PAYMENT_PROVIDER, currencyCode, PURCHASE_INTENT_LINE_CONFIGURATION_KIND, PURCHASE_INTENT_SELLABLE_KIND, PURCHASING_PRINCIPAL_KIND, LEGACY_CHECKOUT_PAYMENT_STATUS, CHECKOUT_COMPLIANCE_REASON, CHECKOUT_COMPLIANCE_LANE, MOBILE_MONEY_TENDER_AUTHORITY_KIND, PAYMENT_OPTION_NEXT_ACTION, PAYMENT_COLLECTION_MODE } from './chunk-
|
|
3
|
+
import { CHECKOUT_PROTECTION_STATUS, PURCHASE_INTENT_MOBILE_MONEY_NETWORK, ErrorCode, PURCHASE_INTENT_CONFIRM_STATUS, PURCHASE_INTENT_STATUS, PAYMENT_OPTION_STATUS, CHECKOUT_TERMS_COMPONENT, CHECKOUT_TERMS_DELTA_KIND, CHECKOUT_INVALIDATION_REASON, PURCHASE_INTENT_SOURCE_KIND, SOURCE_REFUSAL, PURCHASE_INTENT_PAYMENT_METHOD, PURCHASE_INTENT_PAYMENT_PROVIDER, currencyCode, PURCHASE_INTENT_LINE_CONFIGURATION_KIND, PURCHASE_INTENT_SELLABLE_KIND, PURCHASING_PRINCIPAL_KIND, LEGACY_CHECKOUT_PAYMENT_STATUS, CHECKOUT_COMPLIANCE_REASON, CHECKOUT_COMPLIANCE_LANE, MOBILE_MONEY_TENDER_AUTHORITY_KIND, PAYMENT_OPTION_NEXT_ACTION, PAYMENT_COLLECTION_MODE } from './chunk-KG3WT4PR.mjs';
|
|
4
4
|
import { __publicField, __privateAdd, __privateSet, __privateGet, __privateMethod, __privateWrapper } from './chunk-3G6RQLXK.mjs';
|
|
5
5
|
|
|
6
6
|
// ../node_modules/.bun/hono@4.13.2/node_modules/hono/dist/compose.js
|
|
@@ -5966,8 +5966,19 @@ function createPurchaseIntentMockService(options) {
|
|
|
5966
5966
|
const checkoutInput = intent.mint_request.checkout;
|
|
5967
5967
|
if (!checkoutInput) throw validation("Cart checkout input is required");
|
|
5968
5968
|
const cart = registry.carts.get(intent.mint_request.source.cart_id);
|
|
5969
|
-
if (!cart
|
|
5970
|
-
return {
|
|
5969
|
+
if (!cart) {
|
|
5970
|
+
return {
|
|
5971
|
+
status: PURCHASE_INTENT_CONFIRM_STATUS.SOURCE_UNAVAILABLE,
|
|
5972
|
+
intent_id: intent.id,
|
|
5973
|
+
reason: SOURCE_REFUSAL.SOURCE_NOT_FOUND
|
|
5974
|
+
};
|
|
5975
|
+
}
|
|
5976
|
+
if (cart.status !== MOCK_PURCHASE_INTENT.CART_STATUS.ACTIVE) {
|
|
5977
|
+
return {
|
|
5978
|
+
status: PURCHASE_INTENT_CONFIRM_STATUS.SOURCE_UNAVAILABLE,
|
|
5979
|
+
intent_id: intent.id,
|
|
5980
|
+
reason: SOURCE_REFUSAL.CART_NOT_ACTIVE
|
|
5981
|
+
};
|
|
5971
5982
|
}
|
|
5972
5983
|
const attemptId = ids.raw(MOCK_PURCHASE_INTENT.ID_PREFIX.ATTEMPT);
|
|
5973
5984
|
const orderId = ids.order();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CimplifyClient } from './catalogue-
|
|
2
|
-
import { A as AppHandle, C as CreateAppOptions } from './server-
|
|
1
|
+
import { C as CimplifyClient } from './catalogue-rWd71Xi-.mjs';
|
|
2
|
+
import { A as AppHandle, C as CreateAppOptions } from './server-Dq70vD7z.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Test client + fixtures.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CimplifyClient } from './catalogue-
|
|
2
|
-
import { A as AppHandle, C as CreateAppOptions } from './server-
|
|
1
|
+
import { C as CimplifyClient } from './catalogue-AmW4XjaN.js';
|
|
2
|
+
import { A as AppHandle, C as CreateAppOptions } from './server-BItJAUTD.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Test client + fixtures.
|