class HTTaxinvoiceService

팝빌 홈택스 세금계산서 연계 API Service Implementation

Public Class Methods

instance(linkID, secretKey) click to toggle source
Calls superclass method BaseService::instance
# File lib/popbill/htTaxinvoice.rb, line 6
def instance(linkID, secretKey)
  super(linkID, secretKey)
  @instance ||= new
  @instance.addScope("111")
  return @instance
end

Public Instance Methods

checkCertValidation(corpNum, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 196
def checkCertValidation(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

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

end
checkDeptUser(corpNum, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 227
def checkDeptUser(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/HomeTax/Taxinvoice/DeptUser", corpNum, userID)
end
checkLoginDeptUser(corpNum, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 235
def checkLoginDeptUser(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/HomeTax/Taxinvoice/DeptUser/Check", corpNum, userID)
end
deleteDeptUser(corpNum, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 243
def deleteDeptUser(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httppost("/HomeTax/Taxinvoice/DeptUser", corpNum, "", "DELETE", userID)
end
getCertificateExpireDate(corpNum, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 163
def getCertificateExpireDate(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/HomeTax/Taxinvoice/CertInfo", corpNum, userID)['certificateExpiration']
end
getCertificatePopUpURL(corpNum, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 147
def getCertificatePopUpURL(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/HomeTax/Taxinvoice?TG=CERT", corpNum, userID)['url']
end
getChargeInfo(corpNum, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 15
def getChargeInfo(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  httpget("/HomeTax/Taxinvoice/ChargeInfo", corpNum, userID)
end
getFlatRatePopUpURL(corpNum, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 139
def getFlatRatePopUpURL(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/HomeTax/Taxinvoice?TG=CHRG", corpNum, userID)['url']
end
getFlatRateState(corpNum, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 155
def getFlatRateState(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/HomeTax/Taxinvoice/Contract", corpNum, userID)
end
getJobState(corpNum, jobID, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 41
def getJobState(corpNum, jobID, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if jobID.to_s == ''
    raise PopbillException.new('-99999999', '작업아이디(jobID)가 입력되지 않았습니다.')
  end

  httpget("/HomeTax/Taxinvoice/#{jobID}/State", corpNum, userID)
end
getPopUpURL(corpNum, ntsConfirmNum, userID ="") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 171
def getPopUpURL(corpNum, ntsConfirmNum, userID ="")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  if ntsConfirmNum.length != 24
    raise PopbillException.new('-99999999', '전자세금계산서 국세청승인번호가 올바르지 않습니다.')
  end

  httpget("/HomeTax/Taxinvoice/#{ntsConfirmNum}/PopUp", corpNum, userID)['url']
end
getPrintURL(corpNum, ntsConfirmNum, userID ="") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 183
def getPrintURL(corpNum, ntsConfirmNum, userID ="")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  if ntsConfirmNum.length != 24
    raise PopbillException.new('-99999999', '전자세금계산서 국세청승인번호가 올바르지 않습니다.')
  end

  httpget("/HomeTax/Taxinvoice/#{ntsConfirmNum}/Print", corpNum, userID)['url']
end
getTaxinvoice(corpNum, ntsConfirmNum, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 117
def getTaxinvoice(corpNum, ntsConfirmNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if ntsConfirmNum.length != 24
    raise PopbillException.new('-99999999', '전자세금계산서 국세청승인번호가 올바르지 않습니다.')
  end

  httpget("/HomeTax/Taxinvoice/#{ntsConfirmNum}", corpNum, userID)
end
getXML(corpNum, ntsConfirmNum, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 128
def getXML(corpNum, ntsConfirmNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if ntsConfirmNum.length != 24
    raise PopbillException.new('-99999999', '전자세금계산서 국세청승인번호가 올바르지 않습니다.')
  end

  httpget("/HomeTax/Taxinvoice/#{ntsConfirmNum}?T=xml", corpNum, userID)
end
listActiveJob(corpNum, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 52
def listActiveJob(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/HomeTax/Taxinvoice/JobList", corpNum, userID)
end
registDeptUser(corpNum, deptUserID, deptUserPWD, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 205
def registDeptUser(corpNum, deptUserID, deptUserPWD, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  if deptUserID.length == 0
    raise PopbillException.new('-99999999', '홈택스 부서사용자 계정 아이디가 입력되지 않았습니다.')
  end

  if deptUserPWD.length == 0
    raise PopbillException.new('-99999999', '홈택스 부서사용자 계정 비밀번호가 입력되지 않았습니다.')
  end

  postData = {}
  postData["id"] = deptUserID
  postData["pwd"] = deptUserPWD

  postData = postData.to_json

  httppost("/HomeTax/Taxinvoice/DeptUser", corpNum, postData, "", userID)
end
requestJob(corpNum, type, dType, sDate, eDate, userID = "") click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 22
def requestJob(corpNum, type, dType, sDate, eDate, 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 = "/HomeTax/Taxinvoice/#{type}?DType=#{dType}&SDate=#{sDate}&EDate=#{eDate}"

  httppost(uri, corpNum, "", "", userID)['jobID']
end
summary(corpNum, jobID, type, taxType, purposeType, taxRegIDType, taxRegIDYN, taxRegID, userID = '', searchString = '') click to toggle source
# File lib/popbill/htTaxinvoice.rb, line 90
def summary(corpNum, jobID, type, taxType, purposeType, taxRegIDType, taxRegIDYN,
  taxRegID, userID = '', searchString = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if jobID.length != 18
    raise PopbillException.new('-99999999', '작업아이디(jobID)가 올바르지 않습니다.')
  end

  uri = "/HomeTax/Taxinvoice/#{jobID}/Summary"
  uri += "?Type=" + type.join(',')
  uri += "&TaxType=" + taxType.join(',')
  uri += "&PurposeType=" + purposeType.join(',')
  uri += "&TaxRegIDType=" + taxRegIDType
  uri += "&TaxRegID=" + taxRegID

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

  if searchString.to_s != ''
    uri += "&SearchString=" + searchString
  end

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