@final-commerce/command-frame 0.4.0-preprod.1 → 0.4.0-staging.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/README.md +30 -38
- package/dist/actions/add-product-to-cart/types.d.ts +13 -1
- package/dist/actions/apply-transition/mock.d.ts +1 -1
- package/dist/actions/apply-transition/mock.js +18 -8
- package/dist/actions/apply-transition/types.d.ts +4 -6
- package/dist/actions/extension-payment/types.d.ts +2 -2
- package/dist/actions/get-available-transitions/mock.d.ts +3 -5
- package/dist/actions/get-available-transitions/mock.js +12 -24
- package/dist/actions/integration-payment/types.d.ts +0 -2
- package/dist/actions/partial-payment/types.d.ts +2 -2
- package/dist/actions/redeem-payment/types.d.ts +0 -2
- package/dist/actions/terminal-payment/types.d.ts +3 -3
- package/dist/actions/update-cart-item-quantity/types.d.ts +8 -1
- package/dist/demo/database.d.ts +2 -3
- package/dist/demo/database.js +250 -310
- package/dist/index.d.ts +1 -3
- package/dist/index.js +0 -2
- package/dist/projects/render/mocks.js +0 -4
- package/dist/projects/render/types.d.ts +1 -3
- package/dist/pubsub/topics/orders/index.d.ts +2 -2
- package/dist/pubsub/topics/orders/index.js +24 -29
- package/dist/pubsub/topics/orders/types.d.ts +14 -16
- package/dist/pubsub/topics/orders/types.js +6 -7
- package/package.json +2 -2
- package/dist/actions/void-order/action.d.ts +0 -6
- package/dist/actions/void-order/action.js +0 -8
- package/dist/actions/void-order/mock.d.ts +0 -2
- package/dist/actions/void-order/mock.js +0 -23
- package/dist/actions/void-order/types.d.ts +0 -27
- package/dist/actions/void-order/types.js +0 -1
- package/dist/pubsub/topics/orders/order-voided/types.d.ts +0 -14
- package/dist/pubsub/topics/orders/order-voided/types.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,6 @@ export declare const command: {
|
|
|
33
33
|
readonly parkOrder: import(".").ParkOrder;
|
|
34
34
|
readonly resumeParkedOrder: import(".").ResumeParkedOrder;
|
|
35
35
|
readonly deleteParkedOrder: import(".").DeleteParkedOrder;
|
|
36
|
-
readonly voidOrder: import(".").VoidOrder;
|
|
37
36
|
readonly cashPayment: import(".").CashPayment;
|
|
38
37
|
readonly getCashRoundingAmount: import(".").GetCashRoundingAmount;
|
|
39
38
|
readonly tapToPayPayment: import(".").TapToPayPayment;
|
|
@@ -162,7 +161,6 @@ export type { ClearCart, ClearCartResponse } from './actions/clear-cart/types';
|
|
|
162
161
|
export type { ParkOrder, ParkOrderResponse } from './actions/park-order/types';
|
|
163
162
|
export type { ResumeParkedOrder, ResumeParkedOrderParams, ResumeParkedOrderResponse, } from './actions/resume-parked-order/types';
|
|
164
163
|
export type { DeleteParkedOrder, DeleteParkedOrderParams, DeleteParkedOrderResponse, } from './actions/delete-parked-order/types';
|
|
165
|
-
export type { VoidOrder, VoidOrderParams, VoidOrderResponse, VoidOrderOutcome } from './actions/void-order/types';
|
|
166
164
|
export type { CashPayment, CashPaymentParams, CashPaymentResponse } from './actions/cash-payment/types';
|
|
167
165
|
export type { GetCashRoundingAmount, GetCashRoundingAmountParams, GetCashRoundingAmountResponse, } from './actions/get-cash-rounding-amount/types';
|
|
168
166
|
export type { TapToPayPayment, TapToPayPaymentParams, TapToPayPaymentResponse, } from './actions/tap-to-pay-payment/types';
|
|
@@ -242,7 +240,7 @@ export { transactionsTopic } from './pubsub/topics/transactions';
|
|
|
242
240
|
export { categoriesTopic } from './pubsub/topics/categories';
|
|
243
241
|
export { attributesTopic } from './pubsub/topics/attributes';
|
|
244
242
|
export type { CustomerCreatedPayload, CustomerUpdatedPayload, CustomerNoteAddedPayload, CustomerNoteDeletedPayload, CustomerAssignedPayload, CustomerUnassignedPayload, CustomerActiveSetPayload, CustomerActiveGetPayload, CustomerCreatedEvent, CustomerUpdatedEvent, CustomerNoteAddedEvent, CustomerNoteDeletedEvent, CustomerAssignedEvent, CustomerUnassignedEvent, CustomerActiveSetEvent, CustomerActiveGetEvent, CustomersEventType, CustomersEventPayload, } from './pubsub/topics/customers/types';
|
|
245
|
-
export type { OrderCreatedPayload, OrderUpdatedPayload,
|
|
243
|
+
export type { OrderCreatedPayload, OrderUpdatedPayload, OrderActiveSetPayload, OrderActiveGetPayload, OrderCreatedEvent, OrderUpdatedEvent, OrderActiveSetEvent, OrderActiveGetEvent, OrderStateTransitionCompletedPayload, OrderStateTransitionBlockedPayload, OrderStateTransitionCompletedEvent, OrderStateTransitionBlockedEvent, OrdersEventType, OrdersEventPayload, } from './pubsub/topics/orders/types';
|
|
246
244
|
export type { RefundCreatedPayload, RefundUpdatedPayload, RefundActiveSetPayload, RefundActiveGetPayload, RefundCreatedEvent, RefundUpdatedEvent, RefundActiveSetEvent, RefundActiveGetEvent, RefundsEventType, RefundsEventPayload, } from './pubsub/topics/refunds/types';
|
|
247
245
|
export type { ProductCreatedPayload, ProductUpdatedPayload, ProductSetActivePayload, ProductGetActivePayload, ProductCreatedEvent, ProductUpdatedEvent, ProductSetActiveEvent, ProductGetActiveEvent, ProductsEventType, ProductsEventPayload, } from './pubsub/topics/products/types';
|
|
248
246
|
export type { OutletActiveSetPayload, OutletActiveGetPayload, OutletActiveSetEvent, OutletActiveGetEvent, OutletEventType, OutletEventPayload, } from './pubsub/topics/outlet/types';
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,6 @@ import { clearCart } from './actions/clear-cart/action';
|
|
|
33
33
|
import { parkOrder } from './actions/park-order/action';
|
|
34
34
|
import { resumeParkedOrder } from './actions/resume-parked-order/action';
|
|
35
35
|
import { deleteParkedOrder } from './actions/delete-parked-order/action';
|
|
36
|
-
import { voidOrder } from './actions/void-order/action';
|
|
37
36
|
import { cashPayment } from './actions/cash-payment/action';
|
|
38
37
|
import { getCashRoundingAmount } from './actions/get-cash-rounding-amount/action';
|
|
39
38
|
import { tapToPayPayment } from './actions/tap-to-pay-payment/action';
|
|
@@ -164,7 +163,6 @@ export const command = {
|
|
|
164
163
|
parkOrder,
|
|
165
164
|
resumeParkedOrder,
|
|
166
165
|
deleteParkedOrder,
|
|
167
|
-
voidOrder,
|
|
168
166
|
cashPayment,
|
|
169
167
|
getCashRoundingAmount,
|
|
170
168
|
tapToPayPayment,
|
|
@@ -31,7 +31,6 @@ import { mockCashPayment } from '../../actions/cash-payment/mock';
|
|
|
31
31
|
import { mockGetCashRoundingAmount } from '../../actions/get-cash-rounding-amount/mock';
|
|
32
32
|
import { mockClearCart } from '../../actions/clear-cart/mock';
|
|
33
33
|
import { mockDeleteParkedOrder } from '../../actions/delete-parked-order/mock';
|
|
34
|
-
import { mockVoidOrder } from '../../actions/void-order/mock';
|
|
35
34
|
import { mockExampleFunction } from '../../actions/example-function/mock';
|
|
36
35
|
import { mockGetCategories } from '../../actions/get-categories/mock';
|
|
37
36
|
import { mockGetContext } from '../../actions/get-context/mock';
|
|
@@ -92,7 +91,6 @@ import { mockSetActiveUser } from '../../actions/set-active-user/mock';
|
|
|
92
91
|
import { mockSetActiveRefund } from '../../actions/set-active-refund/mock';
|
|
93
92
|
import { canTransitionMock } from '../../actions/can-transition/mock';
|
|
94
93
|
import { getAvailableTransitionsMock } from '../../actions/get-available-transitions/mock';
|
|
95
|
-
import { applyTransitionMock } from '../../actions/apply-transition/mock';
|
|
96
94
|
import { mockGetSmartGridLayout } from '../../actions/get-smart-grid-layout/mock';
|
|
97
95
|
import { mockSaveSmartGridLayout } from '../../actions/save-smart-grid-layout/mock';
|
|
98
96
|
import { mockSendEmail } from '../../actions/send-email/mock';
|
|
@@ -125,7 +123,6 @@ export const RENDER_MOCKS = {
|
|
|
125
123
|
getCashRoundingAmount: mockGetCashRoundingAmount,
|
|
126
124
|
clearCart: mockClearCart,
|
|
127
125
|
deleteParkedOrder: mockDeleteParkedOrder,
|
|
128
|
-
voidOrder: mockVoidOrder,
|
|
129
126
|
exampleFunction: mockExampleFunction,
|
|
130
127
|
getCategories: mockGetCategories,
|
|
131
128
|
getContext: mockGetContext,
|
|
@@ -194,7 +191,6 @@ export const RENDER_MOCKS = {
|
|
|
194
191
|
removeNonRevenueItem: (params) => Promise.resolve({ success: true, externalId: params.externalId, timestamp: new Date().toISOString() }),
|
|
195
192
|
canTransition: canTransitionMock,
|
|
196
193
|
getAvailableTransitions: getAvailableTransitionsMock,
|
|
197
|
-
applyTransition: applyTransitionMock,
|
|
198
194
|
getSmartGridLayout: mockGetSmartGridLayout,
|
|
199
195
|
saveSmartGridLayout: mockSaveSmartGridLayout,
|
|
200
196
|
sendEmail: mockSendEmail,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder,
|
|
1
|
+
import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, InitiateRefund, CashPayment, GetCashRoundingAmount, TapToPayPayment, TerminalPayment, VendaraPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields, GetSecretsKeys, GetSecretVal, SetSecretVal, GetUsers, GetRoles, RemoveCartDiscount, GetActiveOrder, GetActiveCustomer, SetActiveCustomer, GetActiveOutlet, GetActiveStation, GetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem, CanTransition, GetAvailableTransitions, IntegrationPayment, GetSmartGridLayout, SaveSmartGridLayout, SendEmail, SendSms } from '../../index';
|
|
2
2
|
import type { OpenExtensionOverlay } from '../../actions/open-extension-overlay/types';
|
|
3
3
|
import type { ResolveExtensionOverlay } from '../../actions/resolve-extension-overlay/types';
|
|
4
4
|
export interface RenderProviderActions {
|
|
@@ -34,7 +34,6 @@ export interface RenderProviderActions {
|
|
|
34
34
|
parkOrder: ParkOrder;
|
|
35
35
|
resumeParkedOrder: ResumeParkedOrder;
|
|
36
36
|
deleteParkedOrder: DeleteParkedOrder;
|
|
37
|
-
voidOrder: VoidOrder;
|
|
38
37
|
initiateRefund: InitiateRefund;
|
|
39
38
|
openExtensionOverlay: OpenExtensionOverlay;
|
|
40
39
|
resolveExtensionOverlay: ResolveExtensionOverlay;
|
|
@@ -98,7 +97,6 @@ export interface RenderProviderActions {
|
|
|
98
97
|
removeNonRevenueItem: RemoveNonRevenueItem;
|
|
99
98
|
canTransition: CanTransition;
|
|
100
99
|
getAvailableTransitions: GetAvailableTransitions;
|
|
101
|
-
applyTransition: ApplyTransition;
|
|
102
100
|
getSmartGridLayout: GetSmartGridLayout;
|
|
103
101
|
saveSmartGridLayout: SaveSmartGridLayout;
|
|
104
102
|
sendEmail: SendEmail;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Orders Topic Definition
|
|
3
3
|
* Defines the orders topic and its available event types
|
|
4
4
|
*/
|
|
5
|
-
import type { TopicDefinition } from
|
|
5
|
+
import type { TopicDefinition } from "../../types";
|
|
6
6
|
export declare const ordersTopic: TopicDefinition;
|
|
7
|
-
export * from
|
|
7
|
+
export * from "./types";
|
|
@@ -3,46 +3,41 @@
|
|
|
3
3
|
* Defines the orders topic and its available event types
|
|
4
4
|
*/
|
|
5
5
|
export const ordersTopic = {
|
|
6
|
-
id:
|
|
7
|
-
name:
|
|
8
|
-
description:
|
|
6
|
+
id: "orders",
|
|
7
|
+
name: "Orders",
|
|
8
|
+
description: "Topic for order-related events",
|
|
9
9
|
eventTypes: [
|
|
10
10
|
{
|
|
11
|
-
id:
|
|
12
|
-
name:
|
|
13
|
-
description:
|
|
11
|
+
id: "order-created",
|
|
12
|
+
name: "Order Created",
|
|
13
|
+
description: "Published when a new order is created"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
id:
|
|
17
|
-
name:
|
|
18
|
-
description:
|
|
16
|
+
id: "order-updated",
|
|
17
|
+
name: "Order Updated",
|
|
18
|
+
description: "Published when an order is updated"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
id:
|
|
22
|
-
name:
|
|
23
|
-
description:
|
|
21
|
+
id: "set-active-order",
|
|
22
|
+
name: "Set Active Order",
|
|
23
|
+
description: "Published when the active order is set in POS state"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
id:
|
|
27
|
-
name:
|
|
28
|
-
description:
|
|
26
|
+
id: "get-active-order",
|
|
27
|
+
name: "Get Active Order",
|
|
28
|
+
description: "Published when the active order is retrieved for listeners"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
id:
|
|
32
|
-
name:
|
|
33
|
-
description:
|
|
31
|
+
id: "state-transition-completed",
|
|
32
|
+
name: "State Transition Completed",
|
|
33
|
+
description: "Published when an order state transition completes successfully"
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
id:
|
|
37
|
-
name:
|
|
38
|
-
description:
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
id: 'order-voided',
|
|
42
|
-
name: 'Order Voided',
|
|
43
|
-
description: 'Published when an open order is voided (pure void, or captured legs refunded)',
|
|
44
|
-
},
|
|
45
|
-
],
|
|
36
|
+
id: "state-transition-blocked",
|
|
37
|
+
name: "State Transition Blocked",
|
|
38
|
+
description: "Published when an order state transition is blocked by the state machine"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
46
41
|
};
|
|
47
42
|
// Re-export types
|
|
48
|
-
export * from
|
|
43
|
+
export * from "./types";
|
|
@@ -2,19 +2,17 @@
|
|
|
2
2
|
* Orders Topic Types
|
|
3
3
|
* Aggregated types for all order-related events
|
|
4
4
|
*/
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
16
|
-
import type {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export type OrdersEventPayload = OrderCreatedPayload | OrderUpdatedPayload | OrderVoidedPayload | OrderActiveSetPayload | OrderActiveGetPayload | OrderStateTransitionCompletedPayload | OrderStateTransitionBlockedPayload;
|
|
20
|
-
export type OrdersEventType = 'order-created' | 'order-updated' | 'order-voided' | 'set-active-order' | 'get-active-order' | 'state-transition-completed' | 'state-transition-blocked';
|
|
5
|
+
export * from "./order-created/types";
|
|
6
|
+
export * from "./order-updated/types";
|
|
7
|
+
export * from "./set-active-order/types";
|
|
8
|
+
export * from "./get-active-order/types";
|
|
9
|
+
export * from "./state-transition-completed/types";
|
|
10
|
+
export * from "./state-transition-blocked/types";
|
|
11
|
+
import type { OrderCreatedPayload } from "./order-created/types";
|
|
12
|
+
import type { OrderUpdatedPayload } from "./order-updated/types";
|
|
13
|
+
import type { OrderActiveSetPayload } from "./set-active-order/types";
|
|
14
|
+
import type { OrderActiveGetPayload } from "./get-active-order/types";
|
|
15
|
+
import type { OrderStateTransitionCompletedPayload } from "./state-transition-completed/types";
|
|
16
|
+
import type { OrderStateTransitionBlockedPayload } from "./state-transition-blocked/types";
|
|
17
|
+
export type OrdersEventPayload = OrderCreatedPayload | OrderUpdatedPayload | OrderActiveSetPayload | OrderActiveGetPayload | OrderStateTransitionCompletedPayload | OrderStateTransitionBlockedPayload;
|
|
18
|
+
export type OrdersEventType = "order-created" | "order-updated" | "set-active-order" | "get-active-order" | "state-transition-completed" | "state-transition-blocked";
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
* Aggregated types for all order-related events
|
|
4
4
|
*/
|
|
5
5
|
// Re-export all event types
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from './state-transition-blocked/types';
|
|
6
|
+
export * from "./order-created/types";
|
|
7
|
+
export * from "./order-updated/types";
|
|
8
|
+
export * from "./set-active-order/types";
|
|
9
|
+
export * from "./get-active-order/types";
|
|
10
|
+
export * from "./state-transition-completed/types";
|
|
11
|
+
export * from "./state-transition-blocked/types";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@final-commerce/command-frame",
|
|
3
|
-
"version": "0.4.0-
|
|
3
|
+
"version": "0.4.0-staging.1",
|
|
4
4
|
"description": "Commands Frame library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"ignoreBranchesMissingTickets": true
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@final-commerce/common": "
|
|
60
|
+
"@final-commerce/common": "2.2.0-staging.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@commitlint/cli": "^19.0.0",
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { MOCK_ORDERS, mockPublishEvent } from '../../demo/database';
|
|
2
|
-
// Payment states in which an order is still open — mirrors the runtime gate
|
|
3
|
-
// (kaching's OPEN_PAYMENT_STATES / handler.ts). Anything outside this set
|
|
4
|
-
// (paid, partially_refunded, refunded, voided, or unknown) is ORDER_NOT_VOIDABLE.
|
|
5
|
-
const OPEN_PAYMENT_STATES = ['unpaid', 'payment_pending', 'partially_paid'];
|
|
6
|
-
export const mockVoidOrder = async (params) => {
|
|
7
|
-
console.log('[Mock] voidOrder called', params);
|
|
8
|
-
const order = params?.orderId ? MOCK_ORDERS.find((o) => o._id === params.orderId) : MOCK_ORDERS[0];
|
|
9
|
-
if (!order) {
|
|
10
|
-
throw new Error(`Order with ID ${params?.orderId} not found`);
|
|
11
|
-
}
|
|
12
|
-
const orderId = order._id;
|
|
13
|
-
// Only OPEN orders are voidable — mirror the runtime gate.
|
|
14
|
-
if (!OPEN_PAYMENT_STATES.includes(order.paymentState)) {
|
|
15
|
-
throw new Error(`ORDER_NOT_VOIDABLE: order ${orderId} is '${order.paymentState}' — use the refund flow for completed orders`);
|
|
16
|
-
}
|
|
17
|
-
const hasCapturedLegs = (order.paymentMethods?.length ?? 0) > 0;
|
|
18
|
-
const outcome = hasCapturedLegs ? 'refunded' : 'voided';
|
|
19
|
-
order.paymentState = outcome;
|
|
20
|
-
order.fulfillmentState = 'cancelled';
|
|
21
|
-
mockPublishEvent('orders', 'order-voided', { orderId, outcome, reason: params?.reason });
|
|
22
|
-
return { success: true, orderId, outcome, timestamp: new Date().toISOString() };
|
|
23
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { CFTransitionResult } from '../../common-types/order-state';
|
|
2
|
-
export type VoidOrderOutcome = 'voided' | 'refunded';
|
|
3
|
-
export interface VoidOrderParams {
|
|
4
|
-
/** Order to void; defaults to the active order. */
|
|
5
|
-
orderId?: string;
|
|
6
|
-
/**
|
|
7
|
-
* Optional cashier-facing reason. On a pure void, recorded on the void audit
|
|
8
|
-
* row and carried on the `order-voided` event. On the refund branch it rides
|
|
9
|
-
* the event only — the refund dispatcher does not consume it.
|
|
10
|
-
*/
|
|
11
|
-
reason?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface VoidOrderResponse {
|
|
14
|
-
success: boolean;
|
|
15
|
-
orderId: string;
|
|
16
|
-
/**
|
|
17
|
-
* `voided` — nothing was captured; pure state transition to voided × cancelled.
|
|
18
|
-
* `refunded` — captured split legs were refunded to their original tenders;
|
|
19
|
-
* order lands refunded × cancelled (financially equivalent to a
|
|
20
|
-
* void, but the capture + payout stay on the audit trail).
|
|
21
|
-
*/
|
|
22
|
-
outcome: VoidOrderOutcome;
|
|
23
|
-
timestamp: string;
|
|
24
|
-
/** Present when the state machine blocked or forced the transition. */
|
|
25
|
-
transitionResult?: CFTransitionResult;
|
|
26
|
-
}
|
|
27
|
-
export type VoidOrder = (params?: VoidOrderParams) => Promise<VoidOrderResponse>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { TopicEvent } from '../../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Order Voided Event Types
|
|
4
|
-
*/
|
|
5
|
-
export interface OrderVoidedPayload {
|
|
6
|
-
orderId: string;
|
|
7
|
-
/** 'voided' = nothing captured; 'refunded' = captured legs were refunded. */
|
|
8
|
-
outcome: 'voided' | 'refunded';
|
|
9
|
-
reason?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Typed event for order-voided
|
|
13
|
-
*/
|
|
14
|
-
export type OrderVoidedEvent = TopicEvent<OrderVoidedPayload>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|