@portone/browser-sdk 0.0.2 → 0.0.3
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/{types/v2 → v2}/entity/EasyPayProvider.d.ts +1 -0
- package/dist/{types/v2/entity/bypass/payment/TosspaymentsBrandpay.d.ts → v2/entity/bypass/payment/TossBrandpay.d.ts} +22 -3
- package/dist/{types/v2 → v2}/entity/bypass/payment/index.d.ts +2 -2
- package/dist/v2/exception/CheckoutServiceErrorCode.d.ts +1 -0
- package/dist/v2/exception/ModuleError.d.ts +14 -0
- package/dist/{types/v2 → v2}/exception/index.d.ts +1 -0
- package/dist/v2/index.d.ts +15 -0
- package/dist/v2/loader.d.ts +16 -0
- package/dist/v2/requestIdentityVerification.d.ts +25 -0
- package/dist/{types/v2/request/IssueBillingKey.d.ts → v2/requestIssueBillingKey.d.ts} +20 -9
- package/dist/{types/v2/request/Payment.d.ts → v2/requestPayment.d.ts} +21 -9
- package/dist/{chunk-f7332846.js → v2.cjs} +163 -2
- package/dist/v2.js +772 -14
- package/package.json +8 -26
- package/dist/chunk-4ed6f045.js +0 -66
- package/dist/chunk-ced8f127.js +0 -13
- package/dist/loader.d.ts +0 -14
- package/dist/types/v2/entity/index.js +0 -2
- package/dist/types/v2/exception/CheckoutServiceErrorCode.d.ts +0 -1
- package/dist/types/v2/exception/index.js +0 -2
- package/dist/types/v2/index.d.ts +0 -5
- package/dist/types/v2/request/IdentityVerification.d.ts +0 -14
- package/dist/types/v2/request/index.d.ts +0 -5
- package/dist/types/v2/response/IdentityVerification.d.ts +0 -13
- package/dist/types/v2/response/IssueBillingKey.d.ts +0 -12
- package/dist/types/v2/response/Payment.d.ts +0 -13
- package/dist/types/v2/response/index.d.ts +0 -5
- package/dist/v2-entity.js +0 -2
- package/dist/v2-exception.js +0 -2
- package/dist/v2.d.ts +0 -11
- package/dist/{types/utils.d.ts → utils.d.ts} +0 -0
- package/dist/{types/v2 → v2}/entity/Address.d.ts +0 -0
- package/dist/{types/v2 → v2}/entity/Bank.d.ts +0 -0
- package/dist/{types/v2 → v2}/entity/BillingKeyMethod.d.ts +0 -0
- package/dist/{types/v2 → v2}/entity/CardCompany.d.ts +0 -0
- package/dist/{types/v2 → v2}/entity/Carrier.d.ts +0 -0
- package/dist/{types/v2 → v2}/entity/CashReceiptType.d.ts +0 -0
- package/dist/{types/v2 → v2}/entity/Country.d.ts +0 -0
- package/dist/{types/v2 → v2}/entity/Currency.d.ts +0 -0
- package/dist/{types/v2 → v2}/entity/Customer.d.ts +0 -0
- package/dist/{types/v2 → v2}/entity/FreeInstallmentPlan.d.ts +0 -0
- package/dist/{types/v2 → v2}/entity/Gender.d.ts +0 -0
- package/dist/{types/v2 → v2}/entity/GiftCertificateType.d.ts +0 -0
- package/dist/{types/v2 → v2}/entity/Installment.d.ts +1 -1
- /package/dist/{types/v2 → v2}/entity/Locale.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/OfferPeriod.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/PayMethod.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/PgProvider.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/Product.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/ProductType.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/StoreDetails.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/TransactionType.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/WindowType.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/identityVerification/Danal.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/identityVerification/index.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/issueBillingKey/Naverpay.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/issueBillingKey/PaypalV2.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/issueBillingKey/SmartroV2.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/issueBillingKey/index.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/payment/Kakaopay.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/payment/Ksnet.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/payment/Naverpay.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/payment/NiceV2.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/payment/PaypalV2.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/payment/SmartroV2.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/bypass/payment/Tosspayments.d.ts +0 -0
- /package/dist/{types/v2 → v2}/entity/index.d.ts +0 -0
- /package/dist/{types/v2 → v2}/exception/GrpcErrorCode.d.ts +0 -0
- /package/dist/{types/v2 → v2}/exception/IdentityVerificationError.d.ts +0 -0
- /package/dist/{types/v2 → v2}/exception/IssueBillingKeyError.d.ts +0 -0
- /package/dist/{types/v2 → v2}/exception/PaymentError.d.ts +0 -0
- /package/dist/{types/v2 → v2}/exception/TxServiceIdentityVerificationErrorCode.d.ts +0 -0
- /package/dist/{types/v2 → v2}/exception/TxServiceIssueErrorCode.d.ts +0 -0
- /package/dist/{types/v2 → v2}/exception/TxServicePayErrorCode.d.ts +0 -0
|
@@ -16,5 +16,6 @@ export declare const EasyPayProvider: {
|
|
|
16
16
|
readonly NAVERPAY_POINT: "EASY_PAY_PROVIDER_NAVERPAY_POINT";
|
|
17
17
|
readonly SSGPAY_POINT: "EASY_PAY_PROVIDER_SSGPAY_POINT";
|
|
18
18
|
readonly SSGPAY_BANK: "EASY_PAY_PROVIDER_SSGPAY_BANK";
|
|
19
|
+
readonly TOSS_BRANDPAY: "EASY_PAY_PROVIDER_TOSS_BRANDPAY";
|
|
19
20
|
};
|
|
20
21
|
export type EasyPayProvider = typeof EasyPayProvider[keyof typeof EasyPayProvider];
|
|
@@ -2,11 +2,19 @@
|
|
|
2
2
|
* 정규화가 어려운 토스페이먼츠 브랜드페이 bypass 파라미터
|
|
3
3
|
* 가맹점으로부터 전달 된 값을 PG사로 그대로 전달
|
|
4
4
|
*/
|
|
5
|
-
export type
|
|
5
|
+
export type TossBrandpayPaymentBypass = {
|
|
6
|
+
brandpayOptions?: {
|
|
7
|
+
ui?: BrandpayUi;
|
|
8
|
+
};
|
|
9
|
+
widgetOptions?: {
|
|
10
|
+
methodType?: '카드' | '계좌';
|
|
11
|
+
methodId?: string;
|
|
12
|
+
ui?: BrandpayWidgetUi;
|
|
13
|
+
};
|
|
6
14
|
discountCode?: string;
|
|
7
|
-
|
|
15
|
+
methodId?: string;
|
|
8
16
|
};
|
|
9
|
-
type
|
|
17
|
+
type BrandpayUi = {
|
|
10
18
|
highlightColor?: string;
|
|
11
19
|
/**
|
|
12
20
|
* 버튼 스타일
|
|
@@ -24,4 +32,15 @@ type NavigationBar = {
|
|
|
24
32
|
visible?: boolean;
|
|
25
33
|
paddingTop?: number;
|
|
26
34
|
};
|
|
35
|
+
type BrandpayWidgetUi = {
|
|
36
|
+
promotionSection?: {
|
|
37
|
+
summary?: {
|
|
38
|
+
visible?: boolean;
|
|
39
|
+
};
|
|
40
|
+
description?: {
|
|
41
|
+
visible?: boolean;
|
|
42
|
+
defaultOpen?: boolean;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
27
46
|
export {};
|
|
@@ -5,7 +5,7 @@ import { KakaopayPaymentBypass } from './Kakaopay.js';
|
|
|
5
5
|
import { SmartroV2PaymentBypass } from './SmartroV2.js';
|
|
6
6
|
import { NaverpayPaymentBypass } from './Naverpay.js';
|
|
7
7
|
import { NiceV2PaymentBypass } from './NiceV2.js';
|
|
8
|
-
import {
|
|
8
|
+
import { TossBrandpayPaymentBypass } from './TossBrandpay.js';
|
|
9
9
|
export type PaymentBypass = {
|
|
10
10
|
tosspayments?: TosspaymentsPaymentBypass;
|
|
11
11
|
ksnet?: KsnetPaymentBypass;
|
|
@@ -14,5 +14,5 @@ export type PaymentBypass = {
|
|
|
14
14
|
smartro_v2?: SmartroV2PaymentBypass;
|
|
15
15
|
naverpay?: NaverpayPaymentBypass;
|
|
16
16
|
nice_v2?: NiceV2PaymentBypass;
|
|
17
|
-
|
|
17
|
+
toss_brandpay?: TossBrandpayPaymentBypass;
|
|
18
18
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CheckoutServiceErrorCode = 'BadRequest' | 'ParseChannelFailed' | 'ParseIdentityVerificationPrepareResponseFailed' | 'ParseIssuePrepareResponseFailed' | 'ParsePgRawIdentityVerificationResponseFailed' | 'ParsePgRawIssueBillingKeyResponseFailed' | 'ParsePgRawResponseFailed' | 'ParsePrepareResponseFailed';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CheckoutServiceErrorCode } from './CheckoutServiceErrorCode.js';
|
|
2
|
+
import { GrpcErrorCode } from './GrpcErrorCode.js';
|
|
3
|
+
import { PortOneError } from './index.js';
|
|
4
|
+
export type ModuleErrorCode = CheckoutServiceErrorCode | GrpcErrorCode;
|
|
5
|
+
export declare function isModuleError(error: unknown): error is ModuleError;
|
|
6
|
+
export declare class ModuleError extends Error implements PortOneError {
|
|
7
|
+
__portOneErrorType: string;
|
|
8
|
+
code: ModuleErrorCode;
|
|
9
|
+
message: string;
|
|
10
|
+
constructor({ code, message }: {
|
|
11
|
+
code: ModuleErrorCode;
|
|
12
|
+
message: string;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -4,4 +4,5 @@ export interface PortOneError extends Error {
|
|
|
4
4
|
export declare function isPortOneError(error: unknown): error is PortOneError;
|
|
5
5
|
export * from './IdentityVerificationError.js';
|
|
6
6
|
export * from './IssueBillingKeyError.js';
|
|
7
|
+
export * from './ModuleError.js';
|
|
7
8
|
export * from './PaymentError.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { requestPayment } from './requestPayment.js';
|
|
2
|
+
import { requestIssueBillingKey } from './requestIssueBillingKey.js';
|
|
3
|
+
import { requestIdentityVerification } from './requestIdentityVerification.js';
|
|
4
|
+
declare const PortOne: {
|
|
5
|
+
requestPayment: typeof requestPayment;
|
|
6
|
+
requestIssueBillingKey: typeof requestIssueBillingKey;
|
|
7
|
+
requestIdentityVerification: typeof requestIdentityVerification;
|
|
8
|
+
};
|
|
9
|
+
export { setPortOneJsSdkUrl as __INTERNAL__setPortOneSdkUrl } from './loader.js';
|
|
10
|
+
export { requestPayment, type PaymentRequest, type PaymentResponse, } from './requestPayment.js';
|
|
11
|
+
export { requestIssueBillingKey, type IssueBillingKeyRequest, type IssueBillingKeyResponse, } from './requestIssueBillingKey.js';
|
|
12
|
+
export { requestIdentityVerification, type IdentityVerificationRequest, type IdentityVerificationResponse, } from './requestIdentityVerification.js';
|
|
13
|
+
export * as Entity from './entity/index.js';
|
|
14
|
+
export * from './exception/index.js';
|
|
15
|
+
export default PortOne;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PaymentRequest, PaymentResponse } from './requestPayment.js';
|
|
2
|
+
import type { IssueBillingKeyRequest, IssueBillingKeyResponse } from './requestIssueBillingKey.js';
|
|
3
|
+
import type { IdentityVerificationRequest, IdentityVerificationResponse } from './requestIdentityVerification.js';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
PortOne: PortOne | undefined;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
interface PortOne {
|
|
10
|
+
requestPayment(request: PaymentRequest): Promise<PaymentResponse>;
|
|
11
|
+
requestIssueBillingKey(request: IssueBillingKeyRequest): Promise<IssueBillingKeyResponse>;
|
|
12
|
+
requestIdentityVerification(request: IdentityVerificationRequest): Promise<IdentityVerificationResponse>;
|
|
13
|
+
}
|
|
14
|
+
export declare function loadScript(): Promise<PortOne>;
|
|
15
|
+
export declare function setPortOneJsSdkUrl(url: string): string;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Entity } from './index.js';
|
|
2
|
+
export declare function requestIdentityVerification(request: IdentityVerificationRequest): Promise<IdentityVerificationResponse | undefined>;
|
|
3
|
+
export type IdentityVerificationRequest = {
|
|
4
|
+
storeId: string;
|
|
5
|
+
identityVerificationId: string;
|
|
6
|
+
channelKey?: string;
|
|
7
|
+
pgProvider?: Entity.PgProvider;
|
|
8
|
+
isTestChannel?: boolean;
|
|
9
|
+
customer?: Entity.Customer;
|
|
10
|
+
windowType?: Entity.WindowTypes;
|
|
11
|
+
redirectUrl?: string;
|
|
12
|
+
customData?: string;
|
|
13
|
+
bypass?: Entity.IdentityVerificationBypass;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* iframe/popup 방식으로 PG사 창이 렌더링 된 경우
|
|
17
|
+
* 프로세스 종료 후, 콜백 함수로 전달 될 본인인증 정보 데이터
|
|
18
|
+
*/
|
|
19
|
+
export type IdentityVerificationResponse = {
|
|
20
|
+
transactionType: typeof Entity.TransactionType.IDENTITY_VERIFICATION;
|
|
21
|
+
identityVerificationId?: string;
|
|
22
|
+
identityVerificationTxId: string;
|
|
23
|
+
code?: string;
|
|
24
|
+
message?: string;
|
|
25
|
+
};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { CapsToCamel } from '
|
|
2
|
-
import { Entity } from '
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} & {
|
|
6
|
-
[K in Method as CapsToCamel<K>]?: T;
|
|
7
|
-
};
|
|
8
|
-
type IssueBillingKeyRequest = {
|
|
1
|
+
import { CapsToCamel } from '../utils.js';
|
|
2
|
+
import { Entity } from './index.js';
|
|
3
|
+
export declare function requestIssueBillingKey(request: IssueBillingKeyRequest): Promise<IssueBillingKeyResponse | undefined>;
|
|
4
|
+
export type IssueBillingKeyRequest = {
|
|
9
5
|
displayAmount?: number;
|
|
10
6
|
currency?: Entity.Currency;
|
|
11
7
|
storeId: string;
|
|
@@ -25,6 +21,21 @@ type IssueBillingKeyRequest = {
|
|
|
25
21
|
noticeUrls?: string[];
|
|
26
22
|
bypass?: Entity.IssueBillingKeyBypass;
|
|
27
23
|
} & (BillingKeyMethodOptions<'CARD', Card> | BillingKeyMethodOptions<'MOBILE', Mobile> | BillingKeyMethodOptions<'EASY_PAY', EasyPay> | BillingKeyMethodOptions<'PAYPAL', Paypal>);
|
|
24
|
+
/**
|
|
25
|
+
* iframe/popup 방식으로 PG사 창이 렌더링 된 경우
|
|
26
|
+
* 프로세스 종료 후, 콜백 함수로 전달 될 빌링키 발급 정보 데이터
|
|
27
|
+
*/
|
|
28
|
+
export type IssueBillingKeyResponse = {
|
|
29
|
+
transactionType: typeof Entity.TransactionType.ISSUE_BILLING_KEY;
|
|
30
|
+
billingKey?: string;
|
|
31
|
+
code?: string;
|
|
32
|
+
message?: string;
|
|
33
|
+
};
|
|
34
|
+
type BillingKeyMethodOptions<Method extends Entity.BillingKeyMethod, T> = {
|
|
35
|
+
billingKeyMethod: Method;
|
|
36
|
+
} & {
|
|
37
|
+
[K in Method as CapsToCamel<K>]?: T;
|
|
38
|
+
};
|
|
28
39
|
type Card = {
|
|
29
40
|
cardCompany?: Entity.CardCompany;
|
|
30
41
|
};
|
|
@@ -35,4 +46,4 @@ type Mobile = {
|
|
|
35
46
|
carrier?: Entity.Carrier;
|
|
36
47
|
};
|
|
37
48
|
type Paypal = Record<string, never>;
|
|
38
|
-
export
|
|
49
|
+
export {};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { CapsToCamel, OneOfType } from '
|
|
2
|
-
import { Entity } from '
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} & {
|
|
6
|
-
[K in Method as CapsToCamel<K>]?: T;
|
|
7
|
-
};
|
|
8
|
-
type PaymentRequest = {
|
|
1
|
+
import { CapsToCamel, OneOfType } from '../utils.js';
|
|
2
|
+
import { Entity } from './index.js';
|
|
3
|
+
export declare function requestPayment(request: PaymentRequest): Promise<PaymentResponse | undefined>;
|
|
4
|
+
export type PaymentRequest = {
|
|
9
5
|
storeId: string;
|
|
10
6
|
paymentId: string;
|
|
11
7
|
orderName: string;
|
|
@@ -34,6 +30,22 @@ type PaymentRequest = {
|
|
|
34
30
|
country?: Entity.Country;
|
|
35
31
|
shippingAddress?: Entity.Address;
|
|
36
32
|
} & (PayMethodOptions<'CARD', Card> | PayMethodOptions<'VIRTUAL_ACCOUNT', VirtualAccount> | PayMethodOptions<'TRANSFER', Transfer> | PayMethodOptions<'MOBILE', Mobile> | PayMethodOptions<'GIFT_CERTIFICATE', GiftCertificate> | PayMethodOptions<'EASY_PAY', EasyPay> | PayMethodOptions<'PAYPAL', Paypal>);
|
|
33
|
+
/**
|
|
34
|
+
* iframe/popup 방식으로 PG사 창이 렌더링 된 경우
|
|
35
|
+
* 프로세스 종료 후, 콜백 함수로 전달 될 결제 정보 데이터
|
|
36
|
+
*/
|
|
37
|
+
export type PaymentResponse = {
|
|
38
|
+
transactionType: typeof Entity.TransactionType.PAYMENT;
|
|
39
|
+
txId: string;
|
|
40
|
+
paymentId?: string;
|
|
41
|
+
code?: string;
|
|
42
|
+
message?: string;
|
|
43
|
+
};
|
|
44
|
+
type PayMethodOptions<Method extends Entity.PayMethod, T> = {
|
|
45
|
+
payMethod: Method;
|
|
46
|
+
} & {
|
|
47
|
+
[K in Method as CapsToCamel<K>]?: T;
|
|
48
|
+
};
|
|
37
49
|
type Card = {
|
|
38
50
|
cardCompany?: Entity.CardCompany;
|
|
39
51
|
installment?: Entity.Installment;
|
|
@@ -76,4 +88,4 @@ type EasyPay = {
|
|
|
76
88
|
useCardPoint?: boolean;
|
|
77
89
|
};
|
|
78
90
|
type Paypal = Record<string, never>;
|
|
79
|
-
export
|
|
91
|
+
export {};
|
|
@@ -1,4 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _a;
|
|
6
|
+
let promise = null;
|
|
7
|
+
const portone = {
|
|
8
|
+
jsSdkUrl: (_a = undefined) !== null && _a !== void 0 ? _a : 'https://cdn.portone.io/v2/browser-sdk.js',
|
|
9
|
+
};
|
|
10
|
+
function findScript() {
|
|
11
|
+
return document.querySelector(`script[src="${portone.jsSdkUrl}"]`);
|
|
12
|
+
}
|
|
13
|
+
function injectScript() {
|
|
14
|
+
const script = document.createElement('script');
|
|
15
|
+
script.src = portone.jsSdkUrl;
|
|
16
|
+
const headOrBody = document.head || document.body;
|
|
17
|
+
if (!headOrBody)
|
|
18
|
+
throw new Error('[PortOne] Expected document.body not to be null');
|
|
19
|
+
return headOrBody.appendChild(script);
|
|
20
|
+
}
|
|
21
|
+
function loadScript() {
|
|
22
|
+
if (promise != null) {
|
|
23
|
+
// SDK is already loaded
|
|
24
|
+
return promise;
|
|
25
|
+
}
|
|
26
|
+
return (promise = new Promise((resolve, reject) => {
|
|
27
|
+
if (window.PortOne) {
|
|
28
|
+
// window.PortOne is already injected by CDN
|
|
29
|
+
return resolve(window.PortOne);
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
// window.PortOne will be injected by @portone/browser-sdk
|
|
33
|
+
const script = findScript() || injectScript();
|
|
34
|
+
script.addEventListener('load', () => {
|
|
35
|
+
// script has just loaded
|
|
36
|
+
if (window.PortOne) {
|
|
37
|
+
// window.PortOne is successfully injected @portone/browser-sdk
|
|
38
|
+
return resolve(window.PortOne);
|
|
39
|
+
}
|
|
40
|
+
reject(new Error('[PortOne] Failed to load window.PortOne'));
|
|
41
|
+
});
|
|
42
|
+
script.addEventListener('error', () => {
|
|
43
|
+
reject(new Error('[PortOne] Failed to load window.PortOne'));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
return reject(error);
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
function setPortOneJsSdkUrl(url) {
|
|
52
|
+
return (portone.jsSdkUrl = url);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function requestPayment(request) {
|
|
56
|
+
return loadScript().then((sdk) => sdk.requestPayment(request));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function requestIssueBillingKey(request) {
|
|
60
|
+
return loadScript().then((sdk) => sdk.requestIssueBillingKey(request));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function requestIdentityVerification(request) {
|
|
64
|
+
return loadScript().then((sdk) => sdk.requestIdentityVerification(request));
|
|
65
|
+
}
|
|
2
66
|
|
|
3
67
|
// 계좌이체, 가상계좌 발급시 사용되는 은행 코드
|
|
4
68
|
const Bank = {
|
|
@@ -590,6 +654,7 @@ const EasyPayProvider = {
|
|
|
590
654
|
NAVERPAY_POINT: 'EASY_PAY_PROVIDER_NAVERPAY_POINT',
|
|
591
655
|
SSGPAY_POINT: 'EASY_PAY_PROVIDER_SSGPAY_POINT',
|
|
592
656
|
SSGPAY_BANK: 'EASY_PAY_PROVIDER_SSGPAY_BANK',
|
|
657
|
+
TOSS_BRANDPAY: 'EASY_PAY_PROVIDER_TOSS_BRANDPAY',
|
|
593
658
|
};
|
|
594
659
|
|
|
595
660
|
// 구매자 성별
|
|
@@ -659,6 +724,18 @@ const PgProvider = {
|
|
|
659
724
|
TOSS_BRANDPAY: 'PG_PROVIDER_TOSS_BRANDPAY',
|
|
660
725
|
};
|
|
661
726
|
|
|
727
|
+
/**
|
|
728
|
+
* 트랜잭션 유형
|
|
729
|
+
* - PAYMENT: 결제
|
|
730
|
+
* - ISSUE_BILLING_KEY: 빌링키 발급
|
|
731
|
+
* - IDENTITY_VERIFICATION: 본인 인증
|
|
732
|
+
*/
|
|
733
|
+
const TransactionType = {
|
|
734
|
+
PAYMENT: 'PAYMENT',
|
|
735
|
+
ISSUE_BILLING_KEY: 'ISSUE_BILLING_KEY',
|
|
736
|
+
IDENTITY_VERIFICATION: 'IDENTITY_VERIFICATION',
|
|
737
|
+
};
|
|
738
|
+
|
|
662
739
|
/**
|
|
663
740
|
* PG사 창 렌더링 방식
|
|
664
741
|
* PG사나 결제 환경에 따라 허용되는 창 종류가 다름
|
|
@@ -687,4 +764,88 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
687
764
|
WindowType: WindowType
|
|
688
765
|
});
|
|
689
766
|
|
|
690
|
-
|
|
767
|
+
function isIdentityVerificationError(error) {
|
|
768
|
+
return (isPortOneError(error) &&
|
|
769
|
+
error.__portOneErrorType === 'IdentityVerificationError');
|
|
770
|
+
}
|
|
771
|
+
class IdentityVerificationError extends Error {
|
|
772
|
+
constructor({ code, message, identityVerificationId, identityVerificationTxId, }) {
|
|
773
|
+
super(message);
|
|
774
|
+
this.__portOneErrorType = 'IdentityVerificationError';
|
|
775
|
+
this.transactionType = TransactionType.IDENTITY_VERIFICATION;
|
|
776
|
+
this.code = code;
|
|
777
|
+
this.message = message;
|
|
778
|
+
this.identityVerificationId = identityVerificationId;
|
|
779
|
+
this.identityVerificationTxId = identityVerificationTxId;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
function isIssueBillingKeyError(error) {
|
|
784
|
+
return (isPortOneError(error) && error.__portOneErrorType === 'IssueBillingKeyError');
|
|
785
|
+
}
|
|
786
|
+
class IssueBillingKeyError extends Error {
|
|
787
|
+
constructor({ code, message, billingKey, }) {
|
|
788
|
+
super(message);
|
|
789
|
+
this.__portOneErrorType = 'IssueBillingKeyError';
|
|
790
|
+
this.transactionType = TransactionType.ISSUE_BILLING_KEY;
|
|
791
|
+
this.code = code;
|
|
792
|
+
this.message = message;
|
|
793
|
+
this.billingKey = billingKey;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
function isModuleError(error) {
|
|
798
|
+
return isPortOneError(error) && error.__portOneErrorType === 'ModuleError';
|
|
799
|
+
}
|
|
800
|
+
class ModuleError extends Error {
|
|
801
|
+
constructor({ code, message }) {
|
|
802
|
+
super(message);
|
|
803
|
+
this.__portOneErrorType = 'ModuleError';
|
|
804
|
+
this.code = code;
|
|
805
|
+
this.message = message;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
function isPaymentError(error) {
|
|
810
|
+
return isPortOneError(error) && error.__portOneErrorType === 'PaymentError';
|
|
811
|
+
}
|
|
812
|
+
class PaymentError extends Error {
|
|
813
|
+
constructor({ code, message, txId, paymentId, }) {
|
|
814
|
+
super(message);
|
|
815
|
+
this.__portOneErrorType = 'PaymentError';
|
|
816
|
+
this.transactionType = TransactionType.PAYMENT;
|
|
817
|
+
this.code = code;
|
|
818
|
+
this.message = message;
|
|
819
|
+
this.txId = txId;
|
|
820
|
+
this.paymentId = paymentId;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
function isPortOneError(error) {
|
|
825
|
+
return (error != null &&
|
|
826
|
+
typeof error === 'object' &&
|
|
827
|
+
'__portOneErrorType' in error &&
|
|
828
|
+
typeof error.__portOneErrorType === 'string');
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
const PortOne = {
|
|
832
|
+
requestPayment,
|
|
833
|
+
requestIssueBillingKey,
|
|
834
|
+
requestIdentityVerification,
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
exports.Entity = index;
|
|
838
|
+
exports.IdentityVerificationError = IdentityVerificationError;
|
|
839
|
+
exports.IssueBillingKeyError = IssueBillingKeyError;
|
|
840
|
+
exports.ModuleError = ModuleError;
|
|
841
|
+
exports.PaymentError = PaymentError;
|
|
842
|
+
exports.__INTERNAL__setPortOneSdkUrl = setPortOneJsSdkUrl;
|
|
843
|
+
exports.default = PortOne;
|
|
844
|
+
exports.isIdentityVerificationError = isIdentityVerificationError;
|
|
845
|
+
exports.isIssueBillingKeyError = isIssueBillingKeyError;
|
|
846
|
+
exports.isModuleError = isModuleError;
|
|
847
|
+
exports.isPaymentError = isPaymentError;
|
|
848
|
+
exports.isPortOneError = isPortOneError;
|
|
849
|
+
exports.requestIdentityVerification = requestIdentityVerification;
|
|
850
|
+
exports.requestIssueBillingKey = requestIssueBillingKey;
|
|
851
|
+
exports.requestPayment = requestPayment;
|