popbill 1.12.0 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97313f4d5d7e07f61724f5cdb8d65b5898ca4b96
4
- data.tar.gz: 7362e07f05433f5cd5b8a395c15362b91270f376
3
+ metadata.gz: 0bfb35ee55f47c39313b772f5c2989a036568c87
4
+ data.tar.gz: e5c7df56dd0c1390397df455dae91ce91d81b363
5
5
  SHA512:
6
- metadata.gz: 9b2571b8744be0055cc0f01f2fffd78cfbce771042d15836f3e21df970d0dc31cdbc8fecd14fe89c4abf1ea5d4e3ad7c2bfaa7b39179694d3e17c97d8265a872
7
- data.tar.gz: 306cc66334885945a31494bfa7138816fda7ccf20732efa7ce16825ed82511e5fbcc158e93d6a7845f5ba2c865635497cfecc5dbd34a299df34273e35543ff95
6
+ metadata.gz: 964b15e2850c1c085ce3922e43ec5479331497e25fd698e8d5e281fb9484048b7237b5a62a3268a153339e04415e706bed4a91f936839f7f724872c526840319
7
+ data.tar.gz: d85e2d027ad6d182ffaf3c88213037a45d19ba4f355f59ae48f9d7a865452425ba2831b4b0c7837e6434cf14d54acf6727b00b0bf3e5870ede620cbe4e645b91
@@ -11,10 +11,13 @@ 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_GA_REAL = "https://ga-popbill.linkhub.co.kr"
15
+ ServiceURL_GA_TEST = "https://ga-popbill-test.linkhub.co.kr"
16
+
14
17
  POPBILL_APIVersion = "1.0"
15
18
  BOUNDARY = "==POPBILL_RUBY_SDK=="
16
19
 
17
- attr_accessor :token_table, :scopes, :isTest, :linkhub, :ipRestrictOnOff
20
+ attr_accessor :token_table, :scopes, :isTest, :linkhub, :ipRestrictOnOff, :useStaticIP
18
21
 
19
22
  # Generate Linkhub Class Singleton Instance
20
23
  class << self
@@ -24,6 +27,7 @@ class BaseService
24
27
  @instance.linkhub = Linkhub.instance(linkID, secretKey)
25
28
  @instance.scopes = ["member"]
26
29
  @instance.ipRestrictOnOff = true
30
+ @instance.useStaticIP = false
27
31
 
28
32
  return @instance
29
33
  end
@@ -45,8 +49,17 @@ class BaseService
45
49
  @ipRestrictOnOff = value
46
50
  end
47
51
 
52
+ def setUseStaticIP(value)
53
+ @useStaticIP = value
54
+ end
55
+
48
56
  def getServiceURL()
49
- return @isTest ? BaseService::ServiceURL_TEST : BaseService::ServiceURL_REAL
57
+ if @useStaticIP
58
+ return @isTest ? BaseService::ServiceURL_GA_TEST : BaseService::ServiceURL_GA_REAL
59
+ else
60
+ return @isTest ? BaseService::ServiceURL_TEST : BaseService::ServiceURL_REAL
61
+ end
62
+
50
63
  end
51
64
 
52
65
  def getServiceID()
@@ -68,7 +81,7 @@ class BaseService
68
81
  else
69
82
  # Token's expireTime must use parse() because time format is hh:mm:ss.SSSZ
70
83
  expireTime = DateTime.parse(targetToken['expiration'])
71
- serverUTCTime = DateTime.strptime(@linkhub.getTime())
84
+ serverUTCTime = DateTime.strptime(@linkhub.getTime(@useStaticIP))
72
85
  refresh = expireTime < serverUTCTime
73
86
  end
74
87
 
@@ -76,7 +89,7 @@ class BaseService
76
89
  begin
77
90
  # getSessionToken from Linkhub
78
91
  targetToken = @linkhub.getSessionToken(
79
- @isTest ? ServiceID_TEST : ServiceID_REAL, corpNum, @scopes, @ipRestrictOnOff ? "" : "*")
92
+ @isTest ? ServiceID_TEST : ServiceID_REAL, corpNum, @scopes, @ipRestrictOnOff ? "" : "*", @useStaticIP)
80
93
 
81
94
  rescue LinkhubException => le
82
95
  raise PopbillException.new(le.code, le.message)
@@ -112,6 +125,7 @@ class BaseService
112
125
  end
113
126
 
114
127
  uri = URI(getServiceURL() + url)
128
+
115
129
  request = Net::HTTP.new(uri.host, 443)
116
130
  request.use_ssl = true
117
131
 
@@ -224,6 +238,7 @@ class BaseService
224
238
  # Add the file Data
225
239
 
