popbill 1.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.
data/lib/taxinvoice.rb ADDED
@@ -0,0 +1,648 @@
1
+ # -*- coding: utf-8 -*-
2
+ require_relative './popbill.rb'
3
+
4
+ # 팝빌 세금계산서 API Service Implementation
5
+ class TaxinvoiceService < BaseService
6
+ class << self
7
+ def instance(linkID, secretKey)
8
+ super(linkID, secretKey)
9
+ @instance ||= new
10
+ @instance.addScope("110")
11
+ return @instance
12
+ end
13
+ private :new
14
+ end
15
+
16
+ def getChargeInfo(corpNum, userID = "")
17
+ if corpNum.length != 10
18
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
19
+ end
20
+ httpget("/Taxinvoice/ChargeInfo", corpNum, userID)
21
+ end
22
+
23
+ def getURL(corpNum, togo, userID = "")
24
+ if corpNum.length != 10
25
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
26
+ end
27
+ httpget("/Taxinvoice/?TG=" + togo, corpNum, userID)['url']
28
+ end
29
+
30
+ def getUnitCost(corpNum)
31
+ if corpNum.length != 10
32
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
33
+ end
34
+ httpget("/Taxinvoice?cfg=UNITCOST", corpNum)['unitCost']
35
+ end
36
+
37
+ def getCertificateExpireDate(corpNum)
38
+ if corpNum.length != 10
39
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
40
+ end
41
+ httpget("/Taxinvoice?cfg=CERT", corpNum)['certificateExpiration']
42
+ end
43
+
44
+ def getEmailPublicKeys(corpNum)
45
+ if corpNum.length != 10
46
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
47
+ end
48
+ httpget("/Taxinvoice/EmailPublicKeys", corpNum)
49
+ end
50
+
51
+ def checkMgtKeyInUse(corpNum, mgtKeyType, mgtKey)
52
+ if corpNum.length != 10
53
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
54
+ end
55
+ if mgtKey.to_s == ''
56
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
57
+ end
58
+
59
+ begin
60
+ response = httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum)
61
+ return response['itemKey'].length != 0
62
+ rescue PopbillException => pe
63
+ if pe.code == -11000005
64
+ return false
65
+ end
66
+ raise PopbillException.new(pe.code, pe.message)
67
+ end
68
+ end
69
+
70
+ def register(corpNum, taxinvoice, writeSpecification = false, userID = '')
71
+ if corpNum.length != 10
72
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
73
+ end
74
+ if writeSpecification
75
+ taxinvoice["writeSpecification"] = true
76
+ end
77
+
78
+ postData = taxinvoice.to_json
79
+ httppost("/Taxinvoice", corpNum, postData, "", userID)
80
+ end
81
+
82
+ def registIssue(corpNum, taxinvoice, writeSpecification = false, forceIssue = false, dealInvoiceMgtKey = '', memo = '', emailSubject = '', userID = '')
83
+ if corpNum.length != 10
84
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
85
+ end
86
+ if writeSpecification
87
+ taxinvoice["writeSpecification"] = true
88
+ end
89
+
90
+ if forceIssue
91
+ taxinvoice["forceIssue"] = true
92
+ end
93
+
94
+ if dealInvoiceMgtKey.to_s != ''
95
+ taxinvoice["dealInvoiceMgtKey"] = dealInvoiceMgtKey
96
+ end
97
+
98
+ if memo.to_s != ''
99
+ taxinvoice["memo"] = memo
100
+ end
101
+
102
+ if emailSubject.to_s != ''
103
+ taxinvoice["emailSubject"] = emailSubject
104
+ end
105
+
106
+ postData = taxinvoice.to_json
107
+
108
+ httppost("/Taxinvoice", corpNum, postData, "ISSUE", userID)
109
+
110
+ end
111
+
112
+
113
+ def update(corpNum, mgtKeyType, mgtKey, taxinvoice, userID = '')
114
+ if corpNum.length != 10
115
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
116
+ end
117
+ if mgtKey.to_s == ''
118
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
119
+ end
120
+ postData = taxinvoice.to_json
121
+
122
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "PATCH", userID)
123
+ end
124
+
125
+
126
+ def getInfo(corpNum, mgtKeyType, mgtKey, userID = '')
127
+ if corpNum.length != 10
128
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
129
+ end
130
+ if mgtKey.to_s == ''
131
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
132
+ end
133
+
134
+ httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, userID)
135
+ end
136
+
137
+ def getInfos(corpNum, mgtKeyType, mgtKeyList, userID = '')
138
+ if corpNum.length != 10
139
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
140
+ end
141
+ unless mgtKeyList.any?
142
+ raise PopbillException.new('-99999999', '문서관리번호 배열이 올바르지 않습니다.')
143
+ end
144
+
145
+ postData = mgtKeyList.to_json
146
+
147
+ httppost("/Taxinvoice/#{mgtKeyType}", corpNum, postData, "", userID)
148
+ end
149
+
150
+
151
+ def getDetailInfo(corpNum, mgtKeyType, mgtKey, userID = '')
152
+ if corpNum.length != 10
153
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
154
+ end
155
+ if mgtKey.to_s == ''
156
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
157
+ end
158
+
159
+ httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}?Detail", corpNum, userID)
160
+ end
161
+
162
+
163
+ def delete(corpNum, mgtKeyType, mgtKey, userID = '')
164
+ if corpNum.length != 10
165
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
166
+ end
167
+ if mgtKey.to_s == ''
168
+ raise PopbillException.new('-99999999', '문서관리번호 입력되지 않았습니다.')
169
+ end
170
+
171
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, '', 'DELETE', userID)
172
+ end
173
+
174
+
175
+ def send(corpNum, mgtKeyType, mgtKey, memo = '', emailSubject = '', userID ='')
176
+ if corpNum.length != 10
177
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
178
+ end
179
+ if mgtKey.to_s == ''
180
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
181
+ end
182
+
183
+ postData = {}
184
+
185
+ if memo.to_s != ''
186
+ postData["memo"] = memo
187
+ end
188
+
189
+ if emailSubject.to_s != ''
190
+ postData["emailSubject"] = emailSubject
191
+ end
192
+
193
+ postData = postData.to_json
194
+
195
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "SEND", userID)
196
+ end
197
+
198
+ def cancelSend(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
199
+ if corpNum.length != 10
200
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
201
+ end
202
+ if mgtKey.to_s == ''
203
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
204
+ end
205
+
206
+ postData = {}
207
+
208
+ if memo.to_s != ''
209
+ postData["memo"] = memo
210
+ end
211
+
212
+ postData = postData.to_json
213
+
214
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "CANCELSEND", userID)
215
+ end
216
+
217
+ def accept(corpNum, mgtKeyType, mgtKey, memo = '', userID ='')
218
+ if corpNum.length != 10
219
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
220
+ end
221
+ if mgtKey.to_s == ''
222
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
223
+ end
224
+
225
+ postData = {}
226
+
227
+ if memo.to_s != ''
228
+ postData["memo"] = memo
229
+ end
230
+
231
+ postData = postData.to_json
232
+
233
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "ACCEPT", userID)
234
+ end
235
+
236
+ def deny(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
237
+ if corpNum.length != 10
238
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
239
+ end
240
+ if mgtKey.to_s == ''
241
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
242
+ end
243
+
244
+ postData = {}
245
+
246
+ if memo.to_s != ''
247
+ postData["memo"] = memo
248
+ end
249
+
250
+ postData = postData.to_json
251
+
252
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "DENY", userID)
253
+ end
254
+
255
+ def issue(corpNum, mgtKeyType, mgtKey, forceIssue = false, memo = '', emailSubject ='', userID)
256
+ if corpNum.length != 10
257
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
258
+ end
259
+ if mgtKey.to_s == ''
260
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
261
+ end
262
+
263
+ postData = {}
264
+
265
+ if forceIssue
266
+ postData["forceIssue"] = true
267
+ end
268
+
269
+ if memo.to_s != ''
270
+ postData["memo"] = memo
271
+ end
272
+
273
+ if emailSubject.to_s != ''
274
+ postData["emailSubject"] = emailSubject
275
+ end
276
+
277
+ postData = postData.to_json
278
+
279
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "ISSUE", userID)
280
+
281
+ end
282
+
283
+ def cancelIssue(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
284
+ if corpNum.length != 10
285
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
286
+ end
287
+ if mgtKey.to_s == ''
288
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
289
+ end
290
+
291
+ postData = {}
292
+
293
+ if memo.to_s != ''
294
+ postData["memo"] = memo
295
+ end
296
+
297
+ postData = postData.to_json
298
+
299
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "CANCELISSUE", userID)
300
+ end
301
+
302
+ def request(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
303
+ if corpNum.length != 10
304
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
305
+ end
306
+ if mgtKey.to_s == ''
307
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
308
+ end
309
+
310
+ postData = {}
311
+
312
+ if memo.to_s != ''
313
+ postData["memo"] = memo
314
+ end
315
+
316
+ postData = postData.to_json
317
+
318
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "REQUEST", userID)
319
+ end
320
+
321
+ def refuse(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
322
+ if corpNum.length != 10
323
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
324
+ end
325
+ if mgtKey.to_s == ''
326
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
327
+ end
328
+
329
+ postData = {}
330
+
331
+ if memo.to_s != ''
332
+ postData["memo"] = memo
333
+ end
334
+
335
+ postData = postData.to_json
336
+
337
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "REFUSE", userID)
338
+ end
339
+
340
+ def cancelRequest(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
341
+ if corpNum.length != 10
342
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
343
+ end
344
+ if mgtKey.to_s == ''
345
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
346
+ end
347
+
348
+ postData = {}
349
+
350
+ if memo.to_s != ''
351
+ postData["memo"] = memo
352
+ end
353
+
354
+ postData = postData.to_json
355
+
356
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "CANCELREQUEST", userID)
357
+ end
358
+
359
+
360
+ def sendToNTS(corpNum, mgtKeyType, mgtKey, userID = '')
361
+ if corpNum.length != 10
362
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
363
+ end
364
+ if mgtKey.to_s == ''
365
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
366
+ end
367
+
368
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, '', "NTS", userID)
369
+ end
370
+
371
+
372
+ def sendEmail(corpNum, mgtKeyType, mgtKey, receiverMail, userID = '')
373
+ if corpNum.length != 10
374
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
375
+ end
376
+ if mgtKey.to_s == ''
377
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
378
+ end
379
+
380
+ postData = {}
381
+
382
+ if receiverMail.to_s != ''
383
+ postData["receiver"] = receiverMail
384
+ end
385
+
386
+ postData = postData.to_json
387
+
388
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "EMAIL", userID)
389
+ end
390
+
391
+ def sendSMS(corpNum, mgtKeyType, mgtKey, senderNum, receiverNum, contents, userID = '')
392
+ if corpNum.length != 10
393
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
394
+ end
395
+ if mgtKey.to_s == ''
396
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
397
+ end
398
+
399
+ if senderNum.to_s == ''
400
+ raise PopbillException.new('-99999999', '발신번호가 입력되지 않았습니다.')
401
+ end
402
+
403
+ if receiverNum.to_s == ''
404
+ raise PopbillException.new('-99999999', '수신번호가 입력되지 않았습니다.')
405
+ end
406
+
407
+ if contents.to_s == ''
408
+ raise PopbillException.new('-99999999', '문자 메시지 내용이 입력되지 않았습니다.')
409
+ end
410
+
411
+ postData = {}
412
+ postData["sender"] = senderNum
413
+ postData["receiver"] = receiverNum
414
+ postData["contents"] = contents
415
+
416
+ postData = postData.to_json
417
+
418
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "SMS", userID)
419
+ end
420
+
421
+
422
+ def sendFax(corpNum, mgtKeyType, mgtKey, senderNum, receiverNum, userID = '')
423
+ if corpNum.length != 10
424
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
425
+ end
426
+ if mgtKey.to_s == ''
427
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
428
+ end
429
+
430
+ if senderNum.to_s == ''
431
+ raise PopbillException.new('-99999999', '발신번호가 입력되지 않았습니다.')
432
+ end
433
+
434
+ if receiverNum.to_s == ''
435
+ raise PopbillException.new('-99999999', '수신번호가 입력되지 않았습니다.')
436
+ end
437
+
438
+ postData = {}
439
+ postData["sender"] = senderNum
440
+ postData["receiver"] = receiverNum
441
+
442
+ postData = postData.to_json
443
+
444
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "FAX", userID)
445
+
446
+ end
447
+
448
+ def getLogs(corpNum, mgtKeyType, mgtKey, userID = '')
449
+ if corpNum.length != 10
450
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
451
+ end
452
+ if mgtKey.to_s == ''
453
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
454
+ end
455
+
456
+ httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/Logs", corpNum, userID)
457
+ end
458
+
459
+
460
+ def attachFile(corpNum, mgtKeyType, mgtKey, filePath, userID ='')
461
+ if corpNum.length != 10
462
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
463
+ end
464
+ if mgtKey.to_s == ''
465
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
466
+ end
467
+
468
+ httppostfiles("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/Files", corpNum, '', [filePath], userID)
469
+ end
470
+
471
+
472
+ def getFiles(corpNum, mgtKeyType, mgtKey, userID = '')
473
+ if corpNum.length != 10
474
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
475
+ end
476
+ if mgtKey.to_s == ''
477
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
478
+ end
479
+
480
+ httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/Files", corpNum)
481
+ end
482
+
483
+
484
+ def deleteFile(corpNum, mgtKeyType, mgtKey, fileID, userID = '')
485
+ if corpNum.length != 10
486
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
487
+ end
488
+ if mgtKey.to_s == ''
489
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
490
+ end
491
+ if fileID.to_s == ''
492
+ raise PopbillException.new('-99999999', '파일아이디가 입력되지 않았습니다.')
493
+ end
494
+
495
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/Files/#{fileID}", corpNum, '', "DELETE", userID)
496
+ end
497
+
498
+ def getPopUpURL(corpNum, mgtKeyType, mgtKey, userID = '')
499
+ if corpNum.length != 10
500
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
501
+ end
502
+ if mgtKey.to_s == ''
503
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
504
+ end
505
+
506
+ httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}?TG=POPUP", corpNum, userID)['url']
507
+ end
508
+
509
+ def getPrintURL(corpNum, mgtKeyType, mgtKey, userID = '')
510
+ if corpNum.length != 10
511
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
512
+ end
513
+ if mgtKey.to_s == ''
514
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
515
+ end
516
+
517
+ httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}?TG=PRINT", corpNum, userID)['url']
518
+ end
519
+
520
+ def getEPrintURL(corpNum, mgtKeyType, mgtKey, userID = '')
521
+ if corpNum.length != 10
522
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
523
+ end
524
+ if mgtKey.to_s == ''
525
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
526
+ end
527
+
528
+ httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}?TG=EPRINT", corpNum, userID)['url']
529
+ end
530
+
531
+ def getMailURL(corpNum, mgtKeyType, mgtKey, userID = '')
532
+ if corpNum.length != 10
533
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
534
+ end
535
+ if mgtKey.to_s == ''
536
+ raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
537
+ end
538
+
539
+ httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}?TG=MAIL", corpNum, userID)['url']
540
+ end
541
+
542
+ def getMassPrintURL(corpNum, mgtKeyType, mgtKeyList, userID = '')
543
+ if corpNum.length != 10
544
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
545
+ end
546
+ unless mgtKeyList.any?
547
+ raise PopbillException.new('-99999999', '문서관리번호 배열이 올바르지 않습니다.')
548
+ end
549
+
550
+ postData = mgtKeyList.to_json
551
+ httppost("/Taxinvoice/#{mgtKeyType}?Print", corpNum, postData, "", userID)['url']
552
+ end
553
+
554
+
555
+ def search(corpNum, mgtKeyType, dType, sDate, eDate, state, type, taxType, lateOnly,
556
+ taxRegIDYN, taxRegIDType, taxRegID, page, perPage, order, queryString, userID = '')
557
+ if corpNum.length != 10
558
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
559
+ end
560
+ if dType.to_s == ''
561
+ raise PopbillException.new('-99999999', '검색일자유형이 입력되지 않았습니다.')
562
+ end
563
+
564
+ if sDate.to_s == ''
565
+ raise PopbillException.new('-99999999', '시작일자가 입력되지 않았습니다.')
566
+ end
567
+
568
+ if eDate.to_s == ''
569
+ raise PopbillException.new('-99999999', '종료일자가 입력되지 않았습니다.')
570
+ end
571
+
572
+ uri = "/Taxinvoice/#{mgtKeyType}?DType=#{dType}&SDate=#{sDate}&EDate=#{eDate}"
573
+ uri += "&State=" + state.join(',')
574
+ uri += "&Type=" + type.join(',')
575
+ uri += "&TaxType=" + taxType.join(',')
576
+ uri += "&TaxRegIDType=" + taxRegIDType
577
+ uri += "&TaxRegID=" + taxRegID
578
+ uri += "&Page=" + page.to_s
579
+ uri += "&PerPage=" + perPage.to_s
580
+ uri += "&Order=" + order
581
+
582
+ if lateOnly.to_s != ''
583
+ uri += "&LateOnly=" + lateOnly
584
+ end
585
+
586
+ if taxRegIDYN.to_s != ''
587
+ uri += "&TaxRegIDYN=" + taxRegIDYN
588
+ end
589
+
590
+ if queryString.to_s != ''
591
+ uri += "&QString=" + queryString
592
+ end
593
+
594
+ httpget(URI.escape(uri), corpNum, userID)
595
+
596
+ end
597
+
598
+
599
+ def attachStatement(corpNum, mgtKeyType, mgtKey, itemCode, stmtMgtKey, userID = '')
600
+ if corpNum.length != 10
601
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
602
+ end
603
+ if mgtKey.to_s == ''
604
+ raise PopbillException.new('-99999999', '문서관리번호가 입력되지 않았습니다.')
605
+ end
606
+ if itemCode.to_s == ''
607
+ raise PopbillException.new('-99999999', '전자명세서 종류코드가 입력되지 않았습니다.')
608
+ end
609
+ if stmtMgtKey.to_s == ''
610
+ raise PopbillException.new('-99999999', '전자명세서 문서관리번호가 입력되지 않았습니다.')
611
+ end
612
+
613
+ postData = {}
614
+ postData["ItemCode"] = itemCode
615
+ postData["MgtKey"] = stmtMgtKey
616
+ postData = postData.to_json
617
+
618
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/AttachStmt", corpNum, postData, "", userID)
619
+ end
620
+
621
+ def detachStatement(corpNum, mgtKeyType, mgtKey, itemCode, stmtMgtKey, userID = '')
622
+ if corpNum.length != 10
623
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
624
+ end
625
+ if mgtKey.to_s == ''
626
+ raise PopbillException.new('-99999999', '문서관리번호가 입력되지 않았습니다.')
627
+ end
628
+ if itemCode.to_s == ''
629
+ raise PopbillException.new('-99999999', '전자명세서 종류코드가 입력되지 않았습니다.')
630
+ end
631
+ if stmtMgtKey.to_s == ''
632
+ raise PopbillException.new('-99999999', '전자명세서 문서관리번호가 입력되지 않았습니다.')
633
+ end
634
+
635
+ postData = {}
636
+ postData["ItemCode"] = itemCode
637
+ postData["MgtKey"] = stmtMgtKey
638
+ postData = postData.to_json
639
+
640
+ httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/DetachStmt", corpNum, postData, "", userID)
641
+ end
642
+ end # end of TaxinvoiceService
643
+
644
+ module MgtKeyType
645
+ SELL = "SELL"
646
+ BUY = "BUY"
647
+ TRUSTEE = "TRUSTEE"
648
+ end