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
#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 = '') ⇒ 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, #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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
# File 'lib/popbill/cashbill.rb', line 147
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
163
164
165
166
167
168
169
|
# File 'lib/popbill/cashbill.rb', line 163
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
234
235
236
237
238
239
240
241
242
243
|
# File 'lib/popbill/cashbill.rb', line 234
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
368
369
370
371
372
373
374
375
376
377
|
# File 'lib/popbill/cashbill.rb', line 368
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
208
209
210
211
212
213
214
215
216
217
|
# File 'lib/popbill/cashbill.rb', line 208
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
220
221
222
223
224
225
226
227
228
229
230
231
|
# File 'lib/popbill/cashbill.rb', line 220
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
323
324
325
326
327
328
329
330
331
|
# File 'lib/popbill/cashbill.rb', line 323
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
356
357
358
359
360
361
362
363
364
365
|
# File 'lib/popbill/cashbill.rb', line 356
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
380
381
382
383
384
385
386
387
388
389
390
391
|
# File 'lib/popbill/cashbill.rb', line 380
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
|
334
335
336
337
338
339
340
341
342
343
|
# File 'lib/popbill/cashbill.rb', line 334
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
345
346
347
348
349
350
351
352
353
354
|
# File 'lib/popbill/cashbill.rb', line 345
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# File 'lib/popbill/cashbill.rb', line 131
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
394
395
396
397
398
399
400
|
# File 'lib/popbill/cashbill.rb', line 394
def listEmailConfig(corpNum, userID ='')
if corpNum.length != 10
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
end
httpget("/Cashbill/EmailSendConfig", corpNum, userID)
end
|
#register(corpNum, cashbill, userID = '') ⇒ Object
68
69
70
71
72
73
74
75
76
|
# File 'lib/popbill/cashbill.rb', line 68
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 = '') ⇒ Object
57
58
59
60
61
62
63
64
65
|
# File 'lib/popbill/cashbill.rb', line 57
def registIssue(corpNum, cashbill, memo = '', userID = '')
if corpNum.length != 10
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
end
postData = cashbill.to_json
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/popbill/cashbill.rb', line 101
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/popbill/cashbill.rb', line 79
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
171
172
173
174
175
176
177
178
179
180
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
|
# File 'lib/popbill/cashbill.rb', line 171
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
# File 'lib/popbill/cashbill.rb', line 245
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
# File 'lib/popbill/cashbill.rb', line 296
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
# File 'lib/popbill/cashbill.rb', line 265
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
121
122
123
124
125
126
127
128
129
|
# File 'lib/popbill/cashbill.rb', line 121
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
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
# File 'lib/popbill/cashbill.rb', line 402
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
|