iamport 0.3.3 → 0.4.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.
Files changed (40) hide show
  1. package/README.md +83 -5
  2. package/index.d.ts +848 -0
  3. package/lib/iamport.js +18 -1
  4. package/lib/iamportMethod.js +28 -2
  5. package/lib/resources/Benepia.js +47 -0
  6. package/lib/resources/Certifications.js +26 -0
  7. package/lib/resources/Codes.js +78 -0
  8. package/lib/resources/Cvs.js +46 -0
  9. package/lib/resources/Escrows.js +59 -0
  10. package/lib/resources/KcpQuick.js +47 -0
  11. package/lib/resources/Naver.js +276 -0
  12. package/lib/resources/Partners.js +33 -0
  13. package/lib/resources/Payco.js +33 -0
  14. package/lib/resources/Payments.js +59 -0
  15. package/lib/resources/Paymentwall.js +33 -0
  16. package/lib/resources/Receipts.js +99 -0
  17. package/lib/resources/Subscribe.js +87 -2
  18. package/lib/resources/Subscribe_customer.js +42 -0
  19. package/lib/resources/Tiers.js +32 -0
  20. package/lib/resources/Users.js +32 -0
  21. package/lib/resources/Vbank.js +40 -1
  22. package/openapi.json +11658 -0
  23. package/package.json +1 -1
  24. package/test/resources/Benepia.spec.js +49 -0
  25. package/test/resources/Certification.spec.js +53 -0
  26. package/test/resources/Codes.spec.js +45 -0
  27. package/test/resources/Cvs.spec.js +45 -0
  28. package/test/resources/Escrows.spec.js +71 -0
  29. package/test/resources/KcpQuick.spec.js +45 -0
  30. package/test/resources/Naver.spec.js +305 -0
  31. package/test/resources/Partners.spec.js +31 -0
  32. package/test/resources/Payco.spec.js +31 -0
  33. package/test/resources/Payment.spec.js +60 -0
  34. package/test/resources/Paymentwall.spec.js +31 -0
  35. package/test/resources/Receipts.spec.js +113 -0
  36. package/test/resources/Subscribe.spec.js +163 -0
  37. package/test/resources/Tiers.spec.js +19 -0
  38. package/test/resources/Users.spec.js +11 -0
  39. package/test/resources/Vbank.spec.js +61 -0
  40. package/.npmignore +0 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iamport",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "REST API client for I'amport;",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,49 @@
1
+
2
+ 'use strict';
3
+
4
+ var iamport = new require('../../lib/iamport')()
5
+ , expect = require('chai').expect;
6
+
7
+ describe('benepia.getPoint', function(){
8
+ it('Should return error when benepia_user is missing', function(done){
9
+ iamport.benepia.getPoint()
10
+ .then(function(result){
11
+ expect(result).to.be.empty;
12
+ done();
13
+ })
14
+ .catch(function(error){
15
+ expect(error.toString()).to.contain('Param missing');
16
+ done();
17
+ });
18
+ });
19
+ });
20
+
21
+ describe('benepia.payment', function(){
22
+ it('Should return error when benepia_user is missing', function(done){
23
+ iamport.benepia.payment()
24
+ .then(function(result){
25
+ expect(result).to.be.empty;
26
+ done();
27
+ })
28
+ .catch(function(error){
29
+ expect(error.toString()).to.contain('Param missing');
30
+ done();
31
+ });
32
+ });
33
+
34
+ it('Should return error when merchant_uid is missing', function(done){
35
+ iamport.benepia.payment({
36
+ benepia_user: 'test_user',
37
+ benepia_password: 'test_password',
38
+ channel_key: 'test_key'
39
+ })
40
+ .then(function(result){
41
+ expect(result).to.be.empty;
42
+ done();
43
+ })
44
+ .catch(function(error){
45
+ expect(error.toString()).to.contain('Param missing');
46
+ done();
47
+ });
48
+ });
49
+ });
@@ -0,0 +1,53 @@
1
+
2
+ 'use strict';
3
+
4
+ var iamport = new require('../../lib/iamport')()
5
+ , expect = require('chai').expect;
6
+
7
+ describe('certification.get', function(){
8
+ it('Should return error when imp_uid is missing', function(done){
9
+ iamport.certification.get()
10
+ .then(function(result){
11
+ expect(result).to.be.empty;
12
+ done();
13
+ })
14
+ .catch(function(error){
15
+ expect(error.toString()).to.contain('Param missing');
16
+ done();
17
+ });
18
+ });
19
+ });
20
+
21
+ describe('certification.delete', function(){
22
+ it('Should return error when imp_uid is missing', function(done){
23
+ iamport.certification.delete()
24
+ .then(function(result){
25
+ expect(result).to.be.empty;
26
+ done();
27
+ })
28
+ .catch(function(error){
29
+ expect(error.toString()).to.contain('Param missing');
30
+ done();
31
+ });
32
+ });
33
+ });
34
+
35
+ describe('certification.otpRequest', function(){
36
+ it('Should be a function', function(){
37
+ expect(iamport.certification.otpRequest).to.be.a('function');
38
+ });
39
+ });
40
+
41
+ describe('certification.otpConfirm', function(){
42
+ it('Should return error when imp_uid is missing', function(done){
43
+ iamport.certification.otpConfirm()
44
+ .then(function(result){
45
+ expect(result).to.be.empty;
46
+ done();
47
+ })
48
+ .catch(function(error){
49
+ expect(error.toString()).to.contain('Param missing');
50
+ done();
51
+ });
52
+ });
53
+ });
@@ -0,0 +1,45 @@
1
+
2
+ 'use strict';
3
+
4
+ var iamport = new require('../../lib/iamport')()
5
+ , expect = require('chai').expect;
6
+
7
+ describe('bank.getAll', function(){
8
+ it('Should be a function', function(){
9
+ expect(iamport.bank.getAll).to.be.a('function');
10
+ });
11
+ });
12
+
13
+ describe('bank.getByCode', function(){
14
+ it('Should return error when bank_standard_code is missing', function(done){
15
+ iamport.bank.getByCode()
16
+ .then(function(result){
17
+ expect(result).to.be.empty;
18
+ done();
19
+ })
20
+ .catch(function(error){
21
+ expect(error.toString()).to.contain('Param missing');
22
+ done();
23
+ });
24
+ });
25
+ });
26
+
27
+ describe('card.getAll', function(){
28
+ it('Should be a function', function(){
29
+ expect(iamport.card.getAll).to.be.a('function');
30
+ });
31
+ });
32
+
33
+ describe('card.getByCode', function(){
34
+ it('Should return error when card_standard_code is missing', function(done){
35
+ iamport.card.getByCode()
36
+ .then(function(result){
37
+ expect(result).to.be.empty;
38
+ done();
39
+ })
40
+ .catch(function(error){
41
+ expect(error.toString()).to.contain('Param missing');
42
+ done();
43
+ });
44
+ });
45
+ });
@@ -0,0 +1,45 @@
1
+
2
+ 'use strict';
3
+
4
+ var iamport = new require('../../lib/iamport')()
5
+ , expect = require('chai').expect;
6
+
7
+ describe('cvs.create', function(){
8
+ it('Should return error when channel_key is missing', function(done){
9
+ iamport.cvs.create()
10
+ .then(function(result){
11
+ expect(result).to.be.empty;
12
+ done();
13
+ })
14
+ .catch(function(error){
15
+ expect(error.toString()).to.contain('Param missing');
16
+ done();
17
+ });
18
+ });
19
+
20
+ it('Should return error when merchant_uid is missing', function(done){
21
+ iamport.cvs.create({channel_key: 'test_key'})
22
+ .then(function(result){
23
+ expect(result).to.be.empty;
24
+ done();
25
+ })
26
+ .catch(function(error){
27
+ expect(error.toString()).to.contain('Param missing');
28
+ done();
29
+ });
30
+ });
31
+ });
32
+
33
+ describe('cvs.delete', function(){
34
+ it('Should return error when imp_uid is missing', function(done){
35
+ iamport.cvs.delete()
36
+ .then(function(result){
37
+ expect(result).to.be.empty;
38
+ done();
39
+ })
40
+ .catch(function(error){
41
+ expect(error.toString()).to.contain('Param missing');
42
+ done();
43
+ });
44
+ });
45
+ });
@@ -0,0 +1,71 @@
1
+
2
+ 'use strict';
3
+
4
+ var iamport = new require('../../lib/iamport')()
5
+ , expect = require('chai').expect;
6
+
7
+ describe('escrows.create', function(){
8
+ it('Should return error when imp_uid is missing', function(done){
9
+ iamport.escrows.create()
10
+ .then(function(result){
11
+ expect(result).to.be.empty;
12
+ done();
13
+ })
14
+ .catch(function(error){
15
+ expect(error.toString()).to.contain('Param missing');
16
+ done();
17
+ });
18
+ });
19
+
20
+ it('Should return error when sender is missing', function(done){
21
+ iamport.escrows.create({imp_uid: 'test_imp_uid'})
22
+ .then(function(result){
23
+ expect(result).to.be.empty;
24
+ done();
25
+ })
26
+ .catch(function(error){
27
+ expect(error.toString()).to.contain('Param missing');
28
+ done();
29
+ });
30
+ });
31
+ });
32
+
33
+ describe('escrows.get', function(){
34
+ it('Should return error when imp_uid is missing', function(done){
35
+ iamport.escrows.get()
36
+ .then(function(result){
37
+ expect(result).to.be.empty;
38
+ done();
39
+ })
40
+ .catch(function(error){
41
+ expect(error.toString()).to.contain('Param missing');
42
+ done();
43
+ });
44
+ });
45
+ });
46
+
47
+ describe('escrows.update', function(){
48
+ it('Should return error when imp_uid is missing', function(done){
49
+ iamport.escrows.update()
50
+ .then(function(result){
51
+ expect(result).to.be.empty;
52
+ done();
53
+ })
54
+ .catch(function(error){
55
+ expect(error.toString()).to.contain('Param missing');
56
+ done();
57
+ });
58
+ });
59
+
60
+ it('Should return error when sender is missing', function(done){
61
+ iamport.escrows.update({imp_uid: 'test_imp_uid'})
62
+ .then(function(result){
63
+ expect(result).to.be.empty;
64
+ done();
65
+ })
66
+ .catch(function(error){
67
+ expect(error.toString()).to.contain('Param missing');
68
+ done();
69
+ });
70
+ });
71
+ });
@@ -0,0 +1,45 @@
1
+
2
+ 'use strict';
3
+
4
+ var iamport = new require('../../lib/iamport')()
5
+ , expect = require('chai').expect;
6
+
7
+ describe('kcpQuick.deleteMember', function(){
8
+ it('Should return error when member_id is missing', function(done){
9
+ iamport.kcpQuick.deleteMember()
10
+ .then(function(result){
11
+ expect(result).to.be.empty;
12
+ done();
13
+ })
14
+ .catch(function(error){
15
+ expect(error.toString()).to.contain('Param missing');
16
+ done();
17
+ });
18
+ });
19
+
20
+ it('Should return error when site_code is missing', function(done){
21
+ iamport.kcpQuick.deleteMember({member_id: 'test_member'})
22
+ .then(function(result){
23
+ expect(result).to.be.empty;
24
+ done();
25
+ })
26
+ .catch(function(error){
27
+ expect(error.toString()).to.contain('Param missing');
28
+ done();
29
+ });
30
+ });
31
+ });
32
+
33
+ describe('kcpQuick.payMoney', function(){
34
+ it('Should return error when member_id is missing', function(done){
35
+ iamport.kcpQuick.payMoney()
36
+ .then(function(result){
37
+ expect(result).to.be.empty;
38
+ done();
39
+ })
40
+ .catch(function(error){
41
+ expect(error.toString()).to.contain('Param missing');
42
+ done();
43
+ });
44
+ });
45
+ });
@@ -0,0 +1,305 @@
1
+
2
+ 'use strict';
3
+
4
+ var iamport = new require('../../lib/iamport')()
5
+ , expect = require('chai').expect;
6
+
7
+ // Naver standalone endpoints
8
+ describe('naver.getProductOrder', function(){
9
+ it('Should return error when product_order_id is missing', function(done){
10
+ iamport.naver.getProductOrder()
11
+ .then(function(result){
12
+ expect(result).to.be.empty;
13
+ done();
14
+ })
15
+ .catch(function(error){
16
+ expect(error.toString()).to.contain('Param missing');
17
+ done();
18
+ });
19
+ });
20
+ });
21
+
22
+ describe('naver.getReviews', function(){
23
+ it('Should return error when channel_key is missing', function(done){
24
+ iamport.naver.getReviews()
25
+ .then(function(result){
26
+ expect(result).to.be.empty;
27
+ done();
28
+ })
29
+ .catch(function(error){
30
+ expect(error.toString()).to.contain('Param missing');
31
+ done();
32
+ });
33
+ });
34
+ });
35
+
36
+ // NaverPayment endpoints
37
+ describe('naverPayment.getProductOrders', function(){
38
+ it('Should return error when imp_uid is missing', function(done){
39
+ iamport.naverPayment.getProductOrders()
40
+ .then(function(result){
41
+ expect(result).to.be.empty;
42
+ done();
43
+ })
44
+ .catch(function(error){
45
+ expect(error.toString()).to.contain('Param missing');
46
+ done();
47
+ });
48
+ });
49
+ });
50
+
51
+ describe('naverPayment.getCashAmount', function(){
52
+ it('Should return error when imp_uid is missing', function(done){
53
+ iamport.naverPayment.getCashAmount()
54
+ .then(function(result){
55
+ expect(result).to.be.empty;
56
+ done();
57
+ })
58
+ .catch(function(error){
59
+ expect(error.toString()).to.contain('Param missing');
60
+ done();
61
+ });
62
+ });
63
+ });
64
+
65
+ describe('naverPayment.place', function(){
66
+ it('Should return error when imp_uid is missing', function(done){
67
+ iamport.naverPayment.place()
68
+ .then(function(result){
69
+ expect(result).to.be.empty;
70
+ done();
71
+ })
72
+ .catch(function(error){
73
+ expect(error.toString()).to.contain('Param missing');
74
+ done();
75
+ });
76
+ });
77
+ });
78
+
79
+ describe('naverPayment.ship', function(){
80
+ it('Should return error when imp_uid is missing', function(done){
81
+ iamport.naverPayment.ship()
82
+ .then(function(result){
83
+ expect(result).to.be.empty;
84
+ done();
85
+ })
86
+ .catch(function(error){
87
+ expect(error.toString()).to.contain('Param missing');
88
+ done();
89
+ });
90
+ });
91
+
92
+ it('Should return error when delivery_method is missing', function(done){
93
+ iamport.naverPayment.ship({imp_uid: 'test_imp_uid'})
94
+ .then(function(result){
95
+ expect(result).to.be.empty;
96
+ done();
97
+ })
98
+ .catch(function(error){
99
+ expect(error.toString()).to.contain('Param missing');
100
+ done();
101
+ });
102
+ });
103
+ });
104
+
105
+ describe('naverPayment.confirm', function(){
106
+ it('Should return error when imp_uid is missing', function(done){
107
+ iamport.naverPayment.confirm()
108
+ .then(function(result){
109
+ expect(result).to.be.empty;
110
+ done();
111
+ })
112
+ .catch(function(error){
113
+ expect(error.toString()).to.contain('Param missing');
114
+ done();
115
+ });
116
+ });
117
+ });
118
+
119
+ describe('naverPayment.approveCancel', function(){
120
+ it('Should return error when imp_uid is missing', function(done){
121
+ iamport.naverPayment.approveCancel()
122
+ .then(function(result){
123
+ expect(result).to.be.empty;
124
+ done();
125
+ })
126
+ .catch(function(error){
127
+ expect(error.toString()).to.contain('Param missing');
128
+ done();
129
+ });
130
+ });
131
+ });
132
+
133
+ describe('naverPayment.approveReturn', function(){
134
+ it('Should return error when imp_uid is missing', function(done){
135
+ iamport.naverPayment.approveReturn()
136
+ .then(function(result){
137
+ expect(result).to.be.empty;
138
+ done();
139
+ })
140
+ .catch(function(error){
141
+ expect(error.toString()).to.contain('Param missing');
142
+ done();
143
+ });
144
+ });
145
+ });
146
+
147
+ describe('naverPayment.cancel', function(){
148
+ it('Should return error when imp_uid is missing', function(done){
149
+ iamport.naverPayment.cancel()
150
+ .then(function(result){
151
+ expect(result).to.be.empty;
152
+ done();
153
+ })
154
+ .catch(function(error){
155
+ expect(error.toString()).to.contain('Param missing');
156
+ done();
157
+ });
158
+ });
159
+ });
160
+
161
+ describe('naverPayment.requestReturn', function(){
162
+ it('Should return error when imp_uid is missing', function(done){
163
+ iamport.naverPayment.requestReturn()
164
+ .then(function(result){
165
+ expect(result).to.be.empty;
166
+ done();
167
+ })
168
+ .catch(function(error){
169
+ expect(error.toString()).to.contain('Param missing');
170
+ done();
171
+ });
172
+ });
173
+
174
+ it('Should return error when delivery_method is missing', function(done){
175
+ iamport.naverPayment.requestReturn({imp_uid: 'test_imp_uid'})
176
+ .then(function(result){
177
+ expect(result).to.be.empty;
178
+ done();
179
+ })
180
+ .catch(function(error){
181
+ expect(error.toString()).to.contain('Param missing');
182
+ done();
183
+ });
184
+ });
185
+ });
186
+
187
+ describe('naverPayment.rejectReturn', function(){
188
+ it('Should return error when imp_uid is missing', function(done){
189
+ iamport.naverPayment.rejectReturn()
190
+ .then(function(result){
191
+ expect(result).to.be.empty;
192
+ done();
193
+ })
194
+ .catch(function(error){
195
+ expect(error.toString()).to.contain('Param missing');
196
+ done();
197
+ });
198
+ });
199
+
200
+ it('Should return error when memo is missing', function(done){
201
+ iamport.naverPayment.rejectReturn({imp_uid: 'test_imp_uid'})
202
+ .then(function(result){
203
+ expect(result).to.be.empty;
204
+ done();
205
+ })
206
+ .catch(function(error){
207
+ expect(error.toString()).to.contain('Param missing');
208
+ done();
209
+ });
210
+ });
211
+ });
212
+
213
+ describe('naverPayment.resolveReturn', function(){
214
+ it('Should return error when imp_uid is missing', function(done){
215
+ iamport.naverPayment.resolveReturn()
216
+ .then(function(result){
217
+ expect(result).to.be.empty;
218
+ done();
219
+ })
220
+ .catch(function(error){
221
+ expect(error.toString()).to.contain('Param missing');
222
+ done();
223
+ });
224
+ });
225
+ });
226
+
227
+ describe('naverPayment.withholdReturn', function(){
228
+ it('Should return error when imp_uid is missing', function(done){
229
+ iamport.naverPayment.withholdReturn()
230
+ .then(function(result){
231
+ expect(result).to.be.empty;
232
+ done();
233
+ })
234
+ .catch(function(error){
235
+ expect(error.toString()).to.contain('Param missing');
236
+ done();
237
+ });
238
+ });
239
+
240
+ it('Should return error when memo is missing', function(done){
241
+ iamport.naverPayment.withholdReturn({imp_uid: 'test_imp_uid'})
242
+ .then(function(result){
243
+ expect(result).to.be.empty;
244
+ done();
245
+ })
246
+ .catch(function(error){
247
+ expect(error.toString()).to.contain('Param missing');
248
+ done();
249
+ });
250
+ });
251
+ });
252
+
253
+ describe('naverPayment.collectExchanged', function(){
254
+ it('Should return error when imp_uid is missing', function(done){
255
+ iamport.naverPayment.collectExchanged()
256
+ .then(function(result){
257
+ expect(result).to.be.empty;
258
+ done();
259
+ })
260
+ .catch(function(error){
261
+ expect(error.toString()).to.contain('Param missing');
262
+ done();
263
+ });
264
+ });
265
+ });
266
+
267
+ describe('naverPayment.shipExchanged', function(){
268
+ it('Should return error when imp_uid is missing', function(done){
269
+ iamport.naverPayment.shipExchanged()
270
+ .then(function(result){
271
+ expect(result).to.be.empty;
272
+ done();
273
+ })
274
+ .catch(function(error){
275
+ expect(error.toString()).to.contain('Param missing');
276
+ done();
277
+ });
278
+ });
279
+
280
+ it('Should return error when delivery_method is missing', function(done){
281
+ iamport.naverPayment.shipExchanged({imp_uid: 'test_imp_uid'})
282
+ .then(function(result){
283
+ expect(result).to.be.empty;
284
+ done();
285
+ })
286
+ .catch(function(error){
287
+ expect(error.toString()).to.contain('Param missing');
288
+ done();
289
+ });
290
+ });
291
+ });
292
+
293
+ describe('naverPayment.point', function(){
294
+ it('Should return error when imp_uid is missing', function(done){
295
+ iamport.naverPayment.point()
296
+ .then(function(result){
297
+ expect(result).to.be.empty;
298
+ done();
299
+ })
300
+ .catch(function(error){
301
+ expect(error.toString()).to.contain('Param missing');
302
+ done();
303
+ });
304
+ });
305
+ });
@@ -0,0 +1,31 @@
1
+
2
+ 'use strict';
3
+
4
+ var iamport = new require('../../lib/iamport')()
5
+ , expect = require('chai').expect;
6
+
7
+ describe('partner.issueReceipt', function(){
8
+ it('Should return error when imp_uid is missing', function(done){
9
+ iamport.partner.issueReceipt()
10
+ .then(function(result){
11
+ expect(result).to.be.empty;
12
+ done();
13
+ })
14
+ .catch(function(error){
15
+ expect(error.toString()).to.contain('Param missing');
16
+ done();
17
+ });
18
+ });
19
+
20
+ it('Should return error when data is missing', function(done){
21
+ iamport.partner.issueReceipt({imp_uid: 'test_imp_uid'})
22
+ .then(function(result){
23
+ expect(result).to.be.empty;
24
+ done();
25
+ })
26
+ .catch(function(error){
27
+ expect(error.toString()).to.contain('Param missing');
28
+ done();
29
+ });
30
+ });
31
+ });
@@ -0,0 +1,31 @@
1
+
2
+ 'use strict';
3
+
4
+ var iamport = new require('../../lib/iamport')()
5
+ , expect = require('chai').expect;
6
+
7
+ describe('payco.updateOrderStatus', function(){
8
+ it('Should return error when imp_uid is missing', function(done){
9
+ iamport.payco.updateOrderStatus()
10
+ .then(function(result){
11
+ expect(result).to.be.empty;
12
+ done();
13
+ })
14
+ .catch(function(error){
15
+ expect(error.toString()).to.contain('Param missing');
16
+ done();
17
+ });
18
+ });
19
+
20
+ it('Should return error when status is missing', function(done){
21
+ iamport.payco.updateOrderStatus({imp_uid: 'test_imp_uid'})
22
+ .then(function(result){
23
+ expect(result).to.be.empty;
24
+ done();
25
+ })
26
+ .catch(function(error){
27
+ expect(error.toString()).to.contain('Param missing');
28
+ done();
29
+ });
30
+ });
31
+ });