iamport-react-native 2.0.0-rc.2 → 2.0.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/README.md +1 -1
- package/android/build.gradle +1 -3
- package/lib/commonjs/components/Certification/index.js +16 -23
- package/lib/commonjs/components/Certification/index.js.map +1 -1
- package/lib/commonjs/components/ErrorOnParams/index.js +2 -10
- package/lib/commonjs/components/ErrorOnParams/index.js.map +1 -1
- package/lib/commonjs/components/Loading/index.js +3 -11
- package/lib/commonjs/components/Loading/index.js.map +1 -1
- package/lib/commonjs/components/Payment/index.js +23 -25
- package/lib/commonjs/components/Payment/index.js.map +1 -1
- package/lib/commonjs/constants/index.js +7 -3
- package/lib/commonjs/constants/index.js.map +1 -1
- package/lib/commonjs/utils/IamportUrl.js +27 -19
- package/lib/commonjs/utils/IamportUrl.js.map +1 -1
- package/lib/commonjs/utils/Validation.js +143 -3
- package/lib/commonjs/utils/Validation.js.map +1 -1
- package/lib/commonjs/utils/ValidationForPayment.js +3 -13
- package/lib/commonjs/utils/ValidationForPayment.js.map +1 -1
- package/lib/module/components/Certification/index.js +17 -24
- package/lib/module/components/Certification/index.js.map +1 -1
- package/lib/module/components/ErrorOnParams/index.js +3 -12
- package/lib/module/components/ErrorOnParams/index.js.map +1 -1
- package/lib/module/components/Loading/index.js +3 -11
- package/lib/module/components/Loading/index.js.map +1 -1
- package/lib/module/components/Payment/index.js +23 -25
- package/lib/module/components/Payment/index.js.map +1 -1
- package/lib/module/constants/index.js +7 -3
- package/lib/module/constants/index.js.map +1 -1
- package/lib/module/utils/IamportUrl.js +27 -19
- package/lib/module/utils/IamportUrl.js.map +1 -1
- package/lib/module/utils/Validation.js +143 -3
- package/lib/module/utils/Validation.js.map +1 -1
- package/lib/module/utils/ValidationForPayment.js +3 -13
- package/lib/module/utils/ValidationForPayment.js.map +1 -1
- package/lib/typescript/components/Certification/index.d.ts +1 -1
- package/lib/typescript/components/Payment/index.d.ts +1 -1
- package/lib/typescript/constants/index.d.ts +5 -1
- package/lib/typescript/utils/IamportUrl.d.ts +2 -2
- package/lib/typescript/utils/Validation.d.ts +51 -2
- package/lib/typescript/utils/ValidationForPayment.d.ts +0 -1
- package/package.json +18 -18
- package/src/components/Certification/index.tsx +64 -67
- package/src/components/ErrorOnParams/index.tsx +4 -23
- package/src/components/Loading/index.tsx +3 -11
- package/src/components/Payment/index.tsx +80 -81
- package/src/constants/index.ts +5 -1
- package/src/utils/IamportUrl.ts +27 -22
- package/src/utils/Validation.ts +141 -4
- package/src/utils/ValidationForPayment.ts +5 -14
|
@@ -43,9 +43,25 @@ class Validation {
|
|
|
43
43
|
this.validateCallback();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
validateCallback() {
|
|
46
|
+
validateCallback() {
|
|
47
|
+
if (this.callback !== undefined && typeof this.callback !== 'function') {
|
|
48
|
+
this.isValid = false;
|
|
49
|
+
this.message = '콜백 함수(callback)가 올바르지 않습니다.';
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
this.validateData();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
validateData() {
|
|
57
|
+
var _this$data;
|
|
58
|
+
|
|
59
|
+
if ((_this$data = this.data) !== null && _this$data !== void 0 && _this$data.popup) {
|
|
60
|
+
this.isValid = false;
|
|
61
|
+
this.message = '해당 모듈은 팝업을 지원하지 않습니다.';
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
49
65
|
|
|
50
66
|
getIsValid() {
|
|
51
67
|
return this.isValid;
|
|
@@ -59,7 +75,131 @@ class Validation {
|
|
|
59
75
|
|
|
60
76
|
let IMPData;
|
|
61
77
|
|
|
62
|
-
(function (_IMPData) {
|
|
78
|
+
(function (_IMPData) {
|
|
79
|
+
class CertificationData {
|
|
80
|
+
constructor(carrier, company, merchant_uid, name, phone, min_age, popup, m_redirect_url) {
|
|
81
|
+
_defineProperty(this, "carrier", void 0);
|
|
82
|
+
|
|
83
|
+
_defineProperty(this, "company", void 0);
|
|
84
|
+
|
|
85
|
+
_defineProperty(this, "merchant_uid", void 0);
|
|
86
|
+
|
|
87
|
+
_defineProperty(this, "name", void 0);
|
|
88
|
+
|
|
89
|
+
_defineProperty(this, "phone", void 0);
|
|
90
|
+
|
|
91
|
+
_defineProperty(this, "min_age", void 0);
|
|
92
|
+
|
|
93
|
+
_defineProperty(this, "popup", void 0);
|
|
94
|
+
|
|
95
|
+
_defineProperty(this, "m_redirect_url", void 0);
|
|
96
|
+
|
|
97
|
+
this.carrier = carrier;
|
|
98
|
+
this.company = company;
|
|
99
|
+
this.merchant_uid = merchant_uid;
|
|
100
|
+
this.name = name;
|
|
101
|
+
this.phone = phone;
|
|
102
|
+
this.min_age = min_age;
|
|
103
|
+
this.popup = popup;
|
|
104
|
+
this.m_redirect_url = m_redirect_url;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
_IMPData.CertificationData = CertificationData;
|
|
110
|
+
|
|
111
|
+
class PaymentData {
|
|
112
|
+
constructor(amount, buyer_email, buyer_name, buyer_tel, escrow, merchant_uid, name, pay_method, pg, language, naverPopupMode, naverProducts, naverUseCfm, niceMobileV2, notice_url, m_redirect_url, currency, custom_data, customer_uid, digital, display, buyer_postcode, app_scheme, biz_num, buyer_addr, popup, tax_free, vbank_due) {
|
|
113
|
+
_defineProperty(this, "amount", void 0);
|
|
114
|
+
|
|
115
|
+
_defineProperty(this, "app_scheme", void 0);
|
|
116
|
+
|
|
117
|
+
_defineProperty(this, "biz_num", void 0);
|
|
118
|
+
|
|
119
|
+
_defineProperty(this, "buyer_addr", void 0);
|
|
120
|
+
|
|
121
|
+
_defineProperty(this, "buyer_email", void 0);
|
|
122
|
+
|
|
123
|
+
_defineProperty(this, "buyer_name", void 0);
|
|
124
|
+
|
|
125
|
+
_defineProperty(this, "buyer_postcode", void 0);
|
|
126
|
+
|
|
127
|
+
_defineProperty(this, "buyer_tel", void 0);
|
|
128
|
+
|
|
129
|
+
_defineProperty(this, "currency", void 0);
|
|
130
|
+
|
|
131
|
+
_defineProperty(this, "custom_data", void 0);
|
|
132
|
+
|
|
133
|
+
_defineProperty(this, "customer_uid", void 0);
|
|
134
|
+
|
|
135
|
+
_defineProperty(this, "digital", void 0);
|
|
136
|
+
|
|
137
|
+
_defineProperty(this, "display", void 0);
|
|
138
|
+
|
|
139
|
+
_defineProperty(this, "escrow", void 0);
|
|
140
|
+
|
|
141
|
+
_defineProperty(this, "language", void 0);
|
|
142
|
+
|
|
143
|
+
_defineProperty(this, "m_redirect_url", void 0);
|
|
144
|
+
|
|
145
|
+
_defineProperty(this, "merchant_uid", void 0);
|
|
146
|
+
|
|
147
|
+
_defineProperty(this, "name", void 0);
|
|
148
|
+
|
|
149
|
+
_defineProperty(this, "naverPopupMode", void 0);
|
|
150
|
+
|
|
151
|
+
_defineProperty(this, "naverProducts", void 0);
|
|
152
|
+
|
|
153
|
+
_defineProperty(this, "naverUseCfm", void 0);
|
|
154
|
+
|
|
155
|
+
_defineProperty(this, "niceMobileV2", true);
|
|
156
|
+
|
|
157
|
+
_defineProperty(this, "notice_url", void 0);
|
|
158
|
+
|
|
159
|
+
_defineProperty(this, "pay_method", void 0);
|
|
160
|
+
|
|
161
|
+
_defineProperty(this, "pg", void 0);
|
|
162
|
+
|
|
163
|
+
_defineProperty(this, "popup", void 0);
|
|
164
|
+
|
|
165
|
+
_defineProperty(this, "tax_free", void 0);
|
|
166
|
+
|
|
167
|
+
_defineProperty(this, "vbank_due", void 0);
|
|
168
|
+
|
|
169
|
+
this.amount = amount;
|
|
170
|
+
this.app_scheme = app_scheme;
|
|
171
|
+
this.biz_num = biz_num;
|
|
172
|
+
this.buyer_addr = buyer_addr;
|
|
173
|
+
this.buyer_email = buyer_email;
|
|
174
|
+
this.buyer_name = buyer_name;
|
|
175
|
+
this.buyer_postcode = buyer_postcode;
|
|
176
|
+
this.buyer_tel = buyer_tel;
|
|
177
|
+
this.currency = currency;
|
|
178
|
+
this.custom_data = custom_data;
|
|
179
|
+
this.customer_uid = customer_uid;
|
|
180
|
+
this.digital = digital;
|
|
181
|
+
this.display = display;
|
|
182
|
+
this.escrow = escrow;
|
|
183
|
+
this.language = language;
|
|
184
|
+
this.m_redirect_url = m_redirect_url;
|
|
185
|
+
this.merchant_uid = merchant_uid;
|
|
186
|
+
this.name = name;
|
|
187
|
+
this.naverPopupMode = naverPopupMode;
|
|
188
|
+
this.naverProducts = naverProducts;
|
|
189
|
+
this.naverUseCfm = naverUseCfm;
|
|
190
|
+
this.niceMobileV2 = niceMobileV2;
|
|
191
|
+
this.notice_url = notice_url;
|
|
192
|
+
this.pay_method = pay_method;
|
|
193
|
+
this.pg = pg;
|
|
194
|
+
this.popup = popup;
|
|
195
|
+
this.tax_free = tax_free;
|
|
196
|
+
this.vbank_due = vbank_due;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
_IMPData.PaymentData = PaymentData;
|
|
202
|
+
})(IMPData || (IMPData = {}));
|
|
63
203
|
|
|
64
204
|
export { Validation, IMPData };
|
|
65
205
|
//# sourceMappingURL=Validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Validation.ts"],"names":["Validation","constructor","userCode","loading","callback","data","isValid","message","validateUserCode","validateLoading","undefined","validateCallback","validateData","getIsValid","getMessage","IMPData"],"mappings":";;AAAA,MAAMA,UAAN,CAAiB;AAQfC,EAAAA,WAAW,CACTC,QADS,EAETC,OAFS,EAGTC,QAHS,EAITC,IAJS,EAKT;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AACA,SAAKH,QAAL,GAAgBA,QAAhB;AACA,SAAKC,OAAL,GAAeA,OAAf;AACA,SAAKC,QAAL,GAAgBA,QAAhB;AACA,SAAKC,IAAL,GAAYA,IAAZ;AAEA,SAAKC,OAAL,GAAe,IAAf;AACA,SAAKC,OAAL,GAAe,EAAf;AAEA,SAAKC,gBAAL;AACD;;AAEDA,EAAAA,gBAAgB,GAAG;AACjB,QAAI,CAAC,KAAKN,QAAV,EAAoB;AAClB,WAAKI,OAAL,GAAe,KAAf;AACA,WAAKC,OAAL,GAAe,8BAAf;AACA;AACD;;AACD,SAAKE,eAAL;AACD;;AAEDA,EAAAA,eAAe,GAAG;AAChB,QAAI,KAAKN,OAAL,KAAiBO,SAAjB,IAA8B,OAAO,KAAKP,OAAZ,KAAwB,QAA1D,EAAoE;AAClE,WAAKG,OAAL,GAAe,KAAf;AACA,WAAKC,OAAL,GAAe,8BAAf;AACA;AACD;;AACD,SAAKI,gBAAL;AACD;;AAEDA,EAAAA,gBAAgB,GAAG,
|
|
1
|
+
{"version":3,"sources":["Validation.ts"],"names":["Validation","constructor","userCode","loading","callback","data","isValid","message","validateUserCode","validateLoading","undefined","validateCallback","validateData","popup","getIsValid","getMessage","CertificationData","carrier","company","merchant_uid","name","phone","min_age","m_redirect_url","PaymentData","amount","buyer_email","buyer_name","buyer_tel","escrow","pay_method","pg","language","naverPopupMode","naverProducts","naverUseCfm","niceMobileV2","notice_url","currency","custom_data","customer_uid","digital","display","buyer_postcode","app_scheme","biz_num","buyer_addr","tax_free","vbank_due","IMPData"],"mappings":";;AAAA,MAAMA,UAAN,CAAiB;AAQfC,EAAAA,WAAW,CACTC,QADS,EAETC,OAFS,EAGTC,QAHS,EAITC,IAJS,EAKT;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AACA,SAAKH,QAAL,GAAgBA,QAAhB;AACA,SAAKC,OAAL,GAAeA,OAAf;AACA,SAAKC,QAAL,GAAgBA,QAAhB;AACA,SAAKC,IAAL,GAAYA,IAAZ;AAEA,SAAKC,OAAL,GAAe,IAAf;AACA,SAAKC,OAAL,GAAe,EAAf;AAEA,SAAKC,gBAAL;AACD;;AAEDA,EAAAA,gBAAgB,GAAG;AACjB,QAAI,CAAC,KAAKN,QAAV,EAAoB;AAClB,WAAKI,OAAL,GAAe,KAA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GAAsBA,cAAtB;AACA,WAAKJ,YAAL,GAAoBA,YAApB;AACA,WAAKC,IAAL,GAAYA,IAAZ;AACA,WAAKa,cAAL,GAAsBA,cAAtB;AACA,WAAKC,aAAL,GAAqBA,aAArB;AACA,WAAKC,WAAL,GAAmBA,WAAnB;AACA,WAAKC,YAAL,GAAoBA,YAApB;AACA,WAAKC,UAAL,GAAkBA,UAAlB;AACA,WAAKP,UAAL,GAAkBA,UAAlB;AACA,WAAKC,EAAL,GAAUA,EAAV;AACA,WAAKlB,KAAL,GAAaA,KAAb;AACA,WAAKkC,QAAL,GAAgBA,QAAhB;AACA,WAAKC,SAAL,GAAiBA,SAAjB;AACD;;AA3D8C;;;GA5EzCC,O,KAAAA,O;;AAwKV,SAASjD,UAAT,EAAqBiD,OAArB","sourcesContent":["class Validation {\n userCode: string;\n loading: object;\n callback: ((response: any) => any) | undefined;\n data: IMPData.CertificationData | IMPData.PaymentData | undefined;\n isValid: boolean;\n message: string;\n\n constructor(\n userCode: string,\n loading: object,\n callback?: (response: any) => any,\n data?: IMPData.CertificationData | IMPData.PaymentData\n ) {\n this.userCode = userCode;\n this.loading = loading;\n this.callback = callback;\n this.data = data;\n\n this.isValid = true;\n this.message = '';\n\n this.validateUserCode();\n }\n\n validateUserCode() {\n if (!this.userCode) {\n this.isValid = false;\n this.message = '가맹점 식별코드(userCode)는 필수입력입니다.';\n return;\n }\n this.validateLoading();\n }\n\n validateLoading() {\n if (this.loading !== undefined && typeof this.loading !== 'object') {\n this.isValid = false;\n this.message = '로딩(loading) 컴포넌트가 올바르지 않습니다.';\n return;\n }\n this.validateCallback();\n }\n\n validateCallback() {\n if (this.callback !== undefined && typeof this.callback !== 'function') {\n this.isValid = false;\n this.message = '콜백 함수(callback)가 올바르지 않습니다.';\n return;\n }\n this.validateData();\n }\n\n validateData() {\n if (this.data?.popup) {\n this.isValid = false;\n this.message = '해당 모듈은 팝업을 지원하지 않습니다.';\n return;\n }\n }\n\n getIsValid() {\n return this.isValid;\n }\n\n getMessage() {\n return this.message;\n }\n}\n\nnamespace IMPData {\n interface ICertificationData {\n merchant_uid: string;\n company: string;\n carrier: string;\n name: string;\n phone: string;\n min_age?: string;\n popup?: boolean;\n m_redirect_url?: string;\n }\n\n export class CertificationData implements ICertificationData {\n constructor(\n carrier: string,\n company: string,\n merchant_uid: string,\n name: string,\n phone: string,\n min_age?: string,\n popup?: boolean,\n m_redirect_url?: string\n ) {\n this.carrier = carrier;\n this.company = company;\n this.merchant_uid = merchant_uid;\n this.name = name;\n this.phone = phone;\n this.min_age = min_age;\n this.popup = popup;\n this.m_redirect_url = m_redirect_url;\n }\n\n carrier: string;\n company: string;\n merchant_uid: string;\n name: string;\n phone: string;\n min_age?: string;\n popup?: boolean;\n m_redirect_url?: string;\n }\n\n interface IPaymentData {\n pg: string;\n pay_method: string;\n currency?: string;\n notice_url?: string | string[];\n display?: {\n card_quota: number[];\n };\n merchant_uid: string;\n amount: string | number;\n buyer_tel: string;\n app_scheme?: string;\n escrow: boolean;\n name: string;\n tax_free?: number;\n buyer_name: string;\n buyer_email: string;\n buyer_addr?: string;\n buyer_postcode?: string;\n custom_data?: object;\n vbank_due?: string;\n popup?: boolean;\n digital?: boolean;\n language?: string;\n biz_num?: string;\n customer_uid?: string;\n naverPopupMode?: boolean;\n naverUseCfm?: string;\n naverProducts?: object[];\n m_redirect_url?: string;\n niceMobileV2?: boolean;\n }\n\n export class PaymentData implements IPaymentData {\n constructor(\n amount: string | number,\n buyer_email: string,\n buyer_name: string,\n buyer_tel: string,\n escrow: boolean,\n merchant_uid: string,\n name: string,\n pay_method: string,\n pg: string,\n language?: string,\n naverPopupMode?: boolean,\n naverProducts?: object[],\n naverUseCfm?: string,\n niceMobileV2?: boolean,\n notice_url?: string | string[],\n m_redirect_url?: string,\n currency?: string,\n custom_data?: object,\n customer_uid?: string,\n digital?: boolean,\n display?: { card_quota: number[] },\n buyer_postcode?: string,\n app_scheme?: string,\n biz_num?: string,\n buyer_addr?: string,\n popup?: boolean,\n tax_free?: number,\n vbank_due?: string\n ) {\n this.amount = amount;\n this.app_scheme = app_scheme;\n this.biz_num = biz_num;\n this.buyer_addr = buyer_addr;\n this.buyer_email = buyer_email;\n this.buyer_name = buyer_name;\n this.buyer_postcode = buyer_postcode;\n this.buyer_tel = buyer_tel;\n this.currency = currency;\n this.custom_data = custom_data;\n this.customer_uid = customer_uid;\n this.digital = digital;\n this.display = display;\n this.escrow = escrow;\n this.language = language;\n this.m_redirect_url = m_redirect_url;\n this.merchant_uid = merchant_uid;\n this.name = name;\n this.naverPopupMode = naverPopupMode;\n this.naverProducts = naverProducts;\n this.naverUseCfm = naverUseCfm;\n this.niceMobileV2 = niceMobileV2;\n this.notice_url = notice_url;\n this.pay_method = pay_method;\n this.pg = pg;\n this.popup = popup;\n this.tax_free = tax_free;\n this.vbank_due = vbank_due;\n }\n\n amount: string | number;\n app_scheme?: string;\n biz_num?: string;\n buyer_addr?: string;\n buyer_email: string;\n buyer_name: string;\n buyer_postcode?: string;\n buyer_tel: string;\n currency?: string;\n custom_data?: object;\n customer_uid?: string;\n digital?: boolean;\n display?: { card_quota: number[] };\n escrow: boolean;\n language?: string;\n m_redirect_url?: string;\n merchant_uid: string;\n name: string;\n naverPopupMode?: boolean;\n naverProducts?: object[];\n naverUseCfm?: string;\n niceMobileV2?: boolean = true;\n notice_url?: string | string[];\n pay_method: string;\n pg: string;\n popup?: boolean;\n tax_free?: number;\n vbank_due?: string;\n }\n}\n\nexport { Validation, IMPData };\n"]}
|
|
@@ -6,16 +6,6 @@ class ValidationForPayment extends Validation {
|
|
|
6
6
|
super(userCode, loading, callback, data);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
validateCallback() {
|
|
10
|
-
if (this.callback !== undefined && typeof this.callback !== 'function') {
|
|
11
|
-
this.isValid = false;
|
|
12
|
-
this.message = '콜백 함수(callback)가 올바르지 않습니다.';
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
this.validateData();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
9
|
validateData() {
|
|
20
10
|
const {
|
|
21
11
|
pg,
|
|
@@ -79,7 +69,7 @@ class ValidationForPayment extends Validation {
|
|
|
79
69
|
this.message = '올바르지 않은 언어 설정입니다.\n 선택하신 PG사는 ko, en, zh jp 옵션을 지원합니다.';
|
|
80
70
|
return;
|
|
81
71
|
}
|
|
82
|
-
} else if (IMPConst.LANGUAGE.indexOf(language)
|
|
72
|
+
} else if (IMPConst.LANGUAGE.indexOf(language) === -1) {
|
|
83
73
|
this.isValid = false;
|
|
84
74
|
this.message = '올바르지 않은 언어 설정입니다.\n 선택하신 PG사는 ko 또는 en 옵션을 지원합니다.';
|
|
85
75
|
return;
|
|
@@ -103,9 +93,9 @@ class ValidationForPayment extends Validation {
|
|
|
103
93
|
return;
|
|
104
94
|
}
|
|
105
95
|
|
|
106
|
-
if (
|
|
96
|
+
if (popup) {
|
|
107
97
|
this.isValid = false;
|
|
108
|
-
this.message = '해당
|
|
98
|
+
this.message = '해당 모듈은 팝업을 지원하지 않습니다.';
|
|
109
99
|
return;
|
|
110
100
|
}
|
|
111
101
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ValidationForPayment.ts"],"names":["Validation","IMPConst","ValidationForPayment","constructor","userCode","loading","callback","data","
|
|
1
|
+
{"version":3,"sources":["ValidationForPayment.ts"],"names":["Validation","IMPConst","ValidationForPayment","constructor","userCode","loading","callback","data","validateData","pg","pay_method","merchant_uid","amount","buyer_tel","app_scheme","language","digital","biz_num","customer_uid","naverPopupMode","popup","undefined","isValid","message","pgProvider","split","PG","indexOf","EN_AVAILABLE_PG","includes","LANGUAGE"],"mappings":"AAAA,SAASA,UAAT,QAAoC,cAApC;AACA,SAASC,QAAT,QAAyB,cAAzB;;AAEA,MAAMC,oBAAN,SAAmCF,UAAnC,CAA8C;AAC5CG,EAAAA,WAAW,CACTC,QADS,EAETC,OAFS,EAGTC,QAHS,EAITC,IAJS,EAKT;AACA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A,WAAKC,OAAL,GAAe,4BAAf;AACA;AACD;;AAED,QACE,CAACd,EAAE,KAAK,aAAP,IAAwBA,EAAE,KAAK,OAAhC,KACAS,YAAY,KAAKG,SAFnB,EAGE;AACA,WAAKC,OAAL,GAAe,KAAf;AACA,WAAKC,OAAL,GAAe,8BAAf;AACA;AACD;AACF;;AAlI2C;;AAqI9C,eAAerB,oBAAf","sourcesContent":["import { Validation, IMPData } from './Validation';\nimport { IMPConst } from '../constants';\n\nclass ValidationForPayment extends Validation {\n constructor(\n userCode: string,\n loading: object,\n callback: (response: any) => any,\n data: IMPData.PaymentData\n ) {\n super(userCode, loading, callback, data);\n }\n\n validateData() {\n const {\n pg,\n pay_method,\n merchant_uid,\n amount,\n buyer_tel,\n app_scheme,\n language,\n digital,\n biz_num,\n customer_uid,\n naverPopupMode,\n popup,\n } = <IMPData.PaymentData>this.data;\n\n if (this.data === undefined) {\n this.isValid = false;\n this.message = '결제 파라미터(data)는 필수입력입니다.';\n return;\n }\n\n if (merchant_uid === undefined) {\n this.isValid = false;\n this.message = '주문번호(merchant_uid)는 필수입력입니다.';\n return;\n }\n\n if (amount === undefined) {\n this.isValid = false;\n this.message = '결제금액(amount)은 필수입력입니다.';\n return;\n }\n\n if (buyer_tel === undefined) {\n this.isValid = false;\n this.message = '구매자 번호(buyer_tel)는 필수입력입니다.';\n return;\n }\n\n if (app_scheme === undefined) {\n this.isValid = false;\n this.message = 'app_scheme은 필수입력입니다.';\n return;\n }\n\n if (pg) {\n const [pgProvider] = pg.split('.');\n if (IMPConst.PG.indexOf(pgProvider as any) === -1) {\n this.isValid = false;\n this.message = 'PG사가 올바르지 않습니다.';\n }\n }\n\n if (language && pg !== 'paypal') {\n if (IMPConst.EN_AVAILABLE_PG.indexOf(pg as any) !== -1) {\n if (pg === 'eximbay') {\n if (!['ko', 'en', 'zh', 'jp'].includes(language)) {\n this.isValid = false;\n this.message =\n '올바르지 않은 언어 설정입니다.\\n 선택하신 PG사는 ko, en, zh jp 옵션을 지원합니다.';\n return;\n }\n } else if (IMPConst.LANGUAGE.indexOf(language as any) === -1) {\n this.isValid = false;\n this.message =\n '올바르지 않은 언어 설정입니다.\\n 선택하신 PG사는 ko 또는 en 옵션을 지원합니다.';\n return;\n }\n } else if (language !== 'ko') {\n this.isValid = false;\n this.message =\n '올바르지 않은 언어 설정입니다.\\n 선택하신 PG사는 ko 옵션만 지원합니다.';\n return;\n }\n }\n\n if (pay_method === 'phone' && digital === undefined) {\n this.isValid = false;\n this.message = '휴대폰 소액결제시 digital은 필수입력입니다.';\n return;\n }\n\n if (pg === 'syrup') {\n this.isValid = false;\n this.message = '해당 모듈은 현재 시럽페이를 지원하지 않습니다.';\n return;\n }\n\n if (popup) {\n this.isValid = false;\n this.message = '해당 모듈은 팝업을 지원하지 않습니다.';\n return;\n }\n\n if (pg === 'naverpay' && naverPopupMode) {\n this.isValid = false;\n this.message =\n '해당 모듈에서 popup은\\n네이버 페이 결제시 지원하지 않습니다.';\n return;\n }\n\n if (\n pg === 'danal_tpay' &&\n pay_method === 'vbank' &&\n biz_num === undefined\n ) {\n this.isValid = false;\n this.message = '다날-가상계좌시 biz_num은 필수입력입니다.';\n return;\n }\n\n if (\n (pg === 'kcp_billing' || pg === 'syrup') &&\n customer_uid === undefined\n ) {\n this.isValid = false;\n this.message = '정기결제시 customer_uid는 필수입력입니다.';\n return;\n }\n }\n}\n\nexport default ValidationForPayment;\n"]}
|
|
@@ -3,7 +3,7 @@ declare type Props = {
|
|
|
3
3
|
userCode: string;
|
|
4
4
|
tierCode?: string;
|
|
5
5
|
data: IMPData.CertificationData;
|
|
6
|
-
loading
|
|
6
|
+
loading?: any;
|
|
7
7
|
callback: (response: any) => any;
|
|
8
8
|
};
|
|
9
9
|
declare function Certification({ userCode, tierCode, data, loading, callback }: Props): JSX.Element;
|
|
@@ -11,7 +11,7 @@ declare namespace IMPConst {
|
|
|
11
11
|
const NICE_TRANS_URL = "https://web.nicepay.co.kr/smart/bank/payTrans.jsp";
|
|
12
12
|
const IMP_SDK_URL = "https://service.iamport.kr";
|
|
13
13
|
const SMILEPAY_BASE_URL = "https://www.mysmilepay.com";
|
|
14
|
-
const WEBVIEW_SOURCE_HTML = "\n<html>\n <head>\n <meta http-equiv='content-type' content='text/html; charset=utf-8'>\n <meta name='viewport' content='width=device-width, initial-scale=1.0'>\n\n <script type='text/javascript' src='https://code.jquery.com/jquery-latest.min.js' ></script>\n <script type='text/javascript' src='https://cdn.iamport.kr/js/iamport.payment-1.
|
|
14
|
+
const WEBVIEW_SOURCE_HTML = "\n<html>\n <head>\n <meta http-equiv='content-type' content='text/html; charset=utf-8'>\n <meta name='viewport' content='width=device-width, initial-scale=1.0'>\n\n <script type='text/javascript' src='https://code.jquery.com/jquery-latest.min.js' ></script>\n <script type='text/javascript' src='https://cdn.iamport.kr/js/iamport.payment-1.2.0.js'></script>\n </head>\n <body></body>\n</html>\n";
|
|
15
15
|
const ANDROID_APPSCHEME: {
|
|
16
16
|
readonly ISP: "ispmobile";
|
|
17
17
|
readonly BANKPAY: "kftc-bankpay";
|
|
@@ -35,12 +35,14 @@ declare namespace IMPConst {
|
|
|
35
35
|
readonly LPAY: "lpayapp";
|
|
36
36
|
readonly SSGPAY: "shinsegaeeasypayment";
|
|
37
37
|
readonly KPAY: "kpay";
|
|
38
|
+
readonly KBANKPAY: "ukbanksmartbanknonloginpay";
|
|
38
39
|
readonly PAYNOW: "lguthepay-xpay";
|
|
39
40
|
readonly WOORIWONCARD: "com.wooricard.smartapp";
|
|
40
41
|
readonly LPOINT: "lmslpay";
|
|
41
42
|
readonly KTFAUTH: "ktauthexternalcall";
|
|
42
43
|
readonly LGTAUTH: "upluscorporation";
|
|
43
44
|
readonly SKTAUTH: "tauthlink";
|
|
45
|
+
readonly WOORIWONBANK: "wooribank";
|
|
44
46
|
};
|
|
45
47
|
const ANDROID_PACKAGE: {
|
|
46
48
|
readonly PACKAGE_ISP: "kvp.jjy.MispAndroid320";
|
|
@@ -65,12 +67,14 @@ declare namespace IMPConst {
|
|
|
65
67
|
readonly PACKAGE_LPAY: "com.lotte.lpay";
|
|
66
68
|
readonly PACKAGE_SSGPAY: "com.ssg.serviceapp.android.egiftcertificate";
|
|
67
69
|
readonly PACKAGE_KPAY: "com.inicis.kpay";
|
|
70
|
+
readonly PACKAGE_KBANKPAY: "com.kbankwith.smartbank";
|
|
68
71
|
readonly PACKAGE_PAYNOW: "com.lguplus.paynow";
|
|
69
72
|
readonly PACKAGE_WOORIWONCARD: "com.wooricard.smartapp";
|
|
70
73
|
readonly PACKAGE_LPOINT: "com.lottemembers.android";
|
|
71
74
|
readonly PACKAGE_KTFAUTH: "com.kt.ktauth";
|
|
72
75
|
readonly PACKAGE_LGTAUTH: "com.lguplus.smartotp";
|
|
73
76
|
readonly PACKAGE_SKTAUTH: "com.sktelecom.tauth";
|
|
77
|
+
readonly PACKAGE_WOORIWONBANK: "com.wooribank.smart.npib";
|
|
74
78
|
};
|
|
75
79
|
}
|
|
76
80
|
export { IMPConst };
|
|
@@ -6,14 +6,14 @@ declare class IamportUrl {
|
|
|
6
6
|
package?: string;
|
|
7
7
|
constructor(url: string);
|
|
8
8
|
getUrl(): string;
|
|
9
|
-
isPaymentOver(): boolean;
|
|
9
|
+
isPaymentOver(redirectUrl: string): boolean;
|
|
10
10
|
isAppUrl(): boolean;
|
|
11
11
|
isIframeLoaded(): boolean;
|
|
12
12
|
getAppUrl(): string | undefined;
|
|
13
13
|
getMarketUrl(): string;
|
|
14
14
|
getQuery(): queryString.ParsedQuery<string>;
|
|
15
15
|
getStringifiedQuery(): string;
|
|
16
|
-
getInicisTransQuery(): string;
|
|
16
|
+
getInicisTransQuery(redirectUrl: string): string;
|
|
17
17
|
launchApp(): Promise<any>;
|
|
18
18
|
}
|
|
19
19
|
export default IamportUrl;
|
|
@@ -14,16 +14,28 @@ declare class Validation {
|
|
|
14
14
|
getMessage(): string;
|
|
15
15
|
}
|
|
16
16
|
declare namespace IMPData {
|
|
17
|
-
interface
|
|
17
|
+
interface ICertificationData {
|
|
18
18
|
merchant_uid: string;
|
|
19
19
|
company: string;
|
|
20
20
|
carrier: string;
|
|
21
21
|
name: string;
|
|
22
22
|
phone: string;
|
|
23
23
|
min_age?: string;
|
|
24
|
+
popup?: boolean;
|
|
24
25
|
m_redirect_url?: string;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
+
export class CertificationData implements ICertificationData {
|
|
28
|
+
constructor(carrier: string, company: string, merchant_uid: string, name: string, phone: string, min_age?: string, popup?: boolean, m_redirect_url?: string);
|
|
29
|
+
carrier: string;
|
|
30
|
+
company: string;
|
|
31
|
+
merchant_uid: string;
|
|
32
|
+
name: string;
|
|
33
|
+
phone: string;
|
|
34
|
+
min_age?: string;
|
|
35
|
+
popup?: boolean;
|
|
36
|
+
m_redirect_url?: string;
|
|
37
|
+
}
|
|
38
|
+
interface IPaymentData {
|
|
27
39
|
pg: string;
|
|
28
40
|
pay_method: string;
|
|
29
41
|
currency?: string;
|
|
@@ -53,6 +65,43 @@ declare namespace IMPData {
|
|
|
53
65
|
naverUseCfm?: string;
|
|
54
66
|
naverProducts?: object[];
|
|
55
67
|
m_redirect_url?: string;
|
|
68
|
+
niceMobileV2?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export class PaymentData implements IPaymentData {
|
|
71
|
+
constructor(amount: string | number, buyer_email: string, buyer_name: string, buyer_tel: string, escrow: boolean, merchant_uid: string, name: string, pay_method: string, pg: string, language?: string, naverPopupMode?: boolean, naverProducts?: object[], naverUseCfm?: string, niceMobileV2?: boolean, notice_url?: string | string[], m_redirect_url?: string, currency?: string, custom_data?: object, customer_uid?: string, digital?: boolean, display?: {
|
|
72
|
+
card_quota: number[];
|
|
73
|
+
}, buyer_postcode?: string, app_scheme?: string, biz_num?: string, buyer_addr?: string, popup?: boolean, tax_free?: number, vbank_due?: string);
|
|
74
|
+
amount: string | number;
|
|
75
|
+
app_scheme?: string;
|
|
76
|
+
biz_num?: string;
|
|
77
|
+
buyer_addr?: string;
|
|
78
|
+
buyer_email: string;
|
|
79
|
+
buyer_name: string;
|
|
80
|
+
buyer_postcode?: string;
|
|
81
|
+
buyer_tel: string;
|
|
82
|
+
currency?: string;
|
|
83
|
+
custom_data?: object;
|
|
84
|
+
customer_uid?: string;
|
|
85
|
+
digital?: boolean;
|
|
86
|
+
display?: {
|
|
87
|
+
card_quota: number[];
|
|
88
|
+
};
|
|
89
|
+
escrow: boolean;
|
|
90
|
+
language?: string;
|
|
91
|
+
m_redirect_url?: string;
|
|
92
|
+
merchant_uid: string;
|
|
93
|
+
name: string;
|
|
94
|
+
naverPopupMode?: boolean;
|
|
95
|
+
naverProducts?: object[];
|
|
96
|
+
naverUseCfm?: string;
|
|
97
|
+
niceMobileV2?: boolean;
|
|
98
|
+
notice_url?: string | string[];
|
|
99
|
+
pay_method: string;
|
|
100
|
+
pg: string;
|
|
101
|
+
popup?: boolean;
|
|
102
|
+
tax_free?: number;
|
|
103
|
+
vbank_due?: string;
|
|
56
104
|
}
|
|
105
|
+
export {};
|
|
57
106
|
}
|
|
58
107
|
export { Validation, IMPData };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Validation, IMPData } from './Validation';
|
|
2
2
|
declare class ValidationForPayment extends Validation {
|
|
3
3
|
constructor(userCode: string, loading: object, callback: (response: any) => any, data: IMPData.PaymentData);
|
|
4
|
-
validateCallback(): void;
|
|
5
4
|
validateData(): void;
|
|
6
5
|
}
|
|
7
6
|
export default ValidationForPayment;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iamport-react-native",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "리액트 네이티브용 아임포트 결제/본인인증 연동 라이브러리",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -49,26 +49,26 @@
|
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://github.com/iamport/iamport-react-native#readme",
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@react-native-community/eslint-config": "^
|
|
53
|
-
"@types/react": "^
|
|
54
|
-
"@types/react-native": "0.
|
|
55
|
-
"eslint": "^7.
|
|
56
|
-
"eslint-config-prettier": "^
|
|
57
|
-
"eslint-plugin-prettier": "^3.
|
|
58
|
-
"pod-install": "^0.1.
|
|
59
|
-
"prettier": "^2.
|
|
60
|
-
"
|
|
61
|
-
"react": "
|
|
62
|
-
"react-native": "0.
|
|
63
|
-
"react-native-
|
|
64
|
-
"
|
|
65
|
-
"
|
|
52
|
+
"@react-native-community/eslint-config": "^3.0.0",
|
|
53
|
+
"@types/react": "^17.0.19",
|
|
54
|
+
"@types/react-native": "0.64.13",
|
|
55
|
+
"eslint": "^7.32.0",
|
|
56
|
+
"eslint-config-prettier": "^8.3.0",
|
|
57
|
+
"eslint-plugin-prettier": "^3.4.0",
|
|
58
|
+
"pod-install": "^0.1.26",
|
|
59
|
+
"prettier": "^2.3.2",
|
|
60
|
+
"react": "17.0.2",
|
|
61
|
+
"react-native": "0.65.0",
|
|
62
|
+
"react-native-builder-bob": "^0.18.1",
|
|
63
|
+
"react-native-webview": "^11.13.0",
|
|
64
|
+
"typescript": "^4.3.5",
|
|
65
|
+
"query-string": "^7.0.1"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"react": "
|
|
68
|
+
"react": ">=16.8.0",
|
|
69
69
|
"react-native": ">=0.60.0",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
70
|
+
"query-string": "7.x",
|
|
71
|
+
"react-native-webview": "11.x"
|
|
72
72
|
},
|
|
73
73
|
"eslintConfig": {
|
|
74
74
|
"root": true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { createRef, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { WebView } from 'react-native-webview';
|
|
4
4
|
|
|
@@ -15,94 +15,91 @@ type Props = {
|
|
|
15
15
|
userCode: string;
|
|
16
16
|
tierCode?: string;
|
|
17
17
|
data: IMPData.CertificationData;
|
|
18
|
-
loading
|
|
18
|
+
loading?: any;
|
|
19
19
|
callback: (response: any) => any;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
function Certification({ userCode, tierCode, data, loading, callback }: Props) {
|
|
23
23
|
const [isWebViewLoaded, setIsWebViewLoaded] = useState(false);
|
|
24
|
-
const webview =
|
|
24
|
+
const webview = createRef<WebView>();
|
|
25
|
+
const validation = new Validation(userCode, loading, callback, data);
|
|
26
|
+
let redirectUrl = IMPConst.M_REDIRECT_URL;
|
|
27
|
+
if (data.m_redirect_url !== undefined && data.m_redirect_url.trim() !== '') {
|
|
28
|
+
redirectUrl = data.m_redirect_url;
|
|
29
|
+
}
|
|
25
30
|
|
|
26
|
-
const validation = new Validation(userCode, loading);
|
|
27
31
|
if (validation.getIsValid()) {
|
|
28
|
-
const {
|
|
32
|
+
const { loadingContainer, webViewContainer } = viewStyles;
|
|
29
33
|
return (
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
onLoadEnd={() => {
|
|
41
|
-
if (!isWebViewLoaded) {
|
|
42
|
-
// html이 load되고 최초 한번만 inject javascript
|
|
43
|
-
if (tierCode) {
|
|
44
|
-
webview.current?.injectJavaScript(`
|
|
34
|
+
<>
|
|
35
|
+
<WebView
|
|
36
|
+
containerStyle={webViewContainer}
|
|
37
|
+
ref={webview}
|
|
38
|
+
source={{ html: IMPConst.WEBVIEW_SOURCE_HTML }}
|
|
39
|
+
onLoadEnd={() => {
|
|
40
|
+
if (!isWebViewLoaded) {
|
|
41
|
+
// html이 load되고 최초 한번만 inject javascript
|
|
42
|
+
if (tierCode) {
|
|
43
|
+
webview.current?.injectJavaScript(`
|
|
45
44
|
setTimeout(function() { IMP.agency("${userCode}", "${tierCode}"); });
|
|
46
45
|
`);
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
} else {
|
|
47
|
+
webview.current?.injectJavaScript(`
|
|
49
48
|
setTimeout(function() { IMP.init("${userCode}"); });
|
|
50
49
|
`);
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
}
|
|
51
|
+
webview.current?.injectJavaScript(`
|
|
53
52
|
setTimeout(function() {
|
|
54
53
|
IMP.certification(${JSON.stringify(data)}, function(response) {
|
|
55
54
|
window.ReactNativeWebView.postMessage(JSON.stringify(response));
|
|
56
55
|
});
|
|
57
56
|
});
|
|
58
57
|
`);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
response = JSON.parse(response);
|
|
58
|
+
setIsWebViewLoaded(true);
|
|
59
|
+
}
|
|
60
|
+
}}
|
|
61
|
+
onMessage={(e) => {
|
|
62
|
+
let data = e.nativeEvent.data;
|
|
63
|
+
if (decodeURIComponent(data) !== data) {
|
|
64
|
+
data = decodeURIComponent(data);
|
|
65
|
+
}
|
|
66
|
+
let response = JSON.parse(data);
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
});
|
|
68
|
+
if (typeof callback === 'function') {
|
|
69
|
+
callback(response);
|
|
70
|
+
}
|
|
71
|
+
}}
|
|
72
|
+
startInLoadingState
|
|
73
|
+
renderLoading={() => (
|
|
74
|
+
<View style={loadingContainer}>{loading || <Loading />}</View>
|
|
75
|
+
)}
|
|
76
|
+
originWhitelist={['*']} // https://github.com/facebook/react-native/issues/19986
|
|
77
|
+
onShouldStartLoadWithRequest={(request) => {
|
|
78
|
+
const { url } = request;
|
|
79
|
+
// console.log('url: ' + url);
|
|
80
|
+
const iamportUrl = new IamportUrl(url);
|
|
81
|
+
if (iamportUrl.isAppUrl()) {
|
|
82
|
+
/* 3rd-party 앱 오픈 */
|
|
83
|
+
iamportUrl.launchApp().catch((e) => {
|
|
84
|
+
const { code, message } = e;
|
|
85
|
+
callback({
|
|
86
|
+
imp_success: false,
|
|
87
|
+
error_code: code,
|
|
88
|
+
error_msg: message,
|
|
92
89
|
});
|
|
90
|
+
});
|
|
93
91
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
if (iamportUrl.isPaymentOver(redirectUrl)) {
|
|
95
|
+
callback(iamportUrl.getQuery());
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
100
98
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
</View>
|
|
99
|
+
return true;
|
|
100
|
+
}}
|
|
101
|
+
/>
|
|
102
|
+
</>
|
|
106
103
|
);
|
|
107
104
|
}
|
|
108
105
|
|