@portone/browser-sdk 0.0.2 → 0.0.4

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.
Files changed (96) hide show
  1. package/dist/{types/utils.d.ts → utils.d.ts} +4 -1
  2. package/dist/v2/entity/BillingKeyAndPayMethod.d.ts +4 -0
  3. package/dist/{types/v2 → v2}/entity/Currency.d.ts +0 -1
  4. package/dist/v2/entity/EasyPayPaymentMethod.d.ts +7 -0
  5. package/dist/{types/v2 → v2}/entity/EasyPayProvider.d.ts +1 -4
  6. package/dist/{types/v2 → v2}/entity/GiftCertificateType.d.ts +1 -0
  7. package/dist/v2/entity/IssueBillingKeyUIType.d.ts +4 -0
  8. package/dist/v2/entity/LoadableUIType.d.ts +3 -0
  9. package/dist/{types/v2 → v2}/entity/OfferPeriod.d.ts +11 -0
  10. package/dist/v2/entity/PayMethod.d.ts +1 -0
  11. package/dist/v2/entity/PaymentUIType.d.ts +4 -0
  12. package/dist/{types/v2 → v2}/entity/PgProvider.d.ts +2 -0
  13. package/dist/{types/v2 → v2}/entity/TransactionType.d.ts +2 -0
  14. package/dist/v2/entity/bypass/issueBillingKey/TosspayV2.d.ts +7 -0
  15. package/dist/v2/entity/bypass/issueBillingKey/Welcome.d.ts +6 -0
  16. package/dist/{types/v2 → v2}/entity/bypass/issueBillingKey/index.d.ts +4 -2
  17. package/dist/v2/entity/bypass/issueBillingKeyAndPay/Welcome.d.ts +55 -0
  18. package/dist/v2/entity/bypass/issueBillingKeyAndPay/index.d.ts +4 -0
  19. package/dist/{types/v2/entity/bypass/issueBillingKey → v2/entity/bypass/loadIssueBillingKeyUI}/PaypalV2.d.ts +1 -1
  20. package/dist/v2/entity/bypass/loadIssueBillingKeyUI/index.d.ts +4 -0
  21. package/dist/{types/v2/entity/bypass/payment → v2/entity/bypass/loadPaymentUI}/PaypalV2.d.ts +1 -1
  22. package/dist/v2/entity/bypass/loadPaymentUI/index.d.ts +4 -0
  23. package/dist/{types/v2/entity/bypass/payment/TosspaymentsBrandpay.d.ts → v2/entity/bypass/payment/TossBrandpay.d.ts} +22 -3
  24. package/dist/v2/entity/bypass/payment/TosspayV2.d.ts +17 -0
  25. package/dist/v2/entity/bypass/payment/Welcome.d.ts +108 -0
  26. package/dist/{types/v2 → v2}/entity/bypass/payment/index.d.ts +6 -4
  27. package/dist/{types/v2 → v2}/entity/index.d.ts +8 -0
  28. package/dist/v2/exception/CheckoutServiceErrorCode.d.ts +1 -0
  29. package/dist/v2/exception/IssueBillingKeyAndPayError.d.ts +24 -0
  30. package/dist/v2/exception/LoadIssueBillingKeyUIError.d.ts +16 -0
  31. package/dist/v2/exception/LoadPaymentUIError.d.ts +16 -0
  32. package/dist/v2/exception/ModuleError.d.ts +14 -0
  33. package/dist/{types/v2 → v2}/exception/index.d.ts +4 -0
  34. package/dist/v2/index.d.ts +30 -0
  35. package/dist/v2/loadIssueBillingKeyUI.d.ts +27 -0
  36. package/dist/v2/loadPaymentUI.d.ts +36 -0
  37. package/dist/v2/loader.d.ts +31 -0
  38. package/dist/v2/requestIdentityVerification.d.ts +25 -0
  39. package/dist/{types/v2/request/IssueBillingKey.d.ts → v2/requestIssueBillingKey.d.ts} +22 -9
  40. package/dist/v2/requestIssueBillingKeyAndPay.d.ts +51 -0
  41. package/dist/{types/v2/request/Payment.d.ts → v2/requestPayment.d.ts} +28 -10
  42. package/dist/v2/updateLoadIssueBillingKeyUIRequest.d.ts +2 -0
  43. package/dist/v2/updateLoadPaymentUIRequest.d.ts +2 -0
  44. package/dist/{chunk-f7332846.js → v2.cjs} +264 -7
  45. package/dist/v2.js +861 -18
  46. package/package.json +8 -26
  47. package/dist/chunk-4ed6f045.js +0 -66
  48. package/dist/chunk-ced8f127.js +0 -13
  49. package/dist/loader.d.ts +0 -14
  50. package/dist/types/v2/entity/PayMethod.d.ts +0 -1
  51. package/dist/types/v2/entity/index.js +0 -2
  52. package/dist/types/v2/exception/CheckoutServiceErrorCode.d.ts +0 -1
  53. package/dist/types/v2/exception/index.js +0 -2
  54. package/dist/types/v2/index.d.ts +0 -5
  55. package/dist/types/v2/request/IdentityVerification.d.ts +0 -14
  56. package/dist/types/v2/request/index.d.ts +0 -5
  57. package/dist/types/v2/response/IdentityVerification.d.ts +0 -13
  58. package/dist/types/v2/response/IssueBillingKey.d.ts +0 -12
  59. package/dist/types/v2/response/Payment.d.ts +0 -13
  60. package/dist/types/v2/response/index.d.ts +0 -5
  61. package/dist/v2-entity.js +0 -2
  62. package/dist/v2-exception.js +0 -2
  63. package/dist/v2.d.ts +0 -11
  64. package/dist/{types/v2 → v2}/entity/Address.d.ts +0 -0
  65. package/dist/{types/v2 → v2}/entity/Bank.d.ts +0 -0
  66. package/dist/{types/v2 → v2}/entity/BillingKeyMethod.d.ts +0 -0
  67. package/dist/{types/v2 → v2}/entity/CardCompany.d.ts +0 -0
  68. package/dist/{types/v2 → v2}/entity/Carrier.d.ts +0 -0
  69. package/dist/{types/v2 → v2}/entity/CashReceiptType.d.ts +0 -0
  70. package/dist/{types/v2 → v2}/entity/Country.d.ts +0 -0
  71. package/dist/{types/v2 → v2}/entity/Customer.d.ts +0 -0
  72. package/dist/{types/v2 → v2}/entity/FreeInstallmentPlan.d.ts +0 -0
  73. package/dist/{types/v2 → v2}/entity/Gender.d.ts +0 -0
  74. package/dist/{types/v2 → v2}/entity/Installment.d.ts +1 -1
  75. /package/dist/{types/v2 → v2}/entity/Locale.d.ts +0 -0
  76. /package/dist/{types/v2 → v2}/entity/Product.d.ts +0 -0
  77. /package/dist/{types/v2 → v2}/entity/ProductType.d.ts +0 -0
  78. /package/dist/{types/v2 → v2}/entity/StoreDetails.d.ts +0 -0
  79. /package/dist/{types/v2 → v2}/entity/WindowType.d.ts +0 -0
  80. /package/dist/{types/v2 → v2}/entity/bypass/identityVerification/Danal.d.ts +0 -0
  81. /package/dist/{types/v2 → v2}/entity/bypass/identityVerification/index.d.ts +0 -0
  82. /package/dist/{types/v2 → v2}/entity/bypass/issueBillingKey/Naverpay.d.ts +0 -0
  83. /package/dist/{types/v2 → v2}/entity/bypass/issueBillingKey/SmartroV2.d.ts +0 -0
  84. /package/dist/{types/v2 → v2}/entity/bypass/payment/Kakaopay.d.ts +0 -0
  85. /package/dist/{types/v2 → v2}/entity/bypass/payment/Ksnet.d.ts +0 -0
  86. /package/dist/{types/v2 → v2}/entity/bypass/payment/Naverpay.d.ts +0 -0
  87. /package/dist/{types/v2 → v2}/entity/bypass/payment/NiceV2.d.ts +0 -0
  88. /package/dist/{types/v2 → v2}/entity/bypass/payment/SmartroV2.d.ts +0 -0
  89. /package/dist/{types/v2 → v2}/entity/bypass/payment/Tosspayments.d.ts +0 -0
  90. /package/dist/{types/v2 → v2}/exception/GrpcErrorCode.d.ts +0 -0
  91. /package/dist/{types/v2 → v2}/exception/IdentityVerificationError.d.ts +0 -0
  92. /package/dist/{types/v2 → v2}/exception/IssueBillingKeyError.d.ts +0 -0
  93. /package/dist/{types/v2 → v2}/exception/PaymentError.d.ts +0 -0
  94. /package/dist/{types/v2 → v2}/exception/TxServiceIdentityVerificationErrorCode.d.ts +0 -0
  95. /package/dist/{types/v2 → v2}/exception/TxServiceIssueErrorCode.d.ts +0 -0
  96. /package/dist/{types/v2 → v2}/exception/TxServicePayErrorCode.d.ts +0 -0
