Class: HTCashbillService

Inherits:
BaseService show all
Defined in:
lib/popbill/htCashbill.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, #getAccessURL, #getBalance, #getChargeURL, #getCorpInfo, #getPartnerBalance, #getPartnerURL, #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/htCashbill.rb', line 7

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

Instance Method Details

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



123
124
125
126
127
128
129
130
# File 'lib/popbill/htCashbill.rb', line 123

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

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

end

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



154
155
156
157
158
159
160
# File 'lib/popbill/htCashbill.rb', line 154

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

  httpget("/HomeTax/Cashbill/DeptUser", corpNum, userID)
end

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



162
163
164
165
166
167
168
# File 'lib/popbill/htCashbill.rb', line 162

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

  httpget("/HomeTax/Cashbill/DeptUser/Check", corpNum, userID)
end

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



170
171
172
173
174
175
176
# File 'lib/popbill/htCashbill.rb', line 170

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

  httppost("/HomeTax/Cashbill/DeptUser", corpNum, "", "DELETE", userID)
end

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



115
116
117
118
119
120
121
# File 'lib/popbill/htCashbill.rb', line 115

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

  httpget("/HomeTax/Cashbill/CertInfo", corpNum, userID)['certificateExpiration']
end

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



99
100
101
102
103
104
105
# File 'lib/popbill/htCashbill.rb', line 99

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 = "") ⇒ Object



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

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

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



91
92
93
94
95
96
97
# File 'lib/popbill/htCashbill.rb', line 91

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 = "") ⇒ Object



107
108
109
110
111
112
113
# File 'lib/popbill/htCashbill.rb', line 107

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

  httpget("/HomeTax/Cashbill/Contract", corpNum, userID)
end

#getJobState(corpNum, jobID, userID = "") ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/popbill/htCashbill.rb', line 39

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 = "") ⇒ Object



50
51
52
53
54
55
56
# File 'lib/popbill/htCashbill.rb', line 50

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 = "") ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/popbill/htCashbill.rb', line 132

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 = "") ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/popbill/htCashbill.rb', line 23

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

#search(corpNum, jobID, tradeType, tradeUsage, page, perPage, order, userID = '') ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/popbill/htCashbill.rb', line 58

def search(corpNum, jobID, tradeType, tradeUsage, page, perPage, order, userID = '')
  if corpNum.length != 10
    raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
  end
  if jobID.length != 18
    raise PopbillException.new('-99999999', '작업아이디(jobID)가 올바르지 않습니다.')
  end

  uri = "/HomeTax/Cashbill/#{jobID}"
  uri += "?TradeType=" + tradeType.join(',')
  uri += "&TradeUsage=" + tradeUsage.join(',')
  uri += "&Page=" + page.to_s
  uri += "&PerPage=" + perPage.to_s
  uri += "&Order=" + order

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

#summary(corpNum, jobID, tradeType, tradeUsage, userID = '') ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/popbill/htCashbill.rb', line 76

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