226
240
  uri = URI(getServiceURL() + url)
241
+
227
242
  https = Net::HTTP.new(uri.host, 443)
228
243
  https.use_ssl = true
229
244
  Net::HTTP::Post.new(uri)
@@ -284,6 +299,7 @@ class BaseService
284
299
  # Add the file Data
285
300
 
286
301
  uri = URI(getServiceURL() + url)
302
+
287
303
  https = Net::HTTP.new(uri.host, 443)
288
304
  https.use_ssl = true
289
305
  Net::HTTP::Post.new(uri)
@@ -310,7 +326,7 @@ class BaseService
310
326
  end
311
327
 
312
328
  begin
313
- @linkhub.getBalance(getSession_Token(corpNum), getServiceID())
329
+ @linkhub.getBalance(getSession_Token(corpNum), getServiceID(), @useStaticIP)
314
330
  rescue LinkhubException => le
315
331
  raise PopbillException.new(le.code, le.message)
316
332
  end
@@ -323,7 +339,7 @@ class BaseService
323
339
  end
324
340
 
325
341
  begin
326
- @linkhub.getPartnerBalance(getSession_Token(corpNum), getServiceID())
342
+ @linkhub.getPartnerBalance(getSession_Token(corpNum), getServiceID(), @useStaticIP)
327
343
  rescue LinkhubException => le
328
344
  raise PopbillException.new(le.code, le.message)
329
345
  end
@@ -336,7 +352,7 @@ class BaseService
336
352
  end
337
353
 
338
354
  begin
339
- @linkhub.getPartnerURL(getSession_Token(corpNum), getServiceID(), togo)
355
+ @linkhub.getPartnerURL(getSession_Token(corpNum), getServiceID(), togo, @useStaticIP)
340
356
  rescue LinkhubException => le
341
357
  raise PopbillException.new(le.code, le.message)
342
358
  end
