Class: HTTaxinvoiceService

Inherits:
BaseService show all
Defined in:
lib/popbill/htTaxinvoice.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/htTaxinvoice.rb', line 7

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

Instance Method Details

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



177
178
179
180
181
182
183
184
# File 'lib/popbill/htTaxinvoice.rb', line 177

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

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

end

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



208
209
210
211
212
213
214
# File 'lib/popbill/htTaxinvoice.rb', line 208

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

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

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



216
217
218
219
220
221
222
# File 'lib/popbill/htTaxinvoice.rb', line 216

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

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

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



224
225
226
227
228
229
230
# File 'lib/popbill/htTaxinvoice.rb', line 224

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

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

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



156
157
158
159
160
161
162
# File 'lib/popbill/htTaxinvoice.rb', line 156

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

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

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



140
141
142
143
144
145
146
# File 'lib/popbill/htTaxinvoice.rb', line 140

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



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

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

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



132
133
134
135
136
137
138
# File 'lib/popbill/htTaxinvoice.rb', line 132

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



148
149
150
151
152
153
154
# File 'lib/popbill/htTaxinvoice.rb', line 148

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

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

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



42
43
44
45
46
47
48
49
50
51
# File 'lib/popbill/htTaxinvoice.rb', line 42

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



164
165
166
167
168
169
170
171
172
173
174
# File 'lib/popbill/htTaxinvoice.rb', line 164

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

#getTaxinvoice(corpNum, ntsConfirmNum, userID = "") ⇒ Object



110
111
112
113
114
115
116
117
118
119
# File 'lib/popbill/htTaxinvoice.rb', line 110

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



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

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



53
54
55
56
57
58
59
# File 'lib/popbill/htTaxinvoice.rb', line 53

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



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/popbill/htTaxinvoice.rb', line 186

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



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

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

#search(corpNum, jobID, type, taxType, purposeType, taxRegIDType, taxRegIDYN, taxRegID, page, perPage, order, userID = '') ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/popbill/htTaxinvoice.rb', line 61

def search(corpNum, jobID, type, taxType, purposeType, taxRegIDType, taxRegIDYN,
  taxRegID, 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/Taxinvoice/#{jobID}"
  uri += "?Type=" + type.join(',')
  uri += "&TaxType=" + taxType.join(',')
  uri += "&PurposeType=" + purposeType.join(',')
  uri += "&TaxRegIDType=" + taxRegIDType
  uri += "&TaxRegID=" + taxRegID
  uri += "&Page=" + page.to_s
  uri += "&PerPage=" + perPage.to_s
  uri += "&Order=" + order

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

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

#summary(corpNum, jobID, type, taxType, purposeType, taxRegIDType, taxRegIDYN, taxRegID, userID = '') ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/popbill/htTaxinvoice.rb', line 87

def summary(corpNum, jobID, type, taxType, purposeType, taxRegIDType, taxRegIDYN,
  taxRegID, userID = '')
  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

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