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_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/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



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

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

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

end

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



228
229
230
231
232
233
234
# File 'lib/popbill/htTaxinvoice.rb', line 228

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

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

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



236
237
238
239
240
241
242
# File 'lib/popbill/htTaxinvoice.rb', line 236

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



244
245
246
247
248
249
250
# File 'lib/popbill/htTaxinvoice.rb', line 244

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



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

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



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

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



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

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



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

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



172
173
174
175
176
177
178
179
180
181
182
# File 'lib/popbill/htTaxinvoice.rb', line 172

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



184
185
186
187
188
189
190
191
192
193
194
# File 'lib/popbill/htTaxinvoice.rb', line 184

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



118
119
120
121
122
123
124
125
126
127
# File 'lib/popbill/htTaxinvoice.rb', line 118

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



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

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



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

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 = '', searchString = '') ⇒ 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
86
87
88
89
# File 'lib/popbill/htTaxinvoice.rb', line 61

def search(corpNum, jobID, type, taxType, purposeType, taxRegIDType, taxRegIDYN,
  taxRegID, page, perPage, order, 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}"
  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

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

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

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



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/popbill/htTaxinvoice.rb', line 91

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