popbill 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/popbill/fax.rb +90 -21
- data/lib/popbill/kakaotalk.rb +220 -0
- data/lib/popbill/message.rb +96 -52
- data/lib/popbill/taxinvoice.rb +14 -0
- data/lib/popbill.rb +8 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f7cc3d24260e8d0357184b85867f04f16a3040f
|
4
|
+
data.tar.gz: bd60c1eadec296a587fe95a566f62757a6c6388b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a52baf5909c94324c134b80f0c16564d3cdd5797672c0a4be3e43a0e4da8869eb9121176908453211c51889e7ecedc2f1c72e5a286d83cf04643f1491491e01
|
7
|
+
data.tar.gz: 81e639baea8a2932f9b8984b01a406366b53cb494da2533145d4457dfaee63f124ac3d6f9c803770ec552162885121585e771bab3829375865d91680452c370a
|
data/lib/popbill/fax.rb
CHANGED
@@ -10,6 +10,7 @@ class FaxService < BaseService
|
|
10
10
|
@instance.addScope("160")
|
11
11
|
return @instance
|
12
12
|
end
|
13
|
+
|
13
14
|
private :new
|
14
15
|
end
|
15
16
|
|
@@ -42,19 +43,19 @@ class FaxService < BaseService
|
|
42
43
|
end
|
43
44
|
|
44
45
|
def search(corpNum, sDate, eDate, state, reserveYN, senderOnly, page, perPage,
|
45
|
-
|
46
|
+
order, userID = '')
|
46
47
|
if corpNum.length != 10
|
47
|
-
|
48
|
+
raise PopbillException.new(-99999999, '사업자등록번호가 올바르지 않습니다.')
|
48
49
|
end
|
49
50
|
if sDate.to_s == ''
|
50
|
-
raise PopbillException.new(
|
51
|
+
raise PopbillException.new(-99999999, '시작일자가 입력되지 않았습니다.')
|
51
52
|
end
|
52
53
|
if eDate.to_s == ''
|
53
|
-
raise PopbillException.new(
|
54
|
+
raise PopbillException.new(-99999999, '종료일자가 입력되지 않았습니다.')
|
54
55
|
end
|
55
56
|
|
56
57
|
uri = "/FAX/Search?SDate=#{sDate}&EDate=#{eDate}"
|
57
|
-
uri += "&State=" + state.join(',')
|
58
|
+
uri += "&State=" + state.join(',') if state.to_s != ''
|
58
59
|
uri += "&ReserveYN=" + reserveYN
|
59
60
|
uri += "&SenderOnly=" + senderOnly
|
60
61
|
uri += "&Page=" + page.to_s
|
@@ -65,23 +66,23 @@ class FaxService < BaseService
|
|
65
66
|
end
|
66
67
|
|
67
68
|
def sendFax(corpNum, senderNum, senderName, receiverNum, receiverName, filePath,
|
68
|
-
|
69
|
+
reserveDT = '', userID = '', adsYN = false, title = '', requestNum = '')
|
69
70
|
if corpNum.length != 10
|
70
71
|
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
71
72
|
end
|
72
73
|
|
73
74
|
receiver = [
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
{
|
76
|
+
"rcv" => receiverNum,
|
77
|
+
"rcvnm" => receiverName,
|
78
|
+
}
|
78
79
|
]
|
79
80
|
|
80
|
-
sendFax_multi(corpNum, senderNum, senderName, receiver, filePath, reserveDT, userID, adsYN, title)
|
81
|
+
sendFax_multi(corpNum, senderNum, senderName, receiver, filePath, reserveDT, userID, adsYN, title, requestNum)
|
81
82
|
end
|
82
83
|
|
83
84
|
def sendFax_multi(corpNum, senderNum, senderName, receivers, filePaths,
|
84
|
-
|
85
|
+
reserveDT = '', userID = '', adsYN = false, title = '', requestNum = '')
|
85
86
|
if corpNum.length != 10
|
86
87
|
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
87
88
|
end
|
@@ -93,6 +94,7 @@ class FaxService < BaseService
|
|
93
94
|
postData["sndDT"] = reserveDT
|
94
95
|
postData["rcvs"] = receivers
|
95
96
|
postData["title"] = title
|
97
|
+
postData["requestNum"] = requestNum
|
96
98
|
|
97
99
|
if adsYN
|
98
100
|
postData["adsYN"] = adsYN
|
@@ -102,27 +104,26 @@ class FaxService < BaseService
|
|
102
104
|
end
|
103
105
|
|
104
106
|
def resendFax(corpNum, receiptNum, senderNum, senderName, receiveNum, receiveName,
|
105
|
-
|
107
|
+
reserveDT = '', userID = '', title = '', requestNum = '')
|
106
108
|
if receiptNum.to_s == ''
|
107
109
|
raise PopbillException.new('-99999999', '팩스접수번호(receiptNum)가 입력되지 않았습니다.')
|
108
110
|
end
|
109
111
|
|
110
112
|
receiver = nil
|
111
|
-
|
112
113
|
if receiveNum.to_s != '' || receiveName.to_s != ''
|
113
114
|
receiver = [
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
115
|
+
{
|
116
|
+
"rcv" => receiveNum,
|
117
|
+
"rcvnm" => receiveName,
|
118
|
+
}
|
118
119
|
]
|
119
120
|
end
|
120
121
|
|
121
|
-
resendFax_multi(corpNum, receiptNum, senderNum, senderName, receiver, reserveDT, userID, title)
|
122
|
+
resendFax_multi(corpNum, receiptNum, senderNum, senderName, receiver, reserveDT, userID, title, requestNum)
|
122
123
|
end
|
123
124
|
|
124
|
-
def resendFax_multi(corpNum, receiptNum, senderNum ='', senderName='', receivers = nil,
|
125
|
-
|
125
|
+
def resendFax_multi(corpNum, receiptNum, senderNum = '', senderName = '', receivers = nil,
|
126
|
+
reserveDT = '', userID = '', title = '', requestNum = '')
|
126
127
|
if corpNum.length != 10
|
127
128
|
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
128
129
|
end
|
@@ -133,16 +134,59 @@ class FaxService < BaseService
|
|
133
134
|
postData["sndDT"] = reserveDT
|
134
135
|
postData["rcvs"] = receivers
|
135
136
|
postData["title"] = title
|
137
|
+
postData["requestNum"] = requestNum
|
136
138
|
|
137
139
|
postData = postData.to_json
|
138
140
|
|
139
141
|
httppost("/FAX/#{receiptNum}", corpNum, postData, "", userID)['receiptNum']
|
140
142
|
end
|
141
143
|
|
144
|
+
def resendFAXRN(corpNum, orgRequestNum, senderNum, senderName, receiveNum, receiveName,
|
145
|
+
reserveDT = '', userID = '', title = '', requestNum = '')
|
146
|
+
|
147
|
+
receiver = nil
|
148
|
+
|
149
|
+
if receiveNum.to_s != '' || receiveName.to_s != ''
|
150
|
+
receiver = [
|
151
|
+
{
|
152
|
+
"rcv" => receiveNum,
|
153
|
+
"rcvnm" => receiveName,
|
154
|
+
}
|
155
|
+
]
|
156
|
+
end
|
157
|
+
|
158
|
+
resendFAXRN_multi(corpNum, orgRequestNum, senderNum, senderName, receiver, reserveDT, userID, title, requestNum)
|
159
|
+
end
|
160
|
+
|
161
|
+
def resendFAXRN_multi(corpNum, orgRequestNum, senderNum = '', senderName = '', receivers = nil,
|
162
|
+
reserveDT = '', userID = '', title = '', requestNum = '')
|
163
|
+
if corpNum.length != 10
|
164
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
165
|
+
end
|
166
|
+
if orgRequestNum.to_s == ''
|
167
|
+
raise PopbillException.new(-99999999, "원본 팩스 요청번호가 입력되지 않았습니다.")
|
168
|
+
end
|
169
|
+
|
170
|
+
postData = {}
|
171
|
+
postData["snd"] = senderNum
|
172
|
+
postData["sndnm"] = senderName
|
173
|
+
postData["sndDT"] = reserveDT
|
174
|
+
postData["rcvs"] = receivers
|
175
|
+
postData["title"] = title
|
176
|
+
postData["requestNum"] = requestNum
|
177
|
+
|
178
|
+
postData = postData.to_json
|
179
|
+
|
180
|
+
httppost("/FAX/Resend/#{orgRequestNum}", corpNum, postData, "", userID)['receiptNum']
|
181
|
+
end
|
182
|
+
|
142
183
|
def getFaxDetail(corpNum, receiptNum, userID = '')
|
143
184
|
if corpNum.length != 10
|
144
185
|
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
145
186
|
end
|
187
|
+
if receiptNum.to_s == ''
|
188
|
+
raise PopbillException.new(-99999999, "접수번호(receiptNum)가 입력되지 않았습니다.")
|
189
|
+
end
|
146
190
|
|
147
191
|
httpget("/FAX/#{receiptNum}", corpNum, userID)
|
148
192
|
end
|
@@ -151,10 +195,35 @@ class FaxService < BaseService
|
|
151
195
|
if corpNum.length != 10
|
152
196
|
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
153
197
|
end
|
198
|
+
if receiptNum.to_s == ''
|
199
|
+
raise PopbillException.new(-99999999, "접수번호(receiptNum)가 입력되지 않았습니다.")
|
200
|
+
end
|
154
201
|
|
155
202
|
httpget("/FAX/#{receiptNum}/Cancel", corpNum, userID)
|
156
203
|
end
|
157
204
|
|
158
205
|
|
206
|
+
def getFaxDetailRN(corpNum, requestNum, userID = '')
|
207
|
+
if corpNum.length != 10
|
208
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
209
|
+
end
|
210
|
+
if requestNum.to_s == ''
|
211
|
+
raise PopbillException.new(-99999999, "요청번호(requestNum)가 입력되지 않았습니다.")
|
212
|
+
end
|
213
|
+
|
214
|
+
httpget("/FAX/Get/#{requestNum}", corpNum, userID)
|
215
|
+
end
|
216
|
+
|
217
|
+
|
218
|
+
def cancelReserveRN(corpNum, requestNum, userID = '')
|
219
|
+
if corpNum.length != 10
|
220
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
221
|
+
end
|
222
|
+
if requestNum.to_s == ''
|
223
|
+
raise PopbillException.new(-99999999, "요청번호(requestNum)가 입력되지 않았습니다.")
|
224
|
+
end
|
225
|
+
|
226
|
+
httpget("/FAX/Cancel/#{requestNum}", corpNum, userID)
|
227
|
+
end
|
159
228
|
|
160
229
|
end # end of FaxService
|
@@ -0,0 +1,220 @@
|
|
1
|
+
# -* coding: utf-8 -*-
|
2
|
+
require_relative '../popbill.rb'
|
3
|
+
|
4
|
+
# 팝빌 카카오톡 API Service Implementation
|
5
|
+
class KakaoService < BaseService
|
6
|
+
class << self
|
7
|
+
def instance(linkID, secretKey)
|
8
|
+
super(linkID, secretKey)
|
9
|
+
@instance ||= new
|
10
|
+
@instance.addScope("153")
|
11
|
+
@instance.addScope("154")
|
12
|
+
@instance.addScope("155")
|
13
|
+
return @instance
|
14
|
+
end
|
15
|
+
|
16
|
+
private :new
|
17
|
+
end
|
18
|
+
|
19
|
+
def getURL(corpNum, togo, userID = '')
|
20
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
21
|
+
|
22
|
+
(togo == "SENDER") ?
|
23
|
+
httpget("/Message/?TG=#{togo}", corpNum, userID)['url'] :
|
24
|
+
httpget("/KakaoTalk/?TG=#{togo}", corpNum, userID)['url']
|
25
|
+
end
|
26
|
+
|
27
|
+
def listPlusFriendID(corpNum, userID = '')
|
28
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
29
|
+
|
30
|
+
httpget("/KakaoTalk/ListPlusFriendID", corpNum, userID)
|
31
|
+
end
|
32
|
+
|
33
|
+
def getSenderNumberList(corpNum, userID = '')
|
34
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
35
|
+
|
36
|
+
httpget("/Message/SenderNumber", corpNum, userID)
|
37
|
+
end
|
38
|
+
|
39
|
+
def listATSTemplate(corpNum, userID = '')
|
40
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
41
|
+
|
42
|
+
httpget("/KakaoTalk/ListATSTemplate", corpNum, userID)
|
43
|
+
end
|
44
|
+
|
45
|
+
def sendATS_one(corpNum, templateCode, snd, content, altContent, altSendType, sndDT, receiver, receiverName, requestNum = '', userID = '')
|
46
|
+
msg = [
|
47
|
+
{
|
48
|
+
"rcv" => receiver,
|
49
|
+
"rcvnm" => receiverName,
|
50
|
+
"msg" => content,
|
51
|
+
"altmsg" => altContent,
|
52
|
+
}
|
53
|
+
]
|
54
|
+
sendATS_same(corpNum, templateCode, snd, "", "", altSendType, sndDT, msg, requestNum, userID)
|
55
|
+
end
|
56
|
+
|
57
|
+
def sendATS_multi(corpNum, templateCode, snd, altSendType, sndDT, msgs, requestNum = '', userID = '')
|
58
|
+
sendATS_same(corpNum, templateCode, snd, "", "", altSendType, sndDT, msgs, requestNum, userID)
|
59
|
+
end
|
60
|
+
|
61
|
+
def sendATS_same(corpNum, templateCode, snd, content, altContent, altSendType, sndDT, msgs, requestNum = '', userID = '')
|
62
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
63
|
+
raise PopbillException.new(-99999999, "알림톡 템플릿코드가 입력되지 않았습니다.") if templateCode.to_s == ''
|
64
|
+
raise PopbillException.new(-99999999, "발신번호가 입력되지 않았습니다.") if snd.to_s == ''
|
65
|
+
|
66
|
+
req = {}
|
67
|
+
req["templateCode"] = templateCode if templateCode.to_s != ''
|
68
|
+
req["snd"] = snd if snd.to_s != ''
|
69
|
+
req["content"] = content if content.to_s != ''
|
70
|
+
req["altContent"] = altContent if altContent.to_s != ''
|
71
|
+
req["altSendType"] = altSendType if altSendType.to_s != ''
|
72
|
+
req["sndDT"] = sndDT if sndDT.to_s != ''
|
73
|
+
req["requestNum"] = requestNum if requestNum.to_s != ''
|
74
|
+
req["msgs"] = msgs if msgs.to_s != ''
|
75
|
+
|
76
|
+
postData = req.to_json
|
77
|
+
httppost("/ATS", corpNum, postData, "", userID)
|
78
|
+
end
|
79
|
+
|
80
|
+
def sendFTS_one(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, receiver, receiverName, btns, adsYN = false, requestNum = '', userID = '')
|
81
|
+
msg = [
|
82
|
+
{
|
83
|
+
"rcv" => receiver,
|
84
|
+
"rcvnm" => receiverName,
|
85
|
+
"msg" => content,
|
86
|
+
"altmsg" => altContent,
|
87
|
+
}
|
88
|
+
]
|
89
|
+
sendFTS_same(corpNum, plusFriendID, snd, "", "", altSendType, sndDT, msg, btns, adsYN, requestNum, userID)
|
90
|
+
end
|
91
|
+
|
92
|
+
def sendFTS_multi(corpNum, plusFriendID, snd, altSendType, sndDT, msgs, btns, adsYN = false, requestNum = '', userID = '')
|
93
|
+
sendFTS_same(corpNum, plusFriendID, snd, "", "", altSendType, sndDT, msgs, btns, adsYN, requestNum, userID)
|
94
|
+
end
|
95
|
+
|
96
|
+
def sendFTS_same(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, msgs, btns, adsYN = false, requestNum = '', userID = '')
|
97
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
98
|
+
raise PopbillException.new(-99999999, "플러스친구 아이디가 입력되지 않았습니다.") if plusFriendID.to_s == ''
|
99
|
+
raise PopbillException.new(-99999999, "발신번호가 입력되지 않았습니다.") if snd.to_s == ''
|
100
|
+
|
101
|
+
req = {}
|
102
|
+
req["plusFriendID"] = plusFriendID if plusFriendID.to_s != ''
|
103
|
+
req["snd"] = snd if snd.to_s != ''
|
104
|
+
req["content"] = content if content.to_s != ''
|
105
|
+
req["altContent"] = altContent if altContent.to_s != ''
|
106
|
+
req["altSendType"] = altSendType if altSendType.to_s != ''
|
107
|
+
req["sndDT"] = sndDT if sndDT.to_s != ''
|
108
|
+
req["msgs"] = msgs if msgs.to_s != ''
|
109
|
+
req["btns"] = btns if btns.to_s != ''
|
110
|
+
req["adsYN"] = adsYN if adsYN.to_s != ''
|
111
|
+
req["requestNum"] = requestNum if requestNum.to_s != ''
|
112
|
+
|
113
|
+
postData = req.to_json
|
114
|
+
httppost("/FTS", corpNum, postData, "", userID)
|
115
|
+
end
|
116
|
+
|
117
|
+
def sendFMS_one(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, filePath, imageURL, receiver, receiverName, btns, adsYN = false, requestNum = '', userID = '')
|
118
|
+
msg = [
|
119
|
+
{
|
120
|
+
"rcv" => receiver,
|
121
|
+
"rcvnm" => receiverName,
|
122
|
+
"msg" => content,
|
123
|
+
"altmsg" => altContent,
|
124
|
+
}
|
125
|
+
]
|
126
|
+
sendFMS_same(corpNum, plusFriendID, snd, "", "", altSendType, sndDT, filePath, imageURL, msg, btns, adsYN, requestNum, userID)
|
127
|
+
end
|
128
|
+
|
129
|
+
def sendFMS_multi(corpNum, plusFriendID, snd, altSendType, sndDT, filePath, imageURL, msgs, btns, adsYN = false, requestNum = '', userID = '')
|
130
|
+
sendFMS_same(corpNum, plusFriendID, snd, "", "", altSendType, sndDT, filePath, imageURL, msgs, btns, adsYN, requestNum, userID)
|
131
|
+
end
|
132
|
+
|
133
|
+
def sendFMS_same(corpNum, plusFriendID, snd, content, altContent, altSendType, sndDT, filePath, imageURL, msgs, btns, adsYN = false, requestNum = '', userID = '')
|
134
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
135
|
+
raise PopbillException.new(-99999999, "플러스친구 아이디가 입력되지 않았습니다.") if plusFriendID.to_s == ''
|
136
|
+
raise PopbillException.new(-99999999, "발신번호가 입력되지 않았습니다.") if snd.to_s == ''
|
137
|
+
|
138
|
+
req = {}
|
139
|
+
req["plusFriendID"] = plusFriendID if plusFriendID.to_s != ''
|
140
|
+
req["snd"] = snd if snd.to_s != ''
|
141
|
+
req["content"] = content if content.to_s != ''
|
142
|
+
req["altContent"] = altContent if altContent.to_s != ''
|
143
|
+
req["altSendType"] = altSendType if altSendType.to_s != ''
|
144
|
+
req["sndDT"] = sndDT if sndDT.to_s != ''
|
145
|
+
req["imageURL"] = imageURL if imageURL.to_s != ''
|
146
|
+
req["msgs"] = msgs if msgs.to_s != ''
|
147
|
+
req["btns"] = btns if btns.to_s != ''
|
148
|
+
req["adsYN"] = adsYN if adsYN.to_s != ''
|
149
|
+
req["requestNum"] = requestNum if requestNum.to_s != ''
|
150
|
+
|
151
|
+
httppostfile("/FMS", corpNum, req, [filePath], userID)
|
152
|
+
end
|
153
|
+
|
154
|
+
def cancelReserve(corpNum, receiptNum, userID = '')
|
155
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
156
|
+
raise PopbillException.new(-99999999, "접수번호(receiptNum)가 입력되지 않았습니다.") if receiptNum.to_s == ''
|
157
|
+
|
158
|
+
httpget("/KakaoTalk/#{receiptNum}/Cancel", corpNum, userID)
|
159
|
+
end
|
160
|
+
|
161
|
+
def cancelReserveRN(corpNum, requestNum, userID = '')
|
162
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
163
|
+
raise PopbillException.new(-99999999, "요청번호(requestNum)가 입력되지 않았습니다.") if requestNum.to_s == ''
|
164
|
+
|
165
|
+
httpget("/KakaoTalk/Cancel/#{requestNum}", corpNum, userID)
|
166
|
+
end
|
167
|
+
|
168
|
+
|
169
|
+
def getMessages(corpNum, receiptNum, userID = '')
|
170
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
171
|
+
raise PopbillException.new(-99999999, "접수번호(receiptNum)가 입력되지 않았습니다.") if receiptNum.to_s == ''
|
172
|
+
|
173
|
+
httpget("/KakaoTalk/#{receiptNum}", corpNum, userID)
|
174
|
+
end
|
175
|
+
|
176
|
+
def getMessagesRN(corpNum, requestNum, userID = '')
|
177
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
178
|
+
raise PopbillException.new(-99999999, "요청번호(requestNum)가 입력되지 않았습니다.") if requestNum.to_s == ''
|
179
|
+
|
180
|
+
httpget("/KakaoTalk/Get/#{requestNum}", corpNum, userID)
|
181
|
+
end
|
182
|
+
|
183
|
+
def search(corpNum, sDate, eDate, state, item, reserveYN, senderYN, page, perPage, order, userID = '')
|
184
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
185
|
+
raise PopbillException.new(-99999999, "시작일자가 입력되지 않았습니다.") if sDate.to_s == ''
|
186
|
+
raise PopbillException.new(-99999999, "종료일자가 입력되지 않았습니다.") if eDate.to_s == ''
|
187
|
+
|
188
|
+
uri = "/KakaoTalk/Search?SDate=#{sDate}&EDate=#{eDate}"
|
189
|
+
uri += "&State=" + state.join(',') if state.to_s != ''
|
190
|
+
uri += "&Item=" + item.join(',') if item.to_s != ''
|
191
|
+
uri += "&ReserveYN=" + reserveYN
|
192
|
+
uri += "&SenderYN=" + senderYN
|
193
|
+
uri += "&Page=" + page.to_s
|
194
|
+
uri += "&PerPage=" + perPage.to_s
|
195
|
+
uri += "&Order=" + order
|
196
|
+
|
197
|
+
httpget(URI.escape(uri), corpNum, userID)
|
198
|
+
end
|
199
|
+
|
200
|
+
|
201
|
+
def getUnitCost(corpNum, msgType, userID = '')
|
202
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
203
|
+
|
204
|
+
httpget("/KakaoTalk/UnitCost?Type=#{msgType}", corpNum, userID)
|
205
|
+
end
|
206
|
+
|
207
|
+
def getChargeInfo(corpNum, msgType, userID = '')
|
208
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
209
|
+
|
210
|
+
httpget("/KakaoTalk/ChargeInfo?Type=#{msgType}", corpNum, userID)
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
|
215
|
+
|
216
|
+
module KakaoMsgType
|
217
|
+
ATS = "ATS"
|
218
|
+
FTS = "FTS"
|
219
|
+
FMS = "FMS"
|
220
|
+
end
|
data/lib/popbill/message.rb
CHANGED
@@ -12,6 +12,7 @@ class MessageService < BaseService
|
|
12
12
|
@instance.addScope("152")
|
13
13
|
return @instance
|
14
14
|
end
|
15
|
+
|
15
16
|
private :new
|
16
17
|
end
|
17
18
|
|
@@ -45,7 +46,7 @@ class MessageService < BaseService
|
|
45
46
|
|
46
47
|
|
47
48
|
def sendMessage(msgType, corpNum, sender, senderName, subject, contents,
|
48
|
-
|
49
|
+
messages, reserveDT, adsYN = false, userID = '', requestNum = '')
|
49
50
|
|
50
51
|
if corpNum.length != 10
|
51
52
|
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
@@ -74,6 +75,9 @@ class MessageService < BaseService
|
|
74
75
|
if adsYN
|
75
76
|
req["adsYN"] = true
|
76
77
|
end
|
78
|
+
if requestNum.to_s != ''
|
79
|
+
req["requestNum"] = requestNum
|
80
|
+
end
|
77
81
|
|
78
82
|
postData = req.to_json
|
79
83
|
|
@@ -82,107 +86,108 @@ class MessageService < BaseService
|
|
82
86
|
|
83
87
|
|
84
88
|
def sendSMS(corpNum, sender, senderName, receiver, receiverName, contents,
|
85
|
-
|
89
|
+
reserveDT = '', adsYN = false, userID = '', requestNum = '')
|
86
90
|
|
87
91
|
messages = [
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
{
|
93
|
+
"snd" => sender,
|
94
|
+
"sndName" => senderName,
|
95
|
+
"rcv" => receiver,
|
96
|
+
"rcvnm" => receiverName,
|
97
|
+
"msg" => contents,
|
98
|
+
}
|
95
99
|
]
|
96
100
|
sendMessage("SMS", corpNum, '', '', '', '', messages, reserveDT,
|
97
|
-
|
101
|
+
adsYN, userID, requestNum
|
98
102
|
)
|
99
103
|
end
|
100
104
|
|
101
105
|
def sendSMS_multi(corpNum, sender, senderName, contents, messages, reserveDT = '',
|
102
|
-
|
106
|
+
adsYN = false, userID = '', requestNum = '')
|
103
107
|
|
104
108
|
sendMessage("SMS", corpNum, sender, senderName, '', contents, messages, reserveDT,
|
105
|
-
|
109
|
+
adsYN, userID, requestNum
|
106
110
|
)
|
107
111
|
end
|
108
112
|
|
109
113
|
|
110
114
|
def sendLMS(corpNum, sender, senderName, receiver, receiverName, subject, contents,
|
111
|
-
|
115
|
+
reserveDT = '', adsYN = false, userID = '', requestNum = '')
|
112
116
|
|
113
117
|
messages = [
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
{
|
119
|
+
"snd" => sender,
|
120
|
+
"sndName" => senderName,
|
121
|
+
"rcv" => receiver,
|
122
|
+
"rcvnm" => receiverName,
|
123
|
+
"msg" => contents,
|
124
|
+
"sjt" => subject,
|
125
|
+
}
|
122
126
|
]
|
123
127
|
|
124
128
|
sendMessage("LMS", corpNum, '', '', '', '', messages, reserveDT,
|
125
|
-
|
129
|
+
adsYN, userID, requestNum
|
126
130
|
)
|
127
131
|
end
|
128
132
|
|
129
|
-
def
|
130
|
-
|
133
|
+
def sendLMS_multi(corpNum, sender, senderName, subject, contents, messages,
|
134
|
+
reserveDT = '', adsYN = false, userID = '', requestNum = '')
|
131
135
|
|
132
|
-
sendMessage("
|
133
|
-
|
136
|
+
sendMessage("LMS", corpNum, sender, senderName, subject, contents, messages,
|
137
|
+
reserveDT, adsYN, userID, requestNum
|
134
138
|
)
|
135
139
|
end
|
136
140
|
|
141
|
+
|
137
142
|
def sendXMS(corpNum, sender, senderName, receiver, receiverName, subject, contents,
|
138
|
-
|
143
|
+
reserveDT = '', adsYN = false, userID = '', requestNum = '')
|
139
144
|
|
140
145
|
messages = [
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
146
|
+
{
|
147
|
+
"snd" => sender,
|
148
|
+
"sndName" => senderName,
|
149
|
+
"rcv" => receiver,
|
150
|
+
"rcvnm" => receiverName,
|
151
|
+
"msg" => contents,
|
152
|
+
"sjt" => subject,
|
153
|
+
}
|
149
154
|
]
|
150
155
|
|
151
156
|
sendMessage("XMS", corpNum, '', '', '', '', messages, reserveDT,
|
152
|
-
|
157
|
+
adsYN, userID, requestNum
|
153
158
|
)
|
154
159
|
end
|
155
160
|
|
156
|
-
def
|
157
|
-
|
161
|
+
def sendXMS_multi(corpNum, sender, senderName, subject, contents, messages,
|
162
|
+
reserveDT = '', adsYN = false, userID = '', requestNum = '')
|
158
163
|
|
159
|
-
sendMessage("
|
160
|
-
|
164
|
+
sendMessage("XMS", corpNum, sender, senderName, subject, contents, messages,
|
165
|
+
reserveDT, adsYN, userID, requestNum
|
161
166
|
)
|
162
167
|
end
|
163
168
|
|
164
169
|
|
165
170
|
def sendMMS(corpNum, sender, senderName, receiver, receiverName, subject, contents,
|
166
|
-
|
171
|
+
filePath, reserveDT = '', adsYN = false, userID = '', requestNum = '')
|
167
172
|
|
168
173
|
messages = [
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
174
|
+
{
|
175
|
+
"snd" => sender,
|
176
|
+
"sndnm" => senderName,
|
177
|
+
"rcv" => receiver,
|
178
|
+
"rcvnm" => receiverName,
|
179
|
+
"msg" => contents,
|
180
|
+
"sjt" => subject,
|
181
|
+
}
|
177
182
|
]
|
178
183
|
|
179
184
|
sendMMS_multi(corpNum, sender, senderName, subject, contents, messages, filePath,
|
180
|
-
|
185
|
+
reserveDT, adsYN, userID, requestNum
|
181
186
|
)
|
182
187
|
end
|
183
188
|
|
184
189
|
def sendMMS_multi(corpNum, sender, senderName, subject, contents, messages, filePath,
|
185
|
-
|
190
|
+
reserveDT = '', adsYN = false, userID = '', requestNum = '')
|
186
191
|
|
187
192
|
if corpNum.length != 10
|
188
193
|
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
@@ -212,6 +217,10 @@ class MessageService < BaseService
|
|
212
217
|
req["adsYN"] = true
|
213
218
|
end
|
214
219
|
|
220
|
+
if requestNum.to_s != ''
|
221
|
+
req["requestNum"] = requestNum
|
222
|
+
end
|
223
|
+
|
215
224
|
httppostfile("/MMS", corpNum, req, [filePath], userID)['receiptNum']
|
216
225
|
end
|
217
226
|
|
@@ -226,6 +235,17 @@ class MessageService < BaseService
|
|
226
235
|
httpget("/Message/#{receiptNum}", corpNum, userID)
|
227
236
|
end
|
228
237
|
|
238
|
+
def getMessagesRN(corpNum, requestNum, userID = '')
|
239
|
+
if corpNum.length != 10
|
240
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
241
|
+
end
|
242
|
+
if requestNum.to_s == ''
|
243
|
+
raise PopbillException.new(-99999999, "요청번호(requestNum)가 입력되지 않았습니다.")
|
244
|
+
end
|
245
|
+
|
246
|
+
httpget("/Message/Get/#{requestNum}", corpNum, userID)
|
247
|
+
end
|
248
|
+
|
229
249
|
def cancelReserve(corpNum, receiptNum, userID = '')
|
230
250
|
if corpNum.length != 10
|
231
251
|
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
@@ -237,6 +257,17 @@ class MessageService < BaseService
|
|
237
257
|
httpget("/Message/#{receiptNum}/Cancel", corpNum, userID)
|
238
258
|
end
|
239
259
|
|
260
|
+
def cancelReserveRN(corpNum, requestNum, userID = '')
|
261
|
+
if corpNum.length != 10
|
262
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
263
|
+
end
|
264
|
+
if requestNum.to_s == ''
|
265
|
+
raise PopbillException.new(-99999999, "요청번호(requestNum)가 입력되지 않았습니다.")
|
266
|
+
end
|
267
|
+
|
268
|
+
httpget("/Message/Cancel/#{requestNum}", corpNum, userID)
|
269
|
+
end
|
270
|
+
|
240
271
|
def getURL(corpNum, togo, userID = '')
|
241
272
|
if corpNum.length != 10
|
242
273
|
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
@@ -246,7 +277,7 @@ class MessageService < BaseService
|
|
246
277
|
end
|
247
278
|
|
248
279
|
def search(corpNum, sDate, eDate, state, item, reserveYN, senderYN, page, perPage,
|
249
|
-
|
280
|
+
order, userID = '')
|
250
281
|
if corpNum.length != 10
|
251
282
|
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
252
283
|
end
|
@@ -269,6 +300,19 @@ class MessageService < BaseService
|
|
269
300
|
httpget(URI.escape(uri), corpNum, userID)
|
270
301
|
end
|
271
302
|
|
303
|
+
def getStates(corpNum, reciptNumList, userID = '')
|
304
|
+
if corpNum.length != 10
|
305
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
306
|
+
end
|
307
|
+
unless reciptNumList.any?
|
308
|
+
raise PopbillException.new(-99999999, "접수번호 배열이 올바르지 않습니다.")
|
309
|
+
end
|
310
|
+
|
311
|
+
postData = reciptNumList.to_json
|
312
|
+
|
313
|
+
httppost("/Message/States", corpNum, postData, "", userID)
|
314
|
+
|
315
|
+
end
|
272
316
|
|
273
317
|
end # end of MessageService
|
274
318
|
|
data/lib/popbill/taxinvoice.rb
CHANGED
@@ -644,6 +644,20 @@ class TaxinvoiceService < BaseService
|
|
644
644
|
|
645
645
|
httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}/DetachStmt", corpNum, postData, "", userID)
|
646
646
|
end
|
647
|
+
|
648
|
+
def assignMgtKey(corpNum, mgtKeyType, itemKey, mgtKey, userID = '')
|
649
|
+
if corpNum.length != 10
|
650
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
651
|
+
end
|
652
|
+
if itemKey.to_s == ''
|
653
|
+
raise PopbillException.new('-99999999', '해당문서의 아이템키가 입력되지 않았습니다.')
|
654
|
+
end
|
655
|
+
|
656
|
+
String postDate = "MgtKey="+mgtKey
|
657
|
+
|
658
|
+
httppost("/Taxinvoice/#{itemKey}/#{mgtKeyType}", corpNum, postDate, "", userID, "application/x-www-form-urlencoded; charset=utf-8")
|
659
|
+
end
|
660
|
+
|
647
661
|
end # end of TaxinvoiceService
|
648
662
|
|
649
663
|
module MgtKeyType
|
data/lib/popbill.rb
CHANGED
@@ -122,13 +122,19 @@ class BaseService
|
|
122
122
|
end #end of httpget
|
123
123
|
|
124
124
|
# Request HTTP Post
|
125
|
-
def httppost(url, corpNum, postData, action = '', userID = '')
|
125
|
+
def httppost(url, corpNum, postData, action = '', userID = '', contentsType = '')
|
126
|
+
|
126
127
|
headers = {
|
127
128
|
"x-pb-version" => BaseService::POPBILL_APIVersion,
|
128
129
|
"Accept-Encoding" => "gzip,deflate",
|
129
|
-
"Content-Type" => "application/json; charset=utf8",
|
130
130
|
}
|
131
131
|
|
132
|
+
if contentsType == ''
|
133
|
+
headers["Content-Type"] = "application/json; charset=utf8"
|
134
|
+
else
|
135
|
+
headers["Content-Type"] = contentsType
|
136
|
+
end
|
137
|
+
|
132
138
|
if corpNum.to_s != ''
|
133
139
|
headers["Authorization"] = "Bearer " + getSession_Token(corpNum)
|
134
140
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: popbill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Linkhub Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: linkhub
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- lib/popbill/fax.rb
|
37
37
|
- lib/popbill/htCashbill.rb
|
38
38
|
- lib/popbill/htTaxinvoice.rb
|
39
|
+
- lib/popbill/kakaotalk.rb
|
39
40
|
- lib/popbill/message.rb
|
40
41
|
- lib/popbill/statement.rb
|
41
42
|
- lib/popbill/taxinvoice.rb
|