Class: CashbillService
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
#ipRestrictOnOff, #isTest, #linkhub, #scopes, #token_table
Class Method Summary
collapse
Instance Method Summary
collapse
-
#cancelIssue(corpNum, mgtKey, memo = '', userID = '') ⇒ Object
-
#checkMgtKeyInUse(corpNum, mgtKey, userID = '') ⇒ Object
-
#delete(corpNum, mgtKey, userID = '') ⇒ Object
-
#getChargeInfo(corpNum, userID = '') ⇒ Object
-
#getDetailInfo(corpNum, mgtKey, userID = '') ⇒ Object
-
#getEPrintURL(corpNum, mgtKey, userID = '') ⇒ Object
-
#getInfo(corpNum, mgtKey, userID = '') ⇒ Object
-
#getInfos(corpNum, mgtKeyList, userID = '') ⇒ Object
-
#getLogs(corpNum, mgtKey, userID = '') ⇒ Object
-
#getMailURL(corpNum, mgtKey, userID = '') ⇒ Object
-
#getMassPrintURL(corpNum, mgtKeyList, userID = '') ⇒ Object
-
#getPopUpURL(corpNum, mgtKey, userID = '') ⇒ Object
-
#getPrintURL(corpNum, mgtKey, userID = '') ⇒ Object
-
#getUnitCost(corpNum, userID = '') ⇒ Object
-
#getURL(corpNum, togo, userID = '') ⇒ Object
-
#issue(corpNum, mgtKey, memo = '', userID = '') ⇒ Object
-
#listEmailConfig(corpNum, userID = '') ⇒ Object
-
#register(corpNum, cashbill, userID = '') ⇒ Object
-
#registIssue(corpNum, cashbill, memo = '', userID = '', emailSubject = '') ⇒ Object
-
#revokeRegister(corpNum, mgtKey, orgConfirmNum, orgTradeDate, smssendYN = false, userID = '', isPartCancel = false, cancelType = nil, supplyCost = nil, tax = nil, serviceFee = nil, totalAmount = nil) ⇒ Object
-
#revokeRegistIssue(corpNum, mgtKey, orgConfirmNum, orgTradeDate, smssendYN = false, memo = "", userID = "", isPartCancel = false, cancelType = nil, supplyCost = nil, tax = nil, serviceFee = nil, totalAmount = nil) ⇒ Object
-
#search(corpNum, dType, sDate, eDate, state, tradeType, tradeUsage, taxationType, page, perPage, order, queryString = '', userID = '', tradeOpt = '') ⇒ Object
-
#sendEmail(corpNum, mgtKey, receiverMail, userID = '') ⇒ Object
-
#sendFax(corpNum, mgtKey, senderNum, receiverNum, userID = '') ⇒ Object
-
#sendSMS(corpNum, mgtKey, senderNum, receiverNum, contents, userID = '') ⇒ Object
-
#update(corpNum, mgtKey, cashbill, userID = '') ⇒ Object
-
#updateEmailConfig(corpNum, emailType, sendYN, userID = '') ⇒ Object
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, #setIpRestrictOnOff, #setIsTest, #updateContact, #updateCorpInfo
Class Method Details
.instance(linkID, secretKey) ⇒ Object
7
8
9
10
11
12
|
# File 'lib/popbill/cashbill.rb', line 7
def instance(linkID, secretKey)
super(linkID, secretKey)
@instance ||= new
@instance.addScope("140")
return @instance
end
|
Instance Method Details
#cancelIssue(corpNum, mgtKey, memo = '', userID = '') ⇒ Object
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
# File 'lib/popbill/cashbill.rb', line 157
def cancelIssue(corpNum, mgtKey, memo = '', userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
postData = {}
if memo.to_s != ''
postData["memo"] = memo
end
postData = postData.to_json
httppost("/Cashbill/#{mgtKey}", corpNum, postData, "CANCELISSUE", userID)
end
|
#checkMgtKeyInUse(corpNum, mgtKey, userID = '') ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/popbill/cashbill.rb', line 37
def checkMgtKeyInUse(corpNum, mgtKey, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
if mgtKey.to_s == ''
raise PopbillException.new(-99999999, "현금영수증 문서관리번호가 입력되지 않았습니다.")
end
begin
response = httpget("/Cashbill/#{mgtKey}", corpNum)
return response['itemKey'].length != 0
rescue PopbillException => pe
if pe.code == -14000003
return false
end
raise PopbillException.new(pe.code, pe.message)
end
end
|
#delete(corpNum, mgtKey, userID = '') ⇒ Object
173
174
175
176
177
178
179
|
# File 'lib/popbill/cashbill.rb', line 173
def delete(corpNum, mgtKey, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
httppost("/Cashbill/#{mgtKey}", corpNum, "", "DELETE", userID)
end
|
#getChargeInfo(corpNum, userID = '') ⇒ Object
16
17
18
19
20
21
|
# File 'lib/popbill/cashbill.rb', line 16
def getChargeInfo(corpNum, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
httpget('/Cashbill/ChargeInfo', corpNum, userID)
end
|
#getDetailInfo(corpNum, mgtKey, userID = '') ⇒ Object
244
245
246
247
248
249
250
251
252
253
|
# File 'lib/popbill/cashbill.rb', line 244
def getDetailInfo(corpNum, mgtKey, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
if mgtKey.to_s == ''
raise PopbillException.new('-99999999', '관리번호가 입력되지 않았습니다.')
end
httpget("/Cashbill/#{mgtKey}?Detail", corpNum, userID)
end
|
#getEPrintURL(corpNum, mgtKey, userID = '') ⇒ Object
378
379
380
381
382
383
384
385
386
387
|
# File 'lib/popbill/cashbill.rb', line 378
def getEPrintURL(corpNum, mgtKey, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
if mgtKey.to_s == ''
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
end
httpget("/Cashbill/#{mgtKey}?TG=EPRINT", corpNum, userID)['url']
end
|
#getInfo(corpNum, mgtKey, userID = '') ⇒ Object
218
219
220
221
222
223
224
225
226
227
|
# File 'lib/popbill/cashbill.rb', line 218
def getInfo(corpNum, mgtKey, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
if mgtKey.to_s == ''
raise PopbillException.new('-99999999', '관리번호가 입력되지 않았습니다.')
end
httpget("/Cashbill/#{mgtKey}", corpNum, userID)
end
|
#getInfos(corpNum, mgtKeyList, userID = '') ⇒ Object
230
231
232
233
234
235
236
237
238
239
240
241
|
# File 'lib/popbill/cashbill.rb', line 230
def getInfos(corpNum, mgtKeyList, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
unless mgtKeyList.any?
raise PopbillException.new('-99999999', '문서관리번호 배열이 올바르지 않습니다.')
end
postData = mgtKeyList.to_json
httppost("/Cashbill/States", corpNum, postData, "", userID)
end
|
#getLogs(corpNum, mgtKey, userID = '') ⇒ Object
333
334
335
336
337
338
339
340
341
|
# File 'lib/popbill/cashbill.rb', line 333
def getLogs(corpNum, mgtKey, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
if mgtKey.to_s == ''
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
end
httpget("/Cashbill/#{mgtKey}/Logs", corpNum, userID)
end
|
#getMailURL(corpNum, mgtKey, userID = '') ⇒ Object
366
367
368
369
370
371
372
373
374
375
|
# File 'lib/popbill/cashbill.rb', line 366
def getMailURL(corpNum, mgtKey, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
if mgtKey.to_s == ''
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
end
httpget("/Cashbill/#{mgtKey}?TG=MAIL", corpNum, userID)['url']
end
|
#getMassPrintURL(corpNum, mgtKeyList, userID = '') ⇒ Object
390
391
392
393
394
395
396
397
398
399
400
401
|
# File 'lib/popbill/cashbill.rb', line 390
def getMassPrintURL(corpNum, mgtKeyList, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
unless mgtKeyList.any?
raise PopbillException.new('-99999999', '문서관리번호 배열이 올바르지 않습니다.')
end
postData = mgtKeyList.to_json
httppost("/Cashbill/Prints", corpNum, postData, "", userID)['url']
end
|
344
345
346
347
348
349
350
351
352
353
|
# File 'lib/popbill/cashbill.rb', line 344
def (corpNum, mgtKey, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
if mgtKey.to_s == ''
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
end
httpget("/Cashbill/#{mgtKey}?TG=POPUP", corpNum, userID)['url']
end
|
#getPrintURL(corpNum, mgtKey, userID = '') ⇒ Object
355
356
357
358
359
360
361
362
363
364
|
# File 'lib/popbill/cashbill.rb', line 355
def getPrintURL(corpNum, mgtKey, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
if mgtKey.to_s == ''
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
end
httpget("/Cashbill/#{mgtKey}?TG=PRINT", corpNum, userID)['url']
end
|
#getUnitCost(corpNum, userID = '') ⇒ Object
30
31
32
33
34
35
|
# File 'lib/popbill/cashbill.rb', line 30
def getUnitCost(corpNum, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
httpget("/Cashbill?cfg=UNITCOST", corpNum, userID)['unitCost']
end
|
#getURL(corpNum, togo, userID = '') ⇒ Object
23
24
25
26
27
28
|
# File 'lib/popbill/cashbill.rb', line 23
def getURL(corpNum, togo, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
httpget("/Cashbill?TG=#{togo}", corpNum, userID)['url']
end
|
#issue(corpNum, mgtKey, memo = '', userID = '') ⇒ Object
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
# File 'lib/popbill/cashbill.rb', line 141
def issue(corpNum, mgtKey, memo = '', userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
postData = {}
if memo.to_s != ''
postData["memo"] = memo
end
postData = postData.to_json
httppost("/Cashbill/#{mgtKey}", corpNum, postData, "ISSUE", userID)
end
|
#listEmailConfig(corpNum, userID = '') ⇒ Object
404
405
406
407
408
409
410
|
# File 'lib/popbill/cashbill.rb', line 404
def listEmailConfig(corpNum, userID ='')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
httpget("/Cashbill/EmailSendConfig", corpNum, userID)
end
|
#register(corpNum, cashbill, userID = '') ⇒ Object
78
79
80
81
82
83
84
85
86
|
# File 'lib/popbill/cashbill.rb', line 78
def register(corpNum, cashbill, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
postData = cashbill.to_json
httppost("/Cashbill", corpNum, postData, "", userID)
end
|
#registIssue(corpNum, cashbill, memo = '', userID = '', emailSubject = '') ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/popbill/cashbill.rb', line 57
def registIssue(corpNum, cashbill, memo = '', userID = '', emailSubject = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
if memo.to_s != ''
cashbill["memo"] = memo
end
if emailSubject.to_s != ''
cashbill["emailSubject"] = emailSubject
end
postData = cashbill.to_json
puts postData
httppost("/Cashbill", corpNum, postData, "ISSUE", userID)
end
|
#revokeRegister(corpNum, mgtKey, orgConfirmNum, orgTradeDate, smssendYN = false, userID = '', isPartCancel = false, cancelType = nil, supplyCost = nil, tax = nil, serviceFee = nil, totalAmount = nil) ⇒ Object
취소현금영수증 임시저장 추가. 2017/08/18
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/popbill/cashbill.rb', line 111
def revokeRegister(corpNum, mgtKey, orgConfirmNum, orgTradeDate, smssendYN = false, userID = '',
isPartCancel = false, cancelType = nil, supplyCost = nil, tax = nil, serviceFee = nil, totalAmount = nil)
postData = {}
postData["mgtKey"] = mgtKey
postData["orgConfirmNum"] = orgConfirmNum
postData["orgTradeDate"] = orgTradeDate
postData["smssendYN"] = smssendYN
postData["isPartCancel"] = isPartCancel
postData["cancelType"] = cancelType
postData["supplyCost"] = supplyCost
postData["tax"] = tax
postData["serviceFee"] = serviceFee
postData["totalAmount"] = totalAmount
postData = postData.to_json
httppost("/Cashbill", corpNum, postData, "REVOKE", userID)
end
|
#revokeRegistIssue(corpNum, mgtKey, orgConfirmNum, orgTradeDate, smssendYN = false, memo = "", userID = "", isPartCancel = false, cancelType = nil, supplyCost = nil, tax = nil, serviceFee = nil, totalAmount = nil) ⇒ Object
취소현금영수증 즉시발행 추가. 2017/08/18
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/popbill/cashbill.rb', line 89
def revokeRegistIssue(corpNum, mgtKey, orgConfirmNum, orgTradeDate, smssendYN = false, memo = "", userID = "",
isPartCancel = false, cancelType = nil, supplyCost = nil, tax = nil, serviceFee = nil, totalAmount = nil)
postData = {}
postData["mgtKey"] = mgtKey
postData["orgConfirmNum"] = orgConfirmNum
postData["orgTradeDate"] = orgTradeDate
postData["smssendYN"] = smssendYN
postData["memo"] = memo
postData["isPartCancel"] = isPartCancel
postData["cancelType"] = cancelType
postData["supplyCost"] = supplyCost
postData["tax"] = tax
postData["serviceFee"] = serviceFee
postData["totalAmount"] = totalAmount
postData = postData.to_json
httppost("/Cashbill", corpNum, postData, "REVOKEISSUE", userID)
end
|
#search(corpNum, dType, sDate, eDate, state, tradeType, tradeUsage, taxationType, page, perPage, order, queryString = '', userID = '', tradeOpt = '') ⇒ Object
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
# File 'lib/popbill/cashbill.rb', line 181
def search(corpNum, dType, sDate, eDate, state, tradeType, tradeUsage,
taxationType, page, perPage, order, queryString = '', userID = '', tradeOpt = '')
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 = "/Cashbill/Search?DType=#{dType}&SDate=#{sDate}&EDate=#{eDate}"
uri += "&State=" + state.join(',')
uri += "&TradeUsage=" + tradeUsage.join(',')
uri += "&TradeType=" + tradeType.join(',')
uri += "&TaxationType=" + taxationType.join(',')
uri += "&Page=" + page.to_s
uri += "&PerPage=" + perPage.to_s
uri += "&Order=" + order
if queryString.to_s != ''
uri += "&QString=" + queryString
end
if tradeOpt.to_s != ''
uri += "&TradeOpt=" + tradeOpt.join(',')
end
httpget(URI.escape(uri), corpNum, userID)
end
|
#sendEmail(corpNum, mgtKey, receiverMail, userID = '') ⇒ Object
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
|
# File 'lib/popbill/cashbill.rb', line 255
def sendEmail(corpNum, mgtKey, receiverMail, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
if mgtKey.to_s == ''
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
end
postData = {}
if receiverMail.to_s != ''
postData["receiver"] = receiverMail
end
postData = postData.to_json
httppost("/Cashbill/#{mgtKey}", corpNum, postData, "EMAIL", userID)
end
|
#sendFax(corpNum, mgtKey, senderNum, receiverNum, userID = '') ⇒ Object
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
# File 'lib/popbill/cashbill.rb', line 306
def sendFax(corpNum, mgtKey, senderNum, receiverNum, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
if mgtKey.to_s == ''
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
end
if senderNum.to_s == ''
raise PopbillException.new('-99999999', '발신번호가 입력되지 않았습니다.')
end
if receiverNum.to_s == ''
raise PopbillException.new('-99999999', '수신번호가 입력되지 않았습니다.')
end
postData = {}
postData["sender"] = senderNum
postData["receiver"] = receiverNum
postData = postData.to_json
httppost("/Cashbill/#{mgtKey}", corpNum, postData, "FAX", userID)
end
|
#sendSMS(corpNum, mgtKey, senderNum, receiverNum, contents, userID = '') ⇒ Object
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
# File 'lib/popbill/cashbill.rb', line 275
def sendSMS(corpNum, mgtKey, senderNum, receiverNum, contents, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
if mgtKey.to_s == ''
raise PopbillException.new('-99999999', '문서관리번호 올바르지 않습니다.')
end
if senderNum.to_s == ''
raise PopbillException.new('-99999999', '발신번호가 입력되지 않았습니다.')
end
if receiverNum.to_s == ''
raise PopbillException.new('-99999999', '수신번호가 입력되지 않았습니다.')
end
if contents.to_s == ''
raise PopbillException.new('-99999999', '문자 메시지 내용이 입력되지 않았습니다.')
end
postData = {}
postData["sender"] = senderNum
postData["receiver"] = receiverNum
postData["contents"] = contents
postData = postData.to_json
httppost("/Cashbill/#{mgtKey}", corpNum, postData, "SMS", userID)
end
|
#update(corpNum, mgtKey, cashbill, userID = '') ⇒ Object
131
132
133
134
135
136
137
138
139
|
# File 'lib/popbill/cashbill.rb', line 131
def update(corpNum, mgtKey, cashbill, userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
postData = cashbill.to_json
httppost("/Cashbill/#{mgtKey}", corpNum, postData, "PATCH", userID)
end
|
#updateEmailConfig(corpNum, emailType, sendYN, userID = '') ⇒ Object
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
|
# File 'lib/popbill/cashbill.rb', line 412
def updateEmailConfig(corpNum, emailType, sendYN, userID = '')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
if emailType.to_s == ''
raise PopbillException.new('-99999999', '메일전송 타입이 입력되지 않았습니다.')
end
if sendYN.to_s == ''
raise PopbillException.new('-99999999', '메일전송 여부 항목이 입력되지 않았습니다.')
end
httppost("/Cashbill/EmailSendConfig?EmailType=#{emailType}&SendYN=#{sendYN}", corpNum, userID)
end
|