@dodobrands/pos-receipts-plugin-contracts 5.12.11 → 5.13.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.cjs +1 -103
- package/dist/index.d.cts +448 -172
- package/dist/index.d.ts +448 -172
- package/dist/index.js +1 -70
- package/package.json +2 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,48 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
cashierName?: string;
|
|
1
|
+
/**
|
|
2
|
+
* Enum with supported business types.
|
|
3
|
+
*/
|
|
4
|
+
declare enum Business {
|
|
5
|
+
/**
|
|
6
|
+
* Dodo Pizza business.
|
|
7
|
+
*/
|
|
8
|
+
DodoPizza = "dodoPizza",
|
|
9
|
+
/**
|
|
10
|
+
* Drinkit business.
|
|
11
|
+
*/
|
|
12
|
+
Drinkit = "drinkit",
|
|
13
|
+
/**
|
|
14
|
+
* Doner42 business.
|
|
15
|
+
*/
|
|
16
|
+
Doner42 = "doner42"
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Card information.
|
|
21
|
+
*/
|
|
22
|
+
type CardInfo = {
|
|
23
|
+
/**
|
|
24
|
+
* Masked card number, e.g. ************1234.
|
|
25
|
+
*/
|
|
26
|
+
maskedPan: string;
|
|
27
|
+
/**
|
|
28
|
+
* Card expiration date in format MM/YY.
|
|
29
|
+
*/
|
|
30
|
+
expDate: string | null;
|
|
31
|
+
};
|
|
26
32
|
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
taxpayer?: Taxpayer;
|
|
33
|
-
/** The physical address where organization has been registered */
|
|
34
|
-
registeredAddress?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Country model
|
|
35
|
+
*/
|
|
36
|
+
interface Country {
|
|
37
|
+
code: CountryIsoCode;
|
|
35
38
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
/** Country code based on [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_numeric)
|
|
40
|
+
* @example 643, 705, 566
|
|
41
|
+
*/
|
|
42
|
+
type CountryIsoCode = number;
|
|
43
|
+
declare enum KnownCountryCodes {
|
|
44
|
+
Belarus = 112,
|
|
45
|
+
Kazakhstan = 398,
|
|
46
|
+
Russia = 643,
|
|
47
|
+
Uzbekistan = 860,
|
|
48
|
+
Kyrgyzstan = 417
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
type ProductSpecificData = UzbekistanProductData | KazakhstanProductData | KyrgyzstanProductData | null;
|
|
@@ -70,169 +73,191 @@ interface KyrgyzstanProductData {
|
|
|
70
73
|
/** `product` — if entry is resold, `service` — if entry is prepared in-house. */
|
|
71
74
|
entryType?: 'product' | 'service';
|
|
72
75
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
type MessageMetadata = {
|
|
77
|
+
area?: string;
|
|
78
|
+
};
|
|
79
|
+
type MessageMetadataWith<T> = MessageMetadata & T;
|
|
80
|
+
type ErrorMessageMetadataWith<T> = MessageMetadataWith<T> & {
|
|
81
|
+
error?: Error;
|
|
82
|
+
};
|
|
83
|
+
type CreateScopeOptions = {
|
|
84
|
+
/** If this feature is on: each time when the logger is created,
|
|
85
|
+
* all enabled plugins will launch the optional `registerLogger` call.
|
|
86
|
+
*
|
|
87
|
+
* This allows the plugins to respect the scope of child loggers and select
|
|
88
|
+
* which logger to use under-the-hood while being registered from the original logger.
|
|
89
|
+
*
|
|
90
|
+
* Defaults to `false` */
|
|
91
|
+
propagateUpdatedScopeToPlugins?: boolean;
|
|
92
|
+
};
|
|
93
|
+
interface ILogger<TScope extends Record<string, unknown> = never> {
|
|
94
|
+
createScope<TNewScope>(scope: TNewScope, options?: CreateScopeOptions): ILogger<TScope & TNewScope>;
|
|
95
|
+
diminishScope<TOldScope extends Record<string, unknown>>(scopeToDiminish: TOldScope, options?: CreateScopeOptions): ILogger<Omit<TScope, keyof TOldScope>>;
|
|
96
|
+
trace<T>(message: string, metadata?: MessageMetadataWith<T>): void;
|
|
97
|
+
debug<T>(message: string, metadata?: MessageMetadataWith<T>): void;
|
|
98
|
+
info<T>(message: string, metadata?: MessageMetadataWith<T>): void;
|
|
99
|
+
warn<T>(message: string, metadata?: MessageMetadataWith<T>): void;
|
|
100
|
+
error<T>(message: string, error?: unknown, metadata?: ErrorMessageMetadataWith<T>): void;
|
|
101
|
+
fatal<T>(message: string, error?: unknown, metadata?: ErrorMessageMetadataWith<T>): void;
|
|
82
102
|
}
|
|
83
103
|
|
|
84
104
|
/**
|
|
85
|
-
*
|
|
86
|
-
* Delete after moving all plugins to using new HandleRefundRequest and inner receipt property
|
|
105
|
+
* Unique identifier of the transaction
|
|
87
106
|
*/
|
|
88
|
-
type
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
* */
|
|
99
|
-
departmentUtcOffsetMinutes: number;
|
|
100
|
-
/** Business is the name of the business/franchise we work with. E.g. Dodo Pizza, Doner 42, Drinkit */
|
|
101
|
-
business: Business;
|
|
102
|
-
country: Country;
|
|
103
|
-
cashboxId: string;
|
|
104
|
-
/** Determines should plugin handle sale with paper receipt or not. */
|
|
105
|
-
isPrintingPaperReceiptsDisabled: boolean;
|
|
106
|
-
infrastructure: {
|
|
107
|
-
logger?: ILogger;
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/** Information which may be required to make Z-report. */
|
|
112
|
-
interface MakeZReportOptions {
|
|
113
|
-
cashierName?: string;
|
|
114
|
-
withoutPaper?: boolean;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
interface IDigitalReceipt {
|
|
118
|
-
views: DigitalReceiptView[];
|
|
119
|
-
fields?: Fields;
|
|
120
|
-
version: 'v1';
|
|
121
|
-
}
|
|
122
|
-
type DigitalReceiptViewType = 'mobile' | 'email' | 'link' | 'pos';
|
|
123
|
-
type DigitalReceiptView = {
|
|
124
|
-
type: DigitalReceiptViewType;
|
|
125
|
-
data: string;
|
|
126
|
-
};
|
|
127
|
-
type Fields = {
|
|
128
|
-
type: 'FPtr10';
|
|
129
|
-
fnNumber: string;
|
|
130
|
-
fiscalDocumentSign: string;
|
|
131
|
-
fiscalDocumentNumber: string;
|
|
107
|
+
type TransactionId = string;
|
|
108
|
+
type TransactionIdIdentifier = {
|
|
109
|
+
/**
|
|
110
|
+
* Unique identifier of the transaction
|
|
111
|
+
*/
|
|
112
|
+
transactionId: TransactionId;
|
|
113
|
+
/**
|
|
114
|
+
* Retrieval Reference Number (RRN) of the transaction
|
|
115
|
+
*/
|
|
116
|
+
rrn?: never;
|
|
132
117
|
};
|
|
133
|
-
|
|
134
|
-
/** Other types of receipts may appear here */
|
|
135
|
-
type PrintedReceipt = PrintedFiscalReceipt | PrintedNonFiscalReceipt;
|
|
136
|
-
interface PrintedFiscalReceipt {
|
|
137
|
-
/** Inner receipt ID from POS device */
|
|
138
|
-
id: string;
|
|
139
|
-
/** Type of printed receipt */
|
|
140
|
-
type: 'Fiscal';
|
|
141
|
-
/** Serialized (JSON) body of receipt. Optional */
|
|
142
|
-
body?: string;
|
|
143
|
-
/** Data that allows us to show digital representations of the receipt */
|
|
144
|
-
digitalReceipt?: IDigitalReceipt;
|
|
145
|
-
}
|
|
146
|
-
interface PrintedNonFiscalReceipt {
|
|
147
|
-
/** Type of printed receipt */
|
|
148
|
-
type: 'NonFiscal';
|
|
149
|
-
/** Data that allows us to show digital representations of the receipt */
|
|
150
|
-
digitalReceipt?: IDigitalReceipt;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
interface PrintedRefundReceipt {
|
|
154
|
-
/** Inner receipt ID from POS device */
|
|
155
|
-
id: string;
|
|
156
|
-
/** Type of printed receipt */
|
|
157
|
-
type: 'Refund';
|
|
158
|
-
/** Serialized (JSON) body of receipt. Optional */
|
|
159
|
-
body?: string;
|
|
160
|
-
/** Data that allows us to show digital representations of the receipt */
|
|
161
|
-
digitalReceipt?: IDigitalReceipt;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/** Options that can be used to print any text. Input may differ from country and tenant. */
|
|
165
|
-
interface PrintTextOptions {
|
|
166
|
-
/** Multi-lined text to show in the receipt or separately. */
|
|
167
|
-
data?: string[];
|
|
168
|
-
}
|
|
169
|
-
|
|
170
118
|
/**
|
|
171
|
-
*
|
|
172
|
-
* please look for details in existing plugins
|
|
173
|
-
* note: should be default export
|
|
119
|
+
* Retrieval Reference Number (RRN) of the transaction
|
|
174
120
|
*/
|
|
175
|
-
|
|
121
|
+
type RRN = string;
|
|
122
|
+
type RRNIdentifier = {
|
|
176
123
|
/**
|
|
177
|
-
*
|
|
124
|
+
* Unique identifier of the transaction
|
|
178
125
|
*/
|
|
179
|
-
|
|
126
|
+
transactionId?: never;
|
|
180
127
|
/**
|
|
181
|
-
*
|
|
128
|
+
* Retrieval Reference Number (RRN) of the transaction
|
|
182
129
|
*/
|
|
183
|
-
|
|
130
|
+
rrn: RRN;
|
|
131
|
+
};
|
|
132
|
+
type OperationIdentifiers = TransactionIdIdentifier | RRNIdentifier | {
|
|
184
133
|
/**
|
|
185
|
-
*
|
|
134
|
+
* Unique identifier of the transaction
|
|
186
135
|
*/
|
|
187
|
-
|
|
136
|
+
transactionId: TransactionId;
|
|
188
137
|
/**
|
|
189
|
-
*
|
|
138
|
+
* Retrieval Reference Number (RRN) of the transaction
|
|
190
139
|
*/
|
|
191
|
-
|
|
140
|
+
rrn: RRN;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
type PaymentInfo = OperationIdentifiers;
|
|
144
|
+
|
|
145
|
+
type QRIdType = 'qrId';
|
|
146
|
+
type HTMLContentType = 'htmlContent';
|
|
147
|
+
type QRIdData = {
|
|
148
|
+
type: QRIdType;
|
|
192
149
|
/**
|
|
193
|
-
*
|
|
150
|
+
* URL or ID of the QR code.
|
|
194
151
|
*/
|
|
195
|
-
|
|
152
|
+
qrId: string;
|
|
153
|
+
};
|
|
154
|
+
type HTMLContentData = {
|
|
155
|
+
type: HTMLContentType;
|
|
196
156
|
/**
|
|
197
|
-
*
|
|
198
|
-
* (usually, also final report printed)
|
|
157
|
+
* HTML content that can be used to display the QR code.
|
|
199
158
|
*/
|
|
200
|
-
|
|
159
|
+
html: string;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* QR code data.
|
|
163
|
+
*/
|
|
164
|
+
type QRData = QRIdData | HTMLContentData;
|
|
165
|
+
|
|
166
|
+
type TextSlipType = 'text';
|
|
167
|
+
type TextSlipData = {
|
|
168
|
+
type: TextSlipType;
|
|
169
|
+
textLines: string[];
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Represents the slip data for CARD payment request
|
|
173
|
+
* In the future it could be extended with other types like HtmlSlipData or PdfSlipData
|
|
174
|
+
*/
|
|
175
|
+
type SlipData = TextSlipData;
|
|
176
|
+
|
|
177
|
+
type QrPaymentResult = {
|
|
201
178
|
/**
|
|
202
|
-
*
|
|
179
|
+
* Information about the payment.
|
|
203
180
|
*/
|
|
204
|
-
|
|
181
|
+
paymentInfo: PaymentInfo;
|
|
205
182
|
/**
|
|
206
|
-
*
|
|
183
|
+
* QR code data
|
|
207
184
|
*/
|
|
208
|
-
|
|
185
|
+
qrData: QRData;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Represents the payment result for CARD payment request
|
|
189
|
+
*/
|
|
190
|
+
type CardPaymentResult = {
|
|
209
191
|
/**
|
|
210
|
-
*
|
|
211
|
-
* NOTE: implement this only if your country/business require printing terminal slips or info checks
|
|
192
|
+
* Information about the payment.
|
|
212
193
|
*/
|
|
213
|
-
|
|
194
|
+
paymentInfo: PaymentInfo;
|
|
195
|
+
/**
|
|
196
|
+
* Data for slip
|
|
197
|
+
*/
|
|
198
|
+
slip: SlipData | null;
|
|
199
|
+
/**
|
|
200
|
+
* Card information
|
|
201
|
+
*/
|
|
202
|
+
card: CardInfo | null;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The result of a payment operation for an order.
|
|
207
|
+
* Discriminated union on the shape of the result — add new payment results here as needed.
|
|
208
|
+
*/
|
|
209
|
+
type OrderPaymentResult = CardPaymentResult | QrPaymentResult;
|
|
210
|
+
|
|
211
|
+
type RefundInfo = OperationIdentifiers;
|
|
212
|
+
type BaseRefundResult = {
|
|
213
|
+
refundInfo: RefundInfo;
|
|
214
|
+
};
|
|
215
|
+
type CardRefundResult = BaseRefundResult & {
|
|
216
|
+
slip: SlipData | null;
|
|
217
|
+
};
|
|
218
|
+
type QrRefundResult = BaseRefundResult;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* The result of a refund operation for an order.
|
|
222
|
+
* Discriminated union on the shape of the result — add new refund results here as needed.
|
|
223
|
+
*/
|
|
224
|
+
type OrderRefundResult = CardRefundResult | QrRefundResult;
|
|
225
|
+
|
|
226
|
+
/** The name of the payment provider (e.g. "Ibox", "KaspiQr", "Json_Electron_PosPlugin"). */
|
|
227
|
+
type PaymentProvider = string;
|
|
228
|
+
|
|
229
|
+
declare enum PaymentSource {
|
|
230
|
+
RestaurantCashier = 0,
|
|
231
|
+
Kiosk = 1
|
|
214
232
|
}
|
|
215
233
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
234
|
+
declare enum PaymentStatus {
|
|
235
|
+
NotFound = "NotFound",
|
|
236
|
+
PaymentPending = "PaymentPending",
|
|
237
|
+
PaymentCompleted = "PaymentCompleted",
|
|
238
|
+
RefundPending = "RefundPending",
|
|
239
|
+
RefundCompleted = "RefundCompleted",
|
|
240
|
+
NotNeeded = "NotNeeded"
|
|
220
241
|
}
|
|
221
|
-
|
|
222
|
-
declare enum
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
|
|
242
|
+
|
|
243
|
+
declare enum RefundSource {
|
|
244
|
+
RestaurantCashier = "RestaurantCashier",
|
|
245
|
+
RefundJob = "RefundJob",
|
|
246
|
+
Kiosk = "Kiosk"
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
interface Taxpayer {
|
|
250
|
+
/** A tax identification number. It is used for value added tax purposes.
|
|
251
|
+
* The formal name may differ from country to country: It could be NIP for Poland, INN for Russia, or VAT number.
|
|
252
|
+
* https://en.wikipedia.org/wiki/VAT_identification_number */
|
|
253
|
+
IdentificationNumber: string | null;
|
|
231
254
|
}
|
|
232
255
|
|
|
233
256
|
interface Receipt {
|
|
234
257
|
/** Order for this receipt */
|
|
235
258
|
Order: Order;
|
|
259
|
+
/** Country code based on ISO 3166-1 numeric */
|
|
260
|
+
CountryCode: number;
|
|
236
261
|
/** Customer information */
|
|
237
262
|
Customer: Customer;
|
|
238
263
|
/** Taxpayer information */
|
|
@@ -451,4 +476,255 @@ type UzbekistanMarkingCode = {
|
|
|
451
476
|
};
|
|
452
477
|
type MarkingCodes = RussiaMarkingCode | BelarusMarkingCodes | ArmeniaMarkingCode | UzbekistanMarkingCode | undefined;
|
|
453
478
|
|
|
454
|
-
|
|
479
|
+
type Money = {
|
|
480
|
+
amount: number;
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
/** Information that is required to correctly deposit cash to the register. */
|
|
484
|
+
interface DepositCashOptions {
|
|
485
|
+
cash: Money;
|
|
486
|
+
cashierName?: string;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** Information that is required to correctly withdraw cash from the register. */
|
|
490
|
+
interface WithdrawCashOptions {
|
|
491
|
+
cash: Money;
|
|
492
|
+
cashierName?: string;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/** The information about organization */
|
|
496
|
+
interface OrganizationInfo {
|
|
497
|
+
/** The name of organization */
|
|
498
|
+
name?: string;
|
|
499
|
+
/** Taxpayer information */
|
|
500
|
+
taxpayer?: Taxpayer;
|
|
501
|
+
/** The physical address where organization has been registered */
|
|
502
|
+
registeredAddress?: string;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
interface CashRegisterSettings {
|
|
506
|
+
/** if a flag is not defined, it means it's false */
|
|
507
|
+
canHandleAlreadyHandledSale?: true;
|
|
508
|
+
/** The information about organization which was set in device */
|
|
509
|
+
organizationInfo?: OrganizationInfo;
|
|
510
|
+
/** Any data about the device in key-value form */
|
|
511
|
+
deviceInfo?: {
|
|
512
|
+
[key: string]: string;
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
type BaseReceiptRefundInfo = {
|
|
517
|
+
/** The payment provider used for this transaction (e.g. "Ibox", "KaspiQr"). */
|
|
518
|
+
paymentProvider: PaymentProvider;
|
|
519
|
+
/** The final status of the payment at the time of printing. */
|
|
520
|
+
paymentStatus: PaymentStatus;
|
|
521
|
+
/**
|
|
522
|
+
* The result of the refund operation for this order.
|
|
523
|
+
* Shape varies by refund mode — add new modes to {@link OrderRefundResult} as needed.
|
|
524
|
+
*/
|
|
525
|
+
orderRefundResult?: OrderRefundResult;
|
|
526
|
+
};
|
|
527
|
+
type KioskRefundInfo = BaseReceiptRefundInfo & {
|
|
528
|
+
refundSource: RefundSource.Kiosk;
|
|
529
|
+
};
|
|
530
|
+
type RestaurantCashierRefundInfo = BaseReceiptRefundInfo & {
|
|
531
|
+
refundSource: RefundSource.RestaurantCashier;
|
|
532
|
+
};
|
|
533
|
+
type JobRefundInfo = BaseReceiptRefundInfo & {
|
|
534
|
+
refundSource: RefundSource.RefundJob;
|
|
535
|
+
};
|
|
536
|
+
/**
|
|
537
|
+
* Refund context passed to the receipt plugin when printing a refund receipt.
|
|
538
|
+
* Discriminated union on `refundSource` — add source-specific fields to the
|
|
539
|
+
* corresponding branch as needed.
|
|
540
|
+
*/
|
|
541
|
+
type ReceiptRefundInfo = KioskRefundInfo | RestaurantCashierRefundInfo | JobRefundInfo;
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Obsolete Receipt interface backward compatibility.
|
|
545
|
+
* Delete after moving all plugins to using new HandleRefundRequest and inner receipt property
|
|
546
|
+
*/
|
|
547
|
+
type HandleRefundRequest = HandleRefundRequestClear | Receipt;
|
|
548
|
+
interface HandleRefundRequestClear {
|
|
549
|
+
receipt: Receipt;
|
|
550
|
+
printParams: PrintParams;
|
|
551
|
+
/** Optional refund context — provider, status and source at the time of printing. */
|
|
552
|
+
refundInfo?: ReceiptRefundInfo;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
type BaseReceiptPaymentInfo = {
|
|
556
|
+
/** The payment provider used for this transaction (e.g. "Ibox", "KaspiQr"). */
|
|
557
|
+
paymentProvider: PaymentProvider;
|
|
558
|
+
/** The final status of the payment at the time of printing. */
|
|
559
|
+
paymentStatus: PaymentStatus;
|
|
560
|
+
/**
|
|
561
|
+
* The result of the payment operation for this order.
|
|
562
|
+
* Shape varies by payment mode — add new modes to {@link OrderPaymentResult} as needed.
|
|
563
|
+
*/
|
|
564
|
+
orderPaymentResult?: OrderPaymentResult;
|
|
565
|
+
};
|
|
566
|
+
type KioskPaymentInfo = BaseReceiptPaymentInfo & {
|
|
567
|
+
paymentSource: PaymentSource.Kiosk;
|
|
568
|
+
};
|
|
569
|
+
type RestaurantCashierPaymentInfo = BaseReceiptPaymentInfo & {
|
|
570
|
+
paymentSource: PaymentSource.RestaurantCashier;
|
|
571
|
+
};
|
|
572
|
+
/**
|
|
573
|
+
* Payment context passed to the receipt plugin when printing a receipt.
|
|
574
|
+
* Discriminated union on `paymentSource` — add source-specific fields to the
|
|
575
|
+
* corresponding branch as needed.
|
|
576
|
+
*/
|
|
577
|
+
type ReceiptPaymentInfo = KioskPaymentInfo | RestaurantCashierPaymentInfo;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Obsolete Receipt interface backward compatibility.
|
|
581
|
+
* Delete after moving all plugins to using new HandleRefundRequest and inner receipt property
|
|
582
|
+
*/
|
|
583
|
+
type HandleSaleRequest = HandleSaleRequestClear | Receipt;
|
|
584
|
+
interface HandleSaleRequestClear {
|
|
585
|
+
receipt: Receipt;
|
|
586
|
+
printParams: PrintParams;
|
|
587
|
+
/** Optional payment context — provider, status and source at the time of printing. */
|
|
588
|
+
paymentInfo?: ReceiptPaymentInfo;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
interface InitializationOptions {
|
|
592
|
+
/** Known offset of the department where the store is. Offset **from UTC in minutes**.
|
|
593
|
+
* Can be used to identify which local time should be set on the particular machine.
|
|
594
|
+
* @example -120, 0, 1280
|
|
595
|
+
* */
|
|
596
|
+
departmentUtcOffsetMinutes: number;
|
|
597
|
+
/** Business is the name of the business/franchise we work with. E.g. Dodo Pizza, Doner 42, Drinkit */
|
|
598
|
+
business: Business;
|
|
599
|
+
country: Country;
|
|
600
|
+
cashboxId: string;
|
|
601
|
+
/** Determines should plugin handle sale with paper receipt or not. */
|
|
602
|
+
isPrintingPaperReceiptsDisabled: boolean;
|
|
603
|
+
infrastructure: {
|
|
604
|
+
logger?: ILogger;
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/** Information which may be required to make Z-report. */
|
|
609
|
+
interface MakeZReportOptions {
|
|
610
|
+
cashierName?: string;
|
|
611
|
+
withoutPaper?: boolean;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
interface IDigitalReceipt {
|
|
615
|
+
views: DigitalReceiptView[];
|
|
616
|
+
fields?: Fields;
|
|
617
|
+
version: 'v1';
|
|
618
|
+
}
|
|
619
|
+
type DigitalReceiptViewType = 'mobile' | 'email' | 'link' | 'pos';
|
|
620
|
+
type DigitalReceiptView = {
|
|
621
|
+
type: DigitalReceiptViewType;
|
|
622
|
+
data: string;
|
|
623
|
+
};
|
|
624
|
+
type Fields = {
|
|
625
|
+
type: 'FPtr10';
|
|
626
|
+
fnNumber: string;
|
|
627
|
+
fiscalDocumentSign: string;
|
|
628
|
+
fiscalDocumentNumber: string;
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
/** Other types of receipts may appear here */
|
|
632
|
+
type PrintedReceipt = PrintedFiscalReceipt | PrintedNonFiscalReceipt;
|
|
633
|
+
interface PrintedFiscalReceipt {
|
|
634
|
+
/** Inner receipt ID from POS device */
|
|
635
|
+
id: string;
|
|
636
|
+
/** Type of printed receipt */
|
|
637
|
+
type: 'Fiscal';
|
|
638
|
+
/** Serialized (JSON) body of receipt. Optional */
|
|
639
|
+
body?: string;
|
|
640
|
+
/** Data that allows us to show digital representations of the receipt */
|
|
641
|
+
digitalReceipt?: IDigitalReceipt;
|
|
642
|
+
}
|
|
643
|
+
interface PrintedNonFiscalReceipt {
|
|
644
|
+
/** Type of printed receipt */
|
|
645
|
+
type: 'NonFiscal';
|
|
646
|
+
/** Data that allows us to show digital representations of the receipt */
|
|
647
|
+
digitalReceipt?: IDigitalReceipt;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
interface PrintedRefundReceipt {
|
|
651
|
+
/** Inner receipt ID from POS device */
|
|
652
|
+
id: string;
|
|
653
|
+
/** Type of printed receipt */
|
|
654
|
+
type: 'Refund';
|
|
655
|
+
/** Serialized (JSON) body of receipt. Optional */
|
|
656
|
+
body?: string;
|
|
657
|
+
/** Data that allows us to show digital representations of the receipt */
|
|
658
|
+
digitalReceipt?: IDigitalReceipt;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/** Options that can be used to print any text. Input may differ from country and tenant. */
|
|
662
|
+
interface PrintTextOptions {
|
|
663
|
+
/** Multi-lined text to show in the receipt or separately. */
|
|
664
|
+
data?: string[];
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* The interface for the primary thing to be implemented in a plugin
|
|
669
|
+
* please look for details in existing plugins
|
|
670
|
+
* note: should be default export
|
|
671
|
+
*/
|
|
672
|
+
interface ICashRegister {
|
|
673
|
+
/**
|
|
674
|
+
* Plugin initialization function (will be called right after plugin download/installation and every time on page reload/app start)
|
|
675
|
+
*/
|
|
676
|
+
initialize?: (options: InitializationOptions) => Promise<void>;
|
|
677
|
+
/**
|
|
678
|
+
* Settings getter function (will be called after initialization finish))
|
|
679
|
+
*/
|
|
680
|
+
getSettings: () => Promise<CashRegisterSettings>;
|
|
681
|
+
/**
|
|
682
|
+
* Sale handler
|
|
683
|
+
*/
|
|
684
|
+
handleSale: (handleSaleRequest: HandleSaleRequest) => Promise<PrintedReceipt>;
|
|
685
|
+
/**
|
|
686
|
+
* Refund handler
|
|
687
|
+
*/
|
|
688
|
+
handleRefund?: (handleRefundRequest: HandleRefundRequest) => Promise<PrintedRefundReceipt>;
|
|
689
|
+
/**
|
|
690
|
+
* Call for X-report (usually - statistics for the current time)
|
|
691
|
+
*/
|
|
692
|
+
makeXReport?: () => Promise<void>;
|
|
693
|
+
/**
|
|
694
|
+
* Call for ending the cash shift (e.g. end of workday or schedule)
|
|
695
|
+
* (usually, also final report printed)
|
|
696
|
+
*/
|
|
697
|
+
makeZReport?: (options: MakeZReportOptions) => Promise<void>;
|
|
698
|
+
/**
|
|
699
|
+
* Cash withdrawal handler
|
|
700
|
+
*/
|
|
701
|
+
withdrawCash?: (options: WithdrawCashOptions) => Promise<void>;
|
|
702
|
+
/**
|
|
703
|
+
* Cash deposit handler
|
|
704
|
+
*/
|
|
705
|
+
depositCash?: (options: DepositCashOptions) => Promise<void>;
|
|
706
|
+
/**
|
|
707
|
+
* Print any text, such as informational block, promo details or pos terminal slip.
|
|
708
|
+
* NOTE: implement this only if your country/business require printing terminal slips or info checks
|
|
709
|
+
*/
|
|
710
|
+
printText?: (options: PrintTextOptions) => Promise<void>;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
interface PrintParams {
|
|
714
|
+
/** Has true value when receipt was sent to plugin in background for building Digital version of receipt */
|
|
715
|
+
WithoutPaper: boolean;
|
|
716
|
+
DigitalReceiptNotificationPreference: DigitalReceiptNotificationPreference;
|
|
717
|
+
}
|
|
718
|
+
/** The way we can notify the client about the receipt for the accepted order. */
|
|
719
|
+
declare enum DigitalReceiptNotificationPreference {
|
|
720
|
+
/** Client did not specify how they want to receive digital receipt. Default value. Should be set as `NotSpecified` when the receipt is expected to be NOT digital. */
|
|
721
|
+
NotSpecified = "NotSpecified",
|
|
722
|
+
/** Client selected 'I don't want a receipt' */
|
|
723
|
+
None = "None",
|
|
724
|
+
/** Client selected 'I want the receipt on my email' */
|
|
725
|
+
Email = "Email",
|
|
726
|
+
/** Client selected 'I want the receipt link by phone via SMS' */
|
|
727
|
+
PhoneSms = "PhoneSms"
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
export { type AddedIngredient, Business, type CashRegister, type CashRegisterSettings, type Cashier, type Country, type CountryIsoCode, type Customer, type DepositCashOptions, DigitalReceiptNotificationPreference, type DigitalReceiptView, type DigitalReceiptViewType, type Fields, type HandleRefundRequest, type HandleRefundRequestClear, type HandleSaleRequest, type HandleSaleRequestClear, type ICashRegister, type IDigitalReceipt, type Image, type InitializationOptions, type JobRefundInfo, type KazakhstanProductData, type KioskPaymentInfo, type KioskRefundInfo, KnownCountryCodes, type KyrgyzstanProductData, type Loyalty, type MakeZReportOptions, type MarkingCodes, type Money, type Order, type OrderPrice, OrderSource, OrderType, type Organization, OwnerType, PaymentType, type PreviousReceipt, type PrintParams, type PrintTextOptions, type PrintedFiscalReceipt, type PrintedNonFiscalReceipt, type PrintedReceipt, type PrintedRefundReceipt, type Product, type ProductPrice, type ProductSpecificData, type Receipt, type ReceiptPaymentInfo, type ReceiptRefundInfo, type RestaurantCashierPaymentInfo, type RestaurantCashierRefundInfo, type Store, type Tax, type Taxpayer, type UzbekistanProductData, type WithdrawCashOptions };
|