@korpay/sdk 1.0.9 → 1.1.0
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 +6 -7
- package/dist/index.d.cts +55 -37
- package/dist/index.d.ts +55 -37
- package/dist/index.js +6 -7
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,93 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 결제 요청 수단
|
|
3
|
+
* */
|
|
1
4
|
type PayMethod = 'card' | 'phone' | 'vacnt';
|
|
5
|
+
/**
|
|
6
|
+
* 결제 요청 언어
|
|
7
|
+
* */
|
|
2
8
|
type Language = 'ko' | 'en';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
cardListWithInstallments: CardDto[];
|
|
9
|
-
pgGateway: string;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
interface RequestData {
|
|
9
|
+
/**
|
|
10
|
+
* 결제 요청 데이터
|
|
11
|
+
*/
|
|
12
|
+
interface PaymentData {
|
|
13
|
+
/** MID (10글자) */
|
|
14
14
|
merchantId: string;
|
|
15
|
+
/** 상품명 (최대 50자) */
|
|
15
16
|
productName: string;
|
|
17
|
+
/** 주문번호 (최대 40자) */
|
|
16
18
|
orderNumber: string;
|
|
19
|
+
/** 결제금액 (최소 1000원) */
|
|
17
20
|
amount: number;
|
|
21
|
+
/** 결제수단 */
|
|
18
22
|
payMethod: PayMethod;
|
|
23
|
+
/** 결제 완료 후 이동할 URL */
|
|
19
24
|
returnUrl: string;
|
|
25
|
+
/** 전문생성일시 (yyyyMMddHHmmss) */
|
|
20
26
|
ediDate: string | number;
|
|
27
|
+
/** 해시키 */
|
|
21
28
|
hashKey: string;
|
|
22
|
-
|
|
23
|
-
globalKey?: string;
|
|
29
|
+
/** 구매자명 (최대 30자) */
|
|
24
30
|
customerName?: string;
|
|
31
|
+
/** 구매자 이메일 (최대 60자) */
|
|
25
32
|
customerEmail?: string;
|
|
33
|
+
/** 구매자 전화번호 (8-20자, 숫자만) */
|
|
26
34
|
customerPhone?: string;
|
|
35
|
+
/** 구매자 주소 (최대 100자) */
|
|
27
36
|
customerAddress?: string;
|
|
37
|
+
/** 구매자 우편번호 (최대 6자) */
|
|
28
38
|
customerPost?: string;
|
|
39
|
+
/** 앱 스키마 (앱 인증 이후 앱으로 돌아가기, 최대 200자) */
|
|
29
40
|
appScheme?: string;
|
|
41
|
+
/** 예약 필드 (최대 255자) */
|
|
30
42
|
reserved?: string;
|
|
43
|
+
/** 언어 설정 */
|
|
31
44
|
language?: Language;
|
|
45
|
+
/** 테스트 모드 */
|
|
32
46
|
testMode?: boolean;
|
|
47
|
+
/** 다이렉트 모드 (카드 선택 UI 생략) */
|
|
33
48
|
direct?: boolean;
|
|
49
|
+
/** 카드사 코드 (direct 모드 시 필수) */
|
|
34
50
|
cardCode?: string;
|
|
51
|
+
/** 할부 개월 (direct 모드 시 필수) */
|
|
35
52
|
installment?: string;
|
|
53
|
+
/** 모바일 여부 (자동 바인딩) */
|
|
54
|
+
mobile?: boolean;
|
|
55
|
+
/** 글로벌 키 (자동 바인딩) */
|
|
56
|
+
globalKey?: string;
|
|
36
57
|
}
|
|
37
|
-
|
|
38
|
-
|
|
58
|
+
/**
|
|
59
|
+
* 결제 콜백
|
|
60
|
+
*/
|
|
39
61
|
interface PaymentCallbacks {
|
|
40
62
|
onStart?: () => void;
|
|
41
63
|
onError?: (error: string) => void;
|
|
42
64
|
onClose?: () => void;
|
|
43
65
|
}
|
|
44
|
-
interface CardDto {
|
|
45
|
-
cardCode: CardCompanyCode;
|
|
46
|
-
pgCardCode: string;
|
|
47
|
-
cardName: string;
|
|
48
|
-
pgCode: string;
|
|
49
|
-
primary: boolean;
|
|
50
|
-
installmentMonths: number[];
|
|
51
|
-
freeMonths: number[];
|
|
52
|
-
showCloseHeader?: boolean;
|
|
53
|
-
}
|
|
54
66
|
|
|
55
67
|
declare class KorpaySDK {
|
|
56
|
-
|
|
68
|
+
private baseUrl;
|
|
57
69
|
private messageListener;
|
|
58
70
|
private paymentTimeoutId;
|
|
59
|
-
private readonly PAYMENT_TIMEOUT;
|
|
60
71
|
private callbacks;
|
|
61
|
-
private static instance;
|
|
62
72
|
private initialized;
|
|
73
|
+
private readonly PAYMENT_TIMEOUT;
|
|
74
|
+
private static instance;
|
|
63
75
|
constructor();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
/**
|
|
77
|
+
* 결제 시작
|
|
78
|
+
*/
|
|
79
|
+
payment(baseUrl: string, options: PaymentData, callbacks?: PaymentCallbacks): void;
|
|
80
|
+
/**
|
|
81
|
+
* 현재 한국 기준 시간 생성 (yyyyMMddHHmmss)
|
|
82
|
+
*/
|
|
67
83
|
getEdidate(): string;
|
|
84
|
+
/**
|
|
85
|
+
* 결제 모달 닫기
|
|
86
|
+
*/
|
|
68
87
|
close(): void;
|
|
88
|
+
private ensureInitialized;
|
|
89
|
+
private setBaseUrl;
|
|
69
90
|
private openPaymentModal;
|
|
70
91
|
private selfSubmitPayment;
|
|
71
92
|
private openDirectPaymentModal;
|
|
72
93
|
private showPaymentModal;
|
|
73
94
|
private closePaymentModal;
|
|
74
|
-
private _cleanupModalElements;
|
|
75
95
|
private setupMessageListener;
|
|
76
|
-
private setupPageHideListener;
|
|
77
96
|
private removeMessageListener;
|
|
78
97
|
private setPaymentTimeout;
|
|
79
98
|
private clearPaymentTimeout;
|
|
80
99
|
private handleCallback;
|
|
81
|
-
private createHiddenInput;
|
|
82
100
|
private handlePaymentError;
|
|
83
101
|
}
|
|
84
102
|
|
|
85
|
-
declare const
|
|
103
|
+
declare const KorpaySdk: KorpaySDK;
|
|
86
104
|
|
|
87
105
|
declare global {
|
|
88
106
|
interface Window {
|
|
89
|
-
|
|
107
|
+
KorpaySdk?: KorpaySDK;
|
|
90
108
|
}
|
|
91
109
|
}
|
|
92
110
|
|
|
93
|
-
export { type PaymentCallbacks, type
|
|
111
|
+
export { type PaymentCallbacks, type PaymentData, KorpaySdk as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,93 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 결제 요청 수단
|
|
3
|
+
* */
|
|
1
4
|
type PayMethod = 'card' | 'phone' | 'vacnt';
|
|
5
|
+
/**
|
|
6
|
+
* 결제 요청 언어
|
|
7
|
+
* */
|
|
2
8
|
type Language = 'ko' | 'en';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
cardListWithInstallments: CardDto[];
|
|
9
|
-
pgGateway: string;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
interface RequestData {
|
|
9
|
+
/**
|
|
10
|
+
* 결제 요청 데이터
|
|
11
|
+
*/
|
|
12
|
+
interface PaymentData {
|
|
13
|
+
/** MID (10글자) */
|
|
14
14
|
merchantId: string;
|
|
15
|
+
/** 상품명 (최대 50자) */
|
|
15
16
|
productName: string;
|
|
17
|
+
/** 주문번호 (최대 40자) */
|
|
16
18
|
orderNumber: string;
|
|
19
|
+
/** 결제금액 (최소 1000원) */
|
|
17
20
|
amount: number;
|
|
21
|
+
/** 결제수단 */
|
|
18
22
|
payMethod: PayMethod;
|
|
23
|
+
/** 결제 완료 후 이동할 URL */
|
|
19
24
|
returnUrl: string;
|
|
25
|
+
/** 전문생성일시 (yyyyMMddHHmmss) */
|
|
20
26
|
ediDate: string | number;
|
|
27
|
+
/** 해시키 */
|
|
21
28
|
hashKey: string;
|
|
22
|
-
|
|
23
|
-
globalKey?: string;
|
|
29
|
+
/** 구매자명 (최대 30자) */
|
|
24
30
|
customerName?: string;
|
|
31
|
+
/** 구매자 이메일 (최대 60자) */
|
|
25
32
|
customerEmail?: string;
|
|
33
|
+
/** 구매자 전화번호 (8-20자, 숫자만) */
|
|
26
34
|
customerPhone?: string;
|
|
35
|
+
/** 구매자 주소 (최대 100자) */
|
|
27
36
|
customerAddress?: string;
|
|
37
|
+
/** 구매자 우편번호 (최대 6자) */
|
|
28
38
|
customerPost?: string;
|
|
39
|
+
/** 앱 스키마 (앱 인증 이후 앱으로 돌아가기, 최대 200자) */
|
|
29
40
|
appScheme?: string;
|
|
41
|
+
/** 예약 필드 (최대 255자) */
|
|
30
42
|
reserved?: string;
|
|
43
|
+
/** 언어 설정 */
|
|
31
44
|
language?: Language;
|
|
45
|
+
/** 테스트 모드 */
|
|
32
46
|
testMode?: boolean;
|
|
47
|
+
/** 다이렉트 모드 (카드 선택 UI 생략) */
|
|
33
48
|
direct?: boolean;
|
|
49
|
+
/** 카드사 코드 (direct 모드 시 필수) */
|
|
34
50
|
cardCode?: string;
|
|
51
|
+
/** 할부 개월 (direct 모드 시 필수) */
|
|
35
52
|
installment?: string;
|
|
53
|
+
/** 모바일 여부 (자동 바인딩) */
|
|
54
|
+
mobile?: boolean;
|
|
55
|
+
/** 글로벌 키 (자동 바인딩) */
|
|
56
|
+
globalKey?: string;
|
|
36
57
|
}
|
|
37
|
-
|
|
38
|
-
|
|
58
|
+
/**
|
|
59
|
+
* 결제 콜백
|
|
60
|
+
*/
|
|
39
61
|
interface PaymentCallbacks {
|
|
40
62
|
onStart?: () => void;
|
|
41
63
|
onError?: (error: string) => void;
|
|
42
64
|
onClose?: () => void;
|
|
43
65
|
}
|
|
44
|
-
interface CardDto {
|
|
45
|
-
cardCode: CardCompanyCode;
|
|
46
|
-
pgCardCode: string;
|
|
47
|
-
cardName: string;
|
|
48
|
-
pgCode: string;
|
|
49
|
-
primary: boolean;
|
|
50
|
-
installmentMonths: number[];
|
|
51
|
-
freeMonths: number[];
|
|
52
|
-
showCloseHeader?: boolean;
|
|
53
|
-
}
|
|
54
66
|
|
|
55
67
|
declare class KorpaySDK {
|
|
56
|
-
|
|
68
|
+
private baseUrl;
|
|
57
69
|
private messageListener;
|
|
58
70
|
private paymentTimeoutId;
|
|
59
|
-
private readonly PAYMENT_TIMEOUT;
|
|
60
71
|
private callbacks;
|
|
61
|
-
private static instance;
|
|
62
72
|
private initialized;
|
|
73
|
+
private readonly PAYMENT_TIMEOUT;
|
|
74
|
+
private static instance;
|
|
63
75
|
constructor();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
/**
|
|
77
|
+
* 결제 시작
|
|
78
|
+
*/
|
|
79
|
+
payment(baseUrl: string, options: PaymentData, callbacks?: PaymentCallbacks): void;
|
|
80
|
+
/**
|
|
81
|
+
* 현재 한국 기준 시간 생성 (yyyyMMddHHmmss)
|
|
82
|
+
*/
|
|
67
83
|
getEdidate(): string;
|
|
84
|
+
/**
|
|
85
|
+
* 결제 모달 닫기
|
|
86
|
+
*/
|
|
68
87
|
close(): void;
|
|
88
|
+
private ensureInitialized;
|
|
89
|
+
private setBaseUrl;
|
|
69
90
|
private openPaymentModal;
|
|
70
91
|
private selfSubmitPayment;
|
|
71
92
|
private openDirectPaymentModal;
|
|
72
93
|
private showPaymentModal;
|
|
73
94
|
private closePaymentModal;
|
|
74
|
-
private _cleanupModalElements;
|
|
75
95
|
private setupMessageListener;
|
|
76
|
-
private setupPageHideListener;
|
|
77
96
|
private removeMessageListener;
|
|
78
97
|
private setPaymentTimeout;
|
|
79
98
|
private clearPaymentTimeout;
|
|
80
99
|
private handleCallback;
|
|
81
|
-
private createHiddenInput;
|
|
82
100
|
private handlePaymentError;
|
|
83
101
|
}
|
|
84
102
|
|
|
85
|
-
declare const
|
|
103
|
+
declare const KorpaySdk: KorpaySDK;
|
|
86
104
|
|
|
87
105
|
declare global {
|
|
88
106
|
interface Window {
|
|
89
|
-
|
|
107
|
+
KorpaySdk?: KorpaySDK;
|
|
90
108
|
}
|
|
91
109
|
}
|
|
92
110
|
|
|
93
|
-
export { type PaymentCallbacks, type
|
|
111
|
+
export { type PaymentCallbacks, type PaymentData, KorpaySdk as default };
|