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