@tossplace/pos-plugin-sdk 0.0.4 → 0.0.6
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.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/sdk.d.ts +859 -100
- package/package.json +1 -1
- package/types/index.d.ts +846 -100
package/dist/sdk.d.ts
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
type: 'alert';
|
|
3
|
-
title: string;
|
|
4
|
-
description: string;
|
|
5
|
-
image: string;
|
|
6
|
-
cta: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
declare type AlertResponse = {
|
|
10
|
-
type: 'alert';
|
|
11
|
-
};
|
|
1
|
+
import { WebView } from '@tossplace-nexus/pos-webview';
|
|
12
2
|
|
|
13
3
|
declare type AllPaymentCreateDto = PluginCardDto | PluginCashDto | PluginExternalDto;
|
|
14
4
|
|
|
15
|
-
declare type AllPopupElements = AlertElements | BarcodeElements;
|
|
16
|
-
|
|
17
|
-
declare type AllPopupResponse = AlertResponse | BarcodeResponse;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @publicApi
|
|
21
|
-
*/
|
|
22
|
-
declare type AllPopupType = AllPopupElements['type'];
|
|
23
|
-
|
|
24
5
|
declare const AvailableLanguageCodes: {
|
|
25
6
|
readonly Korean: "ko-KR";
|
|
26
7
|
readonly English: "en-US";
|
|
@@ -48,9 +29,22 @@ declare type BarcodeResponse = {
|
|
|
48
29
|
errorMessage: string;
|
|
49
30
|
};
|
|
50
31
|
|
|
51
|
-
declare type
|
|
32
|
+
declare type BaseInput = {
|
|
33
|
+
id: string;
|
|
34
|
+
label: string;
|
|
35
|
+
required: boolean;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
declare type BaseInput_2 = {
|
|
39
|
+
label: string;
|
|
40
|
+
required: boolean;
|
|
41
|
+
id: string;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
declare type CancelCallback = (order: PluginOrder, payment: PluginPayment, ui: Ui) => Promise<PluginCancelledPaymentDto | undefined>;
|
|
52
45
|
|
|
53
46
|
/**
|
|
47
|
+
* @schema
|
|
54
48
|
* @publicApi
|
|
55
49
|
*/
|
|
56
50
|
export declare type CashReceipt = {
|
|
@@ -66,39 +60,179 @@ export declare type CashReceipt = {
|
|
|
66
60
|
cardNumber: string;
|
|
67
61
|
};
|
|
68
62
|
|
|
69
|
-
|
|
63
|
+
/**
|
|
64
|
+
* @publicApi
|
|
65
|
+
*/
|
|
66
|
+
export declare interface CashReceiptTypes {
|
|
70
67
|
add: (receipt: CashReceipt) => Promise<void>;
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
/**
|
|
74
71
|
* @publicApi
|
|
75
72
|
*/
|
|
76
|
-
export declare
|
|
73
|
+
export declare interface Catalog {
|
|
74
|
+
getCatalogs: () => Promise<PluginCatalogItem[]>;
|
|
75
|
+
on(event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: CatalogEventCallback): void;
|
|
76
|
+
on(event: 'before-add', callback: CatalogRequiredResponseEventCallback): void;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare type CatalogEventCallback = (catalog: PluginCatalogItem) => void;
|
|
77
80
|
|
|
78
81
|
/**
|
|
79
82
|
* @publicApi
|
|
80
83
|
*/
|
|
81
|
-
export declare
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
export declare type CatalogItemOptionChoiceState = 'ON_SALE' | 'SOLD_OUT';
|
|
85
|
+
|
|
86
|
+
declare type CatalogRequiredResponseEventCallback = (payload: {
|
|
87
|
+
payload: Partial<PluginCatalogItemDto>;
|
|
88
|
+
ui: Ui;
|
|
89
|
+
}) => Promise<{
|
|
90
|
+
initialValue?: PluginCatalogItemDto;
|
|
91
|
+
}>;
|
|
85
92
|
|
|
86
93
|
/**
|
|
87
94
|
* @publicApi
|
|
88
95
|
*/
|
|
89
96
|
export declare interface CategoryTypes {
|
|
90
97
|
getCategories: () => Promise<PluginCatalogCategory[]>;
|
|
98
|
+
on: (event: 'update' | 'add' | 'delete', callback: (category: PluginCatalogCategory) => void) => void;
|
|
91
99
|
}
|
|
92
100
|
|
|
93
|
-
|
|
101
|
+
/**
|
|
102
|
+
* @return 선택된 values id의 배열 string[]
|
|
103
|
+
* @example ['option1', 'option2']
|
|
104
|
+
*/
|
|
105
|
+
declare type CheckBoxInput = Omit<BaseInput, 'placeholder'> & {
|
|
106
|
+
type: 'checkbox';
|
|
107
|
+
/**
|
|
108
|
+
* @description 선택된 value의 id의 배열
|
|
109
|
+
*/
|
|
110
|
+
default: string[];
|
|
111
|
+
values: InputValue[];
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @return 선택된 values id의 배열 string[]
|
|
116
|
+
* @example ['option1', 'option2']
|
|
117
|
+
*/
|
|
118
|
+
declare type CheckBoxInput_2 = Omit<BaseInput_2, 'placeholder'> & {
|
|
119
|
+
type: 'checkbox';
|
|
120
|
+
/**
|
|
121
|
+
* @description 선택된 value의 id의 배열
|
|
122
|
+
*/
|
|
123
|
+
default: string[];
|
|
124
|
+
values: InputValue_2[];
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
declare type CtaInput = {
|
|
128
|
+
type: 'cta';
|
|
129
|
+
id: string;
|
|
130
|
+
text: string;
|
|
131
|
+
ctaType: 'primary' | 'danger' | 'weak';
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
declare type DeliveryOrder = Order_2 & {
|
|
135
|
+
type: 'DELIVERY';
|
|
136
|
+
/**
|
|
137
|
+
* 배달 주체
|
|
138
|
+
*/
|
|
139
|
+
deliveryBy: 'DELIVERY_COMPANY' | 'STORE' | 'AGENCY';
|
|
140
|
+
memo: {
|
|
141
|
+
store?: string;
|
|
142
|
+
delivery?: string;
|
|
143
|
+
};
|
|
144
|
+
address: {
|
|
145
|
+
road?: string;
|
|
146
|
+
lot?: string;
|
|
147
|
+
};
|
|
148
|
+
phone?: string;
|
|
149
|
+
status: DeliveryStatus;
|
|
150
|
+
};
|
|
94
151
|
|
|
95
152
|
/**
|
|
96
153
|
* @publicApi
|
|
97
154
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
155
|
+
declare type DeliveryStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_CANCELLED' | 'CANCELLED' | 'RIDER_ASSIGNED' | 'RIDER_ARRIVE_SOON' | 'RIDER_PICKUP_COMPLETED' | 'DONE';
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @publicApi
|
|
159
|
+
*/
|
|
160
|
+
export declare interface Device {
|
|
161
|
+
getDeviceInfo(): Promise<DeviceInfo>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @publicApi
|
|
166
|
+
*/
|
|
167
|
+
export declare type DeviceInfo = {
|
|
168
|
+
name: string;
|
|
169
|
+
version: string;
|
|
170
|
+
platform: Platform;
|
|
171
|
+
arch: string;
|
|
172
|
+
/**
|
|
173
|
+
* 포스 고유번호
|
|
174
|
+
*/
|
|
175
|
+
serialNumber: string;
|
|
176
|
+
/**
|
|
177
|
+
* os 버전을 가져옵니다.
|
|
178
|
+
* https://www.electronjs.org/docs/latest/api/process#processgetsystemversion
|
|
179
|
+
* Windows와 macos에서만 지원됩니다
|
|
180
|
+
*/
|
|
181
|
+
osVersion?: string;
|
|
182
|
+
businessType: {
|
|
183
|
+
business: {
|
|
184
|
+
type: 'CARE' | 'RESTAURANT';
|
|
185
|
+
};
|
|
186
|
+
operation: {
|
|
187
|
+
payment: {
|
|
188
|
+
type: 'PAY_FIRST' | 'PAY_LATER';
|
|
189
|
+
};
|
|
190
|
+
table: {
|
|
191
|
+
enabled: boolean;
|
|
192
|
+
};
|
|
193
|
+
booking: {
|
|
194
|
+
enabled: boolean;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
} | {
|
|
198
|
+
business: {
|
|
199
|
+
type: 'RETAIL' | 'SERVICE';
|
|
200
|
+
};
|
|
201
|
+
operation: {
|
|
202
|
+
payment: {
|
|
203
|
+
type: 'PAY_FIRST';
|
|
204
|
+
};
|
|
205
|
+
table: {
|
|
206
|
+
enabled: false;
|
|
207
|
+
};
|
|
208
|
+
booking: {
|
|
209
|
+
enabled: boolean;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
};
|
|
100
213
|
};
|
|
101
214
|
|
|
215
|
+
declare type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @publicApi
|
|
219
|
+
*/
|
|
220
|
+
export declare interface DraftOrder {
|
|
221
|
+
clear(): Promise<void>;
|
|
222
|
+
get(): Promise<PluginDraftOrder>;
|
|
223
|
+
addLineItem(lineItem: PluginDraftOrderItemDto): Promise<PluginDraftOrder>;
|
|
224
|
+
deleteLineItem(itemKey: string): Promise<PluginDraftOrder>;
|
|
225
|
+
updateItemQuantity(itemKey: string, quantity: number): Promise<PluginDraftOrder>;
|
|
226
|
+
updateItemOptionChoice(itemKey: string, choices: PluginCatalogItemOptionChoice[]): Promise<PluginDraftOrder>;
|
|
227
|
+
updateItemMemo(itemKey: string, memo: string): Promise<PluginDraftOrder>;
|
|
228
|
+
updateIgnorePrint(ignorePrint: boolean): Promise<PluginDraftOrder>;
|
|
229
|
+
deleteDiscount(indexOfDiscount: number): Promise<PluginDraftOrder>;
|
|
230
|
+
deleteItemDiscount(itemKey: string, indexOfDiscount: number): Promise<PluginDraftOrder>;
|
|
231
|
+
startPayment(): Promise<void>;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare type Element_2 = BarcodeElements | InputElements;
|
|
235
|
+
|
|
102
236
|
/**
|
|
103
237
|
* @publicApi
|
|
104
238
|
*/
|
|
@@ -111,6 +245,21 @@ declare interface FFIApi extends FFIFunction {
|
|
|
111
245
|
name: string;
|
|
112
246
|
}
|
|
113
247
|
|
|
248
|
+
/**
|
|
249
|
+
* @internal
|
|
250
|
+
* @publicApi
|
|
251
|
+
*/
|
|
252
|
+
declare interface FFIDownloadInfo {
|
|
253
|
+
win32: {
|
|
254
|
+
filePath: string;
|
|
255
|
+
downloadUrl: string;
|
|
256
|
+
};
|
|
257
|
+
win64: {
|
|
258
|
+
filePath: string;
|
|
259
|
+
downloadUrl: string;
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
114
263
|
/**
|
|
115
264
|
* @publicApi
|
|
116
265
|
*/
|
|
@@ -118,6 +267,7 @@ declare interface FFIFunction {
|
|
|
118
267
|
params?: FFIFunctionParam[];
|
|
119
268
|
return: FFIFunctionReturn;
|
|
120
269
|
options?: FFIFunctionOptions;
|
|
270
|
+
returnData?: any;
|
|
121
271
|
}
|
|
122
272
|
|
|
123
273
|
/**
|
|
@@ -151,16 +301,34 @@ declare type FFIFunctionParam = {
|
|
|
151
301
|
*/
|
|
152
302
|
declare type FFIFunctionReturn = 'void' | 'str' | 'int' | 'bool' | 'wchar *' | 'void *';
|
|
153
303
|
|
|
154
|
-
|
|
155
|
-
|
|
304
|
+
/**
|
|
305
|
+
* @publicApi
|
|
306
|
+
*/
|
|
307
|
+
export declare interface FFITypes {
|
|
308
|
+
download: (downloadInfo: FFIDownloadInfo) => Promise<{
|
|
309
|
+
platform: keyof FFIDownloadInfo;
|
|
310
|
+
}>;
|
|
156
311
|
load: (filePath: string, apis: FFIApi[]) => Promise<void>;
|
|
157
312
|
unload: (filePath: string) => Promise<void>;
|
|
158
313
|
invoke: (filePath: string, apiName: string, params?: any[]) => Promise<any>;
|
|
159
314
|
registerCallback: (filePath: string, signature: FFIFunction, callback: (...args: any[]) => any) => Promise<{
|
|
160
315
|
ffiCallbackId: string;
|
|
161
316
|
}>;
|
|
317
|
+
unregisterCallback: (filePath: string, callbackId: string) => Promise<void>;
|
|
318
|
+
addCallbackErrorHandler: (filePath: string, handler: (error: Error) => void) => void;
|
|
162
319
|
}
|
|
163
320
|
|
|
321
|
+
declare function getValues<T extends Record<string, number | string | string[] | boolean | undefined>>(): Promise<T>;
|
|
322
|
+
|
|
323
|
+
declare type HereOrder = Order_2 & {
|
|
324
|
+
type: 'HERE';
|
|
325
|
+
memo: {
|
|
326
|
+
store?: string;
|
|
327
|
+
};
|
|
328
|
+
phone?: string;
|
|
329
|
+
status: StoreStatus;
|
|
330
|
+
};
|
|
331
|
+
|
|
164
332
|
/**
|
|
165
333
|
* @publicApi
|
|
166
334
|
*/
|
|
@@ -185,32 +353,121 @@ export declare interface HttpTypes {
|
|
|
185
353
|
patch: (url: string, payload: any, headers?: [string, string][]) => Promise<PluginHttpResponse>;
|
|
186
354
|
}
|
|
187
355
|
|
|
356
|
+
declare type InputElements = {
|
|
357
|
+
type: 'input';
|
|
358
|
+
inputs: PluginInputs[];
|
|
359
|
+
title: string;
|
|
360
|
+
description?: string;
|
|
361
|
+
cta: {
|
|
362
|
+
cancel?: CtaInput;
|
|
363
|
+
submit: CtaInput;
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
declare type InputResponse = {
|
|
368
|
+
type: 'input';
|
|
369
|
+
complete: true;
|
|
370
|
+
data: {
|
|
371
|
+
inputs: Record<string, string | number | boolean | string[]>;
|
|
372
|
+
result: 'SUCCESS';
|
|
373
|
+
} | {
|
|
374
|
+
result: 'CANCELLED';
|
|
375
|
+
};
|
|
376
|
+
} | {
|
|
377
|
+
type: 'input';
|
|
378
|
+
complete: false;
|
|
379
|
+
errorMessage: string;
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
declare type InputValue = {
|
|
383
|
+
id: string;
|
|
384
|
+
label: string;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
declare type InputValue_2 = {
|
|
388
|
+
id: string;
|
|
389
|
+
label: string;
|
|
390
|
+
};
|
|
391
|
+
|
|
188
392
|
declare type Join<T extends string, U extends string> = `${T}${U}` | '0';
|
|
189
393
|
|
|
190
394
|
declare type Languages = Record<PluginLanguageCode, string>;
|
|
191
395
|
|
|
192
396
|
/**
|
|
193
397
|
* @publicApi
|
|
398
|
+
* @deprecated
|
|
194
399
|
*/
|
|
195
|
-
|
|
400
|
+
declare type LegacyPluginInputType = PluginInputsLegacy['type'];
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* @publicApi
|
|
404
|
+
*/
|
|
405
|
+
export declare interface MenuOption {
|
|
196
406
|
getOptions: () => Promise<PluginCatalogItemOption[]>;
|
|
197
|
-
on: (event: 'sold-out' | 'on-sale', callback: (option: PluginCatalogItemOption) => void) => void;
|
|
407
|
+
on: (event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: (option: PluginCatalogItemOption) => void) => void;
|
|
198
408
|
}
|
|
199
409
|
|
|
200
410
|
/**
|
|
201
411
|
* @publicApi
|
|
202
412
|
*/
|
|
203
|
-
export declare interface
|
|
413
|
+
export declare interface Merchant {
|
|
204
414
|
getMerchant: () => Promise<TossMerchant>;
|
|
205
415
|
}
|
|
206
416
|
|
|
207
|
-
|
|
417
|
+
/**
|
|
418
|
+
* @publicApi
|
|
419
|
+
*/
|
|
420
|
+
export declare interface Navigation {
|
|
421
|
+
navigate(page: 'plugin-tab', packageName?: string): void;
|
|
422
|
+
navigate(page: 'business-type-setting'): void;
|
|
423
|
+
/**
|
|
424
|
+
* 포스에서 페이지를 이동합니다.
|
|
425
|
+
* @param page business-type-setting 업종유형 변경, plugin-tab 플러그인 탭 이동
|
|
426
|
+
* @param packageName 이동할 탭의 이름, 없는 경우 첫번째 플러그인 탭으로 이동합니다
|
|
427
|
+
*/
|
|
428
|
+
navigate(page: 'business-type-setting' | 'plugin-tab', packageName?: string): void;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* @publicApi
|
|
433
|
+
*/
|
|
434
|
+
export declare class NavigationImpl implements Navigation {
|
|
435
|
+
navigate(page: 'plugin-tab', packageName?: string): void;
|
|
436
|
+
navigate(page: 'business-type-setting'): void;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* @return number
|
|
441
|
+
*/
|
|
442
|
+
declare type NumberInput = BaseInput & {
|
|
443
|
+
type: 'number';
|
|
444
|
+
default: number;
|
|
445
|
+
placeholder?: string;
|
|
446
|
+
suffix?: string;
|
|
447
|
+
/**
|
|
448
|
+
* @see https://deus.toss.im/projects/1057/pages/o58sjnCS@1?node=jIulZjBg%401
|
|
449
|
+
* @description candidates는 선택지를 제공하는 기능으로, candidates중 유저가 하나를 선택하면 textField가 자동으로 value로 채워짐
|
|
450
|
+
*/
|
|
451
|
+
candidates?: {
|
|
452
|
+
text: string;
|
|
453
|
+
value: number;
|
|
454
|
+
}[];
|
|
455
|
+
};
|
|
208
456
|
|
|
209
457
|
/**
|
|
210
458
|
* @publicApi
|
|
211
459
|
*/
|
|
212
|
-
export declare interface
|
|
460
|
+
export declare interface Order {
|
|
213
461
|
getOrder: (id: string) => Promise<PluginOrder>;
|
|
462
|
+
/**
|
|
463
|
+
* @param start yyyyMMdd
|
|
464
|
+
* @param end yyyyMMdd
|
|
465
|
+
* @description createdAt 기준으로 주문을 조회합니다
|
|
466
|
+
*/
|
|
467
|
+
getOrders: (range: {
|
|
468
|
+
start: string;
|
|
469
|
+
end: string;
|
|
470
|
+
}) => Promise<PluginOrder[]>;
|
|
214
471
|
/**
|
|
215
472
|
* 토스 포스에서 카드결제를 취소하면 무조건 카드리딩해야함 그래서 on cancel은 늘 환불까지 된 상태임
|
|
216
473
|
*/
|
|
@@ -224,7 +481,86 @@ export declare interface OrderTypes {
|
|
|
224
481
|
complete: (id: string) => Promise<PluginOrder>;
|
|
225
482
|
}
|
|
226
483
|
|
|
227
|
-
declare type
|
|
484
|
+
declare type Order_2 = {
|
|
485
|
+
/**
|
|
486
|
+
* 포스(사장님)에게 보여줄 주문유형
|
|
487
|
+
* @example 가게배달, 장보기/쇼핑, 픽업, 배민1 등등
|
|
488
|
+
*/
|
|
489
|
+
serviceName: string;
|
|
490
|
+
/**
|
|
491
|
+
* 주문서에서 라이더에게 보여줄 배달 타입 (배민1, 배달의민족)
|
|
492
|
+
*/
|
|
493
|
+
deliveryName: string;
|
|
494
|
+
/**
|
|
495
|
+
* @description 주문 시간 (yyyy-MM-dd'T'HH:mm:ss)
|
|
496
|
+
* @example 2025-04-08T16:11:13.000+09:00
|
|
497
|
+
*/
|
|
498
|
+
orderAt: string;
|
|
499
|
+
/**
|
|
500
|
+
* @description 아이콘 url
|
|
501
|
+
*/
|
|
502
|
+
icon: string;
|
|
503
|
+
/**
|
|
504
|
+
* @description 준비시간(분)
|
|
505
|
+
*/
|
|
506
|
+
preparationTimeMin?: number;
|
|
507
|
+
/**
|
|
508
|
+
* 픽업/배달이 실행될 예약주문 시간 (yyyy-MM-dd'T'HH:mm:ss)
|
|
509
|
+
* @description 예약주문인 경우에만 값이 존재
|
|
510
|
+
* @example 2025-04-08T16:11:13.000+09:00
|
|
511
|
+
*/
|
|
512
|
+
reservedDateTime?: string;
|
|
513
|
+
deliveryId: string;
|
|
514
|
+
origin?: string;
|
|
515
|
+
shop: {
|
|
516
|
+
id: string;
|
|
517
|
+
name: string;
|
|
518
|
+
};
|
|
519
|
+
paymentMethod: '결제완료' | '만나서 카드결제' | '만나서 현금결제' | '선불결제' | '기타결제';
|
|
520
|
+
/**
|
|
521
|
+
* @description 고객이 결제한 금액
|
|
522
|
+
*/
|
|
523
|
+
customerChargedPrice: number;
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
declare type OrderItemType = 'ITEM' | 'DELIVERY_FEE' | 'PREPAID_CARD' | 'MULTI_USE_TICKET';
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* @return string
|
|
530
|
+
*/
|
|
531
|
+
declare type PasswordInput = BaseInput & {
|
|
532
|
+
type: 'password';
|
|
533
|
+
default: string;
|
|
534
|
+
placeholder?: string;
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* @return string
|
|
539
|
+
*/
|
|
540
|
+
declare type PasswordInput_2 = BaseInput_2 & {
|
|
541
|
+
type: 'password';
|
|
542
|
+
default: string;
|
|
543
|
+
placeholder?: string;
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
declare type PayCallback = (order: PluginOrder, price: PluginPrice, ui: Ui) => Promise<PaymentMethodResponse | undefined>;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* @publicApi
|
|
550
|
+
*/
|
|
551
|
+
export declare interface Payment {
|
|
552
|
+
on: (event: 'cancel' | 'paid', callback: PaymentCallback) => void;
|
|
553
|
+
cancel: (order: {
|
|
554
|
+
id: string;
|
|
555
|
+
}, payment: {
|
|
556
|
+
id: string;
|
|
557
|
+
}) => Promise<void>;
|
|
558
|
+
add: (order: {
|
|
559
|
+
id: string;
|
|
560
|
+
}, paymentDto: PluginPaymentDto) => Promise<PluginPaymentOf<'CARD'> | PluginPaymentOf<'CASH'> | PluginPaymentOf<'EXTERNAL'>>;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
declare type PaymentCallback = (payment: PluginPayment, order: PluginOrder) => void;
|
|
228
564
|
|
|
229
565
|
/**
|
|
230
566
|
* @publicApi
|
|
@@ -237,11 +573,13 @@ export declare type PaymentMethodResponse = {
|
|
|
237
573
|
* @example 2022-01-27T11:42:33
|
|
238
574
|
*/
|
|
239
575
|
approvedAt: string;
|
|
240
|
-
approvedNo: string;
|
|
241
576
|
paymentKey: string;
|
|
242
577
|
};
|
|
243
578
|
|
|
244
|
-
|
|
579
|
+
/**
|
|
580
|
+
* @publicApi
|
|
581
|
+
*/
|
|
582
|
+
export declare type PaymentMethodType = {
|
|
245
583
|
add: (payload: {
|
|
246
584
|
data: {
|
|
247
585
|
/**
|
|
@@ -261,16 +599,73 @@ declare type PaymentMethodType = {
|
|
|
261
599
|
}) => void;
|
|
262
600
|
};
|
|
263
601
|
|
|
264
|
-
declare
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
602
|
+
declare type PickupOrder = Order_2 & {
|
|
603
|
+
type: 'PICKUP';
|
|
604
|
+
memo: {
|
|
605
|
+
store?: string;
|
|
606
|
+
};
|
|
607
|
+
phone?: string;
|
|
608
|
+
status: StoreStatus;
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* @publicApi
|
|
613
|
+
*/
|
|
614
|
+
declare type Platform = 'macos' | 'windows' | 'android' | 'ios' | 'unknown';
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* @publicApi
|
|
618
|
+
*/
|
|
619
|
+
export declare const plugin: PluginImpl;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* @publicApi
|
|
623
|
+
*/
|
|
624
|
+
declare interface Plugin_2 {
|
|
625
|
+
on(event: 'close', callback: () => Promise<void>): void;
|
|
626
|
+
getPluginInfo(): Promise<{
|
|
627
|
+
name: string;
|
|
628
|
+
version: string;
|
|
629
|
+
}>;
|
|
630
|
+
}
|
|
631
|
+
export { Plugin_2 as Plugin }
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* @publicApi
|
|
635
|
+
*/
|
|
636
|
+
declare interface PluginAccountTransferPayment extends PluginPaymentBase {
|
|
637
|
+
sourceType: 'ACCOUNT_TRANSFER';
|
|
638
|
+
/** 계좌이체 정보 */
|
|
639
|
+
accountTransfer: {
|
|
640
|
+
/** 은행코드 */
|
|
641
|
+
bankCode: number;
|
|
642
|
+
/** 계좌번호 */
|
|
643
|
+
accountNumber: string;
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* @publicApi
|
|
649
|
+
*/
|
|
650
|
+
declare interface PluginBarcodePayment extends PluginPaymentBase {
|
|
651
|
+
sourceType: 'BARCODE';
|
|
652
|
+
externalDetails: {
|
|
653
|
+
installmentMonth: PluginPaymentInstallment;
|
|
654
|
+
/**
|
|
655
|
+
* 발급사명
|
|
656
|
+
* @example 토스페이, 네이버체크, 카카오페이머니, ...
|
|
657
|
+
*/
|
|
658
|
+
source: string;
|
|
659
|
+
/**
|
|
660
|
+
* 간편결제 구분자
|
|
661
|
+
* @example KKF, SG2, ZRP, ...
|
|
662
|
+
*/
|
|
663
|
+
sourceId: string;
|
|
664
|
+
sourceType?: PluginPaymentExternalSourceType;
|
|
665
|
+
/** 매입사명 */
|
|
666
|
+
cardBrand?: string;
|
|
667
|
+
cardNo?: string;
|
|
668
|
+
};
|
|
274
669
|
}
|
|
275
670
|
|
|
276
671
|
/**
|
|
@@ -371,6 +766,10 @@ export declare interface PluginCatalogItem {
|
|
|
371
766
|
* @description 토스 포스에 등록된 메뉴의 고유 아이디
|
|
372
767
|
*/
|
|
373
768
|
id: number;
|
|
769
|
+
/**
|
|
770
|
+
* 플러그인에서 생성하면 토스포스 서버에 저장되어 항상 같이 내려옴
|
|
771
|
+
*/
|
|
772
|
+
code?: string;
|
|
374
773
|
/**
|
|
375
774
|
* @description 포스 내에서 보여주는 타이틀
|
|
376
775
|
* @description 사장님께만 보입니다
|
|
@@ -398,7 +797,7 @@ export declare interface PluginCatalogItem {
|
|
|
398
797
|
* @description 메뉴에 달린 벳지입니다
|
|
399
798
|
*/
|
|
400
799
|
labels: PluginCatalogItemLabel[];
|
|
401
|
-
imageUrl
|
|
800
|
+
imageUrl?: string;
|
|
402
801
|
/**
|
|
403
802
|
* @description 상품의 가격정보
|
|
404
803
|
*/
|
|
@@ -407,6 +806,13 @@ export declare interface PluginCatalogItem {
|
|
|
407
806
|
* @description 상품에서 사용가능한 옵션 리스트
|
|
408
807
|
*/
|
|
409
808
|
options: PluginCatalogItemOption[];
|
|
809
|
+
/** POS에서 상품 표시시 색상 정보 */
|
|
810
|
+
color?: string;
|
|
811
|
+
/** 제조 및 유통 정보 */
|
|
812
|
+
provenance?: {
|
|
813
|
+
/** 제조사 */
|
|
814
|
+
displayProvenance: string;
|
|
815
|
+
};
|
|
410
816
|
}
|
|
411
817
|
|
|
412
818
|
/**
|
|
@@ -422,14 +828,20 @@ export declare interface PluginCatalogItemDto {
|
|
|
422
828
|
description?: string;
|
|
423
829
|
descriptionI18n?: PluginLanguagePack;
|
|
424
830
|
categoryId: number;
|
|
425
|
-
price:
|
|
831
|
+
price: PluginCatalogItemPriceDto;
|
|
426
832
|
labels: PluginCatalogItemLabel[];
|
|
427
|
-
imageUrl
|
|
833
|
+
imageUrl?: string;
|
|
428
834
|
/**
|
|
429
835
|
* @description 옵션을 먼저 만들고 id를 넣어달라
|
|
430
836
|
*/
|
|
431
837
|
options: Pick<PluginCatalogItemOption, 'id'>[];
|
|
432
|
-
|
|
838
|
+
/** POS에서 상품 표시시 색상 정보 */
|
|
839
|
+
color?: string;
|
|
840
|
+
/** 제조 및 유통 정보 */
|
|
841
|
+
provenance?: {
|
|
842
|
+
/** 제조사 */
|
|
843
|
+
displayProvenance: string;
|
|
844
|
+
};
|
|
433
845
|
}
|
|
434
846
|
|
|
435
847
|
/**
|
|
@@ -494,9 +906,9 @@ export declare interface PluginCatalogItemPrice {
|
|
|
494
906
|
* 재고 관리 코드
|
|
495
907
|
* @see https://en.wikipedia.org/wiki/Stock_keeping_unit
|
|
496
908
|
*/
|
|
497
|
-
sku
|
|
909
|
+
sku?: string;
|
|
498
910
|
/** 상품 가격의 바코드 정보 */
|
|
499
|
-
barcode
|
|
911
|
+
barcode?: string;
|
|
500
912
|
/** 가격 유형 */
|
|
501
913
|
priceType: PluginCatalogItemPriceType;
|
|
502
914
|
/** 가격의 기본 개수 */
|
|
@@ -510,18 +922,39 @@ export declare interface PluginCatalogItemPrice {
|
|
|
510
922
|
/** 재고 관리여부 */
|
|
511
923
|
isStockable: boolean;
|
|
512
924
|
/** 현재 남아있는 재고 수 */
|
|
513
|
-
stockQuantity
|
|
925
|
+
stockQuantity?: {
|
|
514
926
|
remainQuantity: number;
|
|
515
927
|
lastChangeDateTime: string;
|
|
516
|
-
}
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* @publicApi
|
|
933
|
+
*/
|
|
934
|
+
export declare interface PluginCatalogItemPriceDto {
|
|
935
|
+
/** 상품 가격명 */
|
|
936
|
+
title: string;
|
|
937
|
+
/** 상품 가격의 바코드 정보 */
|
|
938
|
+
barcode?: string;
|
|
939
|
+
/** 가격 유형 */
|
|
940
|
+
priceType: PluginCatalogItemPriceType;
|
|
941
|
+
/** 가격의 기본 개수 */
|
|
942
|
+
priceUnit: number;
|
|
943
|
+
/**
|
|
944
|
+
* 부가가치세(VAT)가 포함된 가격
|
|
945
|
+
*/
|
|
946
|
+
priceValue: number;
|
|
947
|
+
/** 비과세 여부 */
|
|
948
|
+
isTaxFree: boolean;
|
|
517
949
|
}
|
|
518
950
|
|
|
519
951
|
/**
|
|
520
952
|
* @publicApi
|
|
521
953
|
* FIXED: 고정 가격
|
|
522
954
|
* VARIABLE: 시가(예: 수산시장 방어회)
|
|
955
|
+
* UNIT: 단위 가격(예: 1kg당 가격, 1L당 가격 등)
|
|
523
956
|
*/
|
|
524
|
-
export declare type PluginCatalogItemPriceType = 'FIXED' | 'VARIABLE';
|
|
957
|
+
export declare type PluginCatalogItemPriceType = 'FIXED' | 'VARIABLE' | 'UNIT';
|
|
525
958
|
|
|
526
959
|
/**
|
|
527
960
|
* 상품 상태
|
|
@@ -532,6 +965,13 @@ export declare type PluginCatalogItemPriceType = 'FIXED' | 'VARIABLE';
|
|
|
532
965
|
*/
|
|
533
966
|
declare type PluginCatalogItemState = 'ON_SALE' | 'SOLD_OUT' | 'UNAVAILABLE' | 'DELETED';
|
|
534
967
|
|
|
968
|
+
/**
|
|
969
|
+
* @publicApi
|
|
970
|
+
*/
|
|
971
|
+
export declare type PluginDelivery<T extends 'PICKUP' | 'HERE' | 'DELIVERY'> = Extract<DeliveryOrder | PickupOrder | HereOrder, {
|
|
972
|
+
type: T;
|
|
973
|
+
}>;
|
|
974
|
+
|
|
535
975
|
/**
|
|
536
976
|
* @publicApi
|
|
537
977
|
* 할인 정보
|
|
@@ -549,6 +989,105 @@ export declare interface PluginDiscount {
|
|
|
549
989
|
titleI18n?: PluginLanguagePack;
|
|
550
990
|
}
|
|
551
991
|
|
|
992
|
+
/**
|
|
993
|
+
* @publicApi
|
|
994
|
+
*/
|
|
995
|
+
export declare interface PluginDraftOrder {
|
|
996
|
+
/**
|
|
997
|
+
* 주문ID
|
|
998
|
+
* 서버 주문을 클라이언트 주문으로 변경했을 때 값이 존재
|
|
999
|
+
*/
|
|
1000
|
+
id?: string;
|
|
1001
|
+
/** 주문 항목 목록 */
|
|
1002
|
+
lineItems: Array<PluginDraftOrderItem>;
|
|
1003
|
+
/** 주문 요청사항 */
|
|
1004
|
+
memo?: string;
|
|
1005
|
+
/** 주문에 적용된 할인 목록 */
|
|
1006
|
+
discounts: PluginDiscount[];
|
|
1007
|
+
price: PluginDraftOrderPrice;
|
|
1008
|
+
/**
|
|
1009
|
+
* 이 주문에 대해 프린트 출력을 무시할지 여부
|
|
1010
|
+
* 이 옵션이 켜져 있는 경우 다른 포스에서도 프린트 출력이 무시됩니다.
|
|
1011
|
+
* 기본값은 false입니다.
|
|
1012
|
+
*/
|
|
1013
|
+
ignorePrint: boolean;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* @publicApi
|
|
1018
|
+
*/
|
|
1019
|
+
export declare interface PluginDraftOrderItem {
|
|
1020
|
+
/**
|
|
1021
|
+
* 넣지 않으면 자동으로 생성됨
|
|
1022
|
+
*/
|
|
1023
|
+
key: string;
|
|
1024
|
+
/** 상품 정보 */
|
|
1025
|
+
item: Pick<PluginCatalogItem, 'id' | 'title' | 'category' | 'options' | 'code'> & {
|
|
1026
|
+
type: OrderItemType;
|
|
1027
|
+
};
|
|
1028
|
+
/** 상품 가격 정보 */
|
|
1029
|
+
itemPrice: Pick<PluginCatalogItemPrice, 'id' | 'isTaxFree' | 'priceType' | 'priceUnit' | 'priceValue' | 'sku' | 'title'>;
|
|
1030
|
+
/** 적용된 할인 목록 */
|
|
1031
|
+
discount: PluginDiscount[];
|
|
1032
|
+
/** 요청사항 */
|
|
1033
|
+
memo: string;
|
|
1034
|
+
/** 선택된 옵션 정보 */
|
|
1035
|
+
optionChoices: PluginCatalogItemOptionChoice[];
|
|
1036
|
+
/** 수량 */
|
|
1037
|
+
quantity: number;
|
|
1038
|
+
/** 식사 유형 */
|
|
1039
|
+
diningOption: PluginOrderDiningOption;
|
|
1040
|
+
/**
|
|
1041
|
+
* 서버에서 생성된 lineItemId
|
|
1042
|
+
*/
|
|
1043
|
+
lineItemId?: string;
|
|
1044
|
+
metadata?: {
|
|
1045
|
+
/**
|
|
1046
|
+
* true : 유저가 메모 수정 불가
|
|
1047
|
+
*/
|
|
1048
|
+
disableMemoEdit?: boolean;
|
|
1049
|
+
/**
|
|
1050
|
+
* true : 유저가 옵션 수정 불가
|
|
1051
|
+
*/
|
|
1052
|
+
disableOptionEdit?: boolean;
|
|
1053
|
+
/**
|
|
1054
|
+
* true : 유저가 수량 변경 불가
|
|
1055
|
+
*/
|
|
1056
|
+
disableQuantityEdit?: boolean;
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* @publicApi
|
|
1062
|
+
* @desription key는 넣으면 할당되고 없으면 포스에서 자동생성
|
|
1063
|
+
*/
|
|
1064
|
+
declare type PluginDraftOrderItemDto = PluginDraftOrderItem & {
|
|
1065
|
+
key?: string;
|
|
1066
|
+
itemPrice: Pick<PluginCatalogItemPrice, 'isTaxFree' | 'priceType' | 'priceUnit' | 'priceValue' | 'sku' | 'title'>;
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1069
|
+
declare interface PluginDraftOrderPrice {
|
|
1070
|
+
/** (-)할인 금액 */
|
|
1071
|
+
orderDiscountValue: number;
|
|
1072
|
+
/**
|
|
1073
|
+
* 원주문 금액
|
|
1074
|
+
* Σ OrderItem.orderPrice.orderListPriceValue
|
|
1075
|
+
*/
|
|
1076
|
+
orderListPriceValue: number;
|
|
1077
|
+
/**
|
|
1078
|
+
* 주문 금액 = 원주문금액 + 할인 금액 + 보증금 + 봉사료
|
|
1079
|
+
*
|
|
1080
|
+
* @see 보증금: DraftOrder.bookingFee
|
|
1081
|
+
*/
|
|
1082
|
+
orderPriceValue: number;
|
|
1083
|
+
/** 봉사료 */
|
|
1084
|
+
orderTipValue: number;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* 밴을 통하지 않으면 바코드결제라고 해도 externalPayment로 처리해주세요
|
|
1089
|
+
* 취소를 플러그인에서 따로 처리해야하면 externalPayment로 처리해주세요
|
|
1090
|
+
*/
|
|
552
1091
|
declare interface PluginExternalDto extends PluginPaymentDtoBase {
|
|
553
1092
|
sourceType: 'EXTERNAL';
|
|
554
1093
|
}
|
|
@@ -594,6 +1133,33 @@ export declare type PluginHttpResponse = {
|
|
|
594
1133
|
code: number;
|
|
595
1134
|
};
|
|
596
1135
|
|
|
1136
|
+
declare class PluginImpl implements Plugin_2 {
|
|
1137
|
+
private readonly webview;
|
|
1138
|
+
private pluginCallbacks;
|
|
1139
|
+
constructor(webview: WebView);
|
|
1140
|
+
private initializePlugin;
|
|
1141
|
+
on(event: 'close', callback: () => Promise<void>): void;
|
|
1142
|
+
getPluginInfo(): Promise<{
|
|
1143
|
+
name: string;
|
|
1144
|
+
version: string;
|
|
1145
|
+
}>;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* @publicApi
|
|
1150
|
+
* @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
|
|
1151
|
+
*/
|
|
1152
|
+
export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* @publicApi
|
|
1156
|
+
* @deprecated
|
|
1157
|
+
* @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
|
|
1158
|
+
*/
|
|
1159
|
+
declare type PluginInputsLegacy<T extends LegacyPluginInputType = any> = Extract<TextInput_2 | PasswordInput_2 | RadioInput_2 | CheckBoxInput_2 | ToggleInput_2 | SliderInput_2, {
|
|
1160
|
+
type: T;
|
|
1161
|
+
}>;
|
|
1162
|
+
|
|
597
1163
|
declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
|
|
598
1164
|
|
|
599
1165
|
/**
|
|
@@ -604,6 +1170,26 @@ export declare interface PluginLanguagePack {
|
|
|
604
1170
|
languages: Partial<Languages>;
|
|
605
1171
|
}
|
|
606
1172
|
|
|
1173
|
+
/**
|
|
1174
|
+
* @publicApi
|
|
1175
|
+
*/
|
|
1176
|
+
export declare interface PluginMessenger {
|
|
1177
|
+
broadcast<T = any>(message: T): void;
|
|
1178
|
+
on<T = any>(event: 'message', callback: (message: T) => void): void;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* @publicApi
|
|
1183
|
+
*/
|
|
1184
|
+
export declare const pluginMessenger: PluginMessengerImpl;
|
|
1185
|
+
|
|
1186
|
+
declare class PluginMessengerImpl implements PluginMessenger {
|
|
1187
|
+
private readonly webview;
|
|
1188
|
+
constructor(webview: WebView);
|
|
1189
|
+
broadcast<T = any>(message: T): void;
|
|
1190
|
+
on<T = any>(event: 'message', callback: (message: T) => void): void;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
607
1193
|
/**
|
|
608
1194
|
* @publicApi
|
|
609
1195
|
* @description pluginOrder orderDto를 서버에 저장 후 가공해서 내려 준 값
|
|
@@ -614,7 +1200,14 @@ export declare interface PluginOrder {
|
|
|
614
1200
|
tableId?: number;
|
|
615
1201
|
table?: PluginTable;
|
|
616
1202
|
orderKey: string;
|
|
617
|
-
|
|
1203
|
+
/**
|
|
1204
|
+
* 결제상태
|
|
1205
|
+
*/
|
|
1206
|
+
paymentState: PluginOrderPaymentState;
|
|
1207
|
+
/**
|
|
1208
|
+
* 주문상태
|
|
1209
|
+
*/
|
|
1210
|
+
orderState: PluginOrderState;
|
|
618
1211
|
lineItems: PluginOrderItem[];
|
|
619
1212
|
discounts?: PluginDiscount[];
|
|
620
1213
|
payments: PluginPayment[];
|
|
@@ -624,9 +1217,13 @@ export declare interface PluginOrder {
|
|
|
624
1217
|
source: string;
|
|
625
1218
|
memo?: string;
|
|
626
1219
|
/**
|
|
1220
|
+
* @description 주문시각
|
|
627
1221
|
* 해당값이 있다면 createdAt 대신 사용해주세요.
|
|
628
1222
|
*/
|
|
629
1223
|
openedAt?: string;
|
|
1224
|
+
/**
|
|
1225
|
+
* @description 생성시각
|
|
1226
|
+
*/
|
|
630
1227
|
createdAt: string;
|
|
631
1228
|
updatedAt?: string;
|
|
632
1229
|
cancelledAt?: string;
|
|
@@ -680,14 +1277,14 @@ export declare interface PluginOrderItem {
|
|
|
680
1277
|
id: string;
|
|
681
1278
|
orderId: string;
|
|
682
1279
|
diningOption: PluginOrderDiningOption;
|
|
683
|
-
item: Pick<PluginCatalogItem, 'id' | 'title' | 'category'> & {
|
|
1280
|
+
item: Pick<PluginCatalogItem, 'id' | 'title' | 'category' | 'code'> & {
|
|
684
1281
|
type: OrderItemType;
|
|
685
1282
|
};
|
|
686
1283
|
quantity: {
|
|
687
1284
|
value: number;
|
|
688
1285
|
};
|
|
689
1286
|
/**
|
|
690
|
-
* @description 실제 고객이 결제하는 금액에 대한 정보입니다.
|
|
1287
|
+
* @description 실제 고객이 결제하는 금액에 대한 정보입니다. (할인 적용 금액)
|
|
691
1288
|
*/
|
|
692
1289
|
chargePrice: {
|
|
693
1290
|
value: number;
|
|
@@ -704,6 +1301,22 @@ declare interface PluginOrderPaymentPrice {
|
|
|
704
1301
|
paymentPaidValue: number;
|
|
705
1302
|
}
|
|
706
1303
|
|
|
1304
|
+
/**
|
|
1305
|
+
* @publicApi
|
|
1306
|
+
* 주문의 결제상태
|
|
1307
|
+
* 상태 전이 규칙은 아래 문서를 참조해주세요. (22.09)
|
|
1308
|
+
* https://www.notion.so/tossteam/1affab9356d24d2d9256ca21be2db473
|
|
1309
|
+
* 또다른 문서도 있어요. (25.03)
|
|
1310
|
+
* https://www.notion.so/tossteam/1c3a360d33e380979d4df2a1ba3bfd31
|
|
1311
|
+
*
|
|
1312
|
+
* OPENED: 결제 전 (초기 상태)
|
|
1313
|
+
* PAID: 부분 결제 (일부 금액만 결제된 상태)
|
|
1314
|
+
* CANCELLED: 취소
|
|
1315
|
+
* COMPLETED: 결제 완료 (주문 금액이 모두 결제된 경우)
|
|
1316
|
+
* REFUNDED: 환불 (모든 결제가 취소된 상태)
|
|
1317
|
+
*/
|
|
1318
|
+
declare type PluginOrderPaymentState = 'OPENED' | 'PAID' | 'CANCELLED' | 'COMPLETED' | 'REFUNDED';
|
|
1319
|
+
|
|
707
1320
|
declare interface PluginOrderRequestInfo {
|
|
708
1321
|
/** 요청 시간 */
|
|
709
1322
|
requestAt: string;
|
|
@@ -724,21 +1337,18 @@ declare interface PluginOrderRequestInfo {
|
|
|
724
1337
|
/**
|
|
725
1338
|
* @publicApi
|
|
726
1339
|
* 주문 상태
|
|
727
|
-
* 상태 전이 규칙은 아래 문서를 참조해주세요.
|
|
728
|
-
* https://www.notion.so/tossteam/1affab9356d24d2d9256ca21be2db473
|
|
729
1340
|
*
|
|
730
|
-
*
|
|
731
|
-
*
|
|
732
|
-
*
|
|
733
|
-
*
|
|
734
|
-
* REFUNDED: 환불
|
|
1341
|
+
* - REQUEST: 주문 접수 (requestedInfo가 있는 주문의 초기 상태)
|
|
1342
|
+
* - OPENED: 주문 진행중 (포스 등 일반적인 환경에서 주문의 초기 상태)
|
|
1343
|
+
* - COMPLETED: 주문 완료
|
|
1344
|
+
* - CANCELLED: 주문 취소
|
|
735
1345
|
*/
|
|
736
|
-
export declare type PluginOrderState = '
|
|
1346
|
+
export declare type PluginOrderState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'CANCELLED';
|
|
737
1347
|
|
|
738
1348
|
/**
|
|
739
1349
|
* @publicApi
|
|
740
1350
|
*/
|
|
741
|
-
export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment) & {
|
|
1351
|
+
export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment | PluginAccountTransferPayment | PluginBarcodePayment) & {
|
|
742
1352
|
paymentKey: string;
|
|
743
1353
|
};
|
|
744
1354
|
|
|
@@ -803,6 +1413,11 @@ declare type PluginPaymentDtoBase = Pick<PluginPayment,
|
|
|
803
1413
|
*/
|
|
804
1414
|
'orderId' | 'sourceType' | 'amountMoney' | 'taxMoney' | 'approvedNo' | 'approvedAt' | 'paymentKey' | 'supplyMoney' | 'tipMoney' | 'taxExemptMoney'>;
|
|
805
1415
|
|
|
1416
|
+
/**
|
|
1417
|
+
* @publicApi
|
|
1418
|
+
*/
|
|
1419
|
+
declare type PluginPaymentExternalSourceType = 'CARD' | 'BANK_TRANSFER' | 'OTHER_GIFT_CARD' | 'POINT' | 'COUPON' | 'OTHER';
|
|
1420
|
+
|
|
806
1421
|
/**
|
|
807
1422
|
* @publicApi
|
|
808
1423
|
* 할부개월 수
|
|
@@ -825,7 +1440,7 @@ export declare type PluginPaymentOf<S extends PluginPaymentSourceType> = Extract
|
|
|
825
1440
|
* BARCODE: 바코드/QR을 사용하는 간편결제
|
|
826
1441
|
* EXTERNAL: 기타결제(쿠폰, 외상 등)
|
|
827
1442
|
*/
|
|
828
|
-
export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL';
|
|
1443
|
+
export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL' | 'BARCODE' | 'ACCOUNT_TRANSFER';
|
|
829
1444
|
|
|
830
1445
|
/**
|
|
831
1446
|
* @publicApi
|
|
@@ -874,49 +1489,120 @@ export declare interface PluginTableGroup {
|
|
|
874
1489
|
/**
|
|
875
1490
|
* @publicApi
|
|
876
1491
|
*/
|
|
877
|
-
export declare type PopupActionResponse<T extends
|
|
1492
|
+
export declare type PopupActionResponse<T extends PopupType> = Extract<Response_2, {
|
|
878
1493
|
type: T;
|
|
879
|
-
|
|
1494
|
+
complete: true;
|
|
1495
|
+
}>['data'];
|
|
880
1496
|
|
|
881
1497
|
/**
|
|
882
1498
|
* @publicApi
|
|
883
1499
|
*/
|
|
884
|
-
export declare type
|
|
1500
|
+
export declare type PopupElement<T extends PopupType> = Extract<Element_2, {
|
|
885
1501
|
type: T;
|
|
886
1502
|
}>;
|
|
887
1503
|
|
|
888
1504
|
/**
|
|
889
1505
|
* @publicApi
|
|
890
1506
|
*/
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
/**
|
|
894
|
-
* @publicApi
|
|
895
|
-
*/
|
|
896
|
-
export declare class PosPluginSdkError extends Error {
|
|
897
|
-
constructor(message: string);
|
|
898
|
-
static isPosPluginSdkError(error: unknown): error is PosPluginSdkError;
|
|
899
|
-
}
|
|
1507
|
+
declare type PopupType = Element_2['type'];
|
|
900
1508
|
|
|
901
1509
|
/**
|
|
902
1510
|
* @publicApi
|
|
903
1511
|
*/
|
|
904
|
-
export declare type
|
|
905
|
-
table:
|
|
1512
|
+
export declare type PosPluginSdk = {
|
|
1513
|
+
table: Table;
|
|
906
1514
|
category: CategoryTypes;
|
|
907
|
-
catalog:
|
|
908
|
-
option:
|
|
1515
|
+
catalog: Catalog;
|
|
1516
|
+
option: MenuOption;
|
|
909
1517
|
storage: StorageTypes;
|
|
910
1518
|
cashReceipt: CashReceiptTypes;
|
|
911
|
-
order:
|
|
912
|
-
payment:
|
|
1519
|
+
order: Order;
|
|
1520
|
+
payment: Payment;
|
|
913
1521
|
http: HttpTypes;
|
|
914
1522
|
toast: ToastTypes;
|
|
915
|
-
|
|
916
|
-
|
|
1523
|
+
device: Device;
|
|
1524
|
+
merchant: Merchant;
|
|
917
1525
|
paymentMethod: PaymentMethodType;
|
|
918
1526
|
websocket: WebsocketTypes;
|
|
919
1527
|
ffi: FFITypes;
|
|
1528
|
+
plugin: Plugin_2;
|
|
1529
|
+
pluginMessenger: PluginMessenger;
|
|
1530
|
+
setting: SettingTypes;
|
|
1531
|
+
draftOrder: DraftOrder;
|
|
1532
|
+
navigation: Navigation;
|
|
1533
|
+
};
|
|
1534
|
+
|
|
1535
|
+
/**
|
|
1536
|
+
* @publicApi
|
|
1537
|
+
*/
|
|
1538
|
+
export declare const posPluginSdk: PosPluginSdk;
|
|
1539
|
+
|
|
1540
|
+
/**
|
|
1541
|
+
* @publicApi
|
|
1542
|
+
*/
|
|
1543
|
+
export declare class PosPluginSdkError extends Error {
|
|
1544
|
+
constructor(message: string);
|
|
1545
|
+
static isPosPluginSdkError(error: unknown): error is PosPluginSdkError;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
/**
|
|
1549
|
+
* @return string values.id
|
|
1550
|
+
*/
|
|
1551
|
+
declare type RadioInput = Omit<BaseInput, 'placeholder'> & {
|
|
1552
|
+
type: 'radio';
|
|
1553
|
+
/**
|
|
1554
|
+
* @desciption 선택된 value의 id
|
|
1555
|
+
*/
|
|
1556
|
+
default: string;
|
|
1557
|
+
values: InputValue[];
|
|
1558
|
+
};
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* @return string values.id
|
|
1562
|
+
*/
|
|
1563
|
+
declare type RadioInput_2 = Omit<BaseInput_2, 'placeholder'> & {
|
|
1564
|
+
type: 'radio';
|
|
1565
|
+
/**
|
|
1566
|
+
* @desciption 선택된 value의 id
|
|
1567
|
+
*/
|
|
1568
|
+
default: string;
|
|
1569
|
+
values: InputValue_2[];
|
|
1570
|
+
};
|
|
1571
|
+
|
|
1572
|
+
declare type Response_2 = BarcodeResponse | InputResponse;
|
|
1573
|
+
|
|
1574
|
+
declare function setInputs(inputs: Array<PluginInputsLegacy>): void;
|
|
1575
|
+
|
|
1576
|
+
declare const setting: {
|
|
1577
|
+
setInputs: typeof setInputs;
|
|
1578
|
+
getValues: typeof getValues;
|
|
1579
|
+
};
|
|
1580
|
+
|
|
1581
|
+
/**
|
|
1582
|
+
* @publicApi
|
|
1583
|
+
*/
|
|
1584
|
+
export declare type SettingTypes = typeof setting;
|
|
1585
|
+
|
|
1586
|
+
/**
|
|
1587
|
+
* @return number 0 25 50 75 100
|
|
1588
|
+
*/
|
|
1589
|
+
declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
|
|
1590
|
+
type: 'slider';
|
|
1591
|
+
default: number;
|
|
1592
|
+
min: number;
|
|
1593
|
+
max: number;
|
|
1594
|
+
step: number;
|
|
1595
|
+
};
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* @return number 0 25 50 75 100
|
|
1599
|
+
*/
|
|
1600
|
+
declare type SliderInput_2 = Omit<BaseInput_2, 'placeholder'> & {
|
|
1601
|
+
type: 'slider';
|
|
1602
|
+
default: number;
|
|
1603
|
+
min: number;
|
|
1604
|
+
max: number;
|
|
1605
|
+
step: number;
|
|
920
1606
|
};
|
|
921
1607
|
|
|
922
1608
|
/**
|
|
@@ -928,12 +1614,25 @@ export declare interface StorageTypes {
|
|
|
928
1614
|
del: (key: string) => Promise<void>;
|
|
929
1615
|
}
|
|
930
1616
|
|
|
931
|
-
|
|
1617
|
+
/**
|
|
1618
|
+
* @publicApi
|
|
1619
|
+
*/
|
|
1620
|
+
declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_CANCELLED' | 'CANCELLED'
|
|
1621
|
+
/**
|
|
1622
|
+
* 손님이 가져감
|
|
1623
|
+
*/
|
|
1624
|
+
| 'DONE';
|
|
1625
|
+
|
|
1626
|
+
/**
|
|
1627
|
+
* @publicApi
|
|
1628
|
+
*/
|
|
1629
|
+
export declare interface Table {
|
|
932
1630
|
getTables: () => Promise<{
|
|
933
1631
|
table: PluginTable;
|
|
934
1632
|
order?: PluginOrder;
|
|
935
1633
|
}[]>;
|
|
936
|
-
on(event: 'order-update' | 'add'
|
|
1634
|
+
on(event: 'order-update' | 'order-add', callback: (order: PluginOrder) => void): void;
|
|
1635
|
+
on(event: 'clear' | 'add' | 'delete' | 'update', callback: (table: PluginTable) => void): void;
|
|
937
1636
|
on(event: 'swap' | 'move' | 'merge', callback: (before: PluginTable, after: PluginTable) => void): void;
|
|
938
1637
|
clearTable: (payload: {
|
|
939
1638
|
table: PluginTable;
|
|
@@ -941,10 +1640,56 @@ declare interface TableTypes {
|
|
|
941
1640
|
}) => Promise<void>;
|
|
942
1641
|
}
|
|
943
1642
|
|
|
944
|
-
|
|
1643
|
+
/**
|
|
1644
|
+
* @return string
|
|
1645
|
+
*/
|
|
1646
|
+
declare type TextInput = BaseInput & {
|
|
1647
|
+
type: 'text';
|
|
1648
|
+
default: string;
|
|
1649
|
+
placeholder?: string;
|
|
1650
|
+
suffix?: string;
|
|
1651
|
+
/**
|
|
1652
|
+
* @see https://deus.toss.im/projects/1057/pages/o58sjnCS@1?node=jIulZjBg%401
|
|
1653
|
+
* @description candidates는 선택지를 제공하는 기능으로, candidates중 유저가 하나를 선택하면 textField가 자동으로 value로 채워짐
|
|
1654
|
+
*/
|
|
1655
|
+
candidates?: {
|
|
1656
|
+
text: string;
|
|
1657
|
+
value: string;
|
|
1658
|
+
}[];
|
|
1659
|
+
};
|
|
1660
|
+
|
|
1661
|
+
/**
|
|
1662
|
+
* @return string
|
|
1663
|
+
*/
|
|
1664
|
+
declare type TextInput_2 = BaseInput_2 & {
|
|
1665
|
+
type: 'text';
|
|
1666
|
+
default: string;
|
|
1667
|
+
placeholder?: string;
|
|
1668
|
+
};
|
|
1669
|
+
|
|
1670
|
+
/**
|
|
1671
|
+
* @publicApi
|
|
1672
|
+
*/
|
|
1673
|
+
export declare type ToastTypes = {
|
|
945
1674
|
open(message: string): void;
|
|
946
1675
|
};
|
|
947
1676
|
|
|
1677
|
+
/**
|
|
1678
|
+
* @return boolean
|
|
1679
|
+
*/
|
|
1680
|
+
declare type ToggleInput = Omit<BaseInput, 'placeholder'> & {
|
|
1681
|
+
type: 'toggle';
|
|
1682
|
+
default: boolean;
|
|
1683
|
+
};
|
|
1684
|
+
|
|
1685
|
+
/**
|
|
1686
|
+
* @return boolean
|
|
1687
|
+
*/
|
|
1688
|
+
declare type ToggleInput_2 = Omit<BaseInput_2, 'placeholder'> & {
|
|
1689
|
+
type: 'toggle';
|
|
1690
|
+
default: boolean;
|
|
1691
|
+
};
|
|
1692
|
+
|
|
948
1693
|
/**
|
|
949
1694
|
* @publicApi
|
|
950
1695
|
* @description 추후에 필요한 정보 더 추가될 예정
|
|
@@ -952,13 +1697,24 @@ declare type ToastTypes = {
|
|
|
952
1697
|
export declare type TossMerchant = {
|
|
953
1698
|
name: string;
|
|
954
1699
|
id: number;
|
|
1700
|
+
businessNumber: string;
|
|
1701
|
+
/**
|
|
1702
|
+
* @deprecated
|
|
1703
|
+
* @see DeviceInfo.serialNumber
|
|
1704
|
+
*/
|
|
955
1705
|
serialNumber: string;
|
|
956
|
-
|
|
957
|
-
|
|
1706
|
+
franchise?: {
|
|
1707
|
+
id: string;
|
|
1708
|
+
name: string;
|
|
1709
|
+
};
|
|
958
1710
|
};
|
|
959
1711
|
|
|
960
|
-
|
|
961
|
-
|
|
1712
|
+
/**
|
|
1713
|
+
* @publicApi
|
|
1714
|
+
*/
|
|
1715
|
+
export declare type Ui = {
|
|
1716
|
+
openBarcode(message: Omit<PopupElement<'barcode'>, 'type'>): Promise<PopupActionResponse<'barcode'>>;
|
|
1717
|
+
openInputModal(message: Omit<PopupElement<'input'>, 'type'>): Promise<PopupActionResponse<'input'>>;
|
|
962
1718
|
};
|
|
963
1719
|
|
|
964
1720
|
declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
|
|
@@ -995,7 +1751,10 @@ declare class Websocket {
|
|
|
995
1751
|
onOpen(callback: () => void): void;
|
|
996
1752
|
}
|
|
997
1753
|
|
|
998
|
-
|
|
1754
|
+
/**
|
|
1755
|
+
* @publicApi
|
|
1756
|
+
*/
|
|
1757
|
+
export declare type WebsocketTypes = {
|
|
999
1758
|
create: (url: string, headers: Record<string, string>, options?: {
|
|
1000
1759
|
rejectUnauthorized?: boolean;
|
|
1001
1760
|
followRedirects?: boolean;
|