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_GA_REAL, BaseService::ServiceURL_GA_TEST, BaseService::ServiceURL_REAL, BaseService::ServiceURL_Static_REAL, BaseService::ServiceURL_Static_TEST, BaseService::ServiceURL_TEST

Instance Attribute Summary

Attributes inherited from BaseService

#ipRestrictOnOff, #isTest, #linkhub, #scopes, #token_table, #useGAIP, #useLocalTimeYN, #useStaticIP

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseService

#addScope, #checkID, #checkIsMember, #getAccessURL, #getBalance, #getChargeURL, #getContactInfo, #getCorpInfo, #getPartnerBalance, #getPartnerURL, #getPaymentURL, #getPopbillURL, #getServiceID, #getServiceURL, #getSession_Token, #getUseHistoryURL, #gzip_parse, #httpget, #httppost, #httppostbulk, #httppostfile, #httppostfiles, #joinMember, #listContact, #registContact, #setIpRestrictOnOff, #setIsTest, #setUseGAIP, #setUseLocalTimeYN, #setUseStaticIP, #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



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/popbill/taxinvoice.rb', line 249

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

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



740
741
742
743
744
745
746
747
748
749
750
751
# File 'lib/popbill/taxinvoice.rb', line 740

def assignMgtKey(corpNum, mgtKeyType, itemKey, mgtKey, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if itemKey.to_s == ''
    raise PopbillException.new('-99999999', '아이템키가 입력되지 않았습니다.')
  end

  String  = "MgtKey=" + mgtKey

  httppost("/Taxinvoice/#{itemKey}/#{mgtKeyType}", corpNum, , "", userID, "application/x-www-form-urlencoded; charset=utf-8")
end

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



506
507
508
509
510
511
512
513
514
515
# File 'lib/popbill/taxinvoice.rb', line 506

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



696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
# File 'lib/popbill/taxinvoice.rb', line 696

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

#bulkSubmit(corpNum, submitID, taxinvoiceList, forceIssue = false, userID = '') ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/popbill/taxinvoice.rb', line 113

def bulkSubmit(corpNum, submitID, taxinvoiceList, forceIssue = false, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  if submitID.to_s == ''
    raise PopbillException.new('-99999999', '제출아이디가 입렫되지 않았습니다.')
  end

  if taxinvoiceList.to_s == ''
    raise PopbillException.new('-99999999', '세금계산서 정보가 입력되지 않았습니다.')
  end

  postData = {}
  postData['forceIssue'] = forceIssue
  postData['invoices'] = taxinvoiceList

  httppostbulk("/Taxinvoice", corpNum, postData.to_json, submitID, "BULKISSUE", userID)
end

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



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/popbill/taxinvoice.rb', line 315

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



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/popbill/taxinvoice.rb', line 386

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



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/popbill/taxinvoice.rb', line 230

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

#checkCertValidation(corpNum, userID = '') ⇒ Object



785
786
787
788
789
790
791
# File 'lib/popbill/taxinvoice.rb', line 785

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

  httpget("/Taxinvoice/CertCheck", corpNum, userID)
end

#checkMgtKeyInUse(corpNum, mgtKeyType, mgtKey) ⇒ Object



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

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



195
196
197
198
199
200
201
202
203
204
# File 'lib/popbill/taxinvoice.rb', line 195

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



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

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



268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/popbill/taxinvoice.rb', line 268

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



718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
# File 'lib/popbill/taxinvoice.rb', line 718

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

#getBulkResult(corpNum, submitID, userID = '') ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
# File 'lib/popbill/taxinvoice.rb', line 133

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

  if submitID.to_s == ''
    raise PopbillException.new('-99999999', '제출아이디가 입렫되지 않았습니다.')
  end

  httpget("/Taxinvoice/BULK/#{submitID}/State", corpNum, userID)
end

#getCertificateExpireDate(corpNum) ⇒ Object



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

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

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



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

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



183
184
185
186
187
188
189
190
191
192
# File 'lib/popbill/taxinvoice.rb', line 183

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



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

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

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



599
600
601
602
603
604
605
606
607
608
# File 'lib/popbill/taxinvoice.rb', line 599

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



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

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



158
159
160
161
162
163
164
165
166
167
# File 'lib/popbill/taxinvoice.rb', line 158

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



169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/popbill/taxinvoice.rb', line 169

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



494
495
496
497
498
499
500
501
502
503
# File 'lib/popbill/taxinvoice.rb', line 494

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



610
611
612
613
614
615
616
617
618
619
# File 'lib/popbill/taxinvoice.rb', line 610

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



621
622
623
624
625
626
627
628
629
630
631
# File 'lib/popbill/taxinvoice.rb', line 621

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

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



566
567
568
569
570
571
572
573
574
575
# File 'lib/popbill/taxinvoice.rb', line 566

def getOldPrintURL(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=PRINTOLD", corpNum, userID)['url']
end

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



577
578
579
580
581
582
583
584
585
586
# File 'lib/popbill/taxinvoice.rb', line 577

def getPDFURL(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=PDF", corpNum, userID)['url']
end

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



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

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



555
556
557
558
559
560
561
562
563
564
# File 'lib/popbill/taxinvoice.rb', line 555

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

#getSealURL(corpNum, userID) ⇒ Object

팝빌 인감 및 첨부문서 등록 URL



794
795
796
797
798
799
800
801
# File 'lib/popbill/taxinvoice.rb', line 794

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

  response = httpget("/?TG=SEAL", corpNum, userID)
  response['url']
end

#getSendToNTSConfig(corpNum, userID = '') ⇒ Object



777
778
779
780
781
782
783
# File 'lib/popbill/taxinvoice.rb', line 777

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

  httpget("/Taxinvoice/SendToNTSConfig", corpNum, userID)["sendToNTS"]
end

#getTaxCertURL(corpNum, userID) ⇒ Object

공인인증서 등록 URL



804
805
806
807
808
809
810
811
# File 'lib/popbill/taxinvoice.rb', line 804

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

  response = httpget("/?TG=CERT", corpNum, userID)
  response['url']
end

#getUnitCost(corpNum) ⇒ Object



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

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

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



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

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

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



588
589
590
591
592
593
594
595
596
597
# File 'lib/popbill/taxinvoice.rb', line 588

def getViewURL(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=VIEW", corpNum, userID)['url']
end

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



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/popbill/taxinvoice.rb', line 287

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

#listEmailConfig(corpNum, userID = '') ⇒ Object



753
754
755
756
757
758
759
# File 'lib/popbill/taxinvoice.rb', line 753

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

  httpget("/Taxinvoice/EmailSendConfig", corpNum, userID)
end

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



367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/popbill/taxinvoice.rb', line 367

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



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

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



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
111
# File 'lib/popbill/taxinvoice.rb', line 83

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

#registRequest(corpNum, taxinvoice, memo = '', userID = '') ⇒ Object



334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/popbill/taxinvoice.rb', line 334

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

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

  postData = taxinvoice.to_json

  httppost("/Taxinvoice", corpNum, postData, "REQUEST", userID)
end

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



348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/popbill/taxinvoice.rb', line 348

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 = '', interOPYN = '', issueType = [], regType = [], closeDownState = [], mgtKey = '') ⇒ Object



634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
# File 'lib/popbill/taxinvoice.rb', line 634

def search(corpNum, mgtKeyType, dType, sDate, eDate, state, type, taxType, lateOnly,
           taxRegIDYN, taxRegIDType, taxRegID, page, perPage, order, queryString, userID = '', interOPYN = '', issueType = [],
         regType = [], closeDownState = [], mgtKey = '')
  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
  uri += "&InterOPYN=" + interOPYN.to_s

  if issueType.length > 0
    uri += "&IssueType=" + issueType.join(',')
  end

  if regType.length > 0
    uri += "&RegType=" + regType.join(',')
  end

  if closeDownState.length > 0
    uri += "&CloseDownState=" + closeDownState.join(',')
  end

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

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

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

  if mgtKey.to_s != ''
    uri += "&MgtKey=" + mgtKey
  end

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

end

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



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/popbill/taxinvoice.rb', line 207

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



418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/popbill/taxinvoice.rb', line 418

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



468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
# File 'lib/popbill/taxinvoice.rb', line 468

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



437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
# File 'lib/popbill/taxinvoice.rb', line 437

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



406
407
408
409
410
411
412
413
414
415
# File 'lib/popbill/taxinvoice.rb', line 406

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



145
146
147
148
149
150
151
152
153
154
155
# File 'lib/popbill/taxinvoice.rb', line 145

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

#updateEmailConfig(corpNum, emailType, sendYN, userID = '') ⇒ Object



761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
# File 'lib/popbill/taxinvoice.rb', line 761

def updateEmailConfig(corpNum, emailType, sendYN, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  if emailType.to_s == ''
    raise PopbillException.new('-99999999', '메일전송 타입이 입력되지 않았습니다.')
  end

  if sendYN.to_s == ''
    raise PopbillException.new('-99999999', '메일전송 여부 항목이 입력되지 않았습니다.')
  end

  httppost("/Taxinvoice/EmailSendConfig?EmailType=#{emailType}&SendYN=#{sendYN}", corpNum, userID)
end