@dodobrands/pos-receipts-plugin-contracts 5.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +180 -0
- package/LICENSE +201 -0
- package/dist/index.cjs +93 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +445 -0
- package/dist/index.d.ts +445 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/examples/example-1.json +93 -0
- package/examples/example-2.json +115 -0
- package/examples/example-3.json +115 -0
- package/examples/example-4.json +139 -0
- package/examples/example-5.1.json +130 -0
- package/examples/example-5.2.json +139 -0
- package/examples/example-6.json +81 -0
- package/examples/example-7.json +76 -0
- package/examples/readme.md +45 -0
- package/package.json +47 -0
- package/readme.md +18 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { Business, Country, ILogger } from '@dodobrands/pos-plugins-shared-models';
|
|
2
|
+
export { Business, Country, CountryIsoCode } from '@dodobrands/pos-plugins-shared-models';
|
|
3
|
+
|
|
4
|
+
type Money = {
|
|
5
|
+
amount: number;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/** Information that is required to correctly deposit cash to the register. */
|
|
9
|
+
interface DepositCashOptions {
|
|
10
|
+
cash: Money;
|
|
11
|
+
cashierName?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Information that is required to correctly withdraw cash from the register. */
|
|
15
|
+
interface WithdrawCashOptions {
|
|
16
|
+
cash: Money;
|
|
17
|
+
cashierName?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface Taxpayer {
|
|
21
|
+
/** A tax identification number. It is used for value added tax purposes.
|
|
22
|
+
* The formal name may differ from country to country: It could be NIP for Poland, INN for Russia, or VAT number.
|
|
23
|
+
* https://en.wikipedia.org/wiki/VAT_identification_number */
|
|
24
|
+
IdentificationNumber: string | null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The information about organization */
|
|
28
|
+
interface OrganizationInfo {
|
|
29
|
+
/** The name of organization */
|
|
30
|
+
name?: string;
|
|
31
|
+
/** Taxpayer information */
|
|
32
|
+
taxpayer?: Taxpayer;
|
|
33
|
+
/** The physical address where organization has been registered */
|
|
34
|
+
registeredAddress?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface CashRegisterSettings {
|
|
38
|
+
/** if a flag is not defined, it means it's false */
|
|
39
|
+
canHandleAlreadyHandledSale?: true;
|
|
40
|
+
/** The information about organization which was set in device */
|
|
41
|
+
organizationInfo?: OrganizationInfo;
|
|
42
|
+
/** Any data about the device in key-value form */
|
|
43
|
+
deviceInfo?: {
|
|
44
|
+
[key: string]: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type ProductSpecificData = UzbekistanProductData | KazakhstanProductData | null;
|
|
49
|
+
interface UzbekistanProductData {
|
|
50
|
+
/** Identification code of products and services for Uzbekistan */
|
|
51
|
+
ikpu: string;
|
|
52
|
+
/** 0 - resail; 1 - own production; 2 - service */
|
|
53
|
+
ownerType?: OwnerType;
|
|
54
|
+
/** code of measurement type */
|
|
55
|
+
units: string;
|
|
56
|
+
/** related with ikpu */
|
|
57
|
+
barcode: string;
|
|
58
|
+
}
|
|
59
|
+
declare enum OwnerType {
|
|
60
|
+
Resail = 0,
|
|
61
|
+
OwnProduction = 1,
|
|
62
|
+
Service = 2
|
|
63
|
+
}
|
|
64
|
+
interface KazakhstanProductData {
|
|
65
|
+
/** Identification code of products */
|
|
66
|
+
gtin?: string;
|
|
67
|
+
ntin?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Obsolete Receipt interface backward compatibility.
|
|
72
|
+
* Delete after moving all plugins to using new HandleRefundRequest and inner receipt property
|
|
73
|
+
*/
|
|
74
|
+
type HandleRefundRequest = HandleRefundRequestClear | Receipt;
|
|
75
|
+
interface HandleRefundRequestClear {
|
|
76
|
+
receipt: Receipt;
|
|
77
|
+
printParams: PrintParams;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Obsolete Receipt interface backward compatibility.
|
|
82
|
+
* Delete after moving all plugins to using new HandleRefundRequest and inner receipt property
|
|
83
|
+
*/
|
|
84
|
+
type HandleSaleRequest = HandleSaleRequestClear | Receipt;
|
|
85
|
+
interface HandleSaleRequestClear {
|
|
86
|
+
receipt: Receipt;
|
|
87
|
+
printParams: PrintParams;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface InitializationOptions {
|
|
91
|
+
/** Known offset of the department where the store is. Offset **from UTC in minutes**.
|
|
92
|
+
* Can be used to identify which local time should be set on the particular machine.
|
|
93
|
+
* @example -120, 0, 1280
|
|
94
|
+
* */
|
|
95
|
+
departmentUtcOffsetMinutes: number;
|
|
96
|
+
/** Business is the name of the business/franchise we work with. E.g. Dodo Pizza, Doner 42, Drinkit */
|
|
97
|
+
business: Business;
|
|
98
|
+
country: Country;
|
|
99
|
+
cashboxId: string;
|
|
100
|
+
/** Determines should plugin handle sale with paper receipt or not. */
|
|
101
|
+
isPrintingPaperReceiptsDisabled: boolean;
|
|
102
|
+
infrastructure: {
|
|
103
|
+
logger?: ILogger;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Information which may be required to make Z-report. */
|
|
108
|
+
interface MakeZReportOptions {
|
|
109
|
+
cashierName?: string;
|
|
110
|
+
withoutPaper?: boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface IDigitalReceipt {
|
|
114
|
+
views: DigitalReceiptView[];
|
|
115
|
+
fields?: Fields;
|
|
116
|
+
version: 'v1';
|
|
117
|
+
}
|
|
118
|
+
type DigitalReceiptViewType = 'mobile' | 'email' | 'link' | 'pos';
|
|
119
|
+
type DigitalReceiptView = {
|
|
120
|
+
type: DigitalReceiptViewType;
|
|
121
|
+
data: string;
|
|
122
|
+
};
|
|
123
|
+
type Fields = {
|
|
124
|
+
type: 'FPtr10';
|
|
125
|
+
fnNumber: string;
|
|
126
|
+
fiscalDocumentSign: string;
|
|
127
|
+
fiscalDocumentNumber: string;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/** Other types of receipts may appear here */
|
|
131
|
+
type PrintedReceipt = PrintedFiscalReceipt | PrintedNonFiscalReceipt;
|
|
132
|
+
interface PrintedFiscalReceipt {
|
|
133
|
+
/** Inner receipt ID from POS device */
|
|
134
|
+
id: string;
|
|
135
|
+
/** Type of printed receipt */
|
|
136
|
+
type: 'Fiscal';
|
|
137
|
+
/** Serialized (JSON) body of receipt. Optional */
|
|
138
|
+
body?: string;
|
|
139
|
+
/** Data that allows us to show digital representations of the receipt */
|
|
140
|
+
digitalReceipt?: IDigitalReceipt;
|
|
141
|
+
}
|
|
142
|
+
interface PrintedNonFiscalReceipt {
|
|
143
|
+
/** Type of printed receipt */
|
|
144
|
+
type: 'NonFiscal';
|
|
145
|
+
/** Data that allows us to show digital representations of the receipt */
|
|
146
|
+
digitalReceipt?: IDigitalReceipt;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface PrintedRefundReceipt {
|
|
150
|
+
/** Inner receipt ID from POS device */
|
|
151
|
+
id: string;
|
|
152
|
+
/** Type of printed receipt */
|
|
153
|
+
type: 'Refund';
|
|
154
|
+
/** Serialized (JSON) body of receipt. Optional */
|
|
155
|
+
body?: string;
|
|
156
|
+
/** Data that allows us to show digital representations of the receipt */
|
|
157
|
+
digitalReceipt?: IDigitalReceipt;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Options that can be used to print any text. Input may differ from country and tenant. */
|
|
161
|
+
interface PrintTextOptions {
|
|
162
|
+
/** Multi-lined text to show in the receipt or separately. */
|
|
163
|
+
data?: string[];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The interface for the primary thing to be implemented in a plugin
|
|
168
|
+
* please look for details in existing plugins
|
|
169
|
+
* note: should be default export
|
|
170
|
+
*/
|
|
171
|
+
interface ICashRegister {
|
|
172
|
+
/**
|
|
173
|
+
* Plugin initialization function (will be called right after plugin download/installation and every time on page reload/app start)
|
|
174
|
+
*/
|
|
175
|
+
initialize?: (options: InitializationOptions) => Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Settings getter function (will be called after initialization finish))
|
|
178
|
+
*/
|
|
179
|
+
getSettings: () => Promise<CashRegisterSettings>;
|
|
180
|
+
/**
|
|
181
|
+
* Sale handler
|
|
182
|
+
*/
|
|
183
|
+
handleSale: (handleSaleRequest: HandleSaleRequest) => Promise<PrintedReceipt>;
|
|
184
|
+
/**
|
|
185
|
+
* Refund handler
|
|
186
|
+
*/
|
|
187
|
+
handleRefund?: (handleRefundRequest: HandleRefundRequest) => Promise<PrintedRefundReceipt>;
|
|
188
|
+
/**
|
|
189
|
+
* Call for X-report (usually - statistics for the current time)
|
|
190
|
+
*/
|
|
191
|
+
makeXReport?: () => Promise<void>;
|
|
192
|
+
/**
|
|
193
|
+
* Call for ending the cash shift (e.g. end of workday or schedule)
|
|
194
|
+
* (usually, also final report printed)
|
|
195
|
+
*/
|
|
196
|
+
makeZReport?: (options: MakeZReportOptions) => Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* Cash withdrawal handler
|
|
199
|
+
*/
|
|
200
|
+
withdrawCash?: (options: WithdrawCashOptions) => Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* Cash deposit handler
|
|
203
|
+
*/
|
|
204
|
+
depositCash?: (options: DepositCashOptions) => Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* Print any text, such as informational block, promo details or pos terminal slip.
|
|
207
|
+
* NOTE: implement this only if your country/business require printing terminal slips or info checks
|
|
208
|
+
*/
|
|
209
|
+
printText?: (options: PrintTextOptions) => Promise<void>;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
interface PrintParams {
|
|
213
|
+
/** Has true value when receipt was sent to plugin in background for building Digital version of receipt */
|
|
214
|
+
WithoutPaper: boolean;
|
|
215
|
+
DigitalReceiptNotificationPreference: DigitalReceiptNotificationPreference;
|
|
216
|
+
}
|
|
217
|
+
/** The way we can notify the client about the receipt for the accepted order. */
|
|
218
|
+
declare enum DigitalReceiptNotificationPreference {
|
|
219
|
+
/** 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. */
|
|
220
|
+
NotSpecified = "NotSpecified",
|
|
221
|
+
/** Client selected 'I don't want a receipt' */
|
|
222
|
+
None = "None",
|
|
223
|
+
/** Client selected 'I want the receipt on my email' */
|
|
224
|
+
Email = "Email",
|
|
225
|
+
/** Client selected 'I want the receipt link by phone via SMS' */
|
|
226
|
+
PhoneSms = "PhoneSms"
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
interface Receipt {
|
|
230
|
+
/** Order for this receipt */
|
|
231
|
+
Order: Order;
|
|
232
|
+
/** Customer information */
|
|
233
|
+
Customer: Customer;
|
|
234
|
+
/** Taxpayer information */
|
|
235
|
+
Taxpayer: Taxpayer;
|
|
236
|
+
/** Cash register from which the receipt is printed */
|
|
237
|
+
CashRegister: CashRegister;
|
|
238
|
+
/** Previous receipts that were printed for this order, including refunds */
|
|
239
|
+
PreviousReceipts: PreviousReceipt[];
|
|
240
|
+
/** Information about the organization that printed the receipt */
|
|
241
|
+
Organization: Organization;
|
|
242
|
+
/** Information about the store in which the purchase is occurring */
|
|
243
|
+
Store: Store;
|
|
244
|
+
/** Information needed for the loyalty program. */
|
|
245
|
+
Loyalty?: Loyalty;
|
|
246
|
+
/** Cash from the customer (if paid in cash) */
|
|
247
|
+
CashFromCustomer: number;
|
|
248
|
+
/** Information about the person taking the order. */
|
|
249
|
+
Cashier?: Cashier;
|
|
250
|
+
/** Url of the image to print on the receipt. */
|
|
251
|
+
Image?: Image;
|
|
252
|
+
}
|
|
253
|
+
interface Cashier {
|
|
254
|
+
/** Cashier name */
|
|
255
|
+
Name: string;
|
|
256
|
+
/** Cashier INN in russia and its analogues in other countries. */
|
|
257
|
+
TaxIdentificationNumber?: string;
|
|
258
|
+
}
|
|
259
|
+
interface Image {
|
|
260
|
+
/** Url of the image to print on the receipt. */
|
|
261
|
+
Url?: string;
|
|
262
|
+
/** Image data in base64 format. (ONLY FOR RUSSIA ATOL) */
|
|
263
|
+
Base64Data?: string;
|
|
264
|
+
}
|
|
265
|
+
interface Loyalty {
|
|
266
|
+
/** Customer Phone number */
|
|
267
|
+
PhoneNumber: string;
|
|
268
|
+
/** Amount of the bonus points awarded for the loyalty program. */
|
|
269
|
+
AwardedBonus: number;
|
|
270
|
+
}
|
|
271
|
+
interface Order {
|
|
272
|
+
/** Internal order identifier */
|
|
273
|
+
Id: string;
|
|
274
|
+
/** Order number seen by customers (e.g. "1-3") */
|
|
275
|
+
Number: string;
|
|
276
|
+
/** Current time in ISO 8601 format (e.g. "2021-04-30T10:50:00.0000000+04:00") */
|
|
277
|
+
CreateDate: string;
|
|
278
|
+
/** Products in cart */
|
|
279
|
+
Products: Product[];
|
|
280
|
+
Price: OrderPrice;
|
|
281
|
+
/** @deprecated Please switch to PaymentTypeEnum. */
|
|
282
|
+
PaymentType: 'Cash' | 'BankCard';
|
|
283
|
+
PaymentTypeEnum: PaymentType;
|
|
284
|
+
OrderSource: OrderSource;
|
|
285
|
+
/** Current time in ISO 8601 format (e.g. "2021-04-30T10:50:00.0000000+04:00") */
|
|
286
|
+
DeliveryDate?: string;
|
|
287
|
+
OrderType: OrderType;
|
|
288
|
+
}
|
|
289
|
+
declare enum OrderType {
|
|
290
|
+
Delivery = 1,
|
|
291
|
+
Pickup = 2,
|
|
292
|
+
Stationary = 3,
|
|
293
|
+
PersonalFood = 4,
|
|
294
|
+
ShopWindowSupply = 5
|
|
295
|
+
}
|
|
296
|
+
/** Shows the source from where the order has been taken. */
|
|
297
|
+
declare enum OrderSource {
|
|
298
|
+
Telephone = 0,
|
|
299
|
+
Site = 1,
|
|
300
|
+
Restaurant = 2,
|
|
301
|
+
DefectOrder = 3,
|
|
302
|
+
Mobile = 4,
|
|
303
|
+
/** Shift manager order from call center. */
|
|
304
|
+
Pizzeria = 5,
|
|
305
|
+
Aggregator = 6,
|
|
306
|
+
Kiosk = 7
|
|
307
|
+
}
|
|
308
|
+
/** Shows how the order has been paid. Please expect frequent updates in the future. */
|
|
309
|
+
declare enum PaymentType {
|
|
310
|
+
Cash = 0,
|
|
311
|
+
BankCard = 1,
|
|
312
|
+
InternetAcquiring = 2,
|
|
313
|
+
Aggregator = 3
|
|
314
|
+
}
|
|
315
|
+
interface OrderPrice {
|
|
316
|
+
/** The total price of the order (how much the customer actually paid) */
|
|
317
|
+
TotalPrice: number;
|
|
318
|
+
/** Total discount for the entire order (excluding discounts for individual products in the order) */
|
|
319
|
+
Discount: number;
|
|
320
|
+
/** Rounded cash amount the customer pays for an order (if paid in cash). Used only in countries with special rules for rounding cash */
|
|
321
|
+
RoundedCashAmount?: number;
|
|
322
|
+
}
|
|
323
|
+
interface Product {
|
|
324
|
+
/** Internal product identifier */
|
|
325
|
+
Id: string;
|
|
326
|
+
/** The product's name */
|
|
327
|
+
Name: string;
|
|
328
|
+
/** The quantity of this product in the order */
|
|
329
|
+
Quantity: number;
|
|
330
|
+
PricePerProduct: ProductPrice;
|
|
331
|
+
/** List of ingredients removed from the product */
|
|
332
|
+
RemovedIngredients: string[];
|
|
333
|
+
/** Additional ingredients added to the product */
|
|
334
|
+
AddedIngredients: AddedIngredient[];
|
|
335
|
+
/** The marking data used in some countries to pass scanned barcode value to the cash register. */
|
|
336
|
+
Marking?: MarkingCodes;
|
|
337
|
+
/** The product excise information */
|
|
338
|
+
Excise?: {
|
|
339
|
+
isExcise: boolean;
|
|
340
|
+
};
|
|
341
|
+
/** Additional data that can be defined for specific country */
|
|
342
|
+
CountrySpecific?: {
|
|
343
|
+
Uzbekistan?: UzbekistanProductData;
|
|
344
|
+
Kazakhstan?: KazakhstanProductData;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
interface ProductPrice {
|
|
348
|
+
/** Price for 1 product excluding discount but with added ingredients */
|
|
349
|
+
Price: number;
|
|
350
|
+
/** Discount for 1 product (excluding the discount for the entire order) */
|
|
351
|
+
Discount: number;
|
|
352
|
+
Taxes: Tax[];
|
|
353
|
+
}
|
|
354
|
+
interface Tax {
|
|
355
|
+
/** Type of tax: value added or sales */
|
|
356
|
+
Type: 'VAT' | 'Sales' | 'Unknown';
|
|
357
|
+
/** Rate in percents */
|
|
358
|
+
Rate: number;
|
|
359
|
+
}
|
|
360
|
+
interface AddedIngredient {
|
|
361
|
+
/** Ingredient name */
|
|
362
|
+
Name: string;
|
|
363
|
+
/** The amount of ingredients added in portions */
|
|
364
|
+
Quantity: number;
|
|
365
|
+
/** Ingredient price added to the product */
|
|
366
|
+
Price: number;
|
|
367
|
+
}
|
|
368
|
+
interface Customer {
|
|
369
|
+
/** The name of the customer that he gave to the cashier */
|
|
370
|
+
Name: string;
|
|
371
|
+
/** Customer's mailing address, which he set in his personal account */
|
|
372
|
+
Email: string | null;
|
|
373
|
+
/** Any additional identifiers, e.g. customer's Tax Identification Number */
|
|
374
|
+
Identifiers: {
|
|
375
|
+
[index: string]: string;
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
interface CashRegister {
|
|
379
|
+
/** Internal cash register identifier */
|
|
380
|
+
UUId: string;
|
|
381
|
+
/** */
|
|
382
|
+
Number: string;
|
|
383
|
+
/** To calculate or not to calculate VAT */
|
|
384
|
+
ShouldCalculateTax: boolean;
|
|
385
|
+
}
|
|
386
|
+
interface PreviousReceipt {
|
|
387
|
+
/** ID of the receipt returned by the POS printer. `null` if a print error has occurred. It is temporary field. Then it will be removed. Use `Identifier` instead of `Id` */
|
|
388
|
+
Id: number | null;
|
|
389
|
+
/** Printed receipt type: sales receipt or refund receipt */
|
|
390
|
+
Type: 'Sell' | 'Refund';
|
|
391
|
+
/** Date in format ISO 8601 (e.g. 2021-04-30T10:50:00.0000000+04:00) */
|
|
392
|
+
PrintDateTime: string;
|
|
393
|
+
/** ID of the receipt returned by the POS printer */
|
|
394
|
+
Identifier: string | null;
|
|
395
|
+
CashboxId: string;
|
|
396
|
+
/** Data returned by cash register after printing receipt */
|
|
397
|
+
CashRegisterOutput?: string;
|
|
398
|
+
/** Previous receipt payment type */
|
|
399
|
+
PaymentType: PaymentType;
|
|
400
|
+
}
|
|
401
|
+
interface Organization {
|
|
402
|
+
/** Full name of the organization */
|
|
403
|
+
Name: string;
|
|
404
|
+
/** Legal address */
|
|
405
|
+
Address: string;
|
|
406
|
+
/** Organization payment details */
|
|
407
|
+
Requisites: {
|
|
408
|
+
[index: string]: string;
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
interface Store {
|
|
412
|
+
/** Actual address */
|
|
413
|
+
Address: string;
|
|
414
|
+
}
|
|
415
|
+
type RussiaMarkingCode = {
|
|
416
|
+
/** Russian country iso code */
|
|
417
|
+
country: 643;
|
|
418
|
+
/** In Russia it's the string of digits, letters, special symbols and group separator. */
|
|
419
|
+
markingCode: string;
|
|
420
|
+
};
|
|
421
|
+
type BelarusMarkingCodes = {
|
|
422
|
+
/** Belarus country iso code */
|
|
423
|
+
country: 112;
|
|
424
|
+
/** Маркировка унифицированными контрольными знаками (УКЗ) */
|
|
425
|
+
ukzCode?: string;
|
|
426
|
+
/** Маркировка средствами идентификации (СИ) */
|
|
427
|
+
siCode?: string;
|
|
428
|
+
/** Маркировка с использованием штрихкода GTIN */
|
|
429
|
+
gtinCode?: string;
|
|
430
|
+
};
|
|
431
|
+
type ArmeniaMarkingCode = {
|
|
432
|
+
/** Armenia country iso code */
|
|
433
|
+
country: 51;
|
|
434
|
+
/** In Armenia it's the string of digits letters, special symbols and group separator. */
|
|
435
|
+
markingCode: string;
|
|
436
|
+
};
|
|
437
|
+
type UzbekistanMarkingCode = {
|
|
438
|
+
/** Uzbekistan country iso code */
|
|
439
|
+
country: 860;
|
|
440
|
+
/** In Uzbekistan it's the string of digits letters, special symbols and group separator. */
|
|
441
|
+
markingCode: string;
|
|
442
|
+
};
|
|
443
|
+
type MarkingCodes = RussiaMarkingCode | BelarusMarkingCodes | ArmeniaMarkingCode | UzbekistanMarkingCode | undefined;
|
|
444
|
+
|
|
445
|
+
export { type AddedIngredient, type CashRegister, type CashRegisterSettings, type Cashier, 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 KazakhstanProductData, 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 Store, type Tax, type Taxpayer, type UzbekistanProductData, type WithdrawCashOptions };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// ../../shared/pos-plugins-shared-models/dist/index.js
|
|
2
|
+
var Business = /* @__PURE__ */ ((Business2) => {
|
|
3
|
+
Business2["DodoPizza"] = `dodoPizza`;
|
|
4
|
+
Business2["Drinkit"] = `drinkit`;
|
|
5
|
+
Business2["Doner42"] = `doner42`;
|
|
6
|
+
return Business2;
|
|
7
|
+
})(Business || {});
|
|
8
|
+
|
|
9
|
+
// src/CountrySpecificData.ts
|
|
10
|
+
var OwnerType = /* @__PURE__ */ ((OwnerType2) => {
|
|
11
|
+
OwnerType2[OwnerType2["Resail"] = 0] = "Resail";
|
|
12
|
+
OwnerType2[OwnerType2["OwnProduction"] = 1] = "OwnProduction";
|
|
13
|
+
OwnerType2[OwnerType2["Service"] = 2] = "Service";
|
|
14
|
+
return OwnerType2;
|
|
15
|
+
})(OwnerType || {});
|
|
16
|
+
|
|
17
|
+
// src/PrintParams.ts
|
|
18
|
+
var DigitalReceiptNotificationPreference = /* @__PURE__ */ ((DigitalReceiptNotificationPreference2) => {
|
|
19
|
+
DigitalReceiptNotificationPreference2["NotSpecified"] = `NotSpecified`;
|
|
20
|
+
DigitalReceiptNotificationPreference2["None"] = `None`;
|
|
21
|
+
DigitalReceiptNotificationPreference2["Email"] = `Email`;
|
|
22
|
+
DigitalReceiptNotificationPreference2["PhoneSms"] = `PhoneSms`;
|
|
23
|
+
return DigitalReceiptNotificationPreference2;
|
|
24
|
+
})(DigitalReceiptNotificationPreference || {});
|
|
25
|
+
|
|
26
|
+
// src/Receipt.ts
|
|
27
|
+
var OrderType = /* @__PURE__ */ ((OrderType2) => {
|
|
28
|
+
OrderType2[OrderType2["Delivery"] = 1] = "Delivery";
|
|
29
|
+
OrderType2[OrderType2["Pickup"] = 2] = "Pickup";
|
|
30
|
+
OrderType2[OrderType2["Stationary"] = 3] = "Stationary";
|
|
31
|
+
OrderType2[OrderType2["PersonalFood"] = 4] = "PersonalFood";
|
|
32
|
+
OrderType2[OrderType2["ShopWindowSupply"] = 5] = "ShopWindowSupply";
|
|
33
|
+
return OrderType2;
|
|
34
|
+
})(OrderType || {});
|
|
35
|
+
var OrderSource = /* @__PURE__ */ ((OrderSource2) => {
|
|
36
|
+
OrderSource2[OrderSource2["Telephone"] = 0] = "Telephone";
|
|
37
|
+
OrderSource2[OrderSource2["Site"] = 1] = "Site";
|
|
38
|
+
OrderSource2[OrderSource2["Restaurant"] = 2] = "Restaurant";
|
|
39
|
+
OrderSource2[OrderSource2["DefectOrder"] = 3] = "DefectOrder";
|
|
40
|
+
OrderSource2[OrderSource2["Mobile"] = 4] = "Mobile";
|
|
41
|
+
OrderSource2[OrderSource2["Pizzeria"] = 5] = "Pizzeria";
|
|
42
|
+
OrderSource2[OrderSource2["Aggregator"] = 6] = "Aggregator";
|
|
43
|
+
OrderSource2[OrderSource2["Kiosk"] = 7] = "Kiosk";
|
|
44
|
+
return OrderSource2;
|
|
45
|
+
})(OrderSource || {});
|
|
46
|
+
var PaymentType = /* @__PURE__ */ ((PaymentType2) => {
|
|
47
|
+
PaymentType2[PaymentType2["Cash"] = 0] = "Cash";
|
|
48
|
+
PaymentType2[PaymentType2["BankCard"] = 1] = "BankCard";
|
|
49
|
+
PaymentType2[PaymentType2["InternetAcquiring"] = 2] = "InternetAcquiring";
|
|
50
|
+
PaymentType2[PaymentType2["Aggregator"] = 3] = "Aggregator";
|
|
51
|
+
return PaymentType2;
|
|
52
|
+
})(PaymentType || {});
|
|
53
|
+
export {
|
|
54
|
+
Business,
|
|
55
|
+
DigitalReceiptNotificationPreference,
|
|
56
|
+
OrderSource,
|
|
57
|
+
OrderType,
|
|
58
|
+
OwnerType,
|
|
59
|
+
PaymentType
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../shared/pos-plugins-shared-models/src/Business.ts","../../../shared/pos-plugins-shared-models/src/Country.ts","../src/CountrySpecificData.ts","../src/PrintParams.ts","../src/Receipt.ts"],"sourcesContent":["/**\n * Enum with supported business types.\n */\nexport enum Business {\n\t/**\n\t * Dodo Pizza business.\n\t */\n\tDodoPizza = `dodoPizza`,\n\t/**\n\t * Drinkit business.\n\t */\n\tDrinkit = `drinkit`,\n\t/**\n\t * Doner42 business.\n\t */\n\tDoner42 = `doner42`,\n}\n","/**\n * Country model\n */\nexport interface Country {\n\tcode: CountryIsoCode;\n}\n\n/** Country code based on [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_numeric)\n * @example 643, 705, 566\n */\nexport type CountryIsoCode = number;\n\nexport enum KnownCountryCodes {\n\tBelarus = 112,\n\tKazakhstan = 398,\n\tRussia = 643,\n\tUzbekistan = 860,\n}\n","export type ProductSpecificData = UzbekistanProductData | KazakhstanProductData | null;\n\nexport interface UzbekistanProductData {\n\t/** Identification code of products and services for Uzbekistan */\n\tikpu: string;\n\t/** 0 - resail; 1 - own production; 2 - service */\n\townerType?: OwnerType;\n\t/** code of measurement type */\n\tunits: string;\n\t/** related with ikpu */\n\tbarcode: string;\n}\n\nexport enum OwnerType {\n\tResail = 0,\n\tOwnProduction = 1,\n\tService = 2,\n}\n\nexport interface KazakhstanProductData {\n\t/** Identification code of products */\n\tgtin?: string;\n\tntin?: string;\n}\n","export interface PrintParams {\n\t/** Has true value when receipt was sent to plugin in background for building Digital version of receipt */\n\tWithoutPaper: boolean;\n\tDigitalReceiptNotificationPreference: DigitalReceiptNotificationPreference;\n}\n\n/** The way we can notify the client about the receipt for the accepted order. */\nexport enum DigitalReceiptNotificationPreference {\n\t/** 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. */\n\tNotSpecified = `NotSpecified`,\n\t/** Client selected 'I don't want a receipt' */\n\tNone = `None`,\n\t/** Client selected 'I want the receipt on my email' */\n\tEmail = `Email`,\n\t/** Client selected 'I want the receipt link by phone via SMS' */\n\tPhoneSms = `PhoneSms`,\n}\n","/* eslint-disable @typescript-eslint/no-magic-numbers */\nimport { type KazakhstanProductData, type UzbekistanProductData } from './CountrySpecificData';\nimport { type Taxpayer } from './Taxpayer';\n\nexport interface Receipt {\n\t/** Order for this receipt */\n\tOrder: Order;\n\t/** Customer information */\n\tCustomer: Customer;\n\t/** Taxpayer information */\n\tTaxpayer: Taxpayer;\n\t/** Cash register from which the receipt is printed */\n\tCashRegister: CashRegister;\n\t/** Previous receipts that were printed for this order, including refunds */\n\tPreviousReceipts: PreviousReceipt[];\n\t/** Information about the organization that printed the receipt */\n\tOrganization: Organization;\n\t/** Information about the store in which the purchase is occurring */\n\tStore: Store;\n\n\t/** Information needed for the loyalty program. */\n\tLoyalty?: Loyalty;\n\n\t/** Cash from the customer (if paid in cash) */\n\tCashFromCustomer: number;\n\n\t/** Information about the person taking the order. */\n\tCashier?: Cashier;\n\n\t/** Url of the image to print on the receipt. */\n\tImage?: Image;\n}\n\nexport interface Cashier {\n\t/** Cashier name */\n\tName: string;\n\n\t/** Cashier INN in russia and its analogues in other countries. */\n\tTaxIdentificationNumber?: string;\n}\n\nexport interface Image {\n\t/** Url of the image to print on the receipt. */\n\tUrl?: string;\n\n\t/** Image data in base64 format. (ONLY FOR RUSSIA ATOL) */\n\tBase64Data?: string;\n}\n\nexport interface Loyalty {\n\t/** Customer Phone number */\n\tPhoneNumber: string;\n\t/** Amount of the bonus points awarded for the loyalty program. */\n\tAwardedBonus: number;\n}\n\nexport interface Order {\n\t/** Internal order identifier */\n\tId: string;\n\t/** Order number seen by customers (e.g. \"1-3\") */\n\tNumber: string; // from OrderNumber\n\t/** Current time in ISO 8601 format (e.g. \"2021-04-30T10:50:00.0000000+04:00\") */\n\tCreateDate: string;\n\t/** Products in cart */\n\tProducts: Product[];\n\tPrice: OrderPrice;\n\t/** @deprecated Please switch to PaymentTypeEnum. */\n\tPaymentType: 'Cash' | 'BankCard';\n\tPaymentTypeEnum: PaymentType;\n\tOrderSource: OrderSource;\n\n\t/** Current time in ISO 8601 format (e.g. \"2021-04-30T10:50:00.0000000+04:00\") */\n\tDeliveryDate?: string;\n\tOrderType: OrderType;\n}\n\nexport enum OrderType {\n\tDelivery = 1,\n\tPickup = 2,\n\tStationary = 3,\n\tPersonalFood = 4,\n\tShopWindowSupply = 5,\n}\n\n/** Shows the source from where the order has been taken. */\nexport enum OrderSource {\n\tTelephone = 0,\n\tSite = 1,\n\tRestaurant = 2,\n\tDefectOrder = 3,\n\tMobile = 4,\n\t/** Shift manager order from call center. */\n\tPizzeria = 5,\n\tAggregator = 6,\n\tKiosk = 7,\n}\n\n/** Shows how the order has been paid. Please expect frequent updates in the future. */\nexport enum PaymentType {\n\tCash = 0,\n\tBankCard = 1,\n\tInternetAcquiring = 2,\n\tAggregator = 3,\n}\n\nexport interface OrderPrice {\n\t/** The total price of the order (how much the customer actually paid) */\n\tTotalPrice: number;\n\t/** Total discount for the entire order (excluding discounts for individual products in the order) */\n\tDiscount: number;\n\t/** Rounded cash amount the customer pays for an order (if paid in cash). Used only in countries with special rules for rounding cash */\n\tRoundedCashAmount?: number;\n}\n\nexport interface Product {\n\t/** Internal product identifier */\n\tId: string;\n\t/** The product's name */\n\tName: string;\n\t/** The quantity of this product in the order */\n\tQuantity: number;\n\tPricePerProduct: ProductPrice;\n\t/** List of ingredients removed from the product */\n\tRemovedIngredients: string[];\n\t/** Additional ingredients added to the product */\n\tAddedIngredients: AddedIngredient[];\n\n\t/** The marking data used in some countries to pass scanned barcode value to the cash register. */\n\tMarking?: MarkingCodes;\n\n\t/** The product excise information */\n\tExcise?: {\n\t\tisExcise: boolean;\n\t};\n\n\t/** Additional data that can be defined for specific country */\n\tCountrySpecific?: {\n\t\tUzbekistan?: UzbekistanProductData;\n\t\tKazakhstan?: KazakhstanProductData;\n\t};\n}\n\nexport interface ProductPrice {\n\t/** Price for 1 product excluding discount but with added ingredients */\n\tPrice: number;\n\t/** Discount for 1 product (excluding the discount for the entire order) */\n\tDiscount: number;\n\tTaxes: Tax[];\n}\n\nexport interface Tax {\n\t/** Type of tax: value added or sales */\n\tType: 'VAT' | 'Sales' | 'Unknown';\n\t/** Rate in percents */\n\tRate: number;\n\t// TODO add later: Value: number\n}\n\nexport interface AddedIngredient {\n\t/** Ingredient name */\n\tName: string;\n\t/** The amount of ingredients added in portions */\n\tQuantity: number;\n\t/** Ingredient price added to the product */\n\tPrice: number;\n}\n\nexport interface Customer {\n\t/** The name of the customer that he gave to the cashier */\n\tName: string;\n\t/** Customer's mailing address, which he set in his personal account */\n\tEmail: string | null;\n\t/** Any additional identifiers, e.g. customer's Tax Identification Number */\n\tIdentifiers: { [index: string]: string };\n}\n\nexport interface CashRegister {\n\t/** Internal cash register identifier */\n\tUUId: string;\n\t/** */\n\tNumber: string;\n\t/** To calculate or not to calculate VAT */\n\tShouldCalculateTax: boolean;\n}\n\nexport interface PreviousReceipt {\n\t/** ID of the receipt returned by the POS printer. `null` if a print error has occurred. It is temporary field. Then it will be removed. Use `Identifier` instead of `Id` */\n\tId: number | null;\n\t/** Printed receipt type: sales receipt or refund receipt */\n\tType: 'Sell' | 'Refund';\n\t/** Date in format ISO 8601 (e.g. 2021-04-30T10:50:00.0000000+04:00) */\n\tPrintDateTime: string;\n\t/** ID of the receipt returned by the POS printer */\n\tIdentifier: string | null;\n\n\tCashboxId: string;\n\n\t/** Data returned by cash register after printing receipt */\n\tCashRegisterOutput?: string;\n\t/** Previous receipt payment type */\n\tPaymentType: PaymentType;\n}\n\nexport interface Organization {\n\t/** Full name of the organization */\n\tName: string;\n\t/** Legal address */\n\tAddress: string;\n\t/** Organization payment details */\n\tRequisites: { [index: string]: string };\n}\n\nexport interface Store {\n\t/** Actual address */\n\tAddress: string;\n}\n\ntype RussiaMarkingCode = {\n\t/** Russian country iso code */\n\tcountry: 643;\n\t/** In Russia it's the string of digits, letters, special symbols and group separator. */\n\tmarkingCode: string;\n};\n\ntype BelarusMarkingCodes = {\n\t/** Belarus country iso code */\n\tcountry: 112;\n\t/** Маркировка унифицированными контрольными знаками (УКЗ) */\n\tukzCode?: string;\n\t/** Маркировка средствами идентификации (СИ) */\n\tsiCode?: string;\n\t/** Маркировка с использованием штрихкода GTIN */\n\tgtinCode?: string;\n};\n\ntype ArmeniaMarkingCode = {\n\t/** Armenia country iso code */\n\tcountry: 51;\n\t/** In Armenia it's the string of digits letters, special symbols and group separator. */\n\tmarkingCode: string;\n};\n\ntype UzbekistanMarkingCode = {\n\t/** Uzbekistan country iso code */\n\tcountry: 860;\n\t/** In Uzbekistan it's the string of digits letters, special symbols and group separator. */\n\tmarkingCode: string;\n};\n\nexport type MarkingCodes =\n\t| RussiaMarkingCode\n\t| BelarusMarkingCodes\n\t| ArmeniaMarkingCode\n\t| UzbekistanMarkingCode\n\t| undefined;\n"],"mappings":";AAGO,IAAK,WAAL,kBAAKA,cAAL;AAINA,YAAA,WAAA,IAAY;AAIZA,YAAA,SAAA,IAAU;AAIVA,YAAA,SAAA,IAAU;AAZC,SAAAA;AAAA,GAAA,YAAA,CAAA,CAAA;;;AEUL,IAAK,YAAL,kBAAKC,eAAL;AACN,EAAAA,sBAAA,YAAS,KAAT;AACA,EAAAA,sBAAA,mBAAgB,KAAhB;AACA,EAAAA,sBAAA,aAAU,KAAV;AAHW,SAAAA;AAAA,GAAA;;;ACNL,IAAK,uCAAL,kBAAKC,0CAAL;AAEN,EAAAA,sCAAA,kBAAe;AAEf,EAAAA,sCAAA,UAAO;AAEP,EAAAA,sCAAA,WAAQ;AAER,EAAAA,sCAAA,cAAW;AARA,SAAAA;AAAA,GAAA;;;ACqEL,IAAK,YAAL,kBAAKC,eAAL;AACN,EAAAA,sBAAA,cAAW,KAAX;AACA,EAAAA,sBAAA,YAAS,KAAT;AACA,EAAAA,sBAAA,gBAAa,KAAb;AACA,EAAAA,sBAAA,kBAAe,KAAf;AACA,EAAAA,sBAAA,sBAAmB,KAAnB;AALW,SAAAA;AAAA,GAAA;AASL,IAAK,cAAL,kBAAKC,iBAAL;AACN,EAAAA,0BAAA,eAAY,KAAZ;AACA,EAAAA,0BAAA,UAAO,KAAP;AACA,EAAAA,0BAAA,gBAAa,KAAb;AACA,EAAAA,0BAAA,iBAAc,KAAd;AACA,EAAAA,0BAAA,YAAS,KAAT;AAEA,EAAAA,0BAAA,cAAW,KAAX;AACA,EAAAA,0BAAA,gBAAa,KAAb;AACA,EAAAA,0BAAA,WAAQ,KAAR;AATW,SAAAA;AAAA,GAAA;AAaL,IAAK,cAAL,kBAAKC,iBAAL;AACN,EAAAA,0BAAA,UAAO,KAAP;AACA,EAAAA,0BAAA,cAAW,KAAX;AACA,EAAAA,0BAAA,uBAAoB,KAApB;AACA,EAAAA,0BAAA,gBAAa,KAAb;AAJW,SAAAA;AAAA,GAAA;","names":["Business","OwnerType","DigitalReceiptNotificationPreference","OrderType","OrderSource","PaymentType"]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"CashFromCustomer": 503,
|
|
3
|
+
"CashRegister": {
|
|
4
|
+
"Number": "31",
|
|
5
|
+
"ShouldCalculateTax": true,
|
|
6
|
+
"UUId": "0022487FBA1EBC6511EBA824DC4AE652"
|
|
7
|
+
},
|
|
8
|
+
"Customer": {
|
|
9
|
+
"Email": null,
|
|
10
|
+
"Identifiers": {
|
|
11
|
+
"NIP": "1231216692"
|
|
12
|
+
},
|
|
13
|
+
"Name": "Tom Riddle"
|
|
14
|
+
},
|
|
15
|
+
"Taxpayer": {
|
|
16
|
+
"IdentificationNumber": null
|
|
17
|
+
},
|
|
18
|
+
"Order": {
|
|
19
|
+
"CreateDate": "2021-05-05T17:18:05.8686153+03:00",
|
|
20
|
+
"Id": "0022487FBA1EBC6911EBADAC8BDE481C",
|
|
21
|
+
"Number": "23",
|
|
22
|
+
"PaymentType": "Cash",
|
|
23
|
+
"PaymentTypeEnum": 0,
|
|
24
|
+
"OrderSource": 2,
|
|
25
|
+
"Price": {
|
|
26
|
+
"Discount": 0,
|
|
27
|
+
"TotalPrice": 503
|
|
28
|
+
},
|
|
29
|
+
"DeliveryDate": "2021-05-05T18:18:05.8686153+03:00",
|
|
30
|
+
"OrderType": 3,
|
|
31
|
+
"Products": [
|
|
32
|
+
{
|
|
33
|
+
"AddedIngredients": [],
|
|
34
|
+
"Id": "000D3A240C71BE9A11E719BE2AB2D427",
|
|
35
|
+
"Name": "Dodster 1 pcs.",
|
|
36
|
+
"PricePerProduct": {
|
|
37
|
+
"Discount": 0,
|
|
38
|
+
"Price": 159,
|
|
39
|
+
"Taxes": []
|
|
40
|
+
},
|
|
41
|
+
"Quantity": 1,
|
|
42
|
+
"RemovedIngredients": []
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"AddedIngredients": [],
|
|
46
|
+
"Id": "000D3A240C71BE9A11E719BE2AD13D0D",
|
|
47
|
+
"Name": "Coca Cola Zero 500 ml",
|
|
48
|
+
"PricePerProduct": {
|
|
49
|
+
"Discount": 0,
|
|
50
|
+
"Price": 95,
|
|
51
|
+
"Taxes": [
|
|
52
|
+
{
|
|
53
|
+
"Rate": 20,
|
|
54
|
+
"Type": "VAT"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"Quantity": 1,
|
|
59
|
+
"RemovedIngredients": []
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"AddedIngredients": [],
|
|
63
|
+
"Id": "11EA5A11B53111A0CB4BC59232AF6200",
|
|
64
|
+
"Name": "Fanta Orange 1.5 l",
|
|
65
|
+
"PricePerProduct": {
|
|
66
|
+
"Discount": 0,
|
|
67
|
+
"Price": 249,
|
|
68
|
+
"Taxes": [
|
|
69
|
+
{
|
|
70
|
+
"Rate": 14,
|
|
71
|
+
"Type": "VAT"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"Quantity": 1,
|
|
76
|
+
"RemovedIngredients": []
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"Organization": {
|
|
81
|
+
"Address": "71-75 Shelton Street, London, WC2H 9JQ, United Kingdom",
|
|
82
|
+
"Name": "Yukon Ltd Limited",
|
|
83
|
+
"Requisites": {
|
|
84
|
+
"VAT": "123456",
|
|
85
|
+
"SOME-OTHER-REQ-1": "1166313070681",
|
|
86
|
+
"SOME-OTHER-REQ-2": ""
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"Store": {
|
|
90
|
+
"Address": "Platform 8 7/4, Kings Cross Station, London, N1 9AP, United Kingdom"
|
|
91
|
+
},
|
|
92
|
+
"PreviousReceipts": []
|
|
93
|
+
}
|