Class: TaxinvoiceService

Inherits:
BaseService show all
Defined in:
lib/popbill/taxinvoice.rb

Overview

팝빌 세금계산서 API Service Implementation

Constant Summary

Constants inherited from BaseService

BaseService::BOUNDARY, BaseService::POPBILL_APIVersion, BaseService::ServiceID_REAL, BaseService::ServiceID_TEST, BaseService::ServiceURL_REAL, BaseService::ServiceURL_TEST

Instance Attribute Summary

Attributes inherited from BaseService

#isTest, #linkhub, #scopes, #token_table

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseService

#addScope, #checkID, #checkIsMember, #getBalance, #getCorpInfo, #getPartnerBalance, #getPopbillURL, #getServiceID, #getServiceURL, #getSession_Token, #gzip_parse, #httpget, #httppost, #httppostfile, #httppostfiles, #joinMember, #listContact, #registContact, #setIsTest, #updateContact, #updateCorpInfo

Class Method Details

.instance(linkID, secretKey) ⇒ Object



7
8
9
10
11
12
# File 'lib/popbill/taxinvoice.rb', line 7

def instance(linkID, secretKey)
  super(linkID, secretKey)
  @instance ||= new
  @instance.addScope("110")
  return @instance
end

Instance Method Details

#accept(corpNum, mgtKeyType, mgtKey, memo = '', userID = '') ⇒ Object



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/popbill/taxinvoice.rb', line 217

def accept(corpNum, mgtKeyType, mgtKey, memo = '', userID ='')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  postData = {}

  if memo.to_s != ''
    postData["memo"] = memo
  end

  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "ACCEPT", userID)
end

#attachFile(corpNum, mgtKeyType, mgtKey, filePath, userID = '') ⇒ Object



460
461
462
463
464
465
466
467
468
469
# File 'lib/popbill/taxinvoice.rb', line 460

def attachFile(corpNum, mgtKeyType, mgtKey, filePath, userID ='')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  httppostfiles("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/Files", corpNum, '', [filePath], userID)
end

#attachStatement(corpNum, mgtKeyType, mgtKey, itemCode, stmtMgtKey, userID = '') ⇒ Object



599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
# File 'lib/popbill/taxinvoice.rb', line 599

def attachStatement(corpNum, mgtKeyType, mgtKey, itemCode, stmtMgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호가 입력되지 않았습니다.')
  end
  if itemCode.to_s == ''
    raise PopbillException.new('-99999999', '전자명세서 종류코드가 입력되지 않았습니다.')
  end
  if stmtMgtKey.to_s == ''
    raise PopbillException.new('-99999999', '전자명세서 문서관리번호가 입력되지 않았습니다.')
  end

  postData = {}
  postData["ItemCode"] = itemCode
  postData["MgtKey"] = stmtMgtKey
  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/AttachStmt", corpNum, postData, "", userID)
end

#cancelIssue(corpNum, mgtKeyType, mgtKey, memo = '', userID = '') ⇒ Object



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/popbill/taxinvoice.rb', line 283

def cancelIssue(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  postData = {}

  if memo.to_s != ''
    postData["memo"] = memo
  end

  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "CANCELISSUE", userID)
end

#cancelRequest(corpNum, mgtKeyType, mgtKey, memo = '', userID = '') ⇒ Object



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/popbill/taxinvoice.rb', line 340

def cancelRequest(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  postData = {}

  if memo.to_s != ''
    postData["memo"] = memo
  end

  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "CANCELREQUEST", userID)
end

#cancelSend(corpNum, mgtKeyType, mgtKey, memo = '', userID = '') ⇒ Object



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/popbill/taxinvoice.rb', line 198

def cancelSend(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  postData = {}

  if memo.to_s != ''
    postData["memo"] = memo
  end

  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "CANCELSEND", userID)
end

#checkMgtKeyInUse(corpNum, mgtKeyType, mgtKey) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/popbill/taxinvoice.rb', line 51

def checkMgtKeyInUse(corpNum, mgtKeyType, mgtKey)
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  begin
    response = httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum)
    return response['itemKey'].length != 0
  rescue PopbillException => pe
    if pe.code == -11000005
      return false
    end
    raise PopbillException.new(pe.code, pe.message)
  end
end

#delete(corpNum, mgtKeyType, mgtKey, userID = '') ⇒ Object



163
164
165
166
167
168
169
170
171
172
# File 'lib/popbill/taxinvoice.rb', line 163

def delete(corpNum, mgtKeyType, mgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 입력되지 않았습니다.')
  end

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, '', 'DELETE', userID)
end

#deleteFile(corpNum, mgtKeyType, mgtKey, fileID, userID = '') ⇒ Object