@@ -0,0 +1,36 @@
1
+ import { Entity, PaymentError, PaymentResponse } from './index.js';
2
+ import { PaymentUIType } from './entity/index.js';
3
+ import { Prettify } from '../utils.js';
4
+ export declare function loadPaymentUI(request: LoadPaymentUIRequest, callbacks: {
5
+ onPaymentSuccess: (response: PaymentResponse) => void;
6
+ onPaymentFail: (error: PaymentError) => void;
7
+ }): Promise<void>;
8
+ export type LoadPaymentUIRequest = Prettify<{
9
+ uiType: PaymentUIType;
10
+ storeId: string;
11
+ paymentId: string;
12
+ orderName: string;
13
+ totalAmount: number;
14
+ channelKey: string;
15
+ pgProvider?: Entity.PgProvider;
16
+ isTestChannel?: boolean;
17
+ taxFreeAmount?: number;
18
+ vatAmount?: number;
19
+ customer?: Entity.Customer;
20
+ redirectUrl?: string;
21
+ noticeUrls?: string[];
22
+ confirmUrl?: string;
23
+ appScheme?: string;
24
+ isEscrow?: boolean;
25
+ products?: Entity.Product[];
26
+ isCulturalExpense?: boolean;
27
+ currency: Entity.Currency;
28
+ locale?: Entity.Locale;
29
+ customData?: Record<string, any>;
30
+ offerPeriod?: Entity.OfferPeriod;
31
+ productType?: Entity.ProductType;
32
+ storeDetails?: Entity.StoreDetails;
33
+ bypass?: Entity.LoadPaymentUIBypass;
34
+ country?: Entity.Country;
35
+ shippingAddress?: Entity.Address;
36
+ }>;
@@ -0,0 +1,31 @@
1
+ import type { IdentityVerificationRequest, IdentityVerificationResponse } from './requestIdentityVerification.js';
2
+ import type { IssueBillingKeyAndPayRequest, IssueBillingKeyAndPayResponse } from './requestIssueBillingKeyAndPay.js';
3
+ import type { IssueBillingKeyRequest, IssueBillingKeyResponse } from './requestIssueBillingKey.js';
4
+ import type { PaymentRequest, PaymentResponse } from './requestPayment.js';
5
+ import { LoadPaymentUIRequest } from './loadPaymentUI.js';
6
+ import { LoadIssueBillingKeyUIRequest } from './loadIssueBillingKeyUI.js';
7
+ import { IssueBillingKeyError, PaymentError } from './exception/index.js';
8
+ declare global {
9
+ interface Window {
10
+ PortOne: PortOne | undefined;
11
+ }
12
+ }
13
+ interface PortOne {
14
+ requestPayment(request: PaymentRequest): Promise<PaymentResponse>;
15
+ requestIssueBillingKeyAndPay(request: IssueBillingKeyAndPayRequest): Promise<IssueBillingKeyAndPayResponse>;
16
+ requestIssueBillingKey(request: IssueBillingKeyRequest): Promise<IssueBillingKeyResponse>;
17
+ requestIdentityVerification(request: IdentityVerificationRequest): Promise<IdentityVerificationResponse>;
18
+ loadPaymentUI(request: LoadPaymentUIRequest, callbacks: {
19
+ onPaymentSuccess: (response: PaymentResponse) => void;
20
+ onPaymentFail: (error: PaymentError) => void;
21
+ }): Promise<void>;
22
+ loadIssueBillingKeyUI(request: LoadIssueBillingKeyUIRequest, callbacks: {
23
+ onIssueBillingKeySuccess: (response: IssueBillingKeyResponse) => void;
24
+ onIssueBillingKeyFail: (error: IssueBillingKeyError) => void;
25
+ }): Promise<void>;
26
+ updateLoadPaymentUIRequest(request: LoadPaymentUIRequest): Promise<void>;
27
+ updateLoadIssueBillingKeyUIRequest(request: LoadIssueBillingKeyUIRequest): Promise<void>;
28
+ }
29
+ export declare function loadScript(): Promise<PortOne>;
30
+ export declare function setPortOneJsSdkUrl(url: string): string;
31
+ 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 '../../utils.js';
2
- import { Entity } from '../index.js';
3
- type BillingKeyMethodOptions<Method extends Entity.BillingKeyMethod, T> = {
4
- billingKeyMethod: Method;
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;
@@ -23,8 +19,24 @@ type IssueBillingKeyRequest = {
23
19
  customData?: Record<string, any>;
24
20
  appScheme?: string;
25
21
  noticeUrls?: string[];
22
+ productType?: Entity.ProductType;
26
23
  bypass?: Entity.IssueBillingKeyBypass;
27
24
  } & (BillingKeyMethodOptions<'CARD', Card> | BillingKeyMethodOptions<'MOBILE', Mobile> | BillingKeyMethodOptions<'EASY_PAY', EasyPay> | BillingKeyMethodOptions<'PAYPAL', Paypal>);
25
+ /**
26
+ * iframe/popup 방식으로 PG사 창이 렌더링 된 경우
27
+ * 프로세스 종료 후, 콜백 함수로 전달 될 빌링키 발급 정보 데이터
28
+ */
29
+ export type IssueBillingKeyResponse = {
30
+ transactionType: typeof Entity.TransactionType.ISSUE_BILLING_KEY;
31
+ billingKey: string;
32
+ code?: string;
33
+ message?: string;
34
+ };
35
+ type BillingKeyMethodOptions<Method extends Entity.BillingKeyMethod, T> = {
36
+ billingKeyMethod: Method;
37
+ } & {
38
+ [K in Method as CapsToCamel<K>]?: T;
39
+ };
28
40
  type Card = {
29
41
  cardCompany?: Entity.CardCompany;
30
42
  };
@@ -33,6 +45,7 @@ type EasyPay = {
33
45
  };
34
46
  type Mobile = {
35
47
  carrier?: Entity.Carrier;
48
+ availableCarriers?: Entity.Carrier[];
36
49
  };
37
50
  type Paypal = Record<string, never>;
38
- export default IssueBillingKeyRequest;
51
+ export {};
@@ -0,0 +1,51 @@
1
+ import { CapsToCamel } from '../utils.js';
2
+ import { Entity } from './index.js';
3
+ export declare function requestIssueBillingKeyAndPay(request: IssueBillingKeyAndPayRequest): Promise<IssueBillingKeyAndPayResponse>;
4
+ export type IssueBillingKeyAndPayRequest = {
5
+ storeId: string;
6
+ paymentId: string;
7
+ orderName: string;
8
+ totalAmount: number;
9
+ channelKey?: string;
10
+ pgProvider?: Entity.PgProvider;
11
+ isTestChannel?: boolean;
12
+ taxFreeAmount?: number;
13
+ vatAmount?: number;
14
+ customer?: Entity.Customer;
15
+ billingKeyAndPayMethod: Entity.BillingKeyAndPayMethod;
16
+ windowType?: Entity.WindowTypes;
17
+ redirectUrl?: string;
18
+ noticeUrls?: string[];
19
+ confirmUrl?: string;
20
+ locale?: Entity.Locale;
21
+ isCulturalExpense?: boolean;
22
+ customData?: Record<string, any>;
23
+ offerPeriod?: Entity.OfferPeriod;
24
+ appScheme?: string;
25
+ productType?: Entity.ProductType;
26
+ storeDetails?: Entity.StoreDetails;
27
+ country?: Entity.Country;
28
+ bypass?: Entity.IssueBillingKeyAndPayBypass;
29
+ } & BillingKeyAndPayMethodOptions<'MOBILE', Mobile>;
30
+ /**
31
+ * iframe/popup 방식으로 PG사 창이 렌더링 된 경우
32
+ * 프로세스 종료 후, 콜백 함수로 전달 될 빌링키 발급 및 결제 정보 데이터
33
+ */
34
+ export type IssueBillingKeyAndPayResponse = {
35
+ transactionType: typeof Entity.TransactionType.ISSUE_BILLING_KEY_AND_PAY;
36
+ txId: string;
37
+ paymentId: string;
38
+ billingKey: string;
39
+ code?: string;
40
+ message?: string;
41
+ };
42
+ type BillingKeyAndPayMethodOptions<Method extends Entity.BillingKeyAndPayMethod, T> = {
43
+ billingKeyAndPayMethod: Method;
44
+ } & {
45
+ [K in Method as CapsToCamel<K>]?: T;
46
+ };
47
+ type Mobile = {
48
+ carrier?: Entity.Carrier;
49
+ availableCarriers?: Entity.Carrier[];
50
+ };
51
+ export {};
@@ -1,11 +1,7 @@
1
- import { CapsToCamel, OneOfType } from '../../utils.js';
2
- import { Entity } from '../index.js';
3
- type PayMethodOptions<Method extends Entity.PayMethod, T> = {
4
- payMethod: Method;
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;
@@ -13,6 +9,7 @@ type PaymentRequest = {
13
9
  channelKey?: string;
14
10
  pgProvider?: Entity.PgProvider;
15
11
  isTestChannel?: boolean;
12
+ channelGroupId?: string;
16
13
  taxFreeAmount?: number;
17
14
  vatAmount?: number;
18
15
  customer?: Entity.Customer;
@@ -33,7 +30,23 @@ type PaymentRequest = {
33
30
  bypass?: Entity.PaymentBypass;
34
31
  country?: Entity.Country;
35
32
  shippingAddress?: Entity.Address;
36
- } & (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
+ } & (PayMethodOptions<'CARD', Card> | PayMethodOptions<'VIRTUAL_ACCOUNT', VirtualAccount> | PayMethodOptions<'TRANSFER', Transfer> | PayMethodOptions<'MOBILE', Mobile> | PayMethodOptions<'GIFT_CERTIFICATE', GiftCertificate> | PayMethodOptions<'EASY_PAY', EasyPay> | PayMethodOptions<'PAYPAL', Paypal> | PayMethodOptions<'ALIPAY', Alipay>);
34
+ /**
35
+ * iframe/popup 방식으로 PG사 창이 렌더링 된 경우
36
+ * 프로세스 종료 후, 콜백 함수로 전달 될 결제 정보 데이터
37
+ */
38
+ export type PaymentResponse = {
39
+ transactionType: typeof Entity.TransactionType.PAYMENT;
40
+ txId: string;
41
+ paymentId?: string;
42
+ code?: string;
43
+ message?: string;
44
+ };
45
+ type PayMethodOptions<Method extends Entity.PayMethod, T> = {
46
+ payMethod: Method;
47
+ } & {
48
+ [K in Method as CapsToCamel<K>]?: T;
49
+ };
37
50
  type Card = {
38
51
  cardCompany?: Entity.CardCompany;
39
52
  installment?: Entity.Installment;
@@ -41,6 +54,7 @@ type Card = {
41
54
  useAppCardOnly?: boolean;
42
55
  availableCards?: Entity.CardCompany[];
43
56
  useFreeInterestFromMall?: boolean;
57
+ useInstallment?: boolean;
44
58
  };
45
59
  type VirtualAccount = {
46
60
  cashReceiptType?: Entity.CashReceiptType;
@@ -62,6 +76,7 @@ type Transfer = {
62
76
  };
63
77
  type Mobile = {
64
78
  carrier?: Entity.Carrier;
79
+ availableCarriers?: Entity.Carrier[];
65
80
  };
66
81
  type GiftCertificate = {
67
82
  giftCertificateType?: Entity.GiftCertificateType;
@@ -74,6 +89,9 @@ type EasyPay = {
74
89
  cashReceiptType?: Entity.CashReceiptType;
75
90
  customerIdentifier?: string;
76
91
  useCardPoint?: boolean;
92
+ availablePayMethods?: Entity.EasyPayPaymentMethod[];
93
+ useInstallment?: boolean;
77
94
  };
78
95
  type Paypal = Record<string, never>;
79
- export default PaymentRequest;
96
+ type Alipay = Record<string, never>;
97
+ export {};
@@ -0,0 +1,2 @@
1
+ import { LoadIssueBillingKeyUIRequest } from './index.js';
2
+ export declare function updateLoadIssueBillingKeyUIRequest(request: LoadIssueBillingKeyUIRequest): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { LoadPaymentUIRequest } from './index.js';
2
+ export declare function updateLoadPaymentUIRequest(request: LoadPaymentUIRequest): Promise<void>;
@@ -1,4 +1,88 @@
1
- import { T as TransactionType } from './chunk-ced8f127.js';
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 = '/v2/browser-sdk.js') !== 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 requestIdentityVerification(request) {
56
+ return loadScript().then((sdk) => sdk.requestIdentityVerification(request));
57
+ }
58
+
59
+ function requestIssueBillingKeyAndPay(request) {
60
+ return loadScript().then((sdk) => sdk.requestIssueBillingKeyAndPay(request));
61
+ }
62
+
63
+ function requestIssueBillingKey(request) {
64
+ return loadScript().then((sdk) => sdk.requestIssueBillingKey(request));
65
+ }
66
+
67
+ function requestPayment(request) {
68
+ return loadScript().then((sdk) => sdk.requestPayment(request));
69
+ }
70
+
71
+ function loadPaymentUI(request, callbacks) {
72
+ return loadScript().then((sdk) => sdk.loadPaymentUI(request, callbacks));
73
+ }
74
+
75
+ function loadIssueBillingKeyUI(request, callbacks) {
76
+ return loadScript().then((sdk) => sdk.loadIssueBillingKeyUI(request, callbacks));
77
+ }
78
+
79
+ function updateLoadPaymentUIRequest(request) {
80
+ return loadScript().then((sdk) => sdk.updateLoadPaymentUIRequest(request));
81
+ }
82
+
83
+ function updateLoadIssueBillingKeyUIRequest(request) {
84
+ return loadScript().then((sdk) => sdk.updateLoadIssueBillingKeyUIRequest(request));
85
+ }
2
86
 
3
87
  // 계좌이체, 가상계좌 발급시 사용되는 은행 코드
4
88
  const Bank = {
@@ -80,6 +164,11 @@ const Bank = {
80
164
  CAPE_INVESTMENT_CERTIFICATE: 'BANK_CAPE_INVESTMENT_CERTIFICATE', // 케이프투자증권
81
165
  };
82
166
 
167
+ // 빌링키 발급 및 결제 수단
168
+ const BillingKeyAndPayMethod = {
169
+ MOBILE: 'MOBILE', // 휴대폰
170
+ };
171
+
83
172
  // 빌링키 발급 수단
84
173
  const BillingKeyMethod = {
85
174
  CARD: 'CARD',
@@ -493,7 +582,6 @@ const Currency = {
493
582
  MWK: 'CURRENCY_MWK',
494
583
  MXN: 'CURRENCY_MXN',
495
584
  MXV: 'CURRENCY_MXV',
496
- MYR: 'CURRENCY_MYR',
497
585
  MZN: 'CURRENCY_MZN',
498
586
  NAD: 'CURRENCY_NAD',
499
587
  NGN: 'CURRENCY_NGN',
@@ -586,10 +674,7 @@ const EasyPayProvider = {
586
674
  APPLEPAY: 'EASY_PAY_PROVIDER_APPLEPAY',
587
675
  PINPAY: 'EASY_PAY_PROVIDER_PINPAY',
588
676
  SKPAY: 'EASY_PAY_PROVIDER_SKPAY',
589
- NAVERPAY_CARD: 'EASY_PAY_PROVIDER_NAVERPAY_CARD',
590
- NAVERPAY_POINT: 'EASY_PAY_PROVIDER_NAVERPAY_POINT',
591
- SSGPAY_POINT: 'EASY_PAY_PROVIDER_SSGPAY_POINT',
592
- SSGPAY_BANK: 'EASY_PAY_PROVIDER_SSGPAY_BANK',
677
+ TOSS_BRANDPAY: 'EASY_PAY_PROVIDER_TOSS_BRANDPAY',
593
678
  };
594
679
 
595
680
  // 구매자 성별
@@ -605,6 +690,7 @@ const GiftCertificateType = {
605
690
  SMART_MUNSANG: 'GIFT_CERTIFICATE_TYPE_SMART_MUNSANG',
606
691
  CULTURELAND: 'GIFT_CERTIFICATE_TYPE_CULTURELAND',
607
692
  HAPPYMONEY: 'GIFT_CERTIFICATE_TYPE_HAPPYMONEY',
693
+ CULTURE_GIFT: 'GIFT_CERTIFICATE_TYPE_CULTURE_GIFT',
608
694
  };
609
695
 
610
696
  // PG사 창 언어 설정
@@ -657,6 +743,22 @@ const PgProvider = {
657
743
  SMARTRO_V2: 'PG_PROVIDER_SMARTRO_V2',
658
744
  NICE_V2: 'PG_PROVIDER_NICE_V2',
659
745
  TOSS_BRANDPAY: 'PG_PROVIDER_TOSS_BRANDPAY',
746
+ WELCOME: 'PG_PROVIDER_WELCOME',
747
+ TOSSPAY_V2: 'PG_PROVIDER_TOSSPAY_V2',
748
+ };
749
+
750
+ /**
751
+ * 트랜잭션 유형
752
+ * - PAYMENT: 결제
753
+ * - ISSUE_BILLING_KEY: 빌링키 발급
754
+ * - IDENTITY_VERIFICATION: 본인 인증
755
+ * - ISSUE_BILLING_KEY_AND_PAY: 빌링키 발급과 동시에 결제
756
+ */
757
+ const TransactionType = {
758
+ PAYMENT: 'PAYMENT',
759
+ ISSUE_BILLING_KEY: 'ISSUE_BILLING_KEY',
760
+ IDENTITY_VERIFICATION: 'IDENTITY_VERIFICATION',
761
+ ISSUE_BILLING_KEY_AND_PAY: 'ISSUE_BILLING_KEY_AND_PAY',
660
762
  };
661
763
 
662
764
  /**
@@ -670,9 +772,18 @@ const WindowType = {
670
772
  UI: 'UI',
671
773
  };
672
774
 
775
+ const PaymentUIType = {
776
+ PAYPAL_SPB: 'PAYPAL_SPB',
777
+ };
778
+
779
+ const IssueBillingKeyUIType = {
780
+ PAYPAL_RT: 'PAYPAL_RT',
781
+ };
782
+
673
783
  var index = /*#__PURE__*/Object.freeze({
674
784
  __proto__: null,
675
785
  Bank: Bank,
786
+ BillingKeyAndPayMethod: BillingKeyAndPayMethod,
676
787
  BillingKeyMethod: BillingKeyMethod,
677
788
  CardCompany: CardCompany,
678
789
  Carrier: Carrier,
@@ -681,10 +792,156 @@ var index = /*#__PURE__*/Object.freeze({
681
792
  EasyPayProvider: EasyPayProvider,
682
793
  Gender: Gender,
683
794
  GiftCertificateType: GiftCertificateType,
795
+ IssueBillingKeyUIType: IssueBillingKeyUIType,
684
796
  Locale: Locale,
797
+ PaymentUIType: PaymentUIType,
685
798
  PgProvider: PgProvider,
686
799
  TransactionType: TransactionType,
687
800
  WindowType: WindowType
688
801
  });
689
802
 
690
- export { Bank as B, CardCompany as C, EasyPayProvider as E, Gender as G, Locale as L, PgProvider as P, WindowType as W, BillingKeyMethod as a, Carrier as b, Country as c, Currency as d, GiftCertificateType as e, index as i };
803
+ function isIdentityVerificationError(error) {
804
+ return (isPortOneError(error) &&
805
+ error.__portOneErrorType === 'IdentityVerificationError');
806
+ }
807
+ class IdentityVerificationError extends Error {
808
+ constructor({ code, message, identityVerificationId, identityVerificationTxId, }) {
809
+ super(message);
810
+ this.__portOneErrorType = 'IdentityVerificationError';
811
+ this.transactionType = TransactionType.IDENTITY_VERIFICATION;
812
+ this.code = code;
813
+ this.message = message;
814
+ this.identityVerificationId = identityVerificationId;
815
+ this.identityVerificationTxId = identityVerificationTxId;
816
+ }
817
+ }
818
+
819
+ function isIssueBillingKeyAndPayError(error) {
820
+ return (isPortOneError(error) &&
821
+ error.__portOneErrorType === 'IssueBillingKeyAndPayError');
822
+ }
823
+ class IssueBillingKeyAndPayError extends Error {
824
+ constructor({ txId, paymentId, billingKey, code, message, }) {
825
+ super(message);
826
+ this.__portOneErrorType = 'IssueBillingKeyAndPayError';
827
+ this.transactionType = TransactionType.ISSUE_BILLING_KEY_AND_PAY;
828
+ this.txId = txId;
829
+ this.paymentId = paymentId;
830
+ this.billingKey = billingKey;
831
+ this.code = code;
832
+ this.message = message;
833
+ }
834
+ }
835
+
836
+ function isIssueBillingKeyError(error) {
837
+ return (isPortOneError(error) && error.__portOneErrorType === 'IssueBillingKeyError');
838
+ }
839
+ class IssueBillingKeyError extends Error {
840
+ constructor({ code, message, billingKey, }) {
841
+ super(message);
842
+ this.__portOneErrorType = 'IssueBillingKeyError';
843
+ this.transactionType = TransactionType.ISSUE_BILLING_KEY;
844
+ this.code = code;
845
+ this.message = message;
846
+ this.billingKey = billingKey;
847
+ }
848
+ }
849
+
850
+ function isModuleError(error) {
851
+ return isPortOneError(error) && error.__portOneErrorType === 'ModuleError';
852
+ }
853
+ class ModuleError extends Error {
854
+ constructor({ code, message }) {
855
+ super(message);
856
+ this.__portOneErrorType = 'ModuleError';
857
+ this.code = code;
858
+ this.message = message;
859
+ }
860
+ }
861
+
862
+ function isPaymentError(error) {
863
+ return isPortOneError(error) && error.__portOneErrorType === 'PaymentError';
864
+ }
865
+ class PaymentError extends Error {
866
+ constructor({ code, message, txId, paymentId, }) {
867
+ super(message);
868
+ this.__portOneErrorType = 'PaymentError';
869
+ this.transactionType = TransactionType.PAYMENT;
870
+ this.code = code;
871
+ this.message = message;
872
+ this.txId = txId;
873
+ this.paymentId = paymentId;
874
+ }
875
+ }
876
+
877
+ function isLoadIssueBillingKeyUIError(error) {
878
+ return (isPortOneError(error) &&
879
+ error.__portOneErrorType === 'LoadIssueBillingKeyUIError');
880
+ }
881
+ class LoadIssueBillingKeyUIError extends Error {
882
+ constructor({ code, message, }) {
883
+ super(message);
884
+ this.__portOneErrorType = 'LoadIssueBillingKeyUIError';
885
+ this.transactionType = TransactionType.ISSUE_BILLING_KEY;
886
+ this.code = code;
887
+ this.message = message;
888
+ }
889
+ }
890
+
891
+ function isLoadPaymentUIError(error) {
892
+ return (isPortOneError(error) && error.__portOneErrorType === 'LoadPaymentUIError');
893
+ }
894
+ class LoadPaymentUIError extends Error {
895
+ constructor({ code, message, }) {
896
+ super(message);
897
+ this.__portOneErrorType = 'LoadPaymentUIError';
898
+ this.transactionType = TransactionType.PAYMENT;
899
+ this.code = code;
900
+ this.message = message;
901
+ }
902
+ }
903
+
904
+ function isPortOneError(error) {
905
+ return (error != null &&
906
+ typeof error === 'object' &&
907
+ '__portOneErrorType' in error &&
908
+ typeof error.__portOneErrorType === 'string');
909
+ }
910
+
911
+ const PortOne = {
912
+ requestIdentityVerification,
913
+ requestIssueBillingKeyAndPay,
914
+ requestIssueBillingKey,
915
+ requestPayment,
916
+ loadPaymentUI,
917
+ loadIssueBillingKeyUI,
918
+ updateLoadPaymentUIRequest,
919
+ updateLoadIssueBillingKeyUIRequest,
920
+ };
921
+
922
+ exports.Entity = index;
923
+ exports.IdentityVerificationError = IdentityVerificationError;
924
+ exports.IssueBillingKeyAndPayError = IssueBillingKeyAndPayError;
925
+ exports.IssueBillingKeyError = IssueBillingKeyError;
926
+ exports.LoadIssueBillingKeyUIError = LoadIssueBillingKeyUIError;
927
+ exports.LoadPaymentUIError = LoadPaymentUIError;
928
+ exports.ModuleError = ModuleError;
929
+ exports.PaymentError = PaymentError;
930
+ exports.__INTERNAL__setPortOneSdkUrl = setPortOneJsSdkUrl;
931
+ exports.default = PortOne;
932
+ exports.isIdentityVerificationError = isIdentityVerificationError;
933
+ exports.isIssueBillingKeyAndPayError = isIssueBillingKeyAndPayError;
934
+ exports.isIssueBillingKeyError = isIssueBillingKeyError;
935
+ exports.isLoadIssueBillingKeyUIError = isLoadIssueBillingKeyUIError;
936
+ exports.isLoadPaymentUIError = isLoadPaymentUIError;
937
+ exports.isModuleError = isModuleError;
938
+ exports.isPaymentError = isPaymentError;
939
+ exports.isPortOneError = isPortOneError;
940
+ exports.loadIssueBillingKeyUI = loadIssueBillingKeyUI;
941
+ exports.loadPaymentUI = loadPaymentUI;
942
+ exports.requestIdentityVerification = requestIdentityVerification;
943
+ exports.requestIssueBillingKey = requestIssueBillingKey;
944
+ exports.requestIssueBillingKeyAndPay = requestIssueBillingKeyAndPay;
945
+ exports.requestPayment = requestPayment;
946
+ exports.updateLoadIssueBillingKeyUIRequest = updateLoadIssueBillingKeyUIRequest;
947
+ exports.updateLoadPaymentUIRequest = updateLoadPaymentUIRequest;