popbill 1.17.2 → 1.51.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/popbill/accountCheck.rb +47 -5
- data/lib/popbill/cashbill.rb +14 -3
- data/lib/popbill/easyFinBank.rb +38 -12
- data/lib/popbill/fax.rb +33 -0
- data/lib/popbill/kakaotalk.rb +7 -0
- data/lib/popbill/statement.rb +9 -1
- data/lib/popbill/taxinvoice.rb +50 -0
- data/lib/popbill.rb +111 -19
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 736c15bce4f45e15f37277ad05efe203f0c581e0
|
4
|
+
data.tar.gz: e2cd1a29a4662cb1699d18f6538cfa8c62067827
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51cf1dd6e3ed2ec9fd91569ecf3496bfd9566da2517329508f83453cdec1089d8964bada787021aec9ded0ef9b6d5982a57a7b63d39b76303693489045fbf925
|
7
|
+
data.tar.gz: 5c942740d36afae6c42552b062c8dd7296ad1cd54e4d259eb9fa52021167f3bdf8cac611944b93e9ed14fd8158f0b8a257c7537a2ea3df319e91b14bdbef3664
|
data/lib/popbill/accountCheck.rb
CHANGED
@@ -8,23 +8,32 @@ class AccountCheckService < BaseService
|
|
8
8
|
super(linkID, secretKey)
|
9
9
|
@instance ||= new
|
10
10
|
@instance.addScope("182")
|
11
|
+
@instance.addScope("183")
|
11
12
|
return @instance
|
12
13
|
end
|
13
14
|
private :new
|
14
15
|
end
|
15
16
|
|
16
|
-
def getChargeInfo(corpNum, userID = '')
|
17
|
+
def getChargeInfo(corpNum, userID = '', serviceType = '')
|
17
18
|
if corpNum.length != 10
|
18
19
|
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
19
20
|
end
|
20
|
-
|
21
|
+
|
22
|
+
uri = "/EasyFin/AccountCheck/ChargeInfo?serviceType=" + serviceType
|
23
|
+
escapeURI = URI.escape(uri)
|
24
|
+
|
25
|
+
httpget(escapeURI, corpNum, userID)
|
21
26
|
end
|
22
27
|
|
23
|
-
def getUnitCost(corpNum, userID = '')
|
28
|
+
def getUnitCost(corpNum, userID = '', serviceType = '')
|
24
29
|
if corpNum.length != 10
|
25
30
|
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
26
31
|
end
|
27
|
-
|
32
|
+
|
33
|
+
uri = "/EasyFin/AccountCheck/UnitCost?serviceType=" + serviceType
|
34
|
+
escapeURI = URI.escape(uri)
|
35
|
+
|
36
|
+
httpget(escapeURI, corpNum, userID)['unitCost']
|
28
37
|
end
|
29
38
|
|
30
39
|
def checkAccountInfo(corpNum, bankCode, accountNumber, userID = '')
|
@@ -44,5 +53,38 @@ class AccountCheckService < BaseService
|
|
44
53
|
httppost(uri, corpNum, "", "", userID)
|
45
54
|
end
|
46
55
|
|
56
|
+
def checkDepositorInfo(corpNum, bankCode, accountNumber, identityNumType, identityNum, userID = '')
|
57
|
+
if corpNum.length != 10
|
58
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
59
|
+
end
|
60
|
+
if bankCode.to_s == ''
|
61
|
+
raise PopbillException.new(-99999999, '기관코드가 입력되지 않았습니다.')
|
62
|
+
end
|
63
|
+
if accountNumber.to_s == ''
|
64
|
+
raise PopbillException.new(-99999999, '계좌번호가 입력되지 않았습니다.')
|
65
|
+
end
|
66
|
+
if identityNumType == ''
|
67
|
+
raise PopbillException.new(-99999999, '등록번호 유형이 입력되지 않았습니다.')
|
68
|
+
end
|
69
|
+
if not identityNumType.match('^[PB]$')
|
70
|
+
raise PopbillException.new(-99999999,"등록번호 유형이 유효하지 않습니다.")
|
71
|
+
end
|
72
|
+
if identityNum == ''
|
73
|
+
raise PopbillException.new(-99999999,"등록번호가 입력되지 않았습니다.")
|
74
|
+
end
|
75
|
+
if not identityNum.match('^\d+$')
|
76
|
+
raise PopbillException.new(-99999999,"등록번호는 숫자만 입력할 수 있습니다.")
|
77
|
+
end
|
78
|
+
|
79
|
+
uri = "/EasyFin/DepositorCheck"
|
80
|
+
uri += "?c="+bankCode
|
81
|
+
uri += "&n="+accountNumber
|
82
|
+
uri += "&t="+identityNumType
|
83
|
+
uri += "&p="+identityNum
|
84
|
+
|
85
|
+
httppost(uri, corpNum, "", "", userID)
|
86
|
+
end
|
87
|
+
|
88
|
+
|
47
89
|
|
48
|
-
end # end of
|
90
|
+
end # end of AccountCheckService
|
data/lib/popbill/cashbill.rb
CHANGED
@@ -69,8 +69,6 @@ class CashbillService < BaseService
|
|
69
69
|
|
70
70
|
postData = cashbill.to_json
|
71
71
|
|
72
|
-
puts postData
|
73
|
-
|
74
72
|
httppost("/Cashbill", corpNum, postData, "ISSUE", userID)
|
75
73
|
end
|
76
74
|
|
@@ -179,7 +177,7 @@ class CashbillService < BaseService
|
|
179
177
|
end
|
180
178
|
|
181
179
|
def search(corpNum, dType, sDate, eDate, state, tradeType, tradeUsage,
|
182
|
-
taxationType, page, perPage, order, queryString = '', userID = '', tradeOpt = '')
|
180
|
+
taxationType, page, perPage, order, queryString = '', userID = '', tradeOpt = '', franchiseTaxRegID = '')
|
183
181
|
if corpNum.length != 10
|
184
182
|
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
185
183
|
end
|
@@ -212,6 +210,8 @@ class CashbillService < BaseService
|
|
212
210
|
uri += "&TradeOpt=" + tradeOpt.join(',')
|
213
211
|
end
|
214
212
|
|
213
|
+
uri+="&FranchiseTaxRegID=" + franchiseTaxRegID
|
214
|
+
|
215
215
|
httpget(URI.escape(uri), corpNum, userID)
|
216
216
|
end
|
217
217
|
|
@@ -352,6 +352,17 @@ class CashbillService < BaseService
|
|
352
352
|
httpget("/Cashbill/#{mgtKey}?TG=POPUP", corpNum, userID)['url']
|
353
353
|
end
|
354
354
|
|
355
|
+
def getViewURL(corpNum, mgtKey, userID = '')
|
356
|
+
if corpNum.length != 10
|
357
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
358
|
+
end
|
359
|
+
if mgtKey.to_s == ''
|
360
|
+
raise PopbillException.new('-99999999', '문서번호가 올바르지 않습니다.')
|
361
|
+
end
|
362
|
+
|
363
|
+
httpget("/Cashbill/#{mgtKey}?TG=VIEW", corpNum, userID)['url']
|
364
|
+
end
|
365
|
+
|
355
366
|
def getPDFURL(corpNum, mgtKey, userID = '')
|
356
367
|
if corpNum.length != 10
|
357
368
|
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
data/lib/popbill/easyFinBank.rb
CHANGED
@@ -19,11 +19,11 @@ class EasyFinBankService < BaseService
|
|
19
19
|
end
|
20
20
|
|
21
21
|
if bankAccountInfo["BankCode"].to_s == ''
|
22
|
-
raise PopbillException.new('-99999999', '
|
22
|
+
raise PopbillException.new('-99999999', '기관코드가 입력되지 않았습니다.')
|
23
23
|
end
|
24
24
|
|
25
25
|
if bankAccountInfo["BankCode"].length != 4
|
26
|
-
raise PopbillException.new('-99999999', '
|
26
|
+
raise PopbillException.new('-99999999', '기관코드가 올바르지 않습니다.')
|
27
27
|
end
|
28
28
|
|
29
29
|
if bankAccountInfo["AccountNumber"].to_s == ''
|
@@ -45,11 +45,11 @@ class EasyFinBankService < BaseService
|
|
45
45
|
end
|
46
46
|
|
47
47
|
if bankAccountInfo["BankCode"].to_s == ''
|
48
|
-
raise PopbillException.new('-99999999', '
|
48
|
+
raise PopbillException.new('-99999999', '기관코드가 입력되지 않았습니다.')
|
49
49
|
end
|
50
50
|
|
51
51
|
if bankAccountInfo["BankCode"].length != 4
|
52
|
-
raise PopbillException.new('-99999999', '
|
52
|
+
raise PopbillException.new('-99999999', '기관코드가 올바르지 않습니다.')
|
53
53
|
end
|
54
54
|
|
55
55
|
if bankAccountInfo["AccountNumber"].to_s == ''
|
@@ -67,11 +67,11 @@ class EasyFinBankService < BaseService
|
|
67
67
|
end
|
68
68
|
|
69
69
|
if bankCode.to_s == ''
|
70
|
-
raise PopbillException.new('-99999999', '
|
70
|
+
raise PopbillException.new('-99999999', '기관코드가 입력되지 않았습니다.')
|
71
71
|
end
|
72
72
|
|
73
73
|
if bankCode.length != 4
|
74
|
-
raise PopbillException.new('-99999999', '
|
74
|
+
raise PopbillException.new('-99999999', '기관코드가 올바르지 않습니다.')
|
75
75
|
end
|
76
76
|
|
77
77
|
if accountNumber.to_s == ''
|
@@ -93,11 +93,11 @@ class EasyFinBankService < BaseService
|
|
93
93
|
end
|
94
94
|
|
95
95
|
if bankCode.to_s == ''
|
96
|
-
raise PopbillException.new('-99999999', '
|
96
|
+
raise PopbillException.new('-99999999', '기관코드가 입력되지 않았습니다.')
|
97
97
|
end
|
98
98
|
|
99
99
|
if bankCode.length != 4
|
100
|
-
raise PopbillException.new('-99999999', '
|
100
|
+
raise PopbillException.new('-99999999', '기관코드가 올바르지 않습니다.')
|
101
101
|
end
|
102
102
|
|
103
103
|
if accountNumber.to_s == ''
|
@@ -109,17 +109,43 @@ class EasyFinBankService < BaseService
|
|
109
109
|
httppost(uri, corpNum, "", "", userID)
|
110
110
|
end
|
111
111
|
|
112
|
+
def deleteBankAccount(corpNum, bankCode, accountNumber, userID = "")
|
113
|
+
if corpNum.length != 10
|
114
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
115
|
+
end
|
116
|
+
|
117
|
+
if bankCode.to_s == ''
|
118
|
+
raise PopbillException.new('-99999999', '기관코드가 입력되지 않았습니다.')
|
119
|
+
end
|
120
|
+
|
121
|
+
if bankCode.length != 4
|
122
|
+
raise PopbillException.new('-99999999', '기관코드가 올바르지 않습니다.')
|
123
|
+
end
|
124
|
+
|
125
|
+
if accountNumber.to_s == ''
|
126
|
+
raise PopbillException.new('-99999999', '은행 계좌번호가 입력되지 않았습니다.')
|
127
|
+
end
|
128
|
+
|
129
|
+
uri = "/EasyFin/Bank/BankAccount/Delete"
|
130
|
+
|
131
|
+
postData = {}
|
132
|
+
postData["BankCode"] = bankCode
|
133
|
+
postData["AccountNumber"] = accountNumber
|
134
|
+
|
135
|
+
httppost(uri, corpNum, postData.to_json, "", userID)
|
136
|
+
end
|
137
|
+
|
112
138
|
def getBankAccountInfo(corpNum, bankCode, accountNumber, userID = "")
|
113
139
|
if corpNum.length != 10
|
114
140
|
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
115
141
|
end
|
116
142
|
|
117
143
|
if bankCode.to_s == ''
|
118
|
-
raise PopbillException.new('-99999999', '
|
144
|
+
raise PopbillException.new('-99999999', '기관코드가 입력되지 않았습니다.')
|
119
145
|
end
|
120
146
|
|
121
147
|
if bankCode.length != 4
|
122
|
-
raise PopbillException.new('-99999999', '
|
148
|
+
raise PopbillException.new('-99999999', '기관코드가 올바르지 않습니다.')
|
123
149
|
end
|
124
150
|
|
125
151
|
if accountNumber.to_s == ''
|
@@ -160,7 +186,7 @@ class EasyFinBankService < BaseService
|
|
160
186
|
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
161
187
|
end
|
162
188
|
if bankCode.to_s == ''
|
163
|
-
raise PopbillException.new('-99999999', '
|
189
|
+
raise PopbillException.new('-99999999', '기관코드가 입력되지 않았습니다.')
|
164
190
|
end
|
165
191
|
if accountNumber.to_s == ''
|
166
192
|
raise PopbillException.new('-99999999', '계좌번호가 입력되지 않았습니다.')
|
@@ -263,7 +289,7 @@ class EasyFinBankService < BaseService
|
|
263
289
|
end
|
264
290
|
|
265
291
|
if bankCode.to_s == ''
|
266
|
-
raise PopbillException.new('-99999999', '
|
292
|
+
raise PopbillException.new('-99999999', '기관코드가 입력되지 않았습니다.')
|
267
293
|
end
|
268
294
|
if accountNumber.to_s == ''
|
269
295
|
raise PopbillException.new('-99999999', '계좌번호가 입력되지 않았습니다.')
|
data/lib/popbill/fax.rb
CHANGED
@@ -128,6 +128,39 @@ class FaxService < BaseService
|
|
128
128
|
httppostfile("/FAX", corpNum, postData, filePaths, userID)['receiptNum']
|
129
129
|
end
|
130
130
|
|
131
|
+
def sendFaxBinary(corpNum, senderNum, senderName, receiverNum, receiverName, fileDatas,
|
132
|
+
reserveDT = '', userID = '', adsYN = false, title = '', requestNum = '')
|
133
|
+
if corpNum.length != 10
|
134
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
|
135
|
+
end
|
136
|
+
|
137
|
+
receiver = [
|
138
|
+
{
|
139
|
+
"rcv" => receiverNum,
|
140
|
+
"rcvnm" => receiverName,
|
141
|
+
}
|
142
|
+
]
|
143
|
+
|
144
|
+
sendFaxBinary_multi(corpNum, senderNum, senderName, receiver, fileDatas, reserveDT, userID, adsYN, title, requestNum)
|
145
|
+
end
|
146
|
+
|
147
|
+
def sendFaxBinary_multi(corpNum, senderNum, senderName, receivers, fileDatas,
|
148
|
+
reserveDT = '', userID = '', adsYN = false, title = '', requestNum = '')
|
149
|
+
postData = {}
|
150
|
+
postData["snd"] = senderNum
|
151
|
+
postData["sndnm"] = senderName
|
152
|
+
postData["fCnt"] = fileDatas.length
|
153
|
+
postData["sndDT"] = reserveDT
|
154
|
+
postData["rcvs"] = receivers
|
155
|
+
postData["title"] = title
|
156
|
+
postData["requestNum"] = requestNum
|
157
|
+
if adsYN
|
158
|
+
postData["adsYN"] = adsYN
|
159
|
+
end
|
160
|
+
|
161
|
+
httppostfile("/FAX", corpNum, postData, fileDatas, userID , true)['receiptNum']
|
162
|
+
end
|
163
|
+
|
131
164
|
def resendFax(corpNum, receiptNum, senderNum, senderName, receiveNum, receiveName,
|
132
165
|
reserveDT = '', userID = '', title = '', requestNum = '')
|
133
166
|
if receiptNum.to_s == ''
|
data/lib/popbill/kakaotalk.rb
CHANGED
@@ -76,6 +76,13 @@ class KakaoService < BaseService
|
|
76
76
|
httpget("/Message/SenderNumber", corpNum, userID)
|
77
77
|
end
|
78
78
|
|
79
|
+
def getATSTemplate(corpNum, templateCode, userID = '')
|
80
|
+
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
81
|
+
raise PopbillException.new(-99999999, "템플릿 코드가 입력되지 않았습니다.")if templateCode.to_s == ''
|
82
|
+
|
83
|
+
httpget("/KakaoTalk/GetATSTemplate/#{templateCode}", corpNum, userID)
|
84
|
+
end
|
85
|
+
|
79
86
|
def listATSTemplate(corpNum, userID = '')
|
80
87
|
raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
|
81
88
|
|
data/lib/popbill/statement.rb
CHANGED
@@ -289,7 +289,6 @@ class StatementService < BaseService
|
|
289
289
|
httppost("/Statement/#{itemCode}/#{mgtKey}", corpNum, postData, "FAX", userID)
|
290
290
|
end
|
291
291
|
|
292
|
-
|
293
292
|
def getLogs(corpNum, itemCode, mgtKey, userID = '')
|
294
293
|
if corpNum.length != 10
|
295
294
|
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
@@ -301,6 +300,15 @@ class StatementService < BaseService
|
|
301
300
|
httpget("/Statement/#{itemCode}/#{mgtKey}/Logs", corpNum, userID)
|
302
301
|
end
|
303
302
|
|
303
|
+
def getSealURL(corpNum, userID)
|
304
|
+
if corpNum.length != 10
|
305
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
306
|
+
end
|
307
|
+
|
308
|
+
response = httpget("/?TG=SEAL", corpNum, userID)
|
309
|
+
response['url']
|
310
|
+
end
|
311
|
+
|
304
312
|
def attachFile(corpNum, itemCode, mgtKey, filePath, userID ='')
|
305
313
|
if corpNum.length != 10
|
306
314
|
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
data/lib/popbill/taxinvoice.rb
CHANGED
@@ -110,6 +110,37 @@ class TaxinvoiceService < BaseService
|
|
110
110
|
|
111
111
|
end
|
112
112
|
|
113
|
+
def bulkSubmit(corpNum, submitID, taxinvoiceList, forceIssue = false, userID = '')
|
114
|
+
if corpNum.length != 10
|
115
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
116
|
+
end
|
117
|
+
|
118
|
+
if submitID.to_s == ''
|
119
|
+
raise PopbillException.new('-99999999', '제출아이디가 입렫되지 않았습니다.')
|
120
|
+
end
|
121
|
+
|
122
|
+
if taxinvoiceList.to_s == ''
|
123
|
+
raise PopbillException.new('-99999999', '세금계산서 정보가 입력되지 않았습니다.')
|
124
|
+
end
|
125
|
+
|
126
|
+
postData = {}
|
127
|
+
postData['forceIssue'] = forceIssue
|
128
|
+
postData['invoices'] = taxinvoiceList
|
129
|
+
|
130
|
+
httppostbulk("/Taxinvoice", corpNum, postData.to_json, submitID, "BULKISSUE", userID)
|
131
|
+
end
|
132
|
+
|
133
|
+
def getBulkResult(corpNum, submitID, userID = '')
|
134
|
+
if corpNum.length != 10
|
135
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
136
|
+
end
|
137
|
+
|
138
|
+
if submitID.to_s == ''
|
139
|
+
raise PopbillException.new('-99999999', '제출아이디가 입렫되지 않았습니다.')
|
140
|
+
end
|
141
|
+
|
142
|
+
httpget("/Taxinvoice/BULK/#{submitID}/State", corpNum, userID)
|
143
|
+
end
|
113
144
|
|
114
145
|
def update(corpNum, mgtKeyType, mgtKey, taxinvoice, userID = '')
|
115
146
|
if corpNum.length != 10
|
@@ -532,6 +563,17 @@ class TaxinvoiceService < BaseService
|
|
532
563
|
httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}?TG=PRINT", corpNum, userID)['url']
|
533
564
|
end
|
534
565
|
|
566
|
+
def getOldPrintURL(corpNum, mgtKeyType, mgtKey, userID = '')
|
567
|
+
if corpNum.length != 10
|
568
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
569
|
+
end
|
570
|
+
if mgtKey.to_s == ''
|
571
|
+
raise PopbillException.new('-99999999', '문서번호가 올바르지 않습니다.')
|
572
|
+
end
|
573
|
+
|
574
|
+
httpget("/Taxinvoice/#{mgtKeyType}/#{mgtKey}?TG=PRINTOLD", corpNum, userID)['url']
|
575
|
+
end
|
576
|
+
|
535
577
|
def getPDFURL(corpNum, mgtKeyType, mgtKey, userID = '')
|
536
578
|
if corpNum.length != 10
|
537
579
|
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
@@ -732,6 +774,14 @@ class TaxinvoiceService < BaseService
|
|
732
774
|
httppost("/Taxinvoice/EmailSendConfig?EmailType=#{emailType}&SendYN=#{sendYN}", corpNum, userID)
|
733
775
|
end
|
734
776
|
|
777
|
+
def getSendToNTSConfig(corpNum, userID = '')
|
778
|
+
if corpNum.length != 10
|
779
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
780
|
+
end
|
781
|
+
|
782
|
+
httpget("/Taxinvoice/SendToNTSConfig", corpNum, userID)["sendToNTS"]
|
783
|
+
end
|
784
|
+
|
735
785
|
def checkCertValidation(corpNum, userID = '')
|
736
786
|
if corpNum.length != 10
|
737
787
|
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
data/lib/popbill.rb
CHANGED
@@ -11,13 +11,15 @@ class BaseService
|
|
11
11
|
ServiceID_TEST = "POPBILL_TEST"
|
12
12
|
ServiceURL_REAL = "https://popbill.linkhub.co.kr"
|
13
13
|
ServiceURL_TEST = "https://popbill-test.linkhub.co.kr"
|
14
|
+
ServiceURL_Static_REAL = "https://static-popbill.linkhub.co.kr"
|
15
|
+
ServiceURL_Static_TEST = "https://static-popbill-test.linkhub.co.kr"
|
14
16
|
ServiceURL_GA_REAL = "https://ga-popbill.linkhub.co.kr"
|
15
17
|
ServiceURL_GA_TEST = "https://ga-popbill-test.linkhub.co.kr"
|
16
18
|
|
17
19
|
POPBILL_APIVersion = "1.0"
|
18
20
|
BOUNDARY = "==POPBILL_RUBY_SDK=="
|
19
21
|
|
20
|
-
attr_accessor :token_table, :scopes, :isTest, :linkhub, :ipRestrictOnOff, :useStaticIP
|
22
|
+
attr_accessor :token_table, :scopes, :isTest, :linkhub, :ipRestrictOnOff, :useStaticIP, :useGAIP, :useLocalTimeYN
|
21
23
|
|
22
24
|
# Generate Linkhub Class Singleton Instance
|
23
25
|
class << self
|
@@ -28,6 +30,8 @@ class BaseService
|
|
28
30
|
@instance.scopes = ["member"]
|
29
31
|
@instance.ipRestrictOnOff = true
|
30
32
|
@instance.useStaticIP = false
|
33
|
+
@instance.useGAIP = false
|
34
|
+
@instance.useLocalTimeYN = true
|
31
35
|
|
32
36
|
return @instance
|
33
37
|
end
|
@@ -53,9 +57,19 @@ class BaseService
|
|
53
57
|
@useStaticIP = value
|
54
58
|
end
|
55
59
|
|
60
|
+
def setUseGAIP(value)
|
61
|
+
@useGAIP = value
|
62
|
+
end
|
63
|
+
|
64
|
+
def setUseLocalTimeYN(value)
|
65
|
+
@useLocalTimeYN = value
|
66
|
+
end
|
67
|
+
|
56
68
|
def getServiceURL()
|
57
|
-
if @
|
58
|
-
|
69
|
+
if @useGAIP
|
70
|
+
return @isTest ? BaseService::ServiceURL_GA_TEST : BaseService::ServiceURL_GA_REAL
|
71
|
+
elsif @useStaticIP
|
72
|
+
return @isTest ? BaseService::ServiceURL_Static_TEST : BaseService::ServiceURL_Static_REAL
|
59
73
|
else
|
60
74
|
return @isTest ? BaseService::ServiceURL_TEST : BaseService::ServiceURL_REAL
|
61
75
|
end
|
@@ -81,7 +95,7 @@ class BaseService
|
|
81
95
|
else
|
82
96
|
# Token's expireTime must use parse() because time format is hh:mm:ss.SSSZ
|
83
97
|
expireTime = DateTime.parse(targetToken['expiration'])
|
84
|
-
serverUTCTime = DateTime.strptime(@linkhub.getTime(@useStaticIP))
|
98
|
+
serverUTCTime = DateTime.strptime(@linkhub.getTime(@useStaticIP, @useGAIP, @useLocalTimeYN))
|
85
99
|
refresh = expireTime < serverUTCTime
|
86
100
|
end
|
87
101
|
|
@@ -89,7 +103,7 @@ class BaseService
|
|
89
103
|
begin
|
90
104
|
# getSessionToken from Linkhub
|
91
105
|
targetToken = @linkhub.getSessionToken(
|
92
|
-
@isTest ? ServiceID_TEST : ServiceID_REAL, corpNum, @scopes, @ipRestrictOnOff ? "" : "*", @useStaticIP)
|
106
|
+
@isTest ? ServiceID_TEST : ServiceID_REAL, corpNum, @scopes, @ipRestrictOnOff ? "" : "*", @useStaticIP, @useGAIP, @useLocalTimeYN)
|
93
107
|
|
94
108
|
rescue LinkhubException => le
|
95
109
|
raise PopbillException.new(le.code, le.message)
|
@@ -195,9 +209,50 @@ class BaseService
|
|
195
209
|
|
196
210
|
#end of httppost
|
197
211
|
|
212
|
+
def httppostbulk(url, corpNum, postData, submitID, action = '', userID = '')
|
213
|
+
headers = {
|
214
|
+
"x-pb-version" => BaseService::POPBILL_APIVersion,
|
215
|
+
"Accept-Encoding" => "gzip,deflate",
|
216
|
+
}
|
217
|
+
|
218
|
+
headers["Content-Type"] = "application/json; charset=utf8"
|
219
|
+
headers["x-pb-message-digest"] = Base64.strict_encode64(Digest::SHA1.digest(postData))
|
220
|
+
headers["x-pb-submit-id"] = submitID
|
221
|
+
|
222
|
+
if corpNum.to_s != ''
|
223
|
+
headers["Authorization"] = "Bearer " + getSession_Token(corpNum)
|
224
|
+
end
|
225
|
+
|
226
|
+
if userID.to_s != ''
|
227
|
+
headers["x-pb-userid"] = userID
|
228
|
+
end
|
229
|
+
|
230
|
+
if action.to_s != ''
|
231
|
+
headers["X-HTTP-Method-Override"] = action
|
232
|
+
end
|
233
|
+
|
234
|
+
uri = URI(getServiceURL() + url)
|
235
|
+
|
236
|
+
https = Net::HTTP.new(uri.host, 443)
|
237
|
+
https.use_ssl = true
|
238
|
+
Net::HTTP::Post.new(uri)
|
239
|
+
|
240
|
+
res = https.post(uri.request_uri, postData, headers)
|
241
|
+
|
242
|
+
if res.code == "200"
|
243
|
+
if res.header['Content-Encoding'].eql?('gzip')
|
244
|
+
JSON.parse(gzip_parse(res.body))
|
245
|
+
else
|
246
|
+
JSON.parse(res.body)
|
247
|
+
end
|
248
|
+
else
|
249
|
+
raise PopbillException.new(JSON.parse(res.body)["code"],
|
250
|
+
JSON.parse(res.body)["message"])
|
251
|
+
end
|
252
|
+
end
|
198
253
|
|
199
254
|
# Request HTTP Post File
|
200
|
-
def httppostfile(url, corpNum, form, files, userID)
|
255
|
+
def httppostfile(url, corpNum, form, files, userID, isBinary = false)
|
201
256
|
headers = {
|
202
257
|
"x-pb-version" => BaseService::POPBILL_APIVersion,
|
203
258
|
"Content-Type" => "multipart/form-data;boundary=" + BaseService::BOUNDARY,
|
@@ -221,20 +276,29 @@ class BaseService
|
|
221
276
|
post_body << "Content-Type: Application/json;\r\n\r\n"
|
222
277
|
post_body << form.to_json + "\r\n"
|
223
278
|
end
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
post_body << "--#{BaseService::BOUNDARY}\r\n"
|
279
|
+
if isBinary
|
280
|
+
files.each do |fileData|
|
281
|
+
fileName = fileData["fileName"]
|
282
|
+
post_body << "\r\n--#{BaseService::BOUNDARY}\r\n"
|
229
283
|
post_body << "Content-Disposition: form-data; name=\"file\"; filename=\"#{fileName}\"\r\n"
|
230
284
|
post_body << "Content-Type: Application/octet-stream\r\n\r\n"
|
231
|
-
post_body <<
|
232
|
-
|
233
|
-
|
285
|
+
post_body << fileData["fileData"].force_encoding("UTF-8")
|
286
|
+
end
|
287
|
+
else
|
288
|
+
files.each do |filePath|
|
289
|
+
begin
|
290
|
+
fileName = File.basename(filePath)
|
291
|
+
post_body << "\r\n--#{BaseService::BOUNDARY}\r\n"
|
292
|
+
post_body << "Content-Disposition: form-data; name=\"file\"; filename=\"#{fileName}\"\r\n"
|
293
|
+
post_body << "Content-Type: Application/octet-stream\r\n\r\n"
|
294
|
+
post_body << File.read(filePath)
|
295
|
+
rescue
|
296
|
+
raise PopbillException.new(-99999999, "Failed to reading filedata from filepath")
|
297
|
+
end
|
234
298
|
end
|
235
299
|
end
|
236
300
|
|
237
|
-
post_body << "\r\n
|
301
|
+
post_body << "\r\n--#{BaseService::BOUNDARY}--\r\n"
|
238
302
|
# Add the file Data
|
239
303
|
|
240
304
|
uri = URI(getServiceURL() + url)
|
@@ -299,7 +363,7 @@ class BaseService
|
|
299
363
|
# Add the file Data
|
300
364
|
|
301
365
|
uri = URI(getServiceURL() + url)
|
302
|
-
|
366
|
+
|
303
367
|
https = Net::HTTP.new(uri.host, 443)
|
304
368
|
https.use_ssl = true
|
305
369
|
Net::HTTP::Post.new(uri)
|
@@ -326,7 +390,7 @@ class BaseService
|
|
326
390
|
end
|
327
391
|
|
328
392
|
begin
|
329
|
-
@linkhub.getBalance(getSession_Token(corpNum), getServiceID(), @useStaticIP)
|
393
|
+
@linkhub.getBalance(getSession_Token(corpNum), getServiceID(), @useStaticIP, @useGAIP)
|
330
394
|
rescue LinkhubException => le
|
331
395
|
raise PopbillException.new(le.code, le.message)
|
332
396
|
end
|
@@ -339,7 +403,7 @@ class BaseService
|
|
339
403
|
end
|
340
404
|
|
341
405
|
begin
|
342
|
-
@linkhub.getPartnerBalance(getSession_Token(corpNum), getServiceID(), @useStaticIP)
|
406
|
+
@linkhub.getPartnerBalance(getSession_Token(corpNum), getServiceID(), @useStaticIP, @useGAIP)
|
343
407
|
rescue LinkhubException => le
|
344
408
|
raise PopbillException.new(le.code, le.message)
|
345
409
|
end
|
@@ -352,7 +416,7 @@ class BaseService
|
|
352
416
|
end
|
353
417
|
|
354
418
|
begin
|
355
|
-
@linkhub.getPartnerURL(getSession_Token(corpNum), getServiceID(), togo, @useStaticIP)
|
419
|
+
@linkhub.getPartnerURL(getSession_Token(corpNum), getServiceID(), togo, @useStaticIP, @useGAIP)
|
356
420
|
rescue LinkhubException => le
|
357
421
|
raise PopbillException.new(le.code, le.message)
|
358
422
|
end
|
@@ -378,6 +442,24 @@ class BaseService
|
|
378
442
|
response['url']
|
379
443
|
end
|
380
444
|
|
445
|
+
# 연동회원 포인트 결제내역 팝업 URL
|
446
|
+
def getPaymentURL(corpNum, userID = "")
|
447
|
+
if corpNum.length != 10
|
448
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
449
|
+
end
|
450
|
+
response = httpget("/?TG=PAYMENT", corpNum, userID)
|
451
|
+
response['url']
|
452
|
+
end
|
453
|
+
|
454
|
+
# 연동회원 포인트 사용내역 팝업 URL
|
455
|
+
def getUseHistoryURL(corpNum, userID = "")
|
456
|
+
if corpNum.length != 10
|
457
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
458
|
+
end
|
459
|
+
response = httpget("/?TG=USEHISTORY", corpNum, userID)
|
460
|
+
response['url']
|
461
|
+
end
|
462
|
+
|
381
463
|
# 팝빌 로그인 URL
|
382
464
|
def getAccessURL(corpNum, userID)
|
383
465
|
if corpNum.length != 10
|
@@ -406,6 +488,16 @@ class BaseService
|
|
406
488
|
http_response = httpget("/Join?CorpNum=" + corpNum + "&LID=" + linkID, "", "")
|
407
489
|
end
|
408
490
|
|
491
|
+
def getContactInfo(corpNum, contactID, userID = "")
|
492
|
+
if corpNum.length != 10
|
493
|
+
raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
|
494
|
+
end
|
495
|
+
postData = {}
|
496
|
+
postData["id"] = contactID
|
497
|
+
|
498
|
+
httppost("/Contact", corpNum, postData.to_json, "", userID)
|
499
|
+
end
|
500
|
+
|
409
501
|
# Get list Corp Contact
|
410
502
|
def listContact(corpNum, userID = "")
|
411
503
|
if corpNum.length != 10
|
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.51.1
|
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: 2022-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: linkhub
|
@@ -16,16 +16,16 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.5.0
|
27
27
|
description: Popbill API SDK
|
28
|
-
email: code@
|
28
|
+
email: code@linkhubcorp.com
|
29
29
|
executables: []
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|