class HTCashbillService

팝빌 홈택스 현금영수증 연계 API Service Implementation

Public Class Methods

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

Public Instance Methods

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

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

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

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

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

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

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

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

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

  httpget("/HomeTax/Cashbill/Contract", corpNum, userID)
end
getJobState(corpNum, jobID, userID = "") click to toggle source
# File lib/popbill/htCashbill.rb, line 38
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/Cashbill/#{jobID}/State", corpNum, userID)
end
listActiveJob(corpNum, userID = "") click to toggle source
# File lib/popbill/htCashbill.rb, line 49
def listActiveJob(corpNum, userID = "")
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end

  httpget("/HomeTax/Cashbill/JobList", corpNum, userID)
end
registDeptUser(corpNum, deptUserID, deptUserPWD, userID = "") click to toggle source
# File lib/popbill/htCashbill.rb, line 131
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/Cashbill/DeptUser", corpNum, postData, "", userID)
end
requestJob(corpNum, type, sDate, eDate, userID = "") click to toggle source
# File lib/popbill/htCashbill.rb, line 22
def requestJob(corpNum, type, sDate, eDate, userID = "")
  if corpNum.length != 10
    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/Cashbill/#{type}?SDate=#{sDate}&EDate=#{eDate}"

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

  uri = "/HomeTax/Cashbill/#{jobID}/Summary"
  uri += "?TradeType=" + tradeType.join(',')
  uri += "&TradeUsage=" + tradeUsage.join(',')

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