@fire-spark/core 0.2.0 → 0.3.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/index.d.ts +196 -22
- package/dist/index.js +1810 -1267
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PaymentAdapter, PaymentCollectAt, PaymentContext, PaymentResult, PaymentStorage, PaymentUI } from "@fire-spark/payments";
|
|
2
|
-
import { AndConditions, CheckoutMode, CheckoutResolved, CmsBlock, Condition, Customer, CustomerIdentifyInput, CustomerRegisterInput, CustomerUpdateInput, Fulfillment, FulfillmentListInput, GroupDisplayType, KioskDeviceConfig, KioskDeviceOverrides, KioskHealthBatchInput, KioskHealthBatchResult, KioskHeartbeatInput, KioskHeartbeatResult, KioskRealtimeToken, MatchResult, MatchableRule, Menu, Menu as Menu$1, MenuLookup, MenuLookup as MenuLookup$1, MerchantPayment, ModifierControlType, ModifierGroup, OrConditions, Order as Order$1, Order as Order$2, OrderFulfillment, OrderInsertInput, OrderLine, OrderListInput, OrderRecordPaymentInput, OrderRedeem, OrderRedemptionStep, OrderReorderInput, OrderTotals, OrderUpdateInput, OrderValidateInput, OrderValidateOutput,
|
|
1
|
+
import { PaymentAdapter, PaymentCollectAt, PaymentContext, PaymentResult, PaymentStorage, PaymentUI, isRealPaymentMethod } from "@fire-spark/payments";
|
|
2
|
+
import { AndConditions, CheckoutMode, CheckoutResolved, CmsBlock, Condition, Customer, CustomerIdentifyInput, CustomerRegisterInput, CustomerUpdateInput, Fulfillment, FulfillmentListInput, GroupDisplayType, KioskDeviceConfig, KioskDeviceOverrides, KioskHealthBatchInput, KioskHealthBatchResult, KioskHeartbeatInput, KioskHeartbeatResult, KioskRealtimeToken, MatchResult, MatchableRule, Menu, Menu as Menu$1, MenuLookup, MenuLookup as MenuLookup$1, MerchantPayment, ModifierControlType, ModifierGroup, OrConditions, Order as Order$1, Order as Order$2, OrderFulfillment, OrderInsertInput, OrderLine, OrderListInput, OrderRecordPaymentInput, OrderRedeem, OrderRedemptionStep, OrderReorderInput, OrderTotals, OrderUpdateInput, OrderValidateInput, OrderValidateOutput, PaymentCollectAt as PaymentCollectAt$1, PaymentIntentPutInput, PaymentMethod, PaymentProvider, PaymentTender, PaymentTenderInput, PlaceOrderResult, PosCatalog, PosHealthBatchInput, PosHealthBatchResult, PosHeartbeatInput, PosHeartbeatResult, PosKioskOrder, PosKioskSettleInput, PosKioskSettleResult, PosOrderInput, PosOrderResult, PricingModifier, Product, Product as Product$1, Recommendation, RecurringDateCronResult, RecurringDateCronValues, RulesEngineOrderLine, RulesEngineParams, RulesEngineRuntime, Schedule, SdkLogContext, SdkLogErrorInfo, SdkLogLevel, SdkLogOptions, Store, StoreGetInput, StoreListInput, StoreNearbyInput, StorefrontAvailability, StorefrontMenu, StorefrontMenuScope, StorefrontMenuStreamOptions, StorefrontPaymentsListInput, StorefrontPreferences, TenderRefundInput, TenderReplaceInput, TenderVoidInput, Variant, VariantGroup } from "@fire-spark/types";
|
|
3
3
|
import { Big } from "big.js";
|
|
4
4
|
//#region src/productCustomization/types.d.ts
|
|
5
5
|
type SelectionStatus = "IDLE" | "INCOMPLETE" | "VALID" | "INVALID";
|
|
@@ -214,10 +214,16 @@ type ServiceHttpOptions = {
|
|
|
214
214
|
fetchImpl?: typeof fetch;
|
|
215
215
|
signal?: AbortSignal;
|
|
216
216
|
};
|
|
217
|
+
type StorefrontErrorDetails = Record<string, unknown> & {
|
|
218
|
+
code?: string;
|
|
219
|
+
};
|
|
217
220
|
declare class StorefrontHttpError extends Error {
|
|
218
221
|
status: number;
|
|
222
|
+
/** `details.code` when present, else the top-level `code`. */
|
|
219
223
|
code?: string;
|
|
220
|
-
|
|
224
|
+
/** API `details` object (e.g. `{ code, payment_id, reason }`). */
|
|
225
|
+
details: StorefrontErrorDetails | null;
|
|
226
|
+
constructor(message: string, status: number, code?: string, details?: StorefrontErrorDetails | null);
|
|
221
227
|
}
|
|
222
228
|
declare const isStorefrontNotFound: (error: unknown) => boolean;
|
|
223
229
|
declare const storefrontJson: <T>(path: string, init?: RequestInit, options?: ServiceHttpOptions) => Promise<T>;
|
|
@@ -227,16 +233,31 @@ declare const listOrders: (input?: OrderListInput, options?: ServiceHttpOptions)
|
|
|
227
233
|
declare const createOrder: (body: OrderInsertInput, options?: ServiceHttpOptions) => Promise<Order$1>;
|
|
228
234
|
declare const getOrder: (id: string, options?: ServiceHttpOptions) => Promise<Order$1>;
|
|
229
235
|
type PlaceOrderInput = {
|
|
236
|
+
/** DRAFT intent built with `PUT /orders/:id/payment-intent`. */
|
|
237
|
+
intent_id?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Simple flow: `Order.placeOrder` turns it into a one-real-tender DRAFT
|
|
240
|
+
* intent (plus REDEMPTION tenders) and places with its `intent_id`.
|
|
241
|
+
*/
|
|
230
242
|
payment?: {
|
|
231
243
|
id?: string;
|
|
232
244
|
type?: PaymentMethod;
|
|
233
245
|
provider?: PaymentProvider;
|
|
234
|
-
|
|
246
|
+
collect_at?: PaymentCollectAt$1;
|
|
235
247
|
};
|
|
236
248
|
};
|
|
237
249
|
declare const placeOrder: (id: string, body?: PlaceOrderInput, options?: ServiceHttpOptions) => Promise<PlaceOrderResult>;
|
|
238
|
-
/** Records (
|
|
250
|
+
/** Records one tender attempt result (idempotent by `attempt_reference`). */
|
|
239
251
|
declare const recordOrderPayment: (id: string, body: OrderRecordPaymentInput, options?: ServiceHttpOptions) => Promise<Order$1>;
|
|
252
|
+
/** Creates or replaces the DRAFT intent; the server computes amounts. */
|
|
253
|
+
declare const putPaymentIntent: (id: string, body: PaymentIntentPutInput, options?: ServiceHttpOptions) => Promise<Order$1>;
|
|
254
|
+
/** Discards the DRAFT intent (`409 PAYMENT_INTENT_LOCKED` once placed). */
|
|
255
|
+
declare const deletePaymentIntent: (id: string, options?: ServiceHttpOptions) => Promise<Order$1>;
|
|
256
|
+
/** New tender with `replaces_tender_id`; only over a `FAILED` tender (D25). */
|
|
257
|
+
declare const replaceTender: (id: string, tenderId: string, body: TenderReplaceInput, options?: ServiceHttpOptions) => Promise<Order$1>;
|
|
258
|
+
declare const voidTender: (id: string, tenderId: string, body: TenderVoidInput, options?: ServiceHttpOptions) => Promise<Order$1>;
|
|
259
|
+
/** Full refund without `amount` / `items`; partial by amount or units. */
|
|
260
|
+
declare const refundTender: (id: string, tenderId: string, body: TenderRefundInput, options?: ServiceHttpOptions) => Promise<Order$1>;
|
|
240
261
|
declare const getOrderFulfillment: (id: string, options?: ServiceHttpOptions) => Promise<OrderFulfillment>;
|
|
241
262
|
declare const listOrderFulfillments: (ids: string[], options?: ServiceHttpOptions) => Promise<OrderFulfillment[]>;
|
|
242
263
|
declare const updateOrder: (id: string, body: OrderUpdateInput, options?: ServiceHttpOptions) => Promise<Order$1>;
|
|
@@ -272,11 +293,14 @@ declare const reversePayment: (adapter: PaymentAdapter, ctx: PaymentContext, res
|
|
|
272
293
|
}) => Promise<ReversalOutcome>;
|
|
273
294
|
//#endregion
|
|
274
295
|
//#region src/order/payments/session.d.ts
|
|
275
|
-
type
|
|
296
|
+
type Intents = Order$1["payment_intents"];
|
|
276
297
|
type PaymentSessionOptions = {
|
|
277
298
|
/** Merchant env is production (`env_is_prod`). */
|
|
278
299
|
isProduction?: boolean;
|
|
279
|
-
/**
|
|
300
|
+
/**
|
|
301
|
+
* Adapter context: `KIOSK` on a kiosk, `DEVICE` on web/app. Tenders the
|
|
302
|
+
* SDK charges are always saved with `collect_at: DEVICE` (§7.3).
|
|
303
|
+
*/
|
|
280
304
|
collectAt?: PaymentCollectAt;
|
|
281
305
|
/** Where cash is collected: `COUNTER` on a kiosk, `DOOR` on delivery. */
|
|
282
306
|
cashCollectAt?: PaymentCollectAt;
|
|
@@ -285,14 +309,64 @@ type PaymentSessionOptions = {
|
|
|
285
309
|
/** Kiosk device id, sent with terminal failure reports. */
|
|
286
310
|
deviceId?: string | null;
|
|
287
311
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
312
|
+
/** `onProgress` of `payIntent` / `retryTender` (§6.1). */
|
|
313
|
+
type PaymentProgressEvent = {
|
|
314
|
+
type: "tender_started";
|
|
315
|
+
tender: PaymentTender;
|
|
316
|
+
} |
|
|
317
|
+
/** Intermediate result of the running tender (QR, redirect, terminal). */
|
|
318
|
+
{
|
|
319
|
+
type: "tender_pending";
|
|
320
|
+
tender: PaymentTender;
|
|
321
|
+
result: PaymentResult;
|
|
322
|
+
} | {
|
|
323
|
+
type: "tender_paid";
|
|
324
|
+
tender: PaymentTender;
|
|
325
|
+
result: PaymentResult;
|
|
326
|
+
} | {
|
|
327
|
+
type: "tender_failed";
|
|
328
|
+
tender: PaymentTender;
|
|
329
|
+
result: PaymentResult;
|
|
330
|
+
} | {
|
|
331
|
+
type: "reversing";
|
|
332
|
+
tender: PaymentTender;
|
|
333
|
+
};
|
|
334
|
+
type PaymentProgressListener = (event: PaymentProgressEvent) => void | Promise<void>;
|
|
335
|
+
type PayIntentOptions = {
|
|
336
|
+
/** Simple flow: placed as the one real tender (plus REDEMPTION). */
|
|
337
|
+
payment?: MerchantPayment;
|
|
291
338
|
signal?: AbortSignal;
|
|
292
|
-
onProgress?:
|
|
339
|
+
onProgress?: PaymentProgressListener;
|
|
340
|
+
};
|
|
341
|
+
/** @deprecated Use `PayIntentOptions`. */
|
|
342
|
+
type PayOptions = Omit<PayIntentOptions, "payment">;
|
|
343
|
+
type FailedCharge = {
|
|
344
|
+
tender: PaymentTender;
|
|
345
|
+
result: PaymentResult;
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* `PAID`: every live tender is settled. `PENDING`: in-person tenders or
|
|
349
|
+
* deferred captures are left. `FAILED`: stopped at `tender` (D25: retry,
|
|
350
|
+
* replace or cancel and refund; nothing expires).
|
|
351
|
+
*/
|
|
352
|
+
type PayIntentResult = {
|
|
353
|
+
status: "PAID" | "PENDING";
|
|
354
|
+
order: Order$1;
|
|
355
|
+
results: PaymentResult[];
|
|
356
|
+
needsReview: boolean;
|
|
357
|
+
} | {
|
|
358
|
+
status: "FAILED";
|
|
359
|
+
order: Order$1;
|
|
360
|
+
results: PaymentResult[];
|
|
361
|
+
needsReview: boolean;
|
|
362
|
+
tender: PaymentTender;
|
|
363
|
+
result: PaymentResult;
|
|
364
|
+
};
|
|
365
|
+
type ReverseAllOptions = {
|
|
366
|
+
onProgress?: PaymentProgressListener;
|
|
293
367
|
};
|
|
294
|
-
/**
|
|
295
|
-
declare const coveredAmount: (intents:
|
|
368
|
+
/** Settled tenders plus PENDING `confirm_after_inject`, order currency. */
|
|
369
|
+
declare const coveredAmount: (intents: Intents) => number;
|
|
296
370
|
declare const remainingAmount: (order: Order$1) => number;
|
|
297
371
|
//#endregion
|
|
298
372
|
//#region src/order/recommendations.d.ts
|
|
@@ -325,7 +399,10 @@ type ReorderOrderOptions = CreateOrderOptions & {
|
|
|
325
399
|
type OrderDraft = Order$2;
|
|
326
400
|
type ApplyRedeemInput = {
|
|
327
401
|
reward_id: string;
|
|
328
|
-
/**
|
|
402
|
+
/**
|
|
403
|
+
* Reward units to redeem (integer ≥ 1). With `payment_id` it is
|
|
404
|
+
* informational: `amount` and `points` already cover every unit.
|
|
405
|
+
*/
|
|
329
406
|
quantity: number;
|
|
330
407
|
/** 0–1, compounded per unit over the remaining value. */
|
|
331
408
|
discount_rate?: number;
|
|
@@ -338,6 +415,22 @@ type ApplyRedeemInput = {
|
|
|
338
415
|
before_taxes?: boolean;
|
|
339
416
|
/** Root line to discount; omit to discount the whole order (prorated). */
|
|
340
417
|
line_uid?: string;
|
|
418
|
+
/**
|
|
419
|
+
* Points / balance: the merchant `REDEMPTION` payment that pays `amount`
|
|
420
|
+
* (a tender, not a discount). Requires `amount` and `points`. Redeems
|
|
421
|
+
* with the same `payment_id` share one tender (`details.rewards[]`).
|
|
422
|
+
*/
|
|
423
|
+
payment_id?: string;
|
|
424
|
+
/**
|
|
425
|
+
* Total money the points cover for the whole entry (all `quantity`
|
|
426
|
+
* units, not per unit); trimmed to total − tip − delivery.
|
|
427
|
+
*/
|
|
428
|
+
amount?: number;
|
|
429
|
+
/** Total points spent for the whole entry (not per unit). */
|
|
430
|
+
points?: number;
|
|
431
|
+
program?: string;
|
|
432
|
+
/** Provider of the REDEMPTION payment (default `firespark`). */
|
|
433
|
+
provider?: PaymentProvider;
|
|
341
434
|
/** ISO datetime with offset; validation fails once it has passed. */
|
|
342
435
|
expires_at?: string;
|
|
343
436
|
};
|
|
@@ -360,6 +453,9 @@ declare class Order {
|
|
|
360
453
|
private readonly http;
|
|
361
454
|
private readonly flush;
|
|
362
455
|
private readonly payments;
|
|
456
|
+
/** Real tenders chosen with `setTenders`; REDEMPTION ones come from redeem. */
|
|
457
|
+
private realTenders;
|
|
458
|
+
private readonly redemptionProviders;
|
|
363
459
|
private constructor();
|
|
364
460
|
/**
|
|
365
461
|
* Opens a cart session: reuses an existing OPEN order for the scope, or a
|
|
@@ -407,12 +503,20 @@ declare class Order {
|
|
|
407
503
|
emptyOrder(): void;
|
|
408
504
|
/**
|
|
409
505
|
* Appends a redeem to `line_uid` (root line) or to the order. Steps keep
|
|
410
|
-
* the order in which redeems were applied.
|
|
506
|
+
* the order in which redeems were applied. With `payment_id` (points /
|
|
507
|
+
* balance) it is not a discount: `amount` and `points` are totals of the
|
|
508
|
+
* whole entry (every unit, not per unit) and `quantity` is informational.
|
|
509
|
+
* Every redeem with the same `payment_id` is paid by one REDEMPTION
|
|
510
|
+
* tender whose `details.rewards[]` lists them; their summed amount is
|
|
511
|
+
* capped at total − tip − delivery (D15, D18, D19).
|
|
411
512
|
*/
|
|
412
513
|
applyRedeem(input: ApplyRedeemInput): void;
|
|
413
514
|
/**
|
|
414
515
|
* Removes `quantity` units of `reward_id` from `line_uid` or the order,
|
|
415
|
-
* latest applied first. Removing more units than applied clears them all
|
|
516
|
+
* latest applied first. Removing more units than applied clears them all
|
|
517
|
+
* (and the REDEMPTION tender of a points / balance redeem). A points /
|
|
518
|
+
* balance entry that keeps some units keeps the same share of its
|
|
519
|
+
* `amount` and `points`.
|
|
416
520
|
*/
|
|
417
521
|
removeRedeem(input: RemoveRedeemInput): void;
|
|
418
522
|
private rememberLogScope;
|
|
@@ -426,6 +530,23 @@ declare class Order {
|
|
|
426
530
|
cancelOrder(): Promise<void>;
|
|
427
531
|
refundOrder(): Promise<void>;
|
|
428
532
|
validateOrder(): Promise<void>;
|
|
533
|
+
/** Tenders of the next intent: real ones plus one per payment redeem. */
|
|
534
|
+
getTenders(payment?: PlaceOrderInput["payment"]): PaymentTenderInput[];
|
|
535
|
+
/**
|
|
536
|
+
* Chooses the real tenders (with allocation for mixed payments) and saves
|
|
537
|
+
* the DRAFT intent; the server returns amounts per tender. REDEMPTION
|
|
538
|
+
* tenders are added from the redeems, never passed here.
|
|
539
|
+
*/
|
|
540
|
+
setTenders(tenders: PaymentTenderInput[]): Promise<Order$1>;
|
|
541
|
+
/** Drops the chosen tenders and discards the DRAFT intent. */
|
|
542
|
+
clearTenders(): Promise<Order$1>;
|
|
543
|
+
private syncPaymentIntent;
|
|
544
|
+
private applyServerOrder;
|
|
545
|
+
/**
|
|
546
|
+
* Places the order with a DRAFT intent: `intent_id` as is, else the
|
|
547
|
+
* tenders of `getTenders(input.payment)` saved first (simple flow: one
|
|
548
|
+
* real tender plus REDEMPTION). The intent is `LOCKED` afterwards (D25).
|
|
549
|
+
*/
|
|
429
550
|
placeOrder(input?: PlaceOrderInput): Promise<void>;
|
|
430
551
|
/** Installed `@fire-spark/payments-*` adapters (provider + method). */
|
|
431
552
|
setPaymentAdapters(adapters: PaymentAdapter[]): void;
|
|
@@ -439,14 +560,34 @@ declare class Order {
|
|
|
439
560
|
getPaymentOptions(payments: MerchantPayment[]): MerchantPayment[];
|
|
440
561
|
/** Device fields still missing for `payment` on this device. */
|
|
441
562
|
getMissingPaymentFields(payment: MerchantPayment): import("@fire-spark/payments").DeviceField[];
|
|
442
|
-
/** Order total minus
|
|
563
|
+
/** Order total minus settled (and confirm-after-inject) tenders. */
|
|
443
564
|
getRemainingAmount(): number;
|
|
444
|
-
/**
|
|
445
|
-
|
|
565
|
+
/** Merchant payments the tenders point to (`payment_id`). */
|
|
566
|
+
setPayments(payments: MerchantPayment[]): void;
|
|
567
|
+
/**
|
|
568
|
+
* Places the order if needed and charges its real device tenders in
|
|
569
|
+
* sequence (§6.1); stops at the first failure with the order frozen.
|
|
570
|
+
*/
|
|
571
|
+
payIntent(options?: PayIntentOptions): Promise<PayIntentResult>;
|
|
572
|
+
/** Charges a FAILED tender again with a new attempt reference (D25). */
|
|
573
|
+
retryTender(tenderId: string, options?: PayIntentOptions): Promise<PayIntentResult>;
|
|
574
|
+
/** Changes the method of a FAILED tender; then `payIntent()` again. */
|
|
575
|
+
replaceTender(tenderId: string, payment: MerchantPayment, collectAt?: PaymentCollectAt$1): Promise<Order$1>;
|
|
576
|
+
/** "Cancel and refund": reverses device charges, then cancels the order. */
|
|
577
|
+
cancelAndRefund(options?: ReverseAllOptions): Promise<ReversalOutcome[]>;
|
|
578
|
+
/** Voids one tender (operator flow); idempotent per call. */
|
|
579
|
+
voidTender(tenderId: string, reason?: string): Promise<Order$1>;
|
|
580
|
+
/** Refunds one tender: all of it, an amount, or some units. */
|
|
581
|
+
refundTender(tenderId: string, input?: {
|
|
582
|
+
amount?: number;
|
|
583
|
+
reason?: string;
|
|
584
|
+
}): Promise<Order$1>;
|
|
585
|
+
/** @deprecated Use `payIntent({ payment })`. */
|
|
586
|
+
pay(payment: MerchantPayment, options?: PayOptions): Promise<PayIntentResult>;
|
|
446
587
|
/** Confirms intents that waited for the order injection. */
|
|
447
588
|
confirmPaymentsAfterInject(): Promise<import("@fire-spark/payments").PaymentResult[]>;
|
|
448
589
|
/** Cancels or refunds every charge of this order (or flags it manual). */
|
|
449
|
-
reversePayments(): Promise<ReversalOutcome[]>;
|
|
590
|
+
reversePayments(options?: ReverseAllOptions): Promise<ReversalOutcome[]>;
|
|
450
591
|
/** Terminal admin operation (init, test, closeBatch, status, extra). */
|
|
451
592
|
runPaymentTerminal(payment: MerchantPayment, key: string): Promise<import("@fire-spark/payments").TerminalResult>;
|
|
452
593
|
/** Applies lines/redeem, replaying redemption steps and totals. */
|
|
@@ -602,6 +743,24 @@ declare const setLineQuantity: (lines: OrderLine[], lineUid: string, quantity: n
|
|
|
602
743
|
/** Drop a root subtree, then add the replacement tree (may merge by fingerprint). */
|
|
603
744
|
declare const replaceLine: (lines: OrderLine[], lineUid: string, next: OrderLine | OrderLine[]) => OrderLine[];
|
|
604
745
|
//#endregion
|
|
746
|
+
//#region src/order/tenders.d.ts
|
|
747
|
+
/**
|
|
748
|
+
* Digital tender the SDK charges (`DEVICE`, §7.3). `KIOSK`, `COUNTER`,
|
|
749
|
+
* `DOOR` and `OTHER` are in person: the POS, an operator or the courier
|
|
750
|
+
* collects them (§12).
|
|
751
|
+
*/
|
|
752
|
+
declare const isDeviceCharged: (tender: {
|
|
753
|
+
collect_at: string;
|
|
754
|
+
}) => boolean;
|
|
755
|
+
/** Most a REDEMPTION can cover: order total − tip − delivery (D18). */
|
|
756
|
+
declare const redemptionCap: (order: Pick<Order$1, "lines" | "totals">) => number;
|
|
757
|
+
type SimpleTenderPayment = {
|
|
758
|
+
id?: string;
|
|
759
|
+
type?: PaymentTenderInput["method"];
|
|
760
|
+
provider?: PaymentProvider;
|
|
761
|
+
collect_at?: PaymentCollectAt$1;
|
|
762
|
+
};
|
|
763
|
+
//#endregion
|
|
605
764
|
//#region src/services/availability.d.ts
|
|
606
765
|
declare const getAvailability: (scope?: StorefrontMenuScope, options?: ServiceHttpOptions) => Promise<StorefrontAvailability>;
|
|
607
766
|
//#endregion
|
|
@@ -664,7 +823,17 @@ declare const listMenus: (scope?: StorefrontMenuScope, options?: ServiceHttpOpti
|
|
|
664
823
|
declare const listMenusStream: (scope?: StorefrontMenuScope, options?: ListMenusStreamOptions) => AsyncGenerator<StorefrontMenu[], any, any>;
|
|
665
824
|
//#endregion
|
|
666
825
|
//#region src/services/payments.d.ts
|
|
667
|
-
|
|
826
|
+
type ListPaymentsOptions = ServiceHttpOptions & {
|
|
827
|
+
/** Keep `REDEMPTION` payments (points / balance) for redeem flows. */
|
|
828
|
+
includeRedemptions?: boolean;
|
|
829
|
+
};
|
|
830
|
+
/**
|
|
831
|
+
* Payments a customer can pick at checkout. `REDEMPTION` payments are
|
|
832
|
+
* applied through the order's `redeem` entries, never chosen as a method.
|
|
833
|
+
*/
|
|
834
|
+
declare const selectablePayments: <T extends MerchantPayment>(payments: readonly T[]) => T[];
|
|
835
|
+
/** Lists payments without `REDEMPTION` unless `includeRedemptions` is set. */
|
|
836
|
+
declare const listPayments: (input: StorefrontPaymentsListInput, options?: ListPaymentsOptions) => Promise<MerchantPayment[]>;
|
|
668
837
|
type PaymentOperationBody = {
|
|
669
838
|
order_id: string | null;
|
|
670
839
|
attempt_reference: string | null;
|
|
@@ -793,6 +962,11 @@ declare const services: {
|
|
|
793
962
|
validate: typeof validateOrder;
|
|
794
963
|
place: typeof placeOrder;
|
|
795
964
|
recordPayment: typeof recordOrderPayment;
|
|
965
|
+
putPaymentIntent: typeof putPaymentIntent;
|
|
966
|
+
deletePaymentIntent: typeof deletePaymentIntent;
|
|
967
|
+
replaceTender: typeof replaceTender;
|
|
968
|
+
voidTender: typeof voidTender;
|
|
969
|
+
refundTender: typeof refundTender;
|
|
796
970
|
getFulfillment: typeof getOrderFulfillment;
|
|
797
971
|
listFulfillments: typeof listOrderFulfillments;
|
|
798
972
|
};
|
|
@@ -1112,4 +1286,4 @@ declare const validateCardholderName: (value: string) => CardholderNameError | n
|
|
|
1112
1286
|
*/
|
|
1113
1287
|
declare const cardPreviewGroups: (value: string) => CardPreviewSlot[][];
|
|
1114
1288
|
//#endregion
|
|
1115
|
-
export { type ApplyRedeemInput, type AuthConfigureOptions, CARD_BRANDS, type CardBrand, type CardBrandSpec, type CardCvcError, type CardExpiry, type CardExpiryError, type CardNumberError, type CardPreviewSlot, type CardholderNameError, type CreateOrderOptions, type CreateSessionOptions, type CustomizationPath, type CustomizationSession, DEFAULT_RECOMMENDATION_TYPES, type ExchangeOptions, type FlatMenuCategory, type GroupDisplayType, type IdBuilder, type ListMenusStreamOptions, type Menu, type MenuCategoryNode, type MenuLookup, type MilestoneSteps, type MilestoneTrackItem, type ModifierControlType, type ModifierCtx, type ModifierGroupCtx, type NestedMenuCategory, Order, type OrderCustomerSource, type OrderDraft, type OrderIssue, type OrderIssueCode, type OrderLineDiff, type OrderLineIssue, type OrderLineIssueCode, type OrderScope, OrderSyncPendingError, OrderValidationError, type OrderValidationResult, type PayOptions, type PaymentCardBrand, type PaymentRunOptions, type PaymentSessionOptions, type PricingModifier, type Product, type ProductCtx, type QuantitiesByPath, type RecommendationType, RecurringDateCron, type RemoveRedeemInput, type ReorderOrderOptions, type ResetOptions, type ReversalOutcome, RulesEngine, type ScheduleWindow, type SelectionStatus, type SelectionsByPath, type SerializedError, type ServiceHttpOptions, type Snapshot, type StorefrontAccessToken, StorefrontHttpError, type TrackWorkflow, type ValidateOptions, type ValidateOrderAgainstMenuInput, type Variant, type VariantGroup, type VariantGroupCtx, type VariantOptionCtx, type VariantSelection, type VerifyWebhookSignatureInput, type VisitedState, addLines, auth, buildCustomerSnapshot, cardBrandSpec, cardDigits, cardNumberGaps, cardNumberMaxLength, cardPreviewGroups, caretAfterDigits, collectOrderLineDiffs, computeStartingPrice, countCartProducts, coveredAmount, createSession, currentNodes, cvcMaxLength, defaultConditionError, detectCardBrand, flattenMenuCategories, flushLogs, formatCardNumber, formatCvc, formatExpiry, fromOrderLines, genId, genOrderId, getLogContext, getScheduleWindow, indexMenu, isCardNumberComplete, isCardNumberDefinitelyInvalid, isCheckoutFieldFilled, isCvcComplete, isDeviceNotLinked, isExpiryComplete, isKioskUnauthorized, isMilestoneStepDone, isOnSchedule, isOrderValidationError, isPosDeviceNotLinked, isPosUnauthorized, isStorefrontNotFound, isVariantBase, listMenusStream, localizePosError, log, logError, luhnCheck, matchAbsoluteDateOperator, matchBooleanOperator, matchCurrencyOperator, matchEnumOperator, matchNumberOperator, matchRecurringDateOperator, matchRelativeDateOperator, matchStringOperator, milestoneSteps, milestoneTrack, nestMenuCategories, normalizeCardholderName, parseExpiry, paymentMatchesClientConditions, recomputeRedemptions, recomputeTotals, remainingAmount, removeLine, replaceLine, resolveCheckout, reversePayment, runPaymentAttempt, serializeError, services, setLineQuantity, storefrontJson, stripRedemptionLines, toOrderLines, toPaymentCardBrand, validateCardNumber, validateCardholderName, validateCvc, validateExpiry, validateOrderAgainstMenu, verifyWebhookSignature, visitedStates };
|
|
1289
|
+
export { type ApplyRedeemInput, type AuthConfigureOptions, CARD_BRANDS, type CardBrand, type CardBrandSpec, type CardCvcError, type CardExpiry, type CardExpiryError, type CardNumberError, type CardPreviewSlot, type CardholderNameError, type CreateOrderOptions, type CreateSessionOptions, type CustomizationPath, type CustomizationSession, DEFAULT_RECOMMENDATION_TYPES, type ExchangeOptions, type FailedCharge, type FlatMenuCategory, type GroupDisplayType, type IdBuilder, type ListMenusStreamOptions, type ListPaymentsOptions, type Menu, type MenuCategoryNode, type MenuLookup, type MilestoneSteps, type MilestoneTrackItem, type ModifierControlType, type ModifierCtx, type ModifierGroupCtx, type NestedMenuCategory, Order, type OrderCustomerSource, type OrderDraft, type OrderIssue, type OrderIssueCode, type OrderLineDiff, type OrderLineIssue, type OrderLineIssueCode, type OrderScope, OrderSyncPendingError, OrderValidationError, type OrderValidationResult, type PayIntentOptions, type PayIntentResult, type PayOptions, type PaymentCardBrand, type PaymentProgressEvent, type PaymentProgressListener, type PaymentRunOptions, type PaymentSessionOptions, type PricingModifier, type Product, type ProductCtx, type QuantitiesByPath, type RecommendationType, RecurringDateCron, type RemoveRedeemInput, type ReorderOrderOptions, type ResetOptions, type ReversalOutcome, type ReverseAllOptions, RulesEngine, type ScheduleWindow, type SelectionStatus, type SelectionsByPath, type SerializedError, type ServiceHttpOptions, type SimpleTenderPayment, type Snapshot, type StorefrontAccessToken, type StorefrontErrorDetails, StorefrontHttpError, type TrackWorkflow, type ValidateOptions, type ValidateOrderAgainstMenuInput, type Variant, type VariantGroup, type VariantGroupCtx, type VariantOptionCtx, type VariantSelection, type VerifyWebhookSignatureInput, type VisitedState, addLines, auth, buildCustomerSnapshot, cardBrandSpec, cardDigits, cardNumberGaps, cardNumberMaxLength, cardPreviewGroups, caretAfterDigits, collectOrderLineDiffs, computeStartingPrice, countCartProducts, coveredAmount, createSession, currentNodes, cvcMaxLength, defaultConditionError, detectCardBrand, flattenMenuCategories, flushLogs, formatCardNumber, formatCvc, formatExpiry, fromOrderLines, genId, genOrderId, getLogContext, getScheduleWindow, indexMenu, isCardNumberComplete, isCardNumberDefinitelyInvalid, isCheckoutFieldFilled, isCvcComplete, isDeviceCharged, isDeviceNotLinked, isExpiryComplete, isKioskUnauthorized, isMilestoneStepDone, isOnSchedule, isOrderValidationError, isPosDeviceNotLinked, isPosUnauthorized, isRealPaymentMethod, isStorefrontNotFound, isVariantBase, listMenusStream, localizePosError, log, logError, luhnCheck, matchAbsoluteDateOperator, matchBooleanOperator, matchCurrencyOperator, matchEnumOperator, matchNumberOperator, matchRecurringDateOperator, matchRelativeDateOperator, matchStringOperator, milestoneSteps, milestoneTrack, nestMenuCategories, normalizeCardholderName, parseExpiry, paymentMatchesClientConditions, recomputeRedemptions, recomputeTotals, redemptionCap, remainingAmount, removeLine, replaceLine, resolveCheckout, reversePayment, runPaymentAttempt, selectablePayments, serializeError, services, setLineQuantity, storefrontJson, stripRedemptionLines, toOrderLines, toPaymentCardBrand, validateCardNumber, validateCardholderName, validateCvc, validateExpiry, validateOrderAgainstMenu, verifyWebhookSignature, visitedStates };
|