484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/popbill/taxinvoice.rb', line 484

def deleteFile(corpNum, mgtKeyType, mgtKey, fileID, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end
  if fileID.to_s == ''
    raise PopbillException.new('-99999999', '파일아이디가 입력되지 않았습니다.')
  end

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/Files/#{fileID}", corpNum, '', "DELETE", userID)
end

#deny(corpNum, mgtKeyType, mgtKey, memo = '', userID = '') ⇒ Object



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/popbill/taxinvoice.rb', line 236

def deny(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  postData = {}

  if memo.to_s != ''
    postData["memo"] = memo
  end

  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "DENY", userID)
end

#detachStatement(corpNum, mgtKeyType, mgtKey, itemCode, stmtMgtKey, userID = '') ⇒ Object



621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
# File 'lib/popbill/taxinvoice.rb', line 621

def detachStatement(corpNum, mgtKeyType, mgtKey, itemCode, stmtMgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호가 입력되지 않았습니다.')
  end
  if itemCode.to_s == ''
    raise PopbillException.new('-99999999', '전자명세서 종류코드가 입력되지 않았습니다.')
  end
  if stmtMgtKey.to_s == ''
    raise PopbillException.new('-99999999', '전자명세서 문서관리번호가 입력되지 않았습니다.')
  end

  postData = {}
  postData["ItemCode"] = itemCode
  postData["MgtKey"] = stmtMgtKey
  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/DetachStmt", corpNum, postData, "", userID)
end

#getCertificateExpireDate(corpNum) ⇒ Object



37
38
39
40
41
42
# File 'lib/popbill/taxinvoice.rb', line 37

def getCertificateExpireDate(corpNum)
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  httpget("/Taxinvoice?cfg=CERT", corpNum)['certificateExpiration']
end

#getChargeInfo(corpNum, userID = "") ⇒ Object



16
17
18
19
20
21
# File 'lib/popbill/taxinvoice.rb', line 16

def getChargeInfo(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  httpget("/Taxinvoice/ChargeInfo", corpNum, userID)
end

#getDetailInfo(corpNum, mgtKeyType, mgtKey, userID = '') ⇒ Object



151
152
153
154
155
156
157
158
159
160
# File 'lib/popbill/taxinvoice.rb', line 151

def getDetailInfo(corpNum, mgtKeyType, mgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}?Detail", corpNum, userID)
end

#getEmailPublicKeys(corpNum) ⇒ Object



44
45
46
47
48
49
# File 'lib/popbill/taxinvoice.rb', line 44

def getEmailPublicKeys(corpNum)
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  httpget("/Taxinvoice/EmailPublicKeys", corpNum)
end

#getEPrintURL(corpNum, mgtKeyType, mgtKey, userID = '') ⇒ Object



520
521
522
523
524
525
526
527
528
529
# File 'lib/popbill/taxinvoice.rb', line 520

def getEPrintURL(corpNum, mgtKeyType, mgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}?TG=EPRINT", corpNum, userID)['url']
end

#getFiles(corpNum, mgtKeyType, mgtKey, userID = '') ⇒ Object



472
473
474
475
476
477
478
479
480
481
# File 'lib/popbill/taxinvoice.rb', line 472

def getFiles(corpNum, mgtKeyType, mgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/Files", corpNum)
end

#getInfo(corpNum, mgtKeyType, mgtKey, userID = '') ⇒ Object



126
127
128
129
130
131
132
133
134
135
# File 'lib/popbill/taxinvoice.rb', line 126

def getInfo(corpNum, mgtKeyType, mgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, userID)
end

#getInfos(corpNum, mgtKeyType, mgtKeyList, userID = '') ⇒ Object



137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/popbill/taxinvoice.rb', line 137

def getInfos(corpNum, mgtKeyType, mgtKeyList, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  unless mgtKeyList.any?
    raise PopbillException.new('-99999999', '문서관리번호 배열이 올바르지 않습니다.')
  end

  postData = mgtKeyList.to_json

  httppost("/Taxinvoice/#{mgtKeyType}", corpNum, postData, "",  userID)
end

#getLogs(corpNum, mgtKeyType, mgtKey, userID = '') ⇒ Object



448
449
450
451
452
453
454
455
456
457
# File 'lib/popbill/taxinvoice.rb', line 448

def getLogs(corpNum, mgtKeyType, mgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/Logs", corpNum, userID)
end

#getMailURL(corpNum, mgtKeyType, mgtKey, userID = '') ⇒ Object



531
532
533
534
535
536
537
538
539
540
# File 'lib/popbill/taxinvoice.rb', line 531

def getMailURL(corpNum, mgtKeyType, mgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}?TG=MAIL", corpNum, userID)['url']
end

#getMassPrintURL(corpNum, mgtKeyType, mgtKeyList, userID = '') ⇒ Object



542
543
544
545
546
547
548
549
550
551
552
# File 'lib/popbill/taxinvoice.rb', line 542

def getMassPrintURL(corpNum, mgtKeyType, mgtKeyList, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  unless mgtKeyList.any?
    raise PopbillException.new('-99999999', '문서관리번호 배열이 올바르지 않습니다.')
  end

  postData = mgtKeyList.to_json
  httppost("/Taxinvoice/#{mgtKeyType}?Print", corpNum, postData, "", userID)['url']
end

#getPopUpURL(corpNum, mgtKeyType, mgtKey, userID = '') ⇒ Object



498
499
500
501
502
503
504
505
506
507
# File 'lib/popbill/taxinvoice.rb', line 498

def getPopUpURL(corpNum, mgtKeyType, mgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}?TG=POPUP", corpNum, userID)['url']
end

#getPrintURL(corpNum, mgtKeyType, mgtKey, userID = '') ⇒ Object



509
510
511
512
513
514
515
516
517
518
# File 'lib/popbill/taxinvoice.rb', line 509

def getPrintURL(corpNum, mgtKeyType, mgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}?TG=PRINT", corpNum, userID)['url']
end

#getUnitCost(corpNum) ⇒ Object



30
31
32
33
34
35
# File 'lib/popbill/taxinvoice.rb', line 30

def getUnitCost(corpNum)
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  httpget("/Taxinvoice?cfg=UNITCOST", corpNum)['unitCost']
end

#getURL(corpNum, togo, userID = "") ⇒ Object



23
24
25
26
27
28
# File 'lib/popbill/taxinvoice.rb', line 23

def getURL(corpNum, togo, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  httpget("/Taxinvoice/?TG=" + togo, corpNum, userID)['url']
end

#issue(corpNum, mgtKeyType, mgtKey, forceIssue = false, memo = '', emailSubject = '', userID) ⇒ Object



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/popbill/taxinvoice.rb', line 255

def issue(corpNum, mgtKeyType, mgtKey, forceIssue = false, memo = '', emailSubject ='', userID)
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  postData = {}

  if forceIssue
    postData["forceIssue"] = true
  end

  if memo.to_s != ''
    postData["memo"] = memo
  end

  if emailSubject.to_s != ''
    postData["emailSubject"] = emailSubject
  end

  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "ISSUE", userID)

end

#refuse(corpNum, mgtKeyType, mgtKey, memo = '', userID = '') ⇒ Object



321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/popbill/taxinvoice.rb', line 321

def refuse(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  postData = {}

  if memo.to_s != ''
    postData["memo"] = memo
  end

  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "REFUSE", userID)
end

#register(corpNum, taxinvoice, writeSpecification = false, userID = '') ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/popbill/taxinvoice.rb', line 70

def register(corpNum, taxinvoice, writeSpecification = false, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if writeSpecification
    taxinvoice["writeSpecification"] = true
  end

  postData = taxinvoice.to_json
  httppost("/Taxinvoice", corpNum, postData, "", userID)
end

#registIssue(corpNum, taxinvoice, writeSpecification = false, forceIssue = false, dealInvoiceMgtKey = '', memo = '', emailSubject = '', userID = '') ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/popbill/taxinvoice.rb', line 82

def registIssue(corpNum, taxinvoice, writeSpecification = false, forceIssue = false, dealInvoiceMgtKey = '', memo = '', emailSubject = '', userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if writeSpecification
    taxinvoice["writeSpecification"] = true
  end

  if forceIssue
    taxinvoice["forceIssue"] = true
  end

  if dealInvoiceMgtKey.to_s != ''
    taxinvoice["dealInvoiceMgtKey"] = dealInvoiceMgtKey
  end

  if memo.to_s != ''
    taxinvoice["memo"] = memo
  end

  if emailSubject.to_s != ''
    taxinvoice["emailSubject"] = emailSubject
  end

  postData = taxinvoice.to_json

  httppost("/Taxinvoice", corpNum, postData, "ISSUE", userID)

end

#request(corpNum, mgtKeyType, mgtKey, memo = '', userID = '') ⇒ Object



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/popbill/taxinvoice.rb', line 302

def request(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  postData = {}

  if memo.to_s != ''
    postData["memo"] = memo
  end

  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "REQUEST", userID)
end

#search(corpNum, mgtKeyType, dType, sDate, eDate, state, type, taxType, lateOnly, taxRegIDYN, taxRegIDType, taxRegID, page, perPage, order, queryString, userID = '') ⇒ Object



555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
# File 'lib/popbill/taxinvoice.rb', line 555

def search(corpNum, mgtKeyType, dType, sDate, eDate, state, type, taxType, lateOnly,
  taxRegIDYN, taxRegIDType, taxRegID, page, perPage, order, queryString, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if dType.to_s == ''
    raise PopbillException.new('-99999999', '검색일자유형이 입력되지 않았습니다.')
  end

  if sDate.to_s == ''
    raise PopbillException.new('-99999999', '시작일자가 입력되지 않았습니다.')
  end

  if eDate.to_s == ''
    raise PopbillException.new('-99999999', '종료일자가 입력되지 않았습니다.')
  end

  uri = "/Taxinvoice/#{mgtKeyType}?DType=#{dType}&SDate=#{sDate}&EDate=#{eDate}"
  uri += "&State=" + state.join(',')
  uri += "&Type=" + type.join(',')
  uri += "&TaxType=" + taxType.join(',')
  uri += "&TaxRegIDType=" + taxRegIDType
  uri += "&TaxRegID=" + taxRegID
  uri += "&Page=" + page.to_s
  uri += "&PerPage=" + perPage.to_s
  uri += "&Order=" + order

  if lateOnly.to_s != ''
    uri += "&LateOnly=" + lateOnly
  end

  if taxRegIDYN.to_s != ''
    uri += "&TaxRegIDYN=" + taxRegIDYN
  end

  if queryString.to_s != ''
    uri += "&QString=" + queryString
  end

  httpget(URI.escape(uri), corpNum, userID)

end

#send(corpNum, mgtKeyType, mgtKey, memo = '', emailSubject = '', userID = '') ⇒ Object



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/popbill/taxinvoice.rb', line 175

def send(corpNum, mgtKeyType, mgtKey, memo = '', emailSubject = '', userID ='')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  postData = {}

  if memo.to_s != ''
    postData["memo"] = memo
  end

  if emailSubject.to_s != ''
    postData["emailSubject"] = emailSubject
  end

  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "SEND", userID)
end

#sendEmail(corpNum, mgtKeyType, mgtKey, receiverMail, userID = '') ⇒ Object



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/popbill/taxinvoice.rb', line 372

def sendEmail(corpNum, mgtKeyType, mgtKey, receiverMail, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  postData = {}

  if receiverMail.to_s != ''
    postData["receiver"] = receiverMail
  end

  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "EMAIL", userID)
end

#sendFax(corpNum, mgtKeyType, mgtKey, senderNum, receiverNum, userID = '') ⇒ Object



422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
# File 'lib/popbill/taxinvoice.rb', line 422

def sendFax(corpNum, mgtKeyType, mgtKey, senderNum, receiverNum, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  if senderNum.to_s == ''
    raise PopbillException.new('-99999999', '발신번호가 입력되지 않았습니다.')
  end

  if receiverNum.to_s == ''
    raise PopbillException.new('-99999999', '수신번호가 입력되지 않았습니다.')
  end

  postData = {}
  postData["sender"] = senderNum
  postData["receiver"] = receiverNum

  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "FAX", userID)

end

#sendSMS(corpNum, mgtKeyType, mgtKey, senderNum, receiverNum, contents, userID = '') ⇒ Object



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/popbill/taxinvoice.rb', line 391

def sendSMS(corpNum, mgtKeyType, mgtKey, senderNum, receiverNum, contents, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  if senderNum.to_s == ''
    raise PopbillException.new('-99999999', '발신번호가 입력되지 않았습니다.')
  end

  if receiverNum.to_s == ''
    raise PopbillException.new('-99999999', '수신번호가 입력되지 않았습니다.')
  end

  if contents.to_s == ''
    raise PopbillException.new('-99999999', '문자 메시지 내용이 입력되지 않았습니다.')
  end

  postData = {}
  postData["sender"] = senderNum
  postData["receiver"] = receiverNum
  postData["contents"] = contents

  postData = postData.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "SMS", userID)
end

#sendToNTS(corpNum, mgtKeyType, mgtKey, userID = '') ⇒ Object



360
361
362
363
364
365
366
367
368
369
# File 'lib/popbill/taxinvoice.rb', line 360

def sendToNTS(corpNum, mgtKeyType, mgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, '', "NTS", userID)
end

#update(corpNum, mgtKeyType, mgtKey, taxinvoice, userID = '') ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
# File 'lib/popbill/taxinvoice.rb', line 113

def update(corpNum, mgtKeyType, mgtKey, taxinvoice, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if mgtKey.to_s == ''
    raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
  end
  postData = taxinvoice.to_json

  httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "PATCH", userID)
end