@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/types/index.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,8 @@ declare interface FFIApi extends FFIFunction {
|
|
|
111
245
|
name: string;
|
|
112
246
|
}
|
|
113
247
|
|
|
248
|
+
/* Excluded from this release type: FFIDownloadInfo */
|
|
249
|
+
|
|
114
250
|
/**
|
|
115
251
|
* @publicApi
|
|
116
252
|
*/
|
|
@@ -118,6 +254,7 @@ declare interface FFIFunction {
|
|
|
118
254
|
params?: FFIFunctionParam[];
|
|
119
255
|
return: FFIFunctionReturn;
|
|
120
256
|
options?: FFIFunctionOptions;
|
|
257
|
+
returnData?: any;
|
|
121
258
|
}
|
|
122
259
|
|
|
123
260
|
/**
|
|
@@ -151,16 +288,34 @@ declare type FFIFunctionParam = {
|
|
|
151
288
|
*/
|
|
152
289
|
declare type FFIFunctionReturn = 'void' | 'str' | 'int' | 'bool' | 'wchar *' | 'void *';
|
|
153
290
|
|
|
154
|
-
|
|
155
|
-
|
|
291
|
+
/**
|
|
292
|
+
* @publicApi
|
|
293
|
+
*/
|
|
294
|
+
export declare interface FFITypes {
|
|
295
|
+
download: (downloadInfo: FFIDownloadInfo) => Promise<{
|
|
296
|
+
platform: keyof FFIDownloadInfo;
|
|
297
|
+
}>;
|
|
156
298
|
load: (filePath: string, apis: FFIApi[]) => Promise<void>;
|
|
157
299
|
unload: (filePath: string) => Promise<void>;
|
|
158
300
|
invoke: (filePath: string, apiName: string, params?: any[]) => Promise<any>;
|
|
159
301
|
registerCallback: (filePath: string, signature: FFIFunction, callback: (...args: any[]) => any) => Promise<{
|
|
160
302
|
ffiCallbackId: string;
|
|
161
303
|
}>;
|
|
304
|
+
unregisterCallback: (filePath: string, callbackId: string) => Promise<void>;
|
|
305
|
+
addCallbackErrorHandler: (filePath: string, handler: (error: Error) => void) => void;
|
|
162
306
|
}
|
|
163
307
|
|
|
308
|
+
declare function getValues<T extends Record<string, number | string | string[] | boolean | undefined>>(): Promise<T>;
|
|
309
|
+
|
|
310
|
+
declare type HereOrder = Order_2 & {
|
|
311
|
+
type: 'HERE';
|
|
312
|
+
memo: {
|
|
313
|
+
store?: string;
|
|
314
|
+
};
|
|
315
|
+
phone?: string;
|
|
316
|
+
status: StoreStatus;
|
|
317
|
+
};
|
|
318
|
+
|
|
164
319
|
/**
|
|
165
320
|
* @publicApi
|
|
166
321
|
*/
|
|
@@ -185,32 +340,121 @@ export declare interface HttpTypes {
|
|
|
185
340
|
patch: (url: string, payload: any, headers?: [string, string][]) => Promise<PluginHttpResponse>;
|
|
186
341
|
}
|
|
187
342
|
|
|
343
|
+
declare type InputElements = {
|
|
344
|
+
type: 'input';
|
|
345
|
+
inputs: PluginInputs[];
|
|
346
|
+
title: string;
|
|
347
|
+
description?: string;
|
|
348
|
+
cta: {
|
|
349
|
+
cancel?: CtaInput;
|
|
350
|
+
submit: CtaInput;
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
declare type InputResponse = {
|
|
355
|
+
type: 'input';
|
|
356
|
+
complete: true;
|
|
357
|
+
data: {
|
|
358
|
+
inputs: Record<string, string | number | boolean | string[]>;
|
|
359
|
+
result: 'SUCCESS';
|
|
360
|
+
} | {
|
|
361
|
+
result: 'CANCELLED';
|
|
362
|
+
};
|
|
363
|
+
} | {
|
|
364
|
+
type: 'input';
|
|
365
|
+
complete: false;
|
|
366
|
+
errorMessage: string;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
declare type InputValue = {
|
|
370
|
+
id: string;
|
|
371
|
+
label: string;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
declare type InputValue_2 = {
|
|
375
|
+
id: string;
|
|
376
|
+
label: string;
|
|
377
|
+
};
|
|
378
|
+
|
|
188
379
|
declare type Join<T extends string, U extends string> = `${T}${U}` | '0';
|
|
189
380
|
|
|
190
381
|
declare type Languages = Record<PluginLanguageCode, string>;
|
|
191
382
|
|
|
383
|
+
/**
|
|
384
|
+
* @publicApi
|
|
385
|
+
* @deprecated
|
|
386
|
+
*/
|
|
387
|
+
declare type LegacyPluginInputType = PluginInputsLegacy['type'];
|
|
388
|
+
|
|
192
389
|
/**
|
|
193
390
|
* @publicApi
|
|
194
391
|
*/
|
|
195
|
-
export declare interface
|
|
392
|
+
export declare interface MenuOption {
|
|
196
393
|
getOptions: () => Promise<PluginCatalogItemOption[]>;
|
|
197
|
-
on: (event: 'sold-out' | 'on-sale', callback: (option: PluginCatalogItemOption) => void) => void;
|
|
394
|
+
on: (event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: (option: PluginCatalogItemOption) => void) => void;
|
|
198
395
|
}
|
|
199
396
|
|
|
200
397
|
/**
|
|
201
398
|
* @publicApi
|
|
202
399
|
*/
|
|
203
|
-
export declare interface
|
|
400
|
+
export declare interface Merchant {
|
|
204
401
|
getMerchant: () => Promise<TossMerchant>;
|
|
205
402
|
}
|
|
206
403
|
|
|
207
|
-
|
|
404
|
+
/**
|
|
405
|
+
* @publicApi
|
|
406
|
+
*/
|
|
407
|
+
export declare interface Navigation {
|
|
408
|
+
navigate(page: 'plugin-tab', packageName?: string): void;
|
|
409
|
+
navigate(page: 'business-type-setting'): void;
|
|
410
|
+
/**
|
|
411
|
+
* 포스에서 페이지를 이동합니다.
|
|
412
|
+
* @param page business-type-setting 업종유형 변경, plugin-tab 플러그인 탭 이동
|
|
413
|
+
* @param packageName 이동할 탭의 이름, 없는 경우 첫번째 플러그인 탭으로 이동합니다
|
|
414
|
+
*/
|
|
415
|
+
navigate(page: 'business-type-setting' | 'plugin-tab', packageName?: string): void;
|
|
416
|
+
}
|
|
208
417
|
|
|
209
418
|
/**
|
|
210
419
|
* @publicApi
|
|
211
420
|
*/
|
|
212
|
-
export declare
|
|
421
|
+
export declare class NavigationImpl implements Navigation {
|
|
422
|
+
navigate(page: 'plugin-tab', packageName?: string): void;
|
|
423
|
+
navigate(page: 'business-type-setting'): void;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* @return number
|
|
428
|
+
*/
|
|
429
|
+
declare type NumberInput = BaseInput & {
|
|
430
|
+
type: 'number';
|
|
431
|
+
default: number;
|
|
432
|
+
placeholder?: string;
|
|
433
|
+
suffix?: string;
|
|
434
|
+
/**
|
|
435
|
+
* @see https://deus.toss.im/projects/1057/pages/o58sjnCS@1?node=jIulZjBg%401
|
|
436
|
+
* @description candidates는 선택지를 제공하는 기능으로, candidates중 유저가 하나를 선택하면 textField가 자동으로 value로 채워짐
|
|
437
|
+
*/
|
|
438
|
+
candidates?: {
|
|
439
|
+
text: string;
|
|
440
|
+
value: number;
|
|
441
|
+
}[];
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* @publicApi
|
|
446
|
+
*/
|
|
447
|
+
export declare interface Order {
|
|
213
448
|
getOrder: (id: string) => Promise<PluginOrder>;
|
|
449
|
+
/**
|
|
450
|
+
* @param start yyyyMMdd
|
|
451
|
+
* @param end yyyyMMdd
|
|
452
|
+
* @description createdAt 기준으로 주문을 조회합니다
|
|
453
|
+
*/
|
|
454
|
+
getOrders: (range: {
|
|
455
|
+
start: string;
|
|
456
|
+
end: string;
|
|
457
|
+
}) => Promise<PluginOrder[]>;
|
|
214
458
|
/**
|
|
215
459
|
* 토스 포스에서 카드결제를 취소하면 무조건 카드리딩해야함 그래서 on cancel은 늘 환불까지 된 상태임
|
|
216
460
|
*/
|
|
@@ -224,7 +468,86 @@ export declare interface OrderTypes {
|
|
|
224
468
|
complete: (id: string) => Promise<PluginOrder>;
|
|
225
469
|
}
|
|
226
470
|
|
|
227
|
-
declare type
|
|
471
|
+
declare type Order_2 = {
|
|
472
|
+
/**
|
|
473
|
+
* 포스(사장님)에게 보여줄 주문유형
|
|
474
|
+
* @example 가게배달, 장보기/쇼핑, 픽업, 배민1 등등
|
|
475
|
+
*/
|
|
476
|
+
serviceName: string;
|
|
477
|
+
/**
|
|
478
|
+
* 주문서에서 라이더에게 보여줄 배달 타입 (배민1, 배달의민족)
|
|
479
|
+
*/
|
|
480
|
+
deliveryName: string;
|
|
481
|
+
/**
|
|
482
|
+
* @description 주문 시간 (yyyy-MM-dd'T'HH:mm:ss)
|
|
483
|
+
* @example 2025-04-08T16:11:13.000+09:00
|
|
484
|
+
*/
|
|
485
|
+
orderAt: string;
|
|
486
|
+
/**
|
|
487
|
+
* @description 아이콘 url
|
|
488
|
+
*/
|
|
489
|
+
icon: string;
|
|
490
|
+
/**
|
|
491
|
+
* @description 준비시간(분)
|
|
492
|
+
*/
|
|
493
|
+
preparationTimeMin?: number;
|
|
494
|
+
/**
|
|
495
|
+
* 픽업/배달이 실행될 예약주문 시간 (yyyy-MM-dd'T'HH:mm:ss)
|
|
496
|
+
* @description 예약주문인 경우에만 값이 존재
|
|
497
|
+
* @example 2025-04-08T16:11:13.000+09:00
|
|
498
|
+
*/
|
|
499
|
+
reservedDateTime?: string;
|
|
500
|
+
deliveryId: string;
|
|
501
|
+
origin?: string;
|
|
502
|
+
shop: {
|
|
503
|
+
id: string;
|
|
504
|
+
name: string;
|
|
505
|
+
};
|
|
506
|
+
paymentMethod: '결제완료' | '만나서 카드결제' | '만나서 현금결제' | '선불결제' | '기타결제';
|
|
507
|
+
/**
|
|
508
|
+
* @description 고객이 결제한 금액
|
|
509
|
+
*/
|
|
510
|
+
customerChargedPrice: number;
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
declare type OrderItemType = 'ITEM' | 'DELIVERY_FEE' | 'PREPAID_CARD' | 'MULTI_USE_TICKET';
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* @return string
|
|
517
|
+
*/
|
|
518
|
+
declare type PasswordInput = BaseInput & {
|
|
519
|
+
type: 'password';
|
|
520
|
+
default: string;
|
|
521
|
+
placeholder?: string;
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* @return string
|
|
526
|
+
*/
|
|
527
|
+
declare type PasswordInput_2 = BaseInput_2 & {
|
|
528
|
+
type: 'password';
|
|
529
|
+
default: string;
|
|
530
|
+
placeholder?: string;
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
declare type PayCallback = (order: PluginOrder, price: PluginPrice, ui: Ui) => Promise<PaymentMethodResponse | undefined>;
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* @publicApi
|
|
537
|
+
*/
|
|
538
|
+
export declare interface Payment {
|
|
539
|
+
on: (event: 'cancel' | 'paid', callback: PaymentCallback) => void;
|
|
540
|
+
cancel: (order: {
|
|
541
|
+
id: string;
|
|
542
|
+
}, payment: {
|
|
543
|
+
id: string;
|
|
544
|
+
}) => Promise<void>;
|
|
545
|
+
add: (order: {
|
|
546
|
+
id: string;
|
|
547
|
+
}, paymentDto: PluginPaymentDto) => Promise<PluginPaymentOf<'CARD'> | PluginPaymentOf<'CASH'> | PluginPaymentOf<'EXTERNAL'>>;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
declare type PaymentCallback = (payment: PluginPayment, order: PluginOrder) => void;
|
|
228
551
|
|
|
229
552
|
/**
|
|
230
553
|
* @publicApi
|
|
@@ -237,11 +560,13 @@ export declare type PaymentMethodResponse = {
|
|
|
237
560
|
* @example 2022-01-27T11:42:33
|
|
238
561
|
*/
|
|
239
562
|
approvedAt: string;
|
|
240
|
-
approvedNo: string;
|
|
241
563
|
paymentKey: string;
|
|
242
564
|
};
|
|
243
565
|
|
|
244
|
-
|
|
566
|
+
/**
|
|
567
|
+
* @publicApi
|
|
568
|
+
*/
|
|
569
|
+
export declare type PaymentMethodType = {
|
|
245
570
|
add: (payload: {
|
|
246
571
|
data: {
|
|
247
572
|
/**
|
|
@@ -261,16 +586,73 @@ declare type PaymentMethodType = {
|
|
|
261
586
|
}) => void;
|
|
262
587
|
};
|
|
263
588
|
|
|
264
|
-
declare
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
589
|
+
declare type PickupOrder = Order_2 & {
|
|
590
|
+
type: 'PICKUP';
|
|
591
|
+
memo: {
|
|
592
|
+
store?: string;
|
|
593
|
+
};
|
|
594
|
+
phone?: string;
|
|
595
|
+
status: StoreStatus;
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* @publicApi
|
|
600
|
+
*/
|
|
601
|
+
declare type Platform = 'macos' | 'windows' | 'android' | 'ios' | 'unknown';
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* @publicApi
|
|
605
|
+
*/
|
|
606
|
+
export declare const plugin: PluginImpl;
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* @publicApi
|
|
610
|
+
*/
|
|
611
|
+
declare interface Plugin_2 {
|
|
612
|
+
on(event: 'close', callback: () => Promise<void>): void;
|
|
613
|
+
getPluginInfo(): Promise<{
|
|
614
|
+
name: string;
|
|
615
|
+
version: string;
|
|
616
|
+
}>;
|
|
617
|
+
}
|
|
618
|
+
export { Plugin_2 as Plugin }
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* @publicApi
|
|
622
|
+
*/
|
|
623
|
+
declare interface PluginAccountTransferPayment extends PluginPaymentBase {
|
|
624
|
+
sourceType: 'ACCOUNT_TRANSFER';
|
|
625
|
+
/** 계좌이체 정보 */
|
|
626
|
+
accountTransfer: {
|
|
627
|
+
/** 은행코드 */
|
|
628
|
+
bankCode: number;
|
|
629
|
+
/** 계좌번호 */
|
|
630
|
+
accountNumber: string;
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* @publicApi
|
|
636
|
+
*/
|
|
637
|
+
declare interface PluginBarcodePayment extends PluginPaymentBase {
|
|
638
|
+
sourceType: 'BARCODE';
|
|
639
|
+
externalDetails: {
|
|
640
|
+
installmentMonth: PluginPaymentInstallment;
|
|
641
|
+
/**
|
|
642
|
+
* 발급사명
|
|
643
|
+
* @example 토스페이, 네이버체크, 카카오페이머니, ...
|
|
644
|
+
*/
|
|
645
|
+
source: string;
|
|
646
|
+
/**
|
|
647
|
+
* 간편결제 구분자
|
|
648
|
+
* @example KKF, SG2, ZRP, ...
|
|
649
|
+
*/
|
|
650
|
+
sourceId: string;
|
|
651
|
+
sourceType?: PluginPaymentExternalSourceType;
|
|
652
|
+
/** 매입사명 */
|
|
653
|
+
cardBrand?: string;
|
|
654
|
+
cardNo?: string;
|
|
655
|
+
};
|
|
274
656
|
}
|
|
275
657
|
|
|
276
658
|
/**
|
|
@@ -371,6 +753,10 @@ export declare interface PluginCatalogItem {
|
|
|
371
753
|
* @description 토스 포스에 등록된 메뉴의 고유 아이디
|
|
372
754
|
*/
|
|
373
755
|
id: number;
|
|
756
|
+
/**
|
|
757
|
+
* 플러그인에서 생성하면 토스포스 서버에 저장되어 항상 같이 내려옴
|
|
758
|
+
*/
|
|
759
|
+
code?: string;
|
|
374
760
|
/**
|
|
375
761
|
* @description 포스 내에서 보여주는 타이틀
|
|
376
762
|
* @description 사장님께만 보입니다
|
|
@@ -398,7 +784,7 @@ export declare interface PluginCatalogItem {
|
|
|
398
784
|
* @description 메뉴에 달린 벳지입니다
|
|
399
785
|
*/
|
|
400
786
|
labels: PluginCatalogItemLabel[];
|
|
401
|
-
imageUrl
|
|
787
|
+
imageUrl?: string;
|
|
402
788
|
/**
|
|
403
789
|
* @description 상품의 가격정보
|
|
404
790
|
*/
|
|
@@ -407,6 +793,13 @@ export declare interface PluginCatalogItem {
|
|
|
407
793
|
* @description 상품에서 사용가능한 옵션 리스트
|
|
408
794
|
*/
|
|
409
795
|
options: PluginCatalogItemOption[];
|
|
796
|
+
/** POS에서 상품 표시시 색상 정보 */
|
|
797
|
+
color?: string;
|
|
798
|
+
/** 제조 및 유통 정보 */
|
|
799
|
+
provenance?: {
|
|
800
|
+
/** 제조사 */
|
|
801
|
+
displayProvenance: string;
|
|
802
|
+
};
|
|
410
803
|
}
|
|
411
804
|
|
|
412
805
|
/**
|
|
@@ -422,14 +815,20 @@ export declare interface PluginCatalogItemDto {
|
|
|
422
815
|
description?: string;
|
|
423
816
|
descriptionI18n?: PluginLanguagePack;
|
|
424
817
|
categoryId: number;
|
|
425
|
-
price:
|
|
818
|
+
price: PluginCatalogItemPriceDto;
|
|
426
819
|
labels: PluginCatalogItemLabel[];
|
|
427
|
-
imageUrl
|
|
820
|
+
imageUrl?: string;
|
|
428
821
|
/**
|
|
429
822
|
* @description 옵션을 먼저 만들고 id를 넣어달라
|
|
430
823
|
*/
|
|
431
824
|
options: Pick<PluginCatalogItemOption, 'id'>[];
|
|
432
|
-
|
|
825
|
+
/** POS에서 상품 표시시 색상 정보 */
|
|
826
|
+
color?: string;
|
|
827
|
+
/** 제조 및 유통 정보 */
|
|
828
|
+
provenance?: {
|
|
829
|
+
/** 제조사 */
|
|
830
|
+
displayProvenance: string;
|
|
831
|
+
};
|
|
433
832
|
}
|
|
434
833
|
|
|
435
834
|
/**
|
|
@@ -494,9 +893,9 @@ export declare interface PluginCatalogItemPrice {
|
|
|
494
893
|
* 재고 관리 코드
|
|
495
894
|
* @see https://en.wikipedia.org/wiki/Stock_keeping_unit
|
|
496
895
|
*/
|
|
497
|
-
sku
|
|
896
|
+
sku?: string;
|
|
498
897
|
/** 상품 가격의 바코드 정보 */
|
|
499
|
-
barcode
|
|
898
|
+
barcode?: string;
|
|
500
899
|
/** 가격 유형 */
|
|
501
900
|
priceType: PluginCatalogItemPriceType;
|
|
502
901
|
/** 가격의 기본 개수 */
|
|
@@ -510,18 +909,39 @@ export declare interface PluginCatalogItemPrice {
|
|
|
510
909
|
/** 재고 관리여부 */
|
|
511
910
|
isStockable: boolean;
|
|
512
911
|
/** 현재 남아있는 재고 수 */
|
|
513
|
-
stockQuantity
|
|
912
|
+
stockQuantity?: {
|
|
514
913
|
remainQuantity: number;
|
|
515
914
|
lastChangeDateTime: string;
|
|
516
|
-
}
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* @publicApi
|
|
920
|
+
*/
|
|
921
|
+
export declare interface PluginCatalogItemPriceDto {
|
|
922
|
+
/** 상품 가격명 */
|
|
923
|
+
title: string;
|
|
924
|
+
/** 상품 가격의 바코드 정보 */
|
|
925
|
+
barcode?: string;
|
|
926
|
+
/** 가격 유형 */
|
|
927
|
+
priceType: PluginCatalogItemPriceType;
|
|
928
|
+
/** 가격의 기본 개수 */
|
|
929
|
+
priceUnit: number;
|
|
930
|
+
/**
|
|
931
|
+
* 부가가치세(VAT)가 포함된 가격
|
|
932
|
+
*/
|
|
933
|
+
priceValue: number;
|
|
934
|
+
/** 비과세 여부 */
|
|
935
|
+
isTaxFree: boolean;
|
|
517
936
|
}
|
|
518
937
|
|
|
519
938
|
/**
|
|
520
939
|
* @publicApi
|
|
521
940
|
* FIXED: 고정 가격
|
|
522
941
|
* VARIABLE: 시가(예: 수산시장 방어회)
|
|
942
|
+
* UNIT: 단위 가격(예: 1kg당 가격, 1L당 가격 등)
|
|
523
943
|
*/
|
|
524
|
-
export declare type PluginCatalogItemPriceType = 'FIXED' | 'VARIABLE';
|
|
944
|
+
export declare type PluginCatalogItemPriceType = 'FIXED' | 'VARIABLE' | 'UNIT';
|
|
525
945
|
|
|
526
946
|
/**
|
|
527
947
|
* 상품 상태
|
|
@@ -532,6 +952,13 @@ export declare type PluginCatalogItemPriceType = 'FIXED' | 'VARIABLE';
|
|
|
532
952
|
*/
|
|
533
953
|
declare type PluginCatalogItemState = 'ON_SALE' | 'SOLD_OUT' | 'UNAVAILABLE' | 'DELETED';
|
|
534
954
|
|
|
955
|
+
/**
|
|
956
|
+
* @publicApi
|
|
957
|
+
*/
|
|
958
|
+
export declare type PluginDelivery<T extends 'PICKUP' | 'HERE' | 'DELIVERY'> = Extract<DeliveryOrder | PickupOrder | HereOrder, {
|
|
959
|
+
type: T;
|
|
960
|
+
}>;
|
|
961
|
+
|
|
535
962
|
/**
|
|
536
963
|
* @publicApi
|
|
537
964
|
* 할인 정보
|
|
@@ -549,6 +976,105 @@ export declare interface PluginDiscount {
|
|
|
549
976
|
titleI18n?: PluginLanguagePack;
|
|
550
977
|
}
|
|
551
978
|
|
|
979
|
+
/**
|
|
980
|
+
* @publicApi
|
|
981
|
+
*/
|
|
982
|
+
export declare interface PluginDraftOrder {
|
|
983
|
+
/**
|
|
984
|
+
* 주문ID
|
|
985
|
+
* 서버 주문을 클라이언트 주문으로 변경했을 때 값이 존재
|
|
986
|
+
*/
|
|
987
|
+
id?: string;
|
|
988
|
+
/** 주문 항목 목록 */
|
|
989
|
+
lineItems: Array<PluginDraftOrderItem>;
|
|
990
|
+
/** 주문 요청사항 */
|
|
991
|
+
memo?: string;
|
|
992
|
+
/** 주문에 적용된 할인 목록 */
|
|
993
|
+
discounts: PluginDiscount[];
|
|
994
|
+
price: PluginDraftOrderPrice;
|
|
995
|
+
/**
|
|
996
|
+
* 이 주문에 대해 프린트 출력을 무시할지 여부
|
|
997
|
+
* 이 옵션이 켜져 있는 경우 다른 포스에서도 프린트 출력이 무시됩니다.
|
|
998
|
+
* 기본값은 false입니다.
|
|
999
|
+
*/
|
|
1000
|
+
ignorePrint: boolean;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* @publicApi
|
|
1005
|
+
*/
|
|
1006
|
+
export declare interface PluginDraftOrderItem {
|
|
1007
|
+
/**
|
|
1008
|
+
* 넣지 않으면 자동으로 생성됨
|
|
1009
|
+
*/
|
|
1010
|
+
key: string;
|
|
1011
|
+
/** 상품 정보 */
|
|
1012
|
+
item: Pick<PluginCatalogItem, 'id' | 'title' | 'category' | 'options' | 'code'> & {
|
|
1013
|
+
type: OrderItemType;
|
|
1014
|
+
};
|
|
1015
|
+
/** 상품 가격 정보 */
|
|
1016
|
+
itemPrice: Pick<PluginCatalogItemPrice, 'id' | 'isTaxFree' | 'priceType' | 'priceUnit' | 'priceValue' | 'sku' | 'title'>;
|
|
1017
|
+
/** 적용된 할인 목록 */
|
|
1018
|
+
discount: PluginDiscount[];
|
|
1019
|
+
/** 요청사항 */
|
|
1020
|
+
memo: string;
|
|
1021
|
+
/** 선택된 옵션 정보 */
|
|
1022
|
+
optionChoices: PluginCatalogItemOptionChoice[];
|
|
1023
|
+
/** 수량 */
|
|
1024
|
+
quantity: number;
|
|
1025
|
+
/** 식사 유형 */
|
|
1026
|
+
diningOption: PluginOrderDiningOption;
|
|
1027
|
+
/**
|
|
1028
|
+
* 서버에서 생성된 lineItemId
|
|
1029
|
+
*/
|
|
1030
|
+
lineItemId?: string;
|
|
1031
|
+
metadata?: {
|
|
1032
|
+
/**
|
|
1033
|
+
* true : 유저가 메모 수정 불가
|
|
1034
|
+
*/
|
|
1035
|
+
disableMemoEdit?: boolean;
|
|
1036
|
+
/**
|
|
1037
|
+
* true : 유저가 옵션 수정 불가
|
|
1038
|
+
*/
|
|
1039
|
+
disableOptionEdit?: boolean;
|
|
1040
|
+
/**
|
|
1041
|
+
* true : 유저가 수량 변경 불가
|
|
1042
|
+
*/
|
|
1043
|
+
disableQuantityEdit?: boolean;
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* @publicApi
|
|
1049
|
+
* @desription key는 넣으면 할당되고 없으면 포스에서 자동생성
|
|
1050
|
+
*/
|
|
1051
|
+
declare type PluginDraftOrderItemDto = PluginDraftOrderItem & {
|
|
1052
|
+
key?: string;
|
|
1053
|
+
itemPrice: Pick<PluginCatalogItemPrice, 'isTaxFree' | 'priceType' | 'priceUnit' | 'priceValue' | 'sku' | 'title'>;
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1056
|
+
declare interface PluginDraftOrderPrice {
|
|
1057
|
+
/** (-)할인 금액 */
|
|
1058
|
+
orderDiscountValue: number;
|
|
1059
|
+
/**
|
|
1060
|
+
* 원주문 금액
|
|
1061
|
+
* Σ OrderItem.orderPrice.orderListPriceValue
|
|
1062
|
+
*/
|
|
1063
|
+
orderListPriceValue: number;
|
|
1064
|
+
/**
|
|
1065
|
+
* 주문 금액 = 원주문금액 + 할인 금액 + 보증금 + 봉사료
|
|
1066
|
+
*
|
|
1067
|
+
* @see 보증금: DraftOrder.bookingFee
|
|
1068
|
+
*/
|
|
1069
|
+
orderPriceValue: number;
|
|
1070
|
+
/** 봉사료 */
|
|
1071
|
+
orderTipValue: number;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* 밴을 통하지 않으면 바코드결제라고 해도 externalPayment로 처리해주세요
|
|
1076
|
+
* 취소를 플러그인에서 따로 처리해야하면 externalPayment로 처리해주세요
|
|
1077
|
+
*/
|
|
552
1078
|
declare interface PluginExternalDto extends PluginPaymentDtoBase {
|
|
553
1079
|
sourceType: 'EXTERNAL';
|
|
554
1080
|
}
|
|
@@ -594,6 +1120,33 @@ export declare type PluginHttpResponse = {
|
|
|
594
1120
|
code: number;
|
|
595
1121
|
};
|
|
596
1122
|
|
|
1123
|
+
declare class PluginImpl implements Plugin_2 {
|
|
1124
|
+
private readonly webview;
|
|
1125
|
+
private pluginCallbacks;
|
|
1126
|
+
constructor(webview: WebView);
|
|
1127
|
+
private initializePlugin;
|
|
1128
|
+
on(event: 'close', callback: () => Promise<void>): void;
|
|
1129
|
+
getPluginInfo(): Promise<{
|
|
1130
|
+
name: string;
|
|
1131
|
+
version: string;
|
|
1132
|
+
}>;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
/**
|
|
1136
|
+
* @publicApi
|
|
1137
|
+
* @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
|
|
1138
|
+
*/
|
|
1139
|
+
export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
|
|
1140
|
+
|
|
1141
|
+
/**
|
|
1142
|
+
* @publicApi
|
|
1143
|
+
* @deprecated
|
|
1144
|
+
* @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
|
|
1145
|
+
*/
|
|
1146
|
+
declare type PluginInputsLegacy<T extends LegacyPluginInputType = any> = Extract<TextInput_2 | PasswordInput_2 | RadioInput_2 | CheckBoxInput_2 | ToggleInput_2 | SliderInput_2, {
|
|
1147
|
+
type: T;
|
|
1148
|
+
}>;
|
|
1149
|
+
|
|
597
1150
|
declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
|
|
598
1151
|
|
|
599
1152
|
/**
|
|
@@ -604,6 +1157,26 @@ export declare interface PluginLanguagePack {
|
|
|
604
1157
|
languages: Partial<Languages>;
|
|
605
1158
|
}
|
|
606
1159
|
|
|
1160
|
+
/**
|
|
1161
|
+
* @publicApi
|
|
1162
|
+
*/
|
|
1163
|
+
export declare interface PluginMessenger {
|
|
1164
|
+
broadcast<T = any>(message: T): void;
|
|
1165
|
+
on<T = any>(event: 'message', callback: (message: T) => void): void;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* @publicApi
|
|
1170
|
+
*/
|
|
1171
|
+
export declare const pluginMessenger: PluginMessengerImpl;
|
|
1172
|
+
|
|
1173
|
+
declare class PluginMessengerImpl implements PluginMessenger {
|
|
1174
|
+
private readonly webview;
|
|
1175
|
+
constructor(webview: WebView);
|
|
1176
|
+
broadcast<T = any>(message: T): void;
|
|
1177
|
+
on<T = any>(event: 'message', callback: (message: T) => void): void;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
607
1180
|
/**
|
|
608
1181
|
* @publicApi
|
|
609
1182
|
* @description pluginOrder orderDto를 서버에 저장 후 가공해서 내려 준 값
|
|
@@ -614,7 +1187,14 @@ export declare interface PluginOrder {
|
|
|
614
1187
|
tableId?: number;
|
|
615
1188
|
table?: PluginTable;
|
|
616
1189
|
orderKey: string;
|
|
617
|
-
|
|
1190
|
+
/**
|
|
1191
|
+
* 결제상태
|
|
1192
|
+
*/
|
|
1193
|
+
paymentState: PluginOrderPaymentState;
|
|
1194
|
+
/**
|
|
1195
|
+
* 주문상태
|
|
1196
|
+
*/
|
|
1197
|
+
orderState: PluginOrderState;
|
|
618
1198
|
lineItems: PluginOrderItem[];
|
|
619
1199
|
discounts?: PluginDiscount[];
|
|
620
1200
|
payments: PluginPayment[];
|
|
@@ -624,9 +1204,13 @@ export declare interface PluginOrder {
|
|
|
624
1204
|
source: string;
|
|
625
1205
|
memo?: string;
|
|
626
1206
|
/**
|
|
1207
|
+
* @description 주문시각
|
|
627
1208
|
* 해당값이 있다면 createdAt 대신 사용해주세요.
|
|
628
1209
|
*/
|
|
629
1210
|
openedAt?: string;
|
|
1211
|
+
/**
|
|
1212
|
+
* @description 생성시각
|
|
1213
|
+
*/
|
|
630
1214
|
createdAt: string;
|
|
631
1215
|
updatedAt?: string;
|
|
632
1216
|
cancelledAt?: string;
|
|
@@ -680,14 +1264,14 @@ export declare interface PluginOrderItem {
|
|
|
680
1264
|
id: string;
|
|
681
1265
|
orderId: string;
|
|
682
1266
|
diningOption: PluginOrderDiningOption;
|
|
683
|
-
item: Pick<PluginCatalogItem, 'id' | 'title' | 'category'> & {
|
|
1267
|
+
item: Pick<PluginCatalogItem, 'id' | 'title' | 'category' | 'code'> & {
|
|
684
1268
|
type: OrderItemType;
|
|
685
1269
|
};
|
|
686
1270
|
quantity: {
|
|
687
1271
|
value: number;
|
|
688
1272
|
};
|
|
689
1273
|
/**
|
|
690
|
-
* @description 실제 고객이 결제하는 금액에 대한 정보입니다.
|
|
1274
|
+
* @description 실제 고객이 결제하는 금액에 대한 정보입니다. (할인 적용 금액)
|
|
691
1275
|
*/
|
|
692
1276
|
chargePrice: {
|
|
693
1277
|
value: number;
|
|
@@ -704,6 +1288,22 @@ declare interface PluginOrderPaymentPrice {
|
|
|
704
1288
|
paymentPaidValue: number;
|
|
705
1289
|
}
|
|
706
1290
|
|
|
1291
|
+
/**
|
|
1292
|
+
* @publicApi
|
|
1293
|
+
* 주문의 결제상태
|
|
1294
|
+
* 상태 전이 규칙은 아래 문서를 참조해주세요. (22.09)
|
|
1295
|
+
* https://www.notion.so/tossteam/1affab9356d24d2d9256ca21be2db473
|
|
1296
|
+
* 또다른 문서도 있어요. (25.03)
|
|
1297
|
+
* https://www.notion.so/tossteam/1c3a360d33e380979d4df2a1ba3bfd31
|
|
1298
|
+
*
|
|
1299
|
+
* OPENED: 결제 전 (초기 상태)
|
|
1300
|
+
* PAID: 부분 결제 (일부 금액만 결제된 상태)
|
|
1301
|
+
* CANCELLED: 취소
|
|
1302
|
+
* COMPLETED: 결제 완료 (주문 금액이 모두 결제된 경우)
|
|
1303
|
+
* REFUNDED: 환불 (모든 결제가 취소된 상태)
|
|
1304
|
+
*/
|
|
1305
|
+
declare type PluginOrderPaymentState = 'OPENED' | 'PAID' | 'CANCELLED' | 'COMPLETED' | 'REFUNDED';
|
|
1306
|
+
|
|
707
1307
|
declare interface PluginOrderRequestInfo {
|
|
708
1308
|
/** 요청 시간 */
|
|
709
1309
|
requestAt: string;
|
|
@@ -724,21 +1324,18 @@ declare interface PluginOrderRequestInfo {
|
|
|
724
1324
|
/**
|
|
725
1325
|
* @publicApi
|
|
726
1326
|
* 주문 상태
|
|
727
|
-
* 상태 전이 규칙은 아래 문서를 참조해주세요.
|
|
728
|
-
* https://www.notion.so/tossteam/1affab9356d24d2d9256ca21be2db473
|
|
729
1327
|
*
|
|
730
|
-
*
|
|
731
|
-
*
|
|
732
|
-
*
|
|
733
|
-
*
|
|
734
|
-
* REFUNDED: 환불
|
|
1328
|
+
* - REQUEST: 주문 접수 (requestedInfo가 있는 주문의 초기 상태)
|
|
1329
|
+
* - OPENED: 주문 진행중 (포스 등 일반적인 환경에서 주문의 초기 상태)
|
|
1330
|
+
* - COMPLETED: 주문 완료
|
|
1331
|
+
* - CANCELLED: 주문 취소
|
|
735
1332
|
*/
|
|
736
|
-
export declare type PluginOrderState = '
|
|
1333
|
+
export declare type PluginOrderState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'CANCELLED';
|
|
737
1334
|
|
|
738
1335
|
/**
|
|
739
1336
|
* @publicApi
|
|
740
1337
|
*/
|
|
741
|
-
export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment) & {
|
|
1338
|
+
export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment | PluginAccountTransferPayment | PluginBarcodePayment) & {
|
|
742
1339
|
paymentKey: string;
|
|
743
1340
|
};
|
|
744
1341
|
|
|
@@ -803,6 +1400,11 @@ declare type PluginPaymentDtoBase = Pick<PluginPayment,
|
|
|
803
1400
|
*/
|
|
804
1401
|
'orderId' | 'sourceType' | 'amountMoney' | 'taxMoney' | 'approvedNo' | 'approvedAt' | 'paymentKey' | 'supplyMoney' | 'tipMoney' | 'taxExemptMoney'>;
|
|
805
1402
|
|
|
1403
|
+
/**
|
|
1404
|
+
* @publicApi
|
|
1405
|
+
*/
|
|
1406
|
+
declare type PluginPaymentExternalSourceType = 'CARD' | 'BANK_TRANSFER' | 'OTHER_GIFT_CARD' | 'POINT' | 'COUPON' | 'OTHER';
|
|
1407
|
+
|
|
806
1408
|
/**
|
|
807
1409
|
* @publicApi
|
|
808
1410
|
* 할부개월 수
|
|
@@ -825,7 +1427,7 @@ export declare type PluginPaymentOf<S extends PluginPaymentSourceType> = Extract
|
|
|
825
1427
|
* BARCODE: 바코드/QR을 사용하는 간편결제
|
|
826
1428
|
* EXTERNAL: 기타결제(쿠폰, 외상 등)
|
|
827
1429
|
*/
|
|
828
|
-
export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL';
|
|
1430
|
+
export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL' | 'BARCODE' | 'ACCOUNT_TRANSFER';
|
|
829
1431
|
|
|
830
1432
|
/**
|
|
831
1433
|
* @publicApi
|
|
@@ -874,49 +1476,120 @@ export declare interface PluginTableGroup {
|
|
|
874
1476
|
/**
|
|
875
1477
|
* @publicApi
|
|
876
1478
|
*/
|
|
877
|
-
export declare type PopupActionResponse<T extends
|
|
1479
|
+
export declare type PopupActionResponse<T extends PopupType> = Extract<Response_2, {
|
|
878
1480
|
type: T;
|
|
879
|
-
|
|
1481
|
+
complete: true;
|
|
1482
|
+
}>['data'];
|
|
880
1483
|
|
|
881
1484
|
/**
|
|
882
1485
|
* @publicApi
|
|
883
1486
|
*/
|
|
884
|
-
export declare type
|
|
1487
|
+
export declare type PopupElement<T extends PopupType> = Extract<Element_2, {
|
|
885
1488
|
type: T;
|
|
886
1489
|
}>;
|
|
887
1490
|
|
|
888
1491
|
/**
|
|
889
1492
|
* @publicApi
|
|
890
1493
|
*/
|
|
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
|
-
}
|
|
1494
|
+
declare type PopupType = Element_2['type'];
|
|
900
1495
|
|
|
901
1496
|
/**
|
|
902
1497
|
* @publicApi
|
|
903
1498
|
*/
|
|
904
|
-
export declare type
|
|
905
|
-
table:
|
|
1499
|
+
export declare type PosPluginSdk = {
|
|
1500
|
+
table: Table;
|
|
906
1501
|
category: CategoryTypes;
|
|
907
|
-
catalog:
|
|
908
|
-
option:
|
|
1502
|
+
catalog: Catalog;
|
|
1503
|
+
option: MenuOption;
|
|
909
1504
|
storage: StorageTypes;
|
|
910
1505
|
cashReceipt: CashReceiptTypes;
|
|
911
|
-
order:
|
|
912
|
-
payment:
|
|
1506
|
+
order: Order;
|
|
1507
|
+
payment: Payment;
|
|
913
1508
|
http: HttpTypes;
|
|
914
1509
|
toast: ToastTypes;
|
|
915
|
-
|
|
916
|
-
|
|
1510
|
+
device: Device;
|
|
1511
|
+
merchant: Merchant;
|
|
917
1512
|
paymentMethod: PaymentMethodType;
|
|
918
1513
|
websocket: WebsocketTypes;
|
|
919
1514
|
ffi: FFITypes;
|
|
1515
|
+
plugin: Plugin_2;
|
|
1516
|
+
pluginMessenger: PluginMessenger;
|
|
1517
|
+
setting: SettingTypes;
|
|
1518
|
+
draftOrder: DraftOrder;
|
|
1519
|
+
navigation: Navigation;
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
/**
|
|
1523
|
+
* @publicApi
|
|
1524
|
+
*/
|
|
1525
|
+
export declare const posPluginSdk: PosPluginSdk;
|
|
1526
|
+
|
|
1527
|
+
/**
|
|
1528
|
+
* @publicApi
|
|
1529
|
+
*/
|
|
1530
|
+
export declare class PosPluginSdkError extends Error {
|
|
1531
|
+
constructor(message: string);
|
|
1532
|
+
static isPosPluginSdkError(error: unknown): error is PosPluginSdkError;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
/**
|
|
1536
|
+
* @return string values.id
|
|
1537
|
+
*/
|
|
1538
|
+
declare type RadioInput = Omit<BaseInput, 'placeholder'> & {
|
|
1539
|
+
type: 'radio';
|
|
1540
|
+
/**
|
|
1541
|
+
* @desciption 선택된 value의 id
|
|
1542
|
+
*/
|
|
1543
|
+
default: string;
|
|
1544
|
+
values: InputValue[];
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
* @return string values.id
|
|
1549
|
+
*/
|
|
1550
|
+
declare type RadioInput_2 = Omit<BaseInput_2, 'placeholder'> & {
|
|
1551
|
+
type: 'radio';
|
|
1552
|
+
/**
|
|
1553
|
+
* @desciption 선택된 value의 id
|
|
1554
|
+
*/
|
|
1555
|
+
default: string;
|
|
1556
|
+
values: InputValue_2[];
|
|
1557
|
+
};
|
|
1558
|
+
|
|
1559
|
+
declare type Response_2 = BarcodeResponse | InputResponse;
|
|
1560
|
+
|
|
1561
|
+
declare function setInputs(inputs: Array<PluginInputsLegacy>): void;
|
|
1562
|
+
|
|
1563
|
+
declare const setting: {
|
|
1564
|
+
setInputs: typeof setInputs;
|
|
1565
|
+
getValues: typeof getValues;
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
/**
|
|
1569
|
+
* @publicApi
|
|
1570
|
+
*/
|
|
1571
|
+
export declare type SettingTypes = typeof setting;
|
|
1572
|
+
|
|
1573
|
+
/**
|
|
1574
|
+
* @return number 0 25 50 75 100
|
|
1575
|
+
*/
|
|
1576
|
+
declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
|
|
1577
|
+
type: 'slider';
|
|
1578
|
+
default: number;
|
|
1579
|
+
min: number;
|
|
1580
|
+
max: number;
|
|
1581
|
+
step: number;
|
|
1582
|
+
};
|
|
1583
|
+
|
|
1584
|
+
/**
|
|
1585
|
+
* @return number 0 25 50 75 100
|
|
1586
|
+
*/
|
|
1587
|
+
declare type SliderInput_2 = Omit<BaseInput_2, 'placeholder'> & {
|
|
1588
|
+
type: 'slider';
|
|
1589
|
+
default: number;
|
|
1590
|
+
min: number;
|
|
1591
|
+
max: number;
|
|
1592
|
+
step: number;
|
|
920
1593
|
};
|
|
921
1594
|
|
|
922
1595
|
/**
|
|
@@ -928,12 +1601,25 @@ export declare interface StorageTypes {
|
|
|
928
1601
|
del: (key: string) => Promise<void>;
|
|
929
1602
|
}
|
|
930
1603
|
|
|
931
|
-
|
|
1604
|
+
/**
|
|
1605
|
+
* @publicApi
|
|
1606
|
+
*/
|
|
1607
|
+
declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_CANCELLED' | 'CANCELLED'
|
|
1608
|
+
/**
|
|
1609
|
+
* 손님이 가져감
|
|
1610
|
+
*/
|
|
1611
|
+
| 'DONE';
|
|
1612
|
+
|
|
1613
|
+
/**
|
|
1614
|
+
* @publicApi
|
|
1615
|
+
*/
|
|
1616
|
+
export declare interface Table {
|
|
932
1617
|
getTables: () => Promise<{
|
|
933
1618
|
table: PluginTable;
|
|
934
1619
|
order?: PluginOrder;
|
|
935
1620
|
}[]>;
|
|
936
|
-
on(event: 'order-update' | 'add'
|
|
1621
|
+
on(event: 'order-update' | 'order-add', callback: (order: PluginOrder) => void): void;
|
|
1622
|
+
on(event: 'clear' | 'add' | 'delete' | 'update', callback: (table: PluginTable) => void): void;
|
|
937
1623
|
on(event: 'swap' | 'move' | 'merge', callback: (before: PluginTable, after: PluginTable) => void): void;
|
|
938
1624
|
clearTable: (payload: {
|
|
939
1625
|
table: PluginTable;
|
|
@@ -941,10 +1627,56 @@ declare interface TableTypes {
|
|
|
941
1627
|
}) => Promise<void>;
|
|
942
1628
|
}
|
|
943
1629
|
|
|
944
|
-
|
|
1630
|
+
/**
|
|
1631
|
+
* @return string
|
|
1632
|
+
*/
|
|
1633
|
+
declare type TextInput = BaseInput & {
|
|
1634
|
+
type: 'text';
|
|
1635
|
+
default: string;
|
|
1636
|
+
placeholder?: string;
|
|
1637
|
+
suffix?: string;
|
|
1638
|
+
/**
|
|
1639
|
+
* @see https://deus.toss.im/projects/1057/pages/o58sjnCS@1?node=jIulZjBg%401
|
|
1640
|
+
* @description candidates는 선택지를 제공하는 기능으로, candidates중 유저가 하나를 선택하면 textField가 자동으로 value로 채워짐
|
|
1641
|
+
*/
|
|
1642
|
+
candidates?: {
|
|
1643
|
+
text: string;
|
|
1644
|
+
value: string;
|
|
1645
|
+
}[];
|
|
1646
|
+
};
|
|
1647
|
+
|
|
1648
|
+
/**
|
|
1649
|
+
* @return string
|
|
1650
|
+
*/
|
|
1651
|
+
declare type TextInput_2 = BaseInput_2 & {
|
|
1652
|
+
type: 'text';
|
|
1653
|
+
default: string;
|
|
1654
|
+
placeholder?: string;
|
|
1655
|
+
};
|
|
1656
|
+
|
|
1657
|
+
/**
|
|
1658
|
+
* @publicApi
|
|
1659
|
+
*/
|
|
1660
|
+
export declare type ToastTypes = {
|
|
945
1661
|
open(message: string): void;
|
|
946
1662
|
};
|
|
947
1663
|
|
|
1664
|
+
/**
|
|
1665
|
+
* @return boolean
|
|
1666
|
+
*/
|
|
1667
|
+
declare type ToggleInput = Omit<BaseInput, 'placeholder'> & {
|
|
1668
|
+
type: 'toggle';
|
|
1669
|
+
default: boolean;
|
|
1670
|
+
};
|
|
1671
|
+
|
|
1672
|
+
/**
|
|
1673
|
+
* @return boolean
|
|
1674
|
+
*/
|
|
1675
|
+
declare type ToggleInput_2 = Omit<BaseInput_2, 'placeholder'> & {
|
|
1676
|
+
type: 'toggle';
|
|
1677
|
+
default: boolean;
|
|
1678
|
+
};
|
|
1679
|
+
|
|
948
1680
|
/**
|
|
949
1681
|
* @publicApi
|
|
950
1682
|
* @description 추후에 필요한 정보 더 추가될 예정
|
|
@@ -952,13 +1684,24 @@ declare type ToastTypes = {
|
|
|
952
1684
|
export declare type TossMerchant = {
|
|
953
1685
|
name: string;
|
|
954
1686
|
id: number;
|
|
1687
|
+
businessNumber: string;
|
|
1688
|
+
/**
|
|
1689
|
+
* @deprecated
|
|
1690
|
+
* @see DeviceInfo.serialNumber
|
|
1691
|
+
*/
|
|
955
1692
|
serialNumber: string;
|
|
956
|
-
|
|
957
|
-
|
|
1693
|
+
franchise?: {
|
|
1694
|
+
id: string;
|
|
1695
|
+
name: string;
|
|
1696
|
+
};
|
|
958
1697
|
};
|
|
959
1698
|
|
|
960
|
-
|
|
961
|
-
|
|
1699
|
+
/**
|
|
1700
|
+
* @publicApi
|
|
1701
|
+
*/
|
|
1702
|
+
export declare type Ui = {
|
|
1703
|
+
openBarcode(message: Omit<PopupElement<'barcode'>, 'type'>): Promise<PopupActionResponse<'barcode'>>;
|
|
1704
|
+
openInputModal(message: Omit<PopupElement<'input'>, 'type'>): Promise<PopupActionResponse<'input'>>;
|
|
962
1705
|
};
|
|
963
1706
|
|
|
964
1707
|
declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
|
|
@@ -995,7 +1738,10 @@ declare class Websocket {
|
|
|
995
1738
|
onOpen(callback: () => void): void;
|
|
996
1739
|
}
|
|
997
1740
|
|
|
998
|
-
|
|
1741
|
+
/**
|
|
1742
|
+
* @publicApi
|
|
1743
|
+
*/
|
|
1744
|
+
export declare type WebsocketTypes = {
|
|
999
1745
|
create: (url: string, headers: Record<string, string>, options?: {
|
|
1000
1746
|
rejectUnauthorized?: boolean;
|
|
1001
1747
|
followRedirects?: boolean;
|