popbill 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/cashbill.rb +336 -0
- data/lib/closedown.rb +55 -0
- data/lib/fax.rb +110 -0
- data/lib/htCashbill.rb +123 -0
- data/lib/htTaxinvoice.rb +170 -0
- data/lib/message.rb +272 -0
- data/lib/popbill.rb +389 -0
- data/lib/statement.rb +444 -0
- data/lib/taxinvoice.rb +648 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1b19c6374dde032be10db067daf8ae17e3655a6b
|
4
|
+
data.tar.gz: d95f7027035fcc519a20a173188f5adee392c24a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1a674c9889c8739f5384d6a34c3cd13e1ff49f1e156a9eecef298b606a76d5a2c381dbc7187dcbfe37ca5ff69f295371be11296979f5f6b851dccbf825b820ec
|
7
|
+
data.tar.gz: 2a899b321f8ddcc8dc83850e95c815efecd11e8bb022a4d599c40862898445049994f6b2ac9a17b8a70496c081eb5c6cebf4c7c95a30c25323d59f7498786179
|
data/lib/cashbill.rb
ADDED
@@ -0,0 +1,336 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require_relative './popbill.rb'
|
3
|
+
|
4
|
+
# 팝빌 현금영수증 API Service Implementation
|
5
|
+
class CashbillService < BaseService
|
6
|
+
class << self
|
7
|
+
def instance(linkID, secretKey)
|
8
|
+
super(linkID, secretKey)
|
9
|
+
@instance ||= new
|
10
|
+
@instance.addScope("140")
|
11
|
+
return @instance
|
12
|
+
end
|
13
|
+
private :new
|
14
|
+
end
|
15
|
+
|
16
|
+
def getChargeInfo(corpNum, userID = '')
|
17
|
+
if corpNum.length != 10
|
18
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
19
|
+
end
|
20
|
+
httpget('/Cashbill/ChargeInfo', corpNum, userID)
|
21
|
+
end
|
22
|
+
|
23
|
+
def getURL(corpNum, togo, userID = '')
|
24
|
+
if corpNum.length != 10
|
25
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
26
|
+
end
|
27
|
+
httpget("/Cashbill?TG=#{togo}", corpNum, userID)['url']
|
28
|
+
end
|
29
|
+
|
30
|
+
def getUnitCost(corpNum, userID = '')
|
31
|
+
if corpNum.length != 10
|
32
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
33
|
+
end
|
34
|
+
httpget("/Cashbill?cfg=UNITCOST", corpNum, userID)['unitCost']
|
35
|
+
end
|
36
|
+
|
37
|
+
def checkMgtKeyInUse(corpNum, mgtKey, userID = '')
|
38
|
+
if corpNum.length != 10
|
39
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
40
|
+
end
|
41
|
+
if mgtKey.to_s == ''
|
42
|
+
raise PopbillException.new(-99999999, "현금영수증 문서관리번호가 입력되지 않았습니다.")
|
43
|
+
end
|
44
|
+
|
45
|
+
begin
|
46
|
+
response = httpget("/Cashbill/#{mgtKey}", corpNum)
|
47
|
+
return response['itemKey'].length != 0
|
48
|
+
rescue PopbillException => pe
|
49
|
+
if pe.code == -14000003
|
50
|
+
return false
|
51
|
+
end
|
52
|
+
raise PopbillException.new(pe.code, pe.message)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
def registIssue(corpNum, cashbill, memo = '', userID = '')
|
58
|
+
if corpNum.length != 10
|
59
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
60
|
+
end
|
61
|
+
|
62
|
+
postData = cashbill.to_json
|
63
|
+
|
64
|
+
httppost("/Cashbill", corpNum, postData, "ISSUE", userID)
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
def register(corpNum, cashbill, userID = '')
|
69
|
+
if corpNum.length != 10
|
70
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
71
|
+
end
|
72
|
+
|
73
|
+
postData = cashbill.to_json
|
74
|
+
|
75
|
+
httppost("/Cashbill", corpNum, postData, "", userID)
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
def update(corpNum, mgtKey, cashbill, userID = '')
|
80
|
+
if corpNum.length != 10
|
81
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
82
|
+
end
|
83
|
+
|
84
|
+
postData = cashbill.to_json
|
85
|
+
|
86
|
+
httppost("/Cashbill/#{mgtKey}", corpNum, postData, "PATCH", userID)
|
87
|
+
end
|
88
|
+
|
89
|
+
def issue(corpNum, mgtKey, memo = '', userID = '')
|
90
|
+
if corpNum.length != 10
|
91
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
92
|
+
end
|
93
|
+
|
94
|
+
postData = {}
|
95
|
+
|
96
|
+
if memo.to_s != ''
|
97
|
+
postData["memo"] = memo
|
98
|
+
end
|
99
|
+
|
100
|
+
postData = postData.to_json
|
101
|
+
|
102
|
+
httppost("/Cashbill/#{mgtKey}", corpNum, postData, "ISSUE", userID)
|
103
|
+
end
|
104
|
+
|
105
|
+
def cancelIssue(corpNum, mgtKey, memo = '', userID = '')
|
106
|
+
if corpNum.length != 10
|
107
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
108
|
+
end
|
109
|
+
|
110
|
+
postData = {}
|
111
|
+
|
112
|
+
if memo.to_s != ''
|
113
|
+
postData["memo"] = memo
|
114
|
+
end
|
115
|
+
|
116
|
+
postData = postData.to_json
|
117
|
+
|
118
|
+
httppost("/Cashbill/#{mgtKey}", corpNum, postData, "CANCELISSUE", userID)
|
119
|
+
end
|
120
|
+
|
121
|
+
def delete(corpNum, mgtKey, userID = '')
|
122
|
+
if corpNum.length != 10
|
123
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
124
|
+
end
|
125
|
+
|
126
|
+
httppost("/Cashbill/#{mgtKey}", corpNum, "", "DELETE", userID)
|
127
|
+
end
|
128
|
+
|
129
|
+
def search(corpNum, dType, sDate, eDate, state, tradeType, tradeUsage,
|
130
|
+
taxationType, page, perPage, order, queryString = '', userID = '')
|
131
|
+
if corpNum.length != 10
|
132
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
133
|
+
end
|
134
|
+
if dType.to_s == ''
|
135
|
+
raise PopbillException.new('-99999999', '검색일자유형이 입력되지 않았습니다.')
|
136
|
+
end
|
137
|
+
|
138
|
+
if sDate.to_s == ''
|
139
|
+
raise PopbillException.new('-99999999', '시작일자가 입력되지 않았습니다.')
|
140
|
+
end
|
141
|
+
|
142
|
+
if eDate.to_s == ''
|
143
|
+
raise PopbillException.new('-99999999', '종료일자가 입력되지 않았습니다.')
|
144
|
+
end
|
145
|
+
|
146
|
+
uri = "/Cashbill/Search?DType=#{dType}&SDate=#{sDate}&EDate=#{eDate}"
|
147
|
+
uri += "&State" + state.join(',')
|
148
|
+
uri += "&TradeUsage" + tradeUsage.join(',')
|
149
|
+
uri += "&TradeType" + tradeType.join(',')
|
150
|
+
uri += "&TaxationType" + taxationType.join(',')
|
151
|
+
uri += "&Page=" + page.to_s
|
152
|
+
uri += "&PerPage=" + perPage.to_s
|
153
|
+
uri += "&Order=" + order
|
154
|
+
|
155
|
+
if queryString.to_s != ''
|
156
|
+
uri += "&QString=" + queryString
|
157
|
+
end
|
158
|
+
|
159
|
+
httpget(URI.escape(uri), corpNum, userID)
|
160
|
+
end
|
161
|
+
|
162
|
+
def getInfo(corpNum, mgtKey, userID = '')
|
163
|
+
if corpNum.length != 10
|
164
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
165
|
+
end
|
166
|
+
if mgtKey.to_s == ''
|
167
|
+
raise PopbillException.new('-99999999', '관리번호가 입력되지 않았습니다.')
|
168
|
+
end
|
169
|
+
|
170
|
+
httpget("/Cashbill/#{mgtKey}", corpNum, userID)
|
171
|
+
end
|
172
|
+
|
173
|
+
|
174
|
+
def getInfos(corpNum, mgtKeyList, userID = '')
|
175
|
+
if corpNum.length != 10
|
176
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
177
|
+
end
|
178
|
+
unless mgtKeyList.any?
|
179
|
+
raise PopbillException.new('-99999999', '문서관리번호 배열이 올바르지 않습니다.')
|
180
|
+
end
|
181
|
+
|
182
|
+
postData = mgtKeyList.to_json
|
183
|
+
|
184
|
+
httppost("/Cashbill/States", corpNum, postData, "", userID)
|
185
|
+
end
|
186
|
+
|
187
|
+
|
188
|
+
def getDetailInfo(corpNum, mgtKey, userID = '')
|
189
|
+
if corpNum.length != 10
|
190
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
191
|
+
end
|
192
|
+
if mgtKey.to_s == ''
|
193
|
+
raise PopbillException.new('-99999999', '관리번호가 입력되지 않았습니다.')
|
194
|
+
end
|
195
|
+
|
196
|
+
httpget("/Cashbill/#{mgtKey}?Detail", corpNum, userID)
|
197
|
+
end
|
198
|
+
|
199
|
+
def sendEmail(corpNum, mgtKey, receiverMail, userID = '')
|
200
|
+
if corpNum.length != 10
|
201
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
202
|
+
end
|
203
|
+
if mgtKey.to_s == ''
|
204
|
+
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
|
205
|
+
end
|
206
|
+
|
207
|
+
postData = {}
|
208
|
+
|
209
|
+
if receiverMail.to_s != ''
|
210
|
+
postData["receiver"] = receiverMail
|
211
|
+
end
|
212
|
+
|
213
|
+
postData = postData.to_json
|
214
|
+
|
215
|
+
httppost("/Cashbill/#{mgtKey}", corpNum, postData, "EMAIL", userID)
|
216
|
+
end
|
217
|
+
|
218
|
+
|
219
|
+
def sendSMS(corpNum, mgtKey, senderNum, receiverNum, contents, userID = '')
|
220
|
+
if corpNum.length != 10
|
221
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
222
|
+
end
|
223
|
+
if mgtKey.to_s == ''
|
224
|
+
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
|
225
|
+
end
|
226
|
+
|
227
|
+
if senderNum.to_s == ''
|
228
|
+
raise PopbillException.new('-99999999', '발신번호가 입력되지 않았습니다.')
|
229
|
+
end
|
230
|
+
|
231
|
+
if receiverNum.to_s == ''
|
232
|
+
raise PopbillException.new('-99999999', '수신번호가 입력되지 않았습니다.')
|
233
|
+
end
|
234
|
+
|
235
|
+
if contents.to_s == ''
|
236
|
+
raise PopbillException.new('-99999999', '문자 메시지 내용이 입력되지 않았습니다.')
|
237
|
+
end
|
238
|
+
|
239
|
+
postData = {}
|
240
|
+
postData["sender"] = senderNum
|
241
|
+
postData["receiver"] = receiverNum
|
242
|
+
postData["contents"] = contents
|
243
|
+
|
244
|
+
postData = postData.to_json
|
245
|
+
|
246
|
+
httppost("/Cashbill/#{mgtKey}", corpNum, postData, "SMS", userID)
|
247
|
+
end
|
248
|
+
|
249
|
+
|
250
|
+
def sendFax(corpNum, mgtKey, senderNum, receiverNum, userID = '')
|
251
|
+
if corpNum.length != 10
|
252
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
253
|
+
end
|
254
|
+
if mgtKey.to_s == ''
|
255
|
+
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
|
256
|
+
end
|
257
|
+
|
258
|
+
if senderNum.to_s == ''
|
259
|
+
raise PopbillException.new('-99999999', '발신번호가 입력되지 않았습니다.')
|
260
|
+
end
|
261
|
+
|
262
|
+
if receiverNum.to_s == ''
|
263
|
+
raise PopbillException.new('-99999999', '수신번호가 입력되지 않았습니다.')
|
264
|
+
end
|
265
|
+
|
266
|
+
postData = {}
|
267
|
+
postData["sender"] = senderNum
|
268
|
+
postData["receiver"] = receiverNum
|
269
|
+
|
270
|
+
postData = postData.to_json
|
271
|
+
|
272
|
+
httppost("/Cashbill/#{mgtKey}", corpNum, postData, "FAX", userID)
|
273
|
+
|
274
|
+
end
|
275
|
+
|
276
|
+
|
277
|
+
def getLogs(corpNum, mgtKey, userID = '')
|
278
|
+
if corpNum.length != 10
|
279
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
280
|
+
end
|
281
|
+
if mgtKey.to_s == ''
|
282
|
+
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
|
283
|
+
end
|
284
|
+
httpget("/Cashbill/#{mgtKey}/Logs", corpNum, userID)
|
285
|
+
end
|
286
|
+
|
287
|
+
|
288
|
+
def getPopUpURL(corpNum, mgtKey, userID = '')
|
289
|
+
if corpNum.length != 10
|
290
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
291
|
+
end
|
292
|
+
if mgtKey.to_s == ''
|
293
|
+
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
|
294
|
+
end
|
295
|
+
|
296
|
+
httpget("/Cashbill/#{mgtKey}?TG=POPUP", corpNum, userID)['url']
|
297
|
+
end
|
298
|
+
|
299
|
+
def getPrintURL(corpNum, mgtKey, userID = '')
|
300
|
+
if corpNum.length != 10
|
301
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
302
|
+
end
|
303
|
+
if mgtKey.to_s == ''
|
304
|
+
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
|
305
|
+
end
|
306
|
+
|
307
|
+
httpget("/Cashbill/#{mgtKey}?TG=PRINT", corpNum, userID)['url']
|
308
|
+
end
|
309
|
+
|
310
|
+
|
311
|
+
def getEPrintURL(corpNum, mgtKey, userID = '')
|
312
|
+
if corpNum.length != 10
|
313
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
314
|
+
end
|
315
|
+
if mgtKey.to_s == ''
|
316
|
+
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
|
317
|
+
end
|
318
|
+
|
319
|
+
httpget("/Cashbill/#{mgtKey}?TG=EPRINT", corpNum, userID)['url']
|
320
|
+
end
|
321
|
+
|
322
|
+
|
323
|
+
def getMassPrintURL(corpNum, mgtKeyList, userID = '')
|
324
|
+
if corpNum.length != 10
|
325
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
326
|
+
end
|
327
|
+
unless mgtKeyList.any?
|
328
|
+
raise PopbillException.new('-99999999', '문서관리번호 배열이 올바르지 않습니다.')
|
329
|
+
end
|
330
|
+
|
331
|
+
postData = mgtKeyList.to_json
|
332
|
+
|
333
|
+
httppost("/Cashbill/Prints", corpNum, postData, "", userID)['url']
|
334
|
+
end
|
335
|
+
|
336
|
+
end # end of CashbillService
|
data/lib/closedown.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require_relative './popbill.rb'
|
3
|
+
|
4
|
+
# 팝빌 휴폐업조회 API Service Implementation
|
5
|
+
class ClosedownService < BaseService
|
6
|
+
class << self
|
7
|
+
def instance(linkID, secretKey)
|
8
|
+
super(linkID, secretKey)
|
9
|
+
@instance ||= new
|
10
|
+
@instance.addScope("170")
|
11
|
+
return @instance
|
12
|
+
end
|
13
|
+
private :new
|
14
|
+
end
|
15
|
+
|
16
|
+
def getChargeInfo(corpNum, userID = '')
|
17
|
+
if corpNum.length != 10
|
18
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
19
|
+
end
|
20
|
+
httpget("/CloseDown/ChargeInfo", corpNum, userID)
|
21
|
+
end
|
22
|
+
|
23
|
+
def getUnitCost(corpNum, userID = '')
|
24
|
+
if corpNum.length != 10
|
25
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
26
|
+
end
|
27
|
+
httpget("/CloseDown/UnitCost", corpNum, userID)['unitCost']
|
28
|
+
end
|
29
|
+
|
30
|
+
def checkCorpNum(corpNum, checkCorpNum, userID = '')
|
31
|
+
if corpNum.length != 10
|
32
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
33
|
+
end
|
34
|
+
|
35
|
+
if checkCorpNum.to_s == ''
|
36
|
+
raise PopbillException.new(-99999999, "조회할 사업자등록번호가 입력되지 않았습니다.")
|
37
|
+
end
|
38
|
+
|
39
|
+
httpget("/CloseDown?CN=#{checkCorpNum}", corpNum, userID)
|
40
|
+
end
|
41
|
+
|
42
|
+
def checkCorpNums(corpNum, checkCorpNums, userID = '')
|
43
|
+
if corpNum.length != 10
|
44
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
45
|
+
end
|
46
|
+
if checkCorpNums.length == 0
|
47
|
+
raise PopbillException.new(-99999999, "조회할 사업자등록번호 배열이 입력되지 않았습니다.")
|
48
|
+
end
|
49
|
+
|
50
|
+
httppost("/CloseDown", corpNum, checkCorpNums.to_json)
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
end # end of FaxService
|
data/lib/fax.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require_relative './popbill.rb'
|
3
|
+
|
4
|
+
# 팝빌 팩스 API Service Implementation
|
5
|
+
class FaxService < BaseService
|
6
|
+
class << self
|
7
|
+
def instance(linkID, secretKey)
|
8
|
+
super(linkID, secretKey)
|
9
|
+
@instance ||= new
|
10
|
+
@instance.addScope("160")
|
11
|
+
return @instance
|
12
|
+
end
|
13
|
+
private :new
|
14
|
+
end
|
15
|
+
|
16
|
+
def getChargeInfo(corpNum, userID = '')
|
17
|
+
if corpNum.length != 10
|
18
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
19
|
+
end
|
20
|
+
httpget("/FAX/ChargeInfo", corpNum, userID)
|
21
|
+
end
|
22
|
+
|
23
|
+
def getURL(corpNum, togo, userID = '')
|
24
|
+
if corpNum.length != 10
|
25
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
26
|
+
end
|
27
|
+
httpget("/FAX/?TG=#{togo}", corpNum, userID)['url']
|
28
|
+
end
|
29
|
+
|
30
|
+
def getUnitCost(corpNum, userID = '')
|
31
|
+
if corpNum.length != 10
|
32
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
33
|
+
end
|
34
|
+
httpget("/FAX/UnitCost", corpNum, userID)['unitCost']
|
35
|
+
end
|
36
|
+
|
37
|
+
def search(corpNum, sDate, eDate, state, reserveYN, senderOnly, page, perPage,
|
38
|
+
order, userID = '')
|
39
|
+
if corpNum.length != 10
|
40
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
41
|
+
end
|
42
|
+
if sDate.to_s == ''
|
43
|
+
raise PopbillException.new('-99999999', '시작일자가 입력되지 않았습니다.')
|
44
|
+
end
|
45
|
+
if eDate.to_s == ''
|
46
|
+
raise PopbillException.new('-99999999', '종료일자가 입력되지 않았습니다.')
|
47
|
+
end
|
48
|
+
|
49
|
+
uri = "/FAX/Search?SDate=#{sDate}&EDate=#{eDate}"
|
50
|
+
uri += "&State=" + state.join(',')
|
51
|
+
uri += "&ReserveYN=" + reserveYN
|
52
|
+
uri += "&SenderOnly=" + senderOnly
|
53
|
+
uri += "&Page=" + page.to_s
|
54
|
+
uri += "&PerPage=" + perPage.to_s
|
55
|
+
uri += "&Order=" + order
|
56
|
+
|
57
|
+
httpget(URI.escape(uri), corpNum, userID)
|
58
|
+
end
|
59
|
+
|
60
|
+
def sendFax(corpNum, senderNum, senderName, receiverNum, receiverName, filePath,
|
61
|
+
reserveDT = '', userID = '')
|
62
|
+
if corpNum.length != 10
|
63
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
64
|
+
end
|
65
|
+
|
66
|
+
receiver = [
|
67
|
+
{
|
68
|
+
"rcv" => receiverNum,
|
69
|
+
"rcvnm" => receiverName,
|
70
|
+
}
|
71
|
+
]
|
72
|
+
|
73
|
+
sendFax_multi(corpNum, senderNum, senderName, receiver, filePath, reserveDT, userID)
|
74
|
+
end
|
75
|
+
|
76
|
+
def sendFax_multi(corpNum, senderNum, senderName, receivers, filePaths,
|
77
|
+
reserveDT = '', userID = '')
|
78
|
+
if corpNum.length != 10
|
79
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
80
|
+
end
|
81
|
+
|
82
|
+
postData = {}
|
83
|
+
postData["snd"] = senderNum
|
84
|
+
postData["sndnm"] = senderName
|
85
|
+
postData["fCnt"] = filePaths.length
|
86
|
+
postData["sndDT"] = reserveDT
|
87
|
+
postData["rcvs"] = receivers
|
88
|
+
|
89
|
+
httppostfile("/FAX", corpNum, postData, filePaths, userID)['receiptNum']
|
90
|
+
end
|
91
|
+
|
92
|
+
def getFaxDetail(corpNum, receiptNum, userID = '')
|
93
|
+
if corpNum.length != 10
|
94
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
95
|
+
end
|
96
|
+
|
97
|
+
httpget("/FAX/#{receiptNum}", corpNum, userID)
|
98
|
+
end
|
99
|
+
|
100
|
+
def cancelReserve(corpNum, receiptNum, userID = '')
|
101
|
+
if corpNum.length != 10
|
102
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
103
|
+
end
|
104
|
+
|
105
|
+
httpget("/FAX/#{receiptNum}/Cancel", corpNum, userID)
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
end # end of FaxService
|
data/lib/htCashbill.rb
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require_relative './popbill.rb'
|
3
|
+
|
4
|
+
# 팝빌 홈택스 현금영수증 연계 API Service Implementation
|
5
|
+
class HTCashbillService < BaseService
|
6
|
+
class << self
|
7
|
+
def instance(linkID, secretKey)
|
8
|
+
super(linkID, secretKey)
|
9
|
+
@instance ||= new
|
10
|
+
@instance.addScope("141")
|
11
|
+
return @instance
|
12
|
+
end
|
13
|
+
private :new
|
14
|
+
end
|
15
|
+
|
16
|
+
def getChargeInfo(corpNum, userID = "")
|
17
|
+
if corpNum.length != 10
|
18
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
19
|
+
end
|
20
|
+
httpget("/HomeTax/Cashbill/ChargeInfo", corpNum, userID)
|
21
|
+
end
|
22
|
+
|
23
|
+
def requestJob(corpNum, type, sDate, eDate, userID = "")
|
24
|
+
if corpNum.length != 10
|
25
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
26
|
+
end
|
27
|
+
if sDate.to_s == ''
|
28
|
+
raise PopbillException.new('-99999999', '시작일자가 입력되지 않았습니다.')
|
29
|
+
end
|
30
|
+
if eDate.to_s == ''
|
31
|
+
raise PopbillException.new('-99999999', '종료일자가 입력되지 않았습니다.')
|
32
|
+
end
|
33
|
+
|
34
|
+
uri = "/HomeTax/Cashbill/#{type}?SDate=#{sDate}&EDate=#{eDate}"
|
35
|
+
|
36
|
+
httppost(uri, corpNum, "", "", userID)['jobID']
|
37
|
+
end
|
38
|
+
|
39
|
+
def getJobState(corpNum, jobID, userID = "")
|
40
|
+
if corpNum.length != 10
|
41
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
42
|
+
end
|
43
|
+
if jobID.to_s == ''
|
44
|
+
raise PopbillException.new('-99999999', '작업아이디(jobID)가 입력되지 않았습니다.')
|
45
|
+
end
|
46
|
+
|
47
|
+
httpget("/HomeTax/Cashbill/#{jobID}/State", corpNum, userID)
|
48
|
+
end
|
49
|
+
|
50
|
+
def listActiveJob(corpNum, userID = "")
|
51
|
+
if corpNum.length != 10
|
52
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
53
|
+
end
|
54
|
+
|
55
|
+
httpget("/HomeTax/Cashbill/JobList", corpNum, userID)
|
56
|
+
end
|
57
|
+
|
58
|
+
def search(corpNum, jobID, tradeType, tradeUsage, page, perPage, order, userID = '')
|
59
|
+
if corpNum.length != 10
|
60
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
61
|
+
end
|
62
|
+
if jobID.length != 18
|
63
|
+
raise PopbillException.new('-99999999', '작업아이디(jobID)가 올바르지 않습니다.')
|
64
|
+
end
|
65
|
+
|
66
|
+
uri = "/HomeTax/Cashbill/#{jobID}"
|
67
|
+
uri += "?TradeType=" + tradeType.join(',')
|
68
|
+
uri += "&TradeUsage=" + tradeUsage.join(',')
|
69
|
+
uri += "&Page=" + page.to_s
|
70
|
+
uri += "&PerPage=" + perPage.to_s
|
71
|
+
uri += "&Order=" + order
|
72
|
+
|
73
|
+
httpget(URI.escape(uri), corpNum, userID)
|
74
|
+
end
|
75
|
+
|
76
|
+
def summary(corpNum, jobID, tradeType, tradeUsage, userID = '')
|
77
|
+
if corpNum.length != 10
|
78
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
79
|
+
end
|
80
|
+
if jobID.length != 18
|
81
|
+
raise PopbillException.new('-99999999', '작업아이디(jobID)가 올바르지 않습니다.')
|
82
|
+
end
|
83
|
+
|
84
|
+
uri = "/HomeTax/Cashbill/#{jobID}/Summary"
|
85
|
+
uri += "?TradeType=" + tradeType.join(',')
|
86
|
+
uri += "&TradeUsage=" + tradeUsage.join(',')
|
87
|
+
|
88
|
+
httpget(URI.escape(uri), corpNum, userID)
|
89
|
+
end
|
90
|
+
|
91
|
+
def getFlatRatePopUpURL(corpNum, userID = "")
|
92
|
+
if corpNum.length != 10
|
93
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
94
|
+
end
|
95
|
+
|
96
|
+
httpget("/HomeTax/Cashbill?TG=CHRG", corpNum, userID)['url']
|
97
|
+
end
|
98
|
+
|
99
|
+
def getCertificatePopUpURL(corpNum, userID = "")
|
100
|
+
if corpNum.length != 10
|
101
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
102
|
+
end
|
103
|
+
|
104
|
+
httpget("/HomeTax/Cashbill?TG=CERT", corpNum, userID)['url']
|
105
|
+
end
|
106
|
+
|
107
|
+
def getFlatRateState(corpNum, userID = "")
|
108
|
+
if corpNum.length != 10
|
109
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
110
|
+
end
|
111
|
+
|
112
|
+
httpget("/HomeTax/Cashbill/Contract", corpNum, userID)
|
113
|
+
end
|
114
|
+
|
115
|
+
def getCertificateExpireDate(corpNum, userID = "")
|
116
|
+
if corpNum.length != 10
|
117
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
118
|
+
end
|
119
|
+
|
120
|
+
httpget("/HomeTax/Cashbill/CertInfo", corpNum, userID)['certificateExpiration']
|
121
|
+
end
|
122
|
+
|
123
|
+
end # end of HTCashbillService
|