@tossplace/pos-plugin-sdk 0.0.3 → 0.0.5

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/types/index.d.ts CHANGED
@@ -1,13 +1,1232 @@
1
- /**
2
- * DO NOT MODIFY, AUTO GENERATED.
3
- * @codegen export
4
- */
5
- export { CatalogTypes } from './catalog/catalog';
6
- export { CategoryTypes } from './category/category';
7
- export { PosPluginSdkError } from './error/PosPluginSdkError';
8
- export { HttpTypes } from './http/http';
9
- export { MerchantTypes } from './merchant/merchant';
10
- export { MenuOptionTypes } from './option/option';
11
- export { OrderTypes } from './order/order';
12
- export { Sdk, pos } from './pos/sdk';
13
- export { StorageTypes } from './storage/storage';
1
+ declare type AllPaymentCreateDto = PluginCardDto | PluginCashDto | PluginExternalDto;
2
+
3
+ declare type AllPopupElements = BarcodeElements;
4
+
5
+ declare type AllPopupResponse = BarcodeResponse;
6
+
7
+ /**
8
+ * @publicApi
9
+ */
10
+ declare type AllPopupType = AllPopupElements['type'];
11
+
12
+ declare const AvailableLanguageCodes: {
13
+ readonly Korean: "ko-KR";
14
+ readonly English: "en-US";
15
+ };
16
+
17
+ /**
18
+ */
19
+ declare type BarcodeElements = {
20
+ type: 'barcode';
21
+ productName: string;
22
+ };
23
+
24
+ declare type BarcodeResponse = {
25
+ type: 'barcode';
26
+ complete: true;
27
+ data: {
28
+ barcode: string;
29
+ result: 'SUCCESS';
30
+ } | {
31
+ result: 'CANCELLED';
32
+ };
33
+ } | {
34
+ type: 'barcode';
35
+ complete: false;
36
+ errorMessage: string;
37
+ };
38
+
39
+ declare type BaseInput = {
40
+ label: string;
41
+ required: boolean;
42
+ id: string;
43
+ };
44
+
45
+ declare type CancelCallback = (order: PluginOrder, payment: PluginPayment) => Promise<PluginCancelledPaymentDto | undefined>;
46
+
47
+ /**
48
+ * @schema
49
+ * @publicApi
50
+ */
51
+ export declare type CashReceipt = {
52
+ /** 현금영수증이 발행 된 order id입니다 */
53
+ orderId: string;
54
+ /** 현금영수증 발행 금액입니다 */
55
+ amount: number;
56
+ /** 현금영수증 발행 날짜입니다 yyyyMMddHHmmss */
57
+ issueDate: string;
58
+ /** 현금영수증 발행 번호입니다 */
59
+ issueNumber: string;
60
+ /** 현금영수증 발행 카드 번호입니다 */
61
+ cardNumber: string;
62
+ };
63
+
64
+ declare interface CashReceiptTypes {
65
+ add: (receipt: CashReceipt) => Promise<void>;
66
+ }
67
+
68
+ /**
69
+ * @publicApi
70
+ */
71
+ export declare interface Catalog {
72
+ getCatalogs: () => Promise<PluginCatalogItem[]>;
73
+ on: (event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: (menu: PluginCatalogItem) => void) => void;
74
+ }
75
+
76
+ /**
77
+ * @publicApi
78
+ */
79
+ export declare type CatalogItemOptionChoiceState = 'ON_SALE' | 'SOLD_OUT';
80
+
81
+ /**
82
+ * @publicApi
83
+ */
84
+ export declare interface CategoryTypes {
85
+ getCategories: () => Promise<PluginCatalogCategory[]>;
86
+ on: (event: 'update' | 'add' | 'delete', callback: (category: PluginCatalogCategory) => void) => void;
87
+ }
88
+
89
+ /**
90
+ * @return 선택된 values id의 배열 string[]
91
+ * @example ['option1', 'option2']
92
+ */
93
+ declare type CheckBoxInput = Omit<BaseInput, 'placeholder'> & {
94
+ type: 'checkbox';
95
+ /**
96
+ * @description 선택된 value의 id의 배열
97
+ */
98
+ default: string[];
99
+ values: InputValue[];
100
+ };
101
+
102
+ declare type DeliveryOrder = Order & {
103
+ type: 'DELIVERY';
104
+ /**
105
+ * 배달 주체
106
+ */
107
+ deliveryBy: 'DELIVERY_COMPANY' | 'STORE' | 'AGENCY';
108
+ memo: {
109
+ store?: string;
110
+ delivery?: string;
111
+ };
112
+ address: {
113
+ road?: string;
114
+ lot?: string;
115
+ };
116
+ phone?: string;
117
+ status: DeliveryStatus;
118
+ };
119
+
120
+ /**
121
+ * @publicApi
122
+ */
123
+ declare type DeliveryStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_CANCELLED' | 'CANCELLED' | 'RIDER_ASSIGNED' | 'RIDER_ARRIVE_SOON' | 'RIDER_PICKUP_COMPLETED' | 'DONE';
124
+
125
+ declare type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
126
+
127
+ /**
128
+ * @publicApi
129
+ */
130
+ declare type FFIAbiType = '__stdcall';
131
+
132
+ /**
133
+ * @publicApi
134
+ */
135
+ declare interface FFIApi extends FFIFunction {
136
+ name: string;
137
+ }
138
+
139
+ /* Excluded from this release type: FFIDownloadInfo */
140
+
141
+ /**
142
+ * @publicApi
143
+ */
144
+ declare interface FFIFunction {
145
+ params?: FFIFunctionParam[];
146
+ return: FFIFunctionReturn;
147
+ options?: FFIFunctionOptions;
148
+ returnData?: any;
149
+ }
150
+
151
+ /**
152
+ * @publicApi
153
+ */
154
+ declare interface FFIFunctionOptions {
155
+ /**
156
+ * Application Binary Interface
157
+ * - 응용 프로그램 바이너리 인터페이스: 컴파일된 프로그램 모듈들이 바이너리 수준에서 상호작용하는 방식을 정의하는 인터페이스
158
+ */
159
+ abi?: FFIAbiType;
160
+ }
161
+
162
+ /**
163
+ * @publicApi
164
+ */
165
+ declare type FFIFunctionParam = {
166
+ type: 'str';
167
+ } | {
168
+ type: 'int';
169
+ } | {
170
+ type: 'bool';
171
+ } | {
172
+ type: 'wchar *';
173
+ } | {
174
+ type: 'callback';
175
+ };
176
+
177
+ /**
178
+ * @publicApi
179
+ */
180
+ declare type FFIFunctionReturn = 'void' | 'str' | 'int' | 'bool' | 'wchar *' | 'void *';
181
+
182
+ declare interface FFITypes {
183
+ download: (downloadInfo: FFIDownloadInfo) => Promise<{
184
+ platform: keyof FFIDownloadInfo;
185
+ }>;
186
+ load: (filePath: string, apis: FFIApi[]) => Promise<void>;
187
+ unload: (filePath: string) => Promise<void>;
188
+ invoke: (filePath: string, apiName: string, params?: any[]) => Promise<any>;
189
+ registerCallback: (filePath: string, signature: FFIFunction, callback: (...args: any[]) => any) => Promise<{
190
+ ffiCallbackId: string;
191
+ }>;
192
+ unregisterCallback: (filePath: string, callbackId: string) => Promise<void>;
193
+ addCallbackErrorHandler: (filePath: string, handler: (error: Error) => void) => void;
194
+ }
195
+
196
+ declare function getPluginInfo(): Promise<{
197
+ name: string;
198
+ version: string;
199
+ }>;
200
+
201
+ declare function getValues<T extends Record<string, number | string | string[] | boolean | undefined>>(): Promise<T>;
202
+
203
+ declare type HereOrder = Order & {
204
+ type: 'HERE';
205
+ memo: {
206
+ store?: string;
207
+ };
208
+ phone?: string;
209
+ status: StoreStatus;
210
+ };
211
+
212
+ /**
213
+ * @publicApi
214
+ */
215
+ export declare type HttpMethod = 'GET' | 'POST' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'PUT' | 'PATCH';
216
+
217
+ declare interface HttpRequest {
218
+ method: HttpMethod;
219
+ payload?: string;
220
+ headers: [string, string][];
221
+ }
222
+
223
+ /**
224
+ * @publicApi
225
+ */
226
+ export declare interface HttpTypes {
227
+ get: (url: string, headers?: [string, string][]) => Promise<PluginHttpResponse>;
228
+ post: (url: string, payload: any, headers?: [string, string][]) => Promise<PluginHttpResponse>;
229
+ delete: (url: string, headers?: [string, string][]) => Promise<PluginHttpResponse>;
230
+ head: (url: string, headers?: [string, string][]) => Promise<PluginHttpResponse>;
231
+ options: (url: string, headers?: [string, string][]) => Promise<PluginHttpResponse>;
232
+ put: (url: string, payload: any, headers?: [string, string][]) => Promise<PluginHttpResponse>;
233
+ patch: (url: string, payload: any, headers?: [string, string][]) => Promise<PluginHttpResponse>;
234
+ }
235
+
236
+ declare type InputValue = {
237
+ id: string;
238
+ label: string;
239
+ };
240
+
241
+ declare type Join<T extends string, U extends string> = `${T}${U}` | '0';
242
+
243
+ declare type Languages = Record<PluginLanguageCode, string>;
244
+
245
+ /**
246
+ * @publicApi
247
+ */
248
+ export declare interface MenuOption {
249
+ getOptions: () => Promise<PluginCatalogItemOption[]>;
250
+ on: (event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: (option: PluginCatalogItemOption) => void) => void;
251
+ }
252
+
253
+ /**
254
+ * @publicApi
255
+ */
256
+ export declare interface MerchantTypes {
257
+ getMerchant: () => Promise<TossMerchant>;
258
+ }
259
+
260
+ declare function on(event: 'close', callback: () => Promise<void>): void;
261
+
262
+ declare type Order = {
263
+ /**
264
+ * 포스(사장님)에게 보여줄 주문유형
265
+ * @example 가게배달, 장보기/쇼핑, 픽업, 배민1 등등
266
+ */
267
+ serviceName: string;
268
+ /**
269
+ * 주문서에서 라이더에게 보여줄 배달 타입 (배민1, 배달의민족)
270
+ */
271
+ deliveryName: string;
272
+ /**
273
+ * @description 주문 시간 (yyyy-MM-dd'T'HH:mm:ss)
274
+ * @example 2025-04-08T16:11:13.000+09:00
275
+ */
276
+ orderAt: string;
277
+ /**
278
+ * @description 아이콘 url
279
+ */
280
+ icon: string;
281
+ /**
282
+ * @description 준비시간(분)
283
+ */
284
+ preparationTimeMin?: number;
285
+ /**
286
+ * 픽업/배달이 실행될 예약주문 시간 (yyyy-MM-dd'T'HH:mm:ss)
287
+ * @description 예약주문인 경우에만 값이 존재
288
+ * @example 2025-04-08T16:11:13.000+09:00
289
+ */
290
+ reservedDateTime?: string;
291
+ deliveryId: string;
292
+ origin?: string;
293
+ shop: {
294
+ id: string;
295
+ name: string;
296
+ };
297
+ paymentMethod: '결제완료' | '만나서 카드결제' | '만나서 현금결제' | '선불결제' | '기타결제';
298
+ /**
299
+ * @description 고객이 결제한 금액
300
+ */
301
+ customerChargedPrice: number;
302
+ };
303
+
304
+ declare type OrderItemType = 'ITEM' | 'DELIVERY_FEE' | 'PREPAID_CARD' | 'MULTI_USE_TICKET';
305
+
306
+ /**
307
+ * @publicApi
308
+ */
309
+ export declare interface OrderTypes {
310
+ getOrder: (id: string) => Promise<PluginOrder>;
311
+ /**
312
+ * 토스 포스에서 카드결제를 취소하면 무조건 카드리딩해야함 그래서 on cancel은 늘 환불까지 된 상태임
313
+ */
314
+ on: (event: 'cancel', callback: (order: PluginOrder) => void) => void;
315
+ cancel: (id: string) => Promise<void>;
316
+ add: (order: PluginOrderDto) => Promise<PluginOrder>;
317
+ /**
318
+ * 새로 추가 된 메뉴만 order에 넣으세요
319
+ */
320
+ addMenu: (orderId: string, order: PluginOrderDto) => Promise<PluginOrder>;
321
+ complete: (id: string) => Promise<PluginOrder>;
322
+ }
323
+
324
+ /**
325
+ * @return string
326
+ */
327
+ declare type PasswordInput = BaseInput & {
328
+ type: 'password';
329
+ default: string;
330
+ placeholder?: string;
331
+ };
332
+
333
+ declare type PayCallback = (order: PluginOrder, price: PluginPrice) => Promise<PaymentMethodResponse | undefined>;
334
+
335
+ /**
336
+ * @publicApi
337
+ * @description 포스에 원장이 생기는 payment
338
+ * @see https://tossteam.slack.com/archives/C037HM4QJ0L/p1740547954237879?thread_ts=1740500512.811309&cid=C037HM4QJ0L
339
+ */
340
+ export declare type PaymentMethodResponse = {
341
+ /**
342
+ * 승인일시
343
+ * @example 2022-01-27T11:42:33
344
+ */
345
+ approvedAt: string;
346
+ paymentKey: string;
347
+ };
348
+
349
+ declare type PaymentMethodType = {
350
+ add: (payload: {
351
+ data: {
352
+ /**
353
+ * @description 결제수단의 id (unique)
354
+ * @description 결제수단이 여러개인 경우 필요하 것 같아 추가함
355
+ */
356
+ id: string;
357
+ paymentName: string;
358
+ /**
359
+ * @description 결제수단의 이미지 url
360
+ * @description 30x30
361
+ */
362
+ image: string;
363
+ };
364
+ payCallback: PayCallback;
365
+ cancelCallback: CancelCallback;
366
+ }) => void;
367
+ };
368
+
369
+ declare interface PaymentTypes {
370
+ on: (event: 'cancel', callback: (payload: PluginPaymentOf<'CASH'> | PluginPaymentOf<'CARD'> | PluginPaymentOf<'EXTERNAL'>) => void) => void;
371
+ cancel: (order: {
372
+ id: string;
373
+ }, payment: {
374
+ id: string;
375
+ }) => Promise<void>;
376
+ add: (order: {
377
+ id: string;
378
+ }, paymentDto: PluginPaymentDto) => Promise<PluginPaymentOf<'CARD'> | PluginPaymentOf<'CASH'> | PluginPaymentOf<'EXTERNAL'>>;
379
+ }
380
+
381
+ declare type PickupOrder = Order & {
382
+ type: 'PICKUP';
383
+ memo: {
384
+ store?: string;
385
+ };
386
+ phone?: string;
387
+ status: StoreStatus;
388
+ };
389
+
390
+ declare const plugin: {
391
+ on: typeof on;
392
+ getPluginInfo: typeof getPluginInfo;
393
+ };
394
+
395
+ /**
396
+ * @publicApi
397
+ */
398
+ export declare type PluginCancelledPaymentDto = {
399
+ cancelledAt: string;
400
+ };
401
+
402
+ declare interface PluginCardDto extends PluginPaymentDtoBase {
403
+ sourceType: 'CARD';
404
+ cardDetails: PluginPaymentOf<'CARD'>['cardDetails'];
405
+ }
406
+
407
+ /**
408
+ * @publicApi
409
+ */
410
+ export declare interface PluginCardPayment extends PluginPaymentBase {
411
+ sourceType: 'CARD';
412
+ cardDetails: {
413
+ installmentMonth: PluginPaymentInstallment;
414
+ cardType: PluginPaymentCardType;
415
+ /** 발급사명 */
416
+ cardBrand: string;
417
+ /** 발급사 코드 */
418
+ cardBrandId?: string;
419
+ /** 카드번호 */
420
+ cardNo: string;
421
+ /** 매입사명 */
422
+ source?: string;
423
+ /** 매입사 코드 */
424
+ sourceId?: string;
425
+ /** 선불카드일 때 잔액 */
426
+ balance?: number;
427
+ /** VAN사 */
428
+ van?: VanType;
429
+ };
430
+ }
431
+
432
+ declare interface PluginCashDto extends PluginPaymentDtoBase {
433
+ sourceType: 'CASH';
434
+ cashReceipt?: PluginCashReceipt;
435
+ }
436
+
437
+ /**
438
+ * @publicApi
439
+ */
440
+ export declare interface PluginCashPayment extends PluginPaymentBase {
441
+ sourceType: 'CASH';
442
+ }
443
+
444
+ /**
445
+ * @publicApi
446
+ * 현금영수증
447
+ */
448
+ export declare interface PluginCashReceipt {
449
+ /** 현금영수증 식별번호 */
450
+ identityNumber: string;
451
+ issuerType: PluginCashReceiptIssuerType;
452
+ issuanceType: PluginCashReceiptIssuanceType;
453
+ /** 자진 발급 여부 */
454
+ selfIssuance: boolean;
455
+ }
456
+
457
+ /**
458
+ * @publicApi
459
+ * 현금영수증 발행 유형
460
+ * PHONE: 휴대폰번호
461
+ * BUSINESS_NUMBER: 사업자번호
462
+ * CARD: 현금영수증 카드
463
+ */
464
+ export declare type PluginCashReceiptIssuanceType = 'PHONE' | 'BUSINESS_NUMBER' | 'CARD';
465
+
466
+ /**
467
+ * @publicApi
468
+ * 현금영수증 발급 유형
469
+ * CONSUMER: 개인
470
+ * BUSINESSES: 사업자
471
+ */
472
+ export declare type PluginCashReceiptIssuerType = 'CONSUMER' | 'BUSINESSES';
473
+
474
+ /**
475
+ * @publicApi
476
+ */
477
+ export declare interface PluginCatalogCategory {
478
+ id: number;
479
+ title: string;
480
+ titleI18n?: PluginLanguagePack;
481
+ }
482
+
483
+ /**
484
+ * @publicApi
485
+ * response
486
+ * 포스에 있는 메뉴를 조회할 때
487
+ */
488
+ export declare interface PluginCatalogItem {
489
+ /**
490
+ * @description 토스 포스에 등록된 메뉴의 고유 아이디
491
+ */
492
+ id: number;
493
+ /**
494
+ * @description 포스 내에서 보여주는 타이틀
495
+ * @description 사장님께만 보입니다
496
+ */
497
+ title: string;
498
+ /**
499
+ * @description 다국어지원을 위해 추가된 필드입니다
500
+ */
501
+ titleI18n?: PluginLanguagePack;
502
+ /**
503
+ * @description 메뉴의 상태입니다
504
+ * @description ON_SALE: 현재 판매중
505
+ * @description SOLD_OUT: 품절
506
+ * @description UNAVAILABLE: 기타 판매불가
507
+ * @description DELETED: 제거됨
508
+ */
509
+ state: PluginCatalogItemState;
510
+ description?: string;
511
+ descriptionI18n?: PluginLanguagePack;
512
+ /**
513
+ * @description 메뉴의 카테고리입니다
514
+ */
515
+ category: PluginCatalogCategory;
516
+ /**
517
+ * @description 메뉴에 달린 벳지입니다
518
+ */
519
+ labels: PluginCatalogItemLabel[];
520
+ imageUrl: string | null;
521
+ /**
522
+ * @description 상품의 가격정보
523
+ */
524
+ price: PluginCatalogItemPrice;
525
+ /**
526
+ * @description 상품에서 사용가능한 옵션 리스트
527
+ */
528
+ options: PluginCatalogItemOption[];
529
+ }
530
+
531
+ /**
532
+ * @publicApi
533
+ * request
534
+ * 포스에 메뉴를 만들때 update아니다 생성할 때만 사용한다
535
+ * update할때는 다른 api 사용하시라
536
+ * 생성할 때 state는 무조건 on_sale
537
+ */
538
+ export declare interface PluginCatalogItemDto {
539
+ title: string;
540
+ titleI18n?: PluginLanguagePack;
541
+ description?: string;
542
+ descriptionI18n?: PluginLanguagePack;
543
+ categoryId: number;
544
+ price: PluginCatalogItemPrice;
545
+ labels: PluginCatalogItemLabel[];
546
+ imageUrl: string | null;
547
+ /**
548
+ * @description 옵션을 먼저 만들고 id를 넣어달라
549
+ */
550
+ options: Pick<PluginCatalogItemOption, 'id'>[];
551
+ kioskTitle?: string;
552
+ }
553
+
554
+ /**
555
+ * @publicApi
556
+ * @description 메뉴에 인기/신규/쿠폰 등의 뱃지를 단다
557
+ */
558
+ export declare interface PluginCatalogItemLabel {
559
+ title: string;
560
+ color: string;
561
+ }
562
+
563
+ /**
564
+ * @publicApi
565
+ * @description 아직 dto는 정의되지 않았음
566
+ * @todo option dto 만들어야함
567
+ */
568
+ export declare interface PluginCatalogItemOption {
569
+ id: number;
570
+ title: string;
571
+ titleI18n?: PluginLanguagePack;
572
+ isRequired: boolean;
573
+ minChoices: number;
574
+ /**
575
+ * 최대로 선택가능한 선택 수
576
+ * -1인 경우 무제한 선택이 가능합니다.
577
+ */
578
+ maxChoices: number;
579
+ choices: PluginCatalogItemOptionChoice[];
580
+ /**
581
+ * 기본으로 선택되어 있는 CatalogItemOptionChoice['id'] 리스트
582
+ * 기본값이 없다면 빈 배열입니다.
583
+ */
584
+ defaultChoices: number[];
585
+ }
586
+
587
+ /**
588
+ * @publicApi
589
+ */
590
+ export declare interface PluginCatalogItemOptionChoice {
591
+ id: number;
592
+ title: string;
593
+ titleI18n?: PluginLanguagePack;
594
+ /** 옵션에 딸린 가격이 없는 경우 0 */
595
+ priceValue: number;
596
+ /** 키오스크에서 표시되는 아이콘 URL */
597
+ imageUrl?: string | null;
598
+ state: CatalogItemOptionChoiceState;
599
+ }
600
+
601
+ /**
602
+ * @publicApi
603
+ */
604
+ export declare interface PluginCatalogItemPrice {
605
+ id: number;
606
+ /** 상품 가격명 */
607
+ title: string;
608
+ /** 기본 가격 여부 */
609
+ isDefault: boolean;
610
+ /** 상품 가격 상태 */
611
+ state: PluginCatalogItemState;
612
+ /**
613
+ * 재고 관리 코드
614
+ * @see https://en.wikipedia.org/wiki/Stock_keeping_unit
615
+ */
616
+ sku: string | null;
617
+ /** 상품 가격의 바코드 정보 */
618
+ barcode: string | null;
619
+ /** 가격 유형 */
620
+ priceType: PluginCatalogItemPriceType;
621
+ /** 가격의 기본 개수 */
622
+ priceUnit: number;
623
+ /**
624
+ * 부가가치세(VAT)가 포함된 가격
625
+ */
626
+ priceValue: number;
627
+ /** 비과세 여부 */
628
+ isTaxFree: boolean;
629
+ /** 재고 관리여부 */
630
+ isStockable: boolean;
631
+ /** 현재 남아있는 재고 수 */
632
+ stockQuantity: {
633
+ remainQuantity: number;
634
+ lastChangeDateTime: string;
635
+ } | null;
636
+ }
637
+
638
+ /**
639
+ * @publicApi
640
+ * FIXED: 고정 가격
641
+ * VARIABLE: 시가(예: 수산시장 방어회)
642
+ * UNIT: 단위 가격(예: 1kg당 가격, 1L당 가격 등)
643
+ */
644
+ export declare type PluginCatalogItemPriceType = 'FIXED' | 'VARIABLE' | 'UNIT';
645
+
646
+ /**
647
+ * 상품 상태
648
+ * ON_SALE: 현재 판매중
649
+ * SOLD_OUT: 품절
650
+ * UNAVAILABLE: 기타 판매불가
651
+ * DELETED: 제거됨
652
+ */
653
+ declare type PluginCatalogItemState = 'ON_SALE' | 'SOLD_OUT' | 'UNAVAILABLE' | 'DELETED';
654
+
655
+ /**
656
+ * @publicApi
657
+ */
658
+ export declare type PluginDelivery<T extends 'PICKUP' | 'HERE' | 'DELIVERY'> = Extract<DeliveryOrder | PickupOrder | HereOrder, {
659
+ type: T;
660
+ }>;
661
+
662
+ /**
663
+ * @publicApi
664
+ * 할인 정보
665
+ * */
666
+ export declare interface PluginDiscount {
667
+ /**
668
+ * 할인 금액
669
+ * 퍼센티지 할인인 경우 계산된 금액 입니다.
670
+ */
671
+ amountMoney: {
672
+ value: number;
673
+ };
674
+ /** 할인 명칭 */
675
+ title: string;
676
+ titleI18n?: PluginLanguagePack;
677
+ }
678
+
679
+ declare interface PluginExternalDto extends PluginPaymentDtoBase {
680
+ sourceType: 'EXTERNAL';
681
+ }
682
+
683
+ /**
684
+ * @publicApi
685
+ */
686
+ export declare interface PluginExternalPayment extends PluginPaymentBase {
687
+ sourceType: 'EXTERNAL';
688
+ externalDetails: {
689
+ /**
690
+ * 기타 결제 수단의 소스
691
+ */
692
+ source?: string;
693
+ sourceId?: string;
694
+ };
695
+ }
696
+
697
+ /**
698
+ * @publicApi
699
+ * 테이블이 놓여진 공간
700
+ * */
701
+ export declare interface PluginHall {
702
+ id: number;
703
+ title: string;
704
+ /** 순서값. 오름차순 정렬 합니다. */
705
+ order: number;
706
+ }
707
+
708
+ /**
709
+ * @publicApi
710
+ */
711
+ export declare interface PluginHttpRequest extends HttpRequest {
712
+ url: string;
713
+ }
714
+
715
+ /**
716
+ * @publicApi
717
+ */
718
+ export declare type PluginHttpResponse = {
719
+ body: string;
720
+ headers: [string, string][];
721
+ code: number;
722
+ };
723
+
724
+ /**
725
+ * @publicApi
726
+ * @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
727
+ */
728
+ export declare type PluginInputs<T extends PluginInputType = any> = Extract<TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput, {
729
+ type: T;
730
+ }>;
731
+
732
+ /**
733
+ * @publicApi
734
+ */
735
+ declare type PluginInputType = PluginInputs['type'];
736
+
737
+ declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
738
+
739
+ /**
740
+ * @publicApi
741
+ */
742
+ export declare interface PluginLanguagePack {
743
+ key?: string;
744
+ languages: Partial<Languages>;
745
+ }
746
+
747
+ /**
748
+ * @publicApi
749
+ * @description pluginOrder orderDto를 서버에 저장 후 가공해서 내려 준 값
750
+ */
751
+ export declare interface PluginOrder {
752
+ id: string;
753
+ /** 테이블 주문. */
754
+ tableId?: number;
755
+ table?: PluginTable;
756
+ orderKey: string;
757
+ /**
758
+ * 결제상태
759
+ */
760
+ paymentState: PluginOrderPaymentState;
761
+ /**
762
+ * 주문상태
763
+ */
764
+ orderState: PluginOrderState;
765
+ lineItems: PluginOrderItem[];
766
+ discounts?: PluginDiscount[];
767
+ payments: PluginPayment[];
768
+ chargePrice: PluginOrderChargePrice;
769
+ paymentPrice: PluginOrderPaymentPrice;
770
+ requestedInfo?: PluginOrderRequestInfo;
771
+ source: string;
772
+ memo?: string;
773
+ /**
774
+ * 해당값이 있다면 createdAt 대신 사용해주세요.
775
+ */
776
+ openedAt?: string;
777
+ createdAt: string;
778
+ updatedAt?: string;
779
+ cancelledAt?: string;
780
+ completedAt?: string;
781
+ }
782
+
783
+ declare interface PluginOrderChargePrice {
784
+ /** 청구 할인 금액 = 할인 금액 + 할인 취소 금액 */
785
+ chargeDiscountValue: number;
786
+ /** 청구 원주문 금액 = 원주문 금액 + 환불 원주문 금액 */
787
+ chargeListPriceValue: number;
788
+ /**
789
+ * 청구 금액 = 청구 원주문 금액 + 청구 할인 금액 + 청구 봉사료
790
+ */
791
+ chargePriceValue: number;
792
+ /** 청구 공급 가액 = 청구 금액 - 청구 세액 */
793
+ chargeSupplyValue: number;
794
+ /**
795
+ * 청구 세액(부가가치세) = 청구 금액 / (1+VAT)
796
+ * VAT=10
797
+ */
798
+ chargeTaxValue: number;
799
+ /** 청구 봉사료 = 봉사료 + 환불 봉사료 */
800
+ chargeTipValue: number;
801
+ }
802
+
803
+ /**
804
+ * @publicApi
805
+ * HERE: 매장내
806
+ * TOGO: 포장
807
+ * DELIVERY: 배달
808
+ * PICKUP: 픽업
809
+ */
810
+ export declare type PluginOrderDiningOption = 'HERE' | 'TOGO' | 'DELIVERY' | 'PICKUP';
811
+
812
+ /**
813
+ * @publicApi
814
+ * @description order를 만들기 위한 dto
815
+ */
816
+ export declare type PluginOrderDto = {
817
+ memo?: string;
818
+ discounts: PluginDiscount[];
819
+ tableId?: number;
820
+ lineItems: Omit<PluginOrderItem, 'id' | 'orderId'>[];
821
+ };
822
+
823
+ /**
824
+ * @publicApi
825
+ */
826
+ export declare interface PluginOrderItem {
827
+ id: string;
828
+ orderId: string;
829
+ diningOption: PluginOrderDiningOption;
830
+ item: Pick<PluginCatalogItem, 'id' | 'title' | 'category'> & {
831
+ type: OrderItemType;
832
+ };
833
+ quantity: {
834
+ value: number;
835
+ };
836
+ /**
837
+ * @description 실제 고객이 결제하는 금액에 대한 정보입니다.
838
+ */
839
+ chargePrice: {
840
+ value: number;
841
+ };
842
+ optionChoices: PluginCatalogItemOptionChoice[];
843
+ discounts?: PluginDiscount[];
844
+ memo?: string;
845
+ }
846
+
847
+ declare interface PluginOrderPaymentPrice {
848
+ /** 미납 결제 금액 */
849
+ paymentUnpaidValue: number;
850
+ /** 완납 결제 금액 */
851
+ paymentPaidValue: number;
852
+ }
853
+
854
+ /**
855
+ * @publicApi
856
+ * 주문의 결제상태
857
+ * 상태 전이 규칙은 아래 문서를 참조해주세요. (22.09)
858
+ * https://www.notion.so/tossteam/1affab9356d24d2d9256ca21be2db473
859
+ * 또다른 문서도 있어요. (25.03)
860
+ * https://www.notion.so/tossteam/1c3a360d33e380979d4df2a1ba3bfd31
861
+ *
862
+ * OPENED: 결제 전 (초기 상태)
863
+ * PAID: 부분 결제 (일부 금액만 결제된 상태)
864
+ * CANCELLED: 취소
865
+ * COMPLETED: 결제 완료 (주문 금액이 모두 결제된 경우)
866
+ * REFUNDED: 환불 (모든 결제가 취소된 상태)
867
+ */
868
+ declare type PluginOrderPaymentState = 'OPENED' | 'PAID' | 'CANCELLED' | 'COMPLETED' | 'REFUNDED';
869
+
870
+ declare interface PluginOrderRequestInfo {
871
+ /** 요청 시간 */
872
+ requestAt: string;
873
+ /** 만료 시간 */
874
+ expiredAt: string;
875
+ /** 픽업 시간 */
876
+ expectedReadyAt: string;
877
+ /** 예상 완료 시간 */
878
+ estimatedReadyAt?: string;
879
+ /** 접수 시간 */
880
+ acceptedAt?: string;
881
+ /** 거부 시간 */
882
+ declinedAt?: string;
883
+ /** 거부 사유 */
884
+ declinedReason?: string;
885
+ }
886
+
887
+ /**
888
+ * @publicApi
889
+ * 주문 상태
890
+ *
891
+ * - REQUEST: 주문 접수 (requestedInfo가 있는 주문의 초기 상태)
892
+ * - OPENED: 주문 진행중 (포스 등 일반적인 환경에서 주문의 초기 상태)
893
+ * - COMPLETED: 주문 완료
894
+ * - CANCELLED: 주문 취소
895
+ */
896
+ export declare type PluginOrderState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'CANCELLED';
897
+
898
+ /**
899
+ * @publicApi
900
+ */
901
+ export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment) & {
902
+ paymentKey: string;
903
+ };
904
+
905
+ /**
906
+ * @publicApi
907
+ */
908
+ export declare interface PluginPaymentBase {
909
+ id: string;
910
+ orderId: string;
911
+ /** 결제상태 */
912
+ state: PluginPaymentState;
913
+ /** 결제수단 */
914
+ sourceType: PluginPaymentSourceType;
915
+ /** 지불액 */
916
+ amountMoney: number;
917
+ /** 부가가치세 */
918
+ taxMoney: number;
919
+ /** 공급가액 */
920
+ supplyMoney: number;
921
+ /** 봉사료 */
922
+ tipMoney: number;
923
+ /** 면세 금액. 값을 지정하지 않으면 기본으로 0원이 지정됨 */
924
+ taxExemptMoney?: number;
925
+ /** 승인번호 */
926
+ approvedNo: string;
927
+ /**
928
+ * 승인일시
929
+ * @example 2022-01-27T11:42:35
930
+ */
931
+ approvedAt: string;
932
+ /**
933
+ * 취소일시
934
+ * 취소거래인 경우에만 값 존재
935
+ */
936
+ cancelledAt?: string;
937
+ /** 현금영수증 정보
938
+ * 계좌이체가 추가되면서 현금 결제가 아니어도 현금영수증 발행이 가능함
939
+ * */
940
+ cashReceipt?: PluginCashReceipt;
941
+ }
942
+
943
+ /**
944
+ * @publicApi
945
+ * CREDIT: 신용카드
946
+ * DEBIT: 체크카드
947
+ * PREPAID: 선불카드
948
+ * FOREIGN: 해외카드
949
+ */
950
+ export declare type PluginPaymentCardType = 'CREDIT' | 'DEBIT' | 'PREPAID' | 'FOREIGN';
951
+
952
+ /**
953
+ * @publicApi
954
+ * @description 파트너사에 원장이 생기는 payment
955
+ */
956
+ export declare type PluginPaymentDto<S extends PluginPaymentSourceType = PluginPaymentSourceType> = Extract<AllPaymentCreateDto, {
957
+ sourceType: S;
958
+ }>;
959
+
960
+ declare type PluginPaymentDtoBase = Pick<PluginPayment,
961
+ /**
962
+ * orderId 그냥 열어두면 이상한 값 넣을가봐 걱정... 방어코드 필요
963
+ */
964
+ 'orderId' | 'sourceType' | 'amountMoney' | 'taxMoney' | 'approvedNo' | 'approvedAt' | 'paymentKey' | 'supplyMoney' | 'tipMoney' | 'taxExemptMoney'>;
965
+
966
+ /**
967
+ * @publicApi
968
+ * 할부개월 수
969
+ * 00: 일시불. 현금IC의 경우 일반거래
970
+ * 01: 현금IC의 경우 간소화 거래(비밀번호 입력생략)
971
+ */
972
+ export declare type PluginPaymentInstallment = Join<Digit, Digit>;
973
+
974
+ /**
975
+ * @publicApi
976
+ */
977
+ export declare type PluginPaymentOf<S extends PluginPaymentSourceType> = Extract<PluginPayment, {
978
+ sourceType: S;
979
+ }>;
980
+
981
+ /**
982
+ * @publicApi
983
+ * CARD: 신용카드
984
+ * CASH: 현금
985
+ * BARCODE: 바코드/QR을 사용하는 간편결제
986
+ * EXTERNAL: 기타결제(쿠폰, 외상 등)
987
+ */
988
+ export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL';
989
+
990
+ /**
991
+ * @publicApi
992
+ */
993
+ export declare type PluginPaymentState = 'APPROVED' | 'COMPLETED' | 'CANCELLED';
994
+
995
+ /**
996
+ * @publicApi
997
+ */
998
+ export declare type PluginPrice = {
999
+ /** 지불액 */
1000
+ amountMoney: number;
1001
+ /** 부가가치세 */
1002
+ taxMoney: number;
1003
+ /** 공급가액 */
1004
+ supplyMoney: number;
1005
+ /** 봉사료 */
1006
+ tipMoney: number;
1007
+ /** 면세금액 */
1008
+ taxExemptMoney: number;
1009
+ };
1010
+
1011
+ /**
1012
+ * @publicApi
1013
+ */
1014
+ export declare interface PluginTable {
1015
+ id: number;
1016
+ /** 테이블이 놓여진 공간 id */
1017
+ hallId: number;
1018
+ /** 테이블명 */
1019
+ title: string;
1020
+ group?: PluginTableGroup;
1021
+ }
1022
+
1023
+ /**
1024
+ * @publicApi
1025
+ */
1026
+ export declare interface PluginTableGroup {
1027
+ id: number;
1028
+ color: string;
1029
+ merchantId: number;
1030
+ /** 공간에 속한 테이블 리스트 */
1031
+ tableIds: number[];
1032
+ }
1033
+
1034
+ declare type PluginTypes = typeof plugin;
1035
+
1036
+ /**
1037
+ * @publicApi
1038
+ */
1039
+ export declare type PopupActionResponse<T extends AllPopupType> = Extract<AllPopupResponse, {
1040
+ type: T;
1041
+ }>;
1042
+
1043
+ /**
1044
+ * @publicApi
1045
+ */
1046
+ export declare type PopupElements<T extends AllPopupType> = Extract<AllPopupElements, {
1047
+ type: T;
1048
+ }>;
1049
+
1050
+ /**
1051
+ * @publicApi
1052
+ */
1053
+ export declare type PosPluginSdk = {
1054
+ table: Table;
1055
+ category: CategoryTypes;
1056
+ catalog: Catalog;
1057
+ option: MenuOption;
1058
+ storage: StorageTypes;
1059
+ cashReceipt: CashReceiptTypes;
1060
+ order: OrderTypes;
1061
+ payment: PaymentTypes;
1062
+ http: HttpTypes;
1063
+ toast: ToastTypes;
1064
+ merchant: MerchantTypes;
1065
+ ui: UiType;
1066
+ paymentMethod: PaymentMethodType;
1067
+ websocket: WebsocketTypes;
1068
+ ffi: FFITypes;
1069
+ plugin: PluginTypes;
1070
+ setting: SettingTypes;
1071
+ };
1072
+
1073
+ /**
1074
+ * @publicApi
1075
+ */
1076
+ export declare const posPluginSdk: PosPluginSdk;
1077
+
1078
+ /**
1079
+ * @publicApi
1080
+ */
1081
+ export declare class PosPluginSdkError extends Error {
1082
+ constructor(message: string);
1083
+ static isPosPluginSdkError(error: unknown): error is PosPluginSdkError;
1084
+ }
1085
+
1086
+ /**
1087
+ * @return string values.id
1088
+ */
1089
+ declare type RadioInput = Omit<BaseInput, 'placeholder'> & {
1090
+ type: 'radio';
1091
+ /**
1092
+ * @desciption 선택된 value의 id
1093
+ */
1094
+ default: string;
1095
+ values: InputValue[];
1096
+ };
1097
+
1098
+ declare function setInputs(inputs: Array<PluginInputs>): void;
1099
+
1100
+ declare const setting: {
1101
+ setInputs: typeof setInputs;
1102
+ getValues: typeof getValues;
1103
+ };
1104
+
1105
+ declare type SettingTypes = typeof setting;
1106
+
1107
+ /**
1108
+ * @return number 0 25 50 75 100
1109
+ */
1110
+ declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
1111
+ type: 'slider';
1112
+ default: number;
1113
+ min: number;
1114
+ max: number;
1115
+ step: number;
1116
+ };
1117
+
1118
+ /**
1119
+ * @publicApi
1120
+ */
1121
+ export declare interface StorageTypes {
1122
+ get: (key: string) => Promise<string | undefined>;
1123
+ set: (key: string, value: string) => Promise<void>;
1124
+ del: (key: string) => Promise<void>;
1125
+ }
1126
+
1127
+ /**
1128
+ * @publicApi
1129
+ */
1130
+ declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_CANCELLED' | 'CANCELLED'
1131
+ /**
1132
+ * 손님이 가져감
1133
+ */
1134
+ | 'DONE';
1135
+
1136
+ declare interface Table {
1137
+ getTables: () => Promise<{
1138
+ table: PluginTable;
1139
+ order?: PluginOrder;
1140
+ }[]>;
1141
+ on(event: 'order-update' | 'order-add', callback: (order: PluginOrder) => void): void;
1142
+ on(event: 'clear' | 'add' | 'delete' | 'update', callback: (table: PluginTable) => void): void;
1143
+ on(event: 'swap' | 'move' | 'merge', callback: (before: PluginTable, after: PluginTable) => void): void;
1144
+ clearTable: (payload: {
1145
+ table: PluginTable;
1146
+ order?: PluginOrder;
1147
+ }) => Promise<void>;
1148
+ }
1149
+
1150
+ /**
1151
+ * @return string
1152
+ */
1153
+ declare type TextInput = BaseInput & {
1154
+ type: 'text';
1155
+ default: string;
1156
+ placeholder?: string;
1157
+ };
1158
+
1159
+ declare type ToastTypes = {
1160
+ open(message: string): void;
1161
+ };
1162
+
1163
+ /**
1164
+ * @return boolean
1165
+ */
1166
+ declare type ToggleInput = Omit<BaseInput, 'placeholder'> & {
1167
+ type: 'toggle';
1168
+ default: boolean;
1169
+ };
1170
+
1171
+ /**
1172
+ * @publicApi
1173
+ * @description 추후에 필요한 정보 더 추가될 예정
1174
+ */
1175
+ export declare type TossMerchant = {
1176
+ name: string;
1177
+ id: number;
1178
+ businessNumber: string;
1179
+ serialNumber: string;
1180
+ franchise?: {
1181
+ id: string;
1182
+ name: string;
1183
+ };
1184
+ };
1185
+
1186
+ declare type UiType = {
1187
+ openPopup<T extends AllPopupType>(message: PopupElements<T>): Promise<PopupActionResponse<T>>;
1188
+ };
1189
+
1190
+ declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
1191
+
1192
+ /**
1193
+ * @publicApi
1194
+ */
1195
+ export declare type VanType = 'NICE' | 'KIS' | 'SMARTRO' | 'KOVAN';
1196
+
1197
+ declare class Websocket {
1198
+ private readonly url;
1199
+ private readonly headers;
1200
+ private readonly options?;
1201
+ onMessageCallback: ((message: string) => void) | undefined;
1202
+ onErrorCallback: ((errorName?: string, errorMessage?: string) => void) | undefined;
1203
+ onCloseCallback: ((code: string) => void) | undefined;
1204
+ onOpenCallback: (() => void) | undefined;
1205
+ constructor(url: string, headers: Record<string, string>, options?: {
1206
+ rejectUnauthorized?: boolean | undefined;
1207
+ followRedirects?: boolean | undefined;
1208
+ timeout?: number | undefined;
1209
+ } | undefined);
1210
+ connect(): Promise<void>;
1211
+ disconnect(): Promise<void>;
1212
+ send(data: {
1213
+ data: string;
1214
+ option?: {
1215
+ mask?: boolean;
1216
+ };
1217
+ }): void;
1218
+ onMessage(callback: (message: string) => void): void;
1219
+ onError(callback: (errorName?: string, errorMessage?: string) => void): void;
1220
+ onClose(callback: (code: string) => void): void;
1221
+ onOpen(callback: () => void): void;
1222
+ }
1223
+
1224
+ declare type WebsocketTypes = {
1225
+ create: (url: string, headers: Record<string, string>, options?: {
1226
+ rejectUnauthorized?: boolean;
1227
+ followRedirects?: boolean;
1228
+ timeout?: number;
1229
+ }) => Promise<Websocket>;
1230
+ };
1231
+
1232
+ export { }