@@ -0,0 +1,48 @@
1
+ # -*- coding: utf-8 -*-
2
+ require_relative '../popbill.rb'
3
+
4
+ # 팝빌 예금주조회 API Service Implementation
5
+ class AccountCheckService < BaseService
6
+ class << self
7
+ def instance(linkID, secretKey)
8
+ super(linkID, secretKey)
9
+ @instance ||= new
10
+ @instance.addScope("182")
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("/EasyFin/AccountCheck/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("/EasyFin/AccountCheck/UnitCost", corpNum, userID)['unitCost']
28
+ end
29
+
30
+ def checkAccountInfo(corpNum, bankCode, accountNumber, userID = '')
31
+ if corpNum.length != 10
32
+ raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
33
+ end
34
+ if bankCode.to_s == ''
35
+ raise PopbillException.new(-99999999, '기관코드가 입력되지 않았습니다.')
36
+ end
37
+
38
+ if accountNumber.to_s == ''
39
+ raise PopbillException.new(-99999999, '계좌번호가 입력되지 않았습니다.')
40
+ end
41
+
42
+ uri = "/EasyFin/AccountCheck?c=#{bankCode}&n=#{accountNumber}"
43
+
44
+ httppost(uri, corpNum, "", "", userID)
45
+ end
46
+
47
+
48
+ end # end of FaxService
@@ -0,0 +1,277 @@
1
+ # -*- coding: utf-8 -*-
2
+ require_relative '../popbill.rb'
3
+
4
+ # 팝빌 계좌조회 API Service Implementation
5
+ class EasyFinBankService < BaseService
6
+ class << self
7
+ def instance(linkID, secretKey)
8
+ super(linkID, secretKey)
9
+ @instance ||= new
10
+ @instance.addScope("180")
11
+ return @instance
12
+ end
13
+ private :new
14
+ end
15
+
16
+ def registBankAccount(corpNum, bankAccountInfo, userID = "")
17
+ if corpNum.length != 10
18
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
19
+ end
20
+
21
+ if bankAccountInfo["BankCode"].to_s == ''
22
+ raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
23
+ end
24
+
25
+ if bankAccountInfo["BankCode"].length != 4
26
+ raise PopbillException.new('-99999999', '은행코드가 올바르지 않습니다.')
27
+ end
28
+
29
+ if bankAccountInfo["AccountNumber"].to_s == ''
30
+ raise PopbillException.new('-99999999', '은행 계좌번호가 입력되지 않았습니다.')
31
+ end
32
+
33
+ uri = "/EasyFin/Bank/BankAccount/Regist"
34
+
35
+ if bankAccountInfo["UsePeriod"].to_s != ''
36
+ uri += "?UsePeriod=" + bankAccountInfo["UsePeriod"]
37
+ end
38
+
39
+ httppost(uri, corpNum, bankAccountInfo.to_json, "", userID)
40
+ end
41
+
42
+ def updateBankAccount(corpNum, bankAccountInfo, userID = "")
43
+ if corpNum.length != 10
44
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
45
+ end
46
+
47
+ if bankAccountInfo["BankCode"].to_s == ''
48
+ raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
49
+ end
50
+
51
+ if bankAccountInfo["BankCode"].length != 4
52
+ raise PopbillException.new('-99999999', '은행코드가 올바르지 않습니다.')
53
+ end
54
+
55
+ if bankAccountInfo["AccountNumber"].to_s == ''
56
+ raise PopbillException.new('-99999999', '은행 계좌번호가 입력되지 않았습니다.')
57
+ end
58
+
59
+ uri = "/EasyFin/Bank/BankAccount/#{bankAccountInfo["BankCode"]}/#{bankAccountInfo["AccountNumber"]}/Update"
60
+
61
+ httppost(uri, corpNum, bankAccountInfo.to_json, "", userID)
62
+ end
63
+
64
+ def closeBankAccount(corpNum, bankCode, accountNumber, closeType, userID = "")
65
+ if corpNum.length != 10
66
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
67
+ end
68
+
69
+ if bankCode.to_s == ''
70
+ raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
71
+ end
72
+
73
+ if bankCode.length != 4
74
+ raise PopbillException.new('-99999999', '은행코드가 올바르지 않습니다.')
75
+ end
76
+
77
+ if accountNumber.to_s == ''
78
+ raise PopbillException.new('-99999999', '은행 계좌번호가 입력되지 않았습니다.')
79
+ end
80
+
81
+ if closeType.to_s == ''
82
+ raise PopbillException.new('-99999999', '정액제 해지유형이 입력되지 않았습니다.')
83
+ end
84
+
85
+ uri = "/EasyFin/Bank/BankAccount/Close/?BankCode=#{bankCode}&AccountNumber=#{accountNumber}&CloseType=#{closeType}"
86
+
87
+ httppost(URI.escape(uri), corpNum, "", "", userID)
88
+ end
89
+
90
+ def revokeCloseBankAccount(corpNum, bankCode, accountNumber, userID = "")
91
+ if corpNum.length != 10
92
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
93
+ end
94
+
95
+ if bankCode.to_s == ''
96
+ raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
97
+ end
98
+
99
+ if bankCode.length != 4
100
+ raise PopbillException.new('-99999999', '은행코드가 올바르지 않습니다.')
101
+ end
102
+
103
+ if accountNumber.to_s == ''
104
+ raise PopbillException.new('-99999999', '은행 계좌번호가 입력되지 않았습니다.')
105
+ end
106
+
107
+ uri = "/EasyFin/Bank/BankAccount/RevokeClose/?BankCode=#{bankCode}&AccountNumber=#{accountNumber}"
108
+
109
+ httppost(uri, corpNum, "", "", userID)
110
+ end
111
+
112
+ def getBankAccountInfo(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/#{bankCode}/#{accountNumber}"
130
+
131
+ httpget(uri, corpNum, userID)
132
+ end
133
+
134
+
135
+ def getChargeInfo(corpNum, userID = "")
136
+ if corpNum.length != 10
137
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
138
+ end
139
+ httpget("/EasyFin/Bank/ChargeInfo", corpNum, userID)
140
+ end
141
+
142
+ def getBankAccountMgtURL(corpNum, userID = "")
143
+ if corpNum.length != 10
144
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
145
+ end
146
+
147
+ httpget("/EasyFin/Bank?TG=BankAccount", corpNum, userID)['url']
148
+ end
149
+
150
+ def listBankAccount(corpNum, userID = "")
151
+ if corpNum.length != 10
152
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
153
+ end
154
+
155
+ httpget("/EasyFin/Bank/ListBankAccount", corpNum, userID)
156
+ end
157
+
158
+ def requestJob(corpNum, bankCode, accountNumber, sDate, eDate, userID = "")
159
+ if corpNum.length != 10
160
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
161
+ end
162
+ if bankCode.to_s == ''
163
+ raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
164
+ end
165
+ if accountNumber.to_s == ''
166
+ raise PopbillException.new('-99999999', '계좌번호가 입력되지 않았습니다.')
167
+ end
168
+ if sDate.to_s == ''
169
+ raise PopbillException.new('-99999999', '시작일자가 입력되지 않았습니다.')
170
+ end
171
+ if eDate.to_s == ''
172
+ raise PopbillException.new('-99999999', '종료일자가 입력되지 않았습니다.')
173
+ end
174
+
175
+ uri = "/EasyFin/Bank/BankAccount?BankCode=#{bankCode}&AccountNumber=#{accountNumber}&SDate=#{sDate}&EDate=#{eDate}"
176
+
177
+ httppost(uri, corpNum, "", "", userID)['jobID']
178
+ end
179
+
180
+ def getJobState(corpNum, jobID, userID = "")
181
+ if corpNum.length != 10
182
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
183
+ end
184
+ if jobID.to_s == ''
185
+ raise PopbillException.new('-99999999', '작업아이디(jobID)가 입력되지 않았습니다.')
186
+ end
187
+
188
+ httpget("/EasyFin/Bank/#{jobID}/State", corpNum, userID)
189
+ end
190
+
191
+ def listActiveJob(corpNum, userID = "")
192
+ if corpNum.length != 10
193
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
194
+ end
195
+
196
+ httpget("/EasyFin/Bank/JobList", corpNum, userID)
197
+ end
198
+
199
+ def search(corpNum, jobID, tradeType, searchString, page, perPage, order, userID = '')
200
+ if corpNum.length != 10
201
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
202
+ end
203
+ if jobID.length != 18
204
+ raise PopbillException.new('-99999999', '작업아이디(jobID)가 올바르지 않습니다.')
205
+ end
206
+
207
+ uri = "/EasyFin/Bank/#{jobID}"
208
+ uri += "?TradeType=" + tradeType.join(',')
209
+ uri += "&Page=" + page.to_s
210
+ uri += "&PerPage=" + perPage.to_s
211
+ uri += "&Order=" + order
212
+
213
+ if searchString.to_s != ''
214
+ uri += "&SearchString=" + searchString
215
+ end
216
+
217
+ httpget(URI.escape(uri), corpNum, userID)
218
+ end
219
+
220
+ def summary(corpNum, jobID, tradeType, searchString, userID = '')
221
+ if corpNum.length != 10
222
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
223
+ end
224
+ if jobID.length != 18
225
+ raise PopbillException.new('-99999999', '작업아이디(jobID)가 올바르지 않습니다.')
226
+ end
227
+
228
+ uri = "/EasyFin/Bank/#{jobID}/Summary"
229
+ uri += "?TradeType=" + tradeType.join(',')
230
+
231
+ if searchString.to_s != ''
232
+ uri += "&SearchString=" + searchString
233
+ end
234
+
235
+ httpget(URI.escape(uri), corpNum, userID)
236
+ end
237
+
238
+ def saveMemo(corpNum, tid, memo, userID = "")
239
+ if corpNum.length != 10
240
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
241
+ end
242
+ if tid.to_s == ''
243
+ raise PopbillException.new('-99999999', '거래내역 아이디가 입력되지 않았습니다.')
244
+ end
245
+
246
+
247
+ uri = "/EasyFin/Bank/SaveMemo?TID=#{tid}&Memo=#{memo}"
248
+
249
+ httppost(uri, corpNum, "", "", userID)
250
+ end
251
+
252
+ def getFlatRatePopUpURL(corpNum, userID = "")
253
+ if corpNum.length != 10
254
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
255
+ end
256
+
257
+ httpget("/EasyFin/Bank?TG=CHRG", corpNum, userID)['url']
258
+ end
259
+
260
+ def getFlatRateState(corpNum, bankCode, accountNumber, userID = "")
261
+ if corpNum.length != 10
262
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
263
+ end
264
+
265
+ if bankCode.to_s == ''
266
+ raise PopbillException.new('-99999999', '은행코드가 입력되지 않았습니다.')
267
+ end
268
+ if accountNumber.to_s == ''
269
+ raise PopbillException.new('-99999999', '계좌번호가 입력되지 않았습니다.')
270
+ end
271
+
272
+ httpget("/EasyFin/Bank/Contract/#{bankCode}/#{accountNumber}", corpNum, userID)
273
+ end
274
+
275
+
276
+
277
+ 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.12.0
4
+ version: 1.16.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: 2020-01-07 00:00:00.000000000 Z
11
+ date: 2020-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: linkhub
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.0
19
+ version: 1.3.1
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.2.0
26
+ version: 1.3.1
27
27
  description: Popbill API SDK
28
28
  email: code@linkhub.co.kr
29
29
  executables: []
@@ -31,8 +31,10 @@ extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
33
  - lib/popbill.rb
34
+ - lib/popbill/accountCheck.rb
34
35
  - lib/popbill/cashbill.rb
35
36
  - lib/popbill/closedown.rb
37
+ - lib/popbill/easyFinBank.rb
36
38
  - lib/popbill/fax.rb
37
39
  - lib/popbill/htCashbill.rb
38
40
  - lib/popbill/htTaxinvoice.rb