popbill 1.17.0 → 1.50.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: 22480042655ba50c0689e39cf346023aee42d1de
4
- data.tar.gz: a6245d69c619d5f5c8e6bbfa57a0eac100a375a7
3
+ metadata.gz: 44b33186b1d460756e62a2735a51e521906ffd6c
4
+ data.tar.gz: 6e2409b253c1e15280d7e9a5425a0a14aa4e43dc
5
5
  SHA512:
6
- metadata.gz: 66ddf09cbde0ca012e8147bbe535e4c48337bee55834b51b4a4f6f310fb8a4f80dda07a894666897d28f738fb79c86e99bbea3663f7bf8134eaf5eb40a8396da
7
- data.tar.gz: ef019f24d2b885584c4dcc2828f2e8ff6c95bdc5caa053d0678ae4d69aec62c163a2b90338ab978cafcfcfac3c93f67c972bd9989312ec39c42447f467d2a591
6
+ metadata.gz: 3b818a09da92f6bb0e62db04e0d32983e988e013da858352c25b964f88b3ffd37b84b9254b4b1191d98433b6c74237eaae0ca841fda12da33d7427e4b87e3224
7
+ data.tar.gz: 2427ddf278d6d54e8c1e2e4e03a7b3022b8f7045d3f43403ea24760362a165bb0acbf628bd14e412a30f6d1a7ed7104a5d0102506fe5afbe2c6e17134903d3f9
@@ -352,6 +352,17 @@ class CashbillService < BaseService
352
352
  httpget("/Cashbill/#{mgtKey}?TG=POPUP", corpNum, userID)['url']
353
353
  end
354
354
 
355
+ def getPDFURL(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=PDF", corpNum, userID)['url']
364
+ end
365
+
355
366
  def getPrintURL(corpNum, mgtKey, userID = '')
356
367
  if corpNum.length != 10
357
368
  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
@@ -361,6 +361,17 @@ class StatementService < BaseService
361
361
  httpget("/Statement/#{itemCode}/#{mgtKey}?TG=PRINT", corpNum, userID)['url']
362
362
  end
363
363
 
364
+ def getViewURL(corpNum, itemCode, mgtKey, userID = '')
365
+ if corpNum.length != 10
366
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
367
+ end
368
+ if mgtKey.to_s == ''
369
+ raise PopbillException.new('-99999999', '문서번호가 올바르지 않습니다.')
370
+ end
371
+
372
+ httpget("/Statement/#{itemCode}/#{mgtKey}?TG=VIEW", corpNum, userID)['url']
373
+ end
374
+
364
375
  def getPDFURL(corpNum, itemCode, mgtKey, userID = '')
365
376
  if corpNum.length != 10
366
377
  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
21
23
 
22
24
  # Generate Linkhub Class Singleton Instance
23
25
  class << self
@@ -28,6 +30,7 @@ class BaseService
28
30
  @instance.scopes = ["member"]
29
31
  @instance.ipRestrictOnOff = true
30
32
  @instance.useStaticIP = false
33
+ @instance.useGAIP = false
31
34
 
32
35
  return @instance
33
36
  end
@@ -53,9 +56,15 @@ class BaseService
53
56
  @useStaticIP = value
54
57
  end
55
58
 
59
+ def setUseGAIP(value)
60
+ @useGAIP = value
61
+ end
62
+
56
63
  def getServiceURL()
57
- if @useStaticIP
58
- return @isTest ? BaseService::ServiceURL_GA_TEST : BaseService::ServiceURL_GA_REAL
64
+ if @useGAIP
65
+ return @isTest ? BaseService::ServiceURL_GA_TEST : BaseService::ServiceURL_GA_REAL
66
+ elsif @useStaticIP
67
+ return @isTest ? BaseService::ServiceURL_Static_TEST : BaseService::ServiceURL_Static_REAL
59
68
  else
60
69
  return @isTest ? BaseService::ServiceURL_TEST : BaseService::ServiceURL_REAL
61
70
  end
@@ -81,7 +90,7 @@ class BaseService
81
90
  else
82
91
  # Token's expireTime must use parse() because time format is hh:mm:ss.SSSZ
83
92
  expireTime = DateTime.parse(targetToken['expiration'])
84
- serverUTCTime = DateTime.strptime(@linkhub.getTime(@useStaticIP))
93
+ serverUTCTime = DateTime.strptime(@linkhub.getTime(@useStaticIP, @useGAIP))
85
94
  refresh = expireTime < serverUTCTime
86
95
  end
87
96
 
@@ -89,7 +98,7 @@ class BaseService
89
98
  begin
90
99
  # getSessionToken from Linkhub
91
100
  targetToken = @linkhub.getSessionToken(
92
- @isTest ? ServiceID_TEST : ServiceID_REAL, corpNum, @scopes, @ipRestrictOnOff ? "" : "*", @useStaticIP)
101
+ @isTest ? ServiceID_TEST : ServiceID_REAL, corpNum, @scopes, @ipRestrictOnOff ? "" : "*", @useStaticIP, @useGAIP)
93
102
 
94
103
  rescue LinkhubException => le
95
104
  raise PopbillException.new(le.code, le.message)
@@ -299,7 +308,7 @@ class BaseService
299
308
  # Add the file Data
300
309
 
301
310
  uri = URI(getServiceURL() + url)
302
-
311
+
303
312
  https = Net::HTTP.new(uri.host, 443)
304
313
  https.use_ssl = true
305
314
  Net::HTTP::Post.new(uri)
@@ -326,7 +335,7 @@ class BaseService
326
335
  end
327
336
 
328
337
  begin
329
- @linkhub.getBalance(getSession_Token(corpNum), getServiceID(), @useStaticIP)
338
+ @linkhub.getBalance(getSession_Token(corpNum), getServiceID(), @useStaticIP, @useGAIP)
330
339
  rescue LinkhubException => le
331
340
  raise PopbillException.new(le.code, le.message)
332
341
  end
@@ -339,7 +348,7 @@ class BaseService
339
348
  end
340
349
 
341
350
  begin
342
- @linkhub.getPartnerBalance(getSession_Token(corpNum), getServiceID(), @useStaticIP)
351
+ @linkhub.getPartnerBalance(getSession_Token(corpNum), getServiceID(), @useStaticIP, @useGAIP)
343
352
  rescue LinkhubException => le
344
353
  raise PopbillException.new(le.code, le.message)
345
354
  end
@@ -352,7 +361,7 @@ class BaseService
352
361
  end
353
362
 
354
363
  begin
355
- @linkhub.getPartnerURL(getSession_Token(corpNum), getServiceID(), togo, @useStaticIP)
364
+ @linkhub.getPartnerURL(getSession_Token(corpNum), getServiceID(), togo, @useStaticIP, @useGAIP)
356
365
  rescue LinkhubException => le
357
366
  raise PopbillException.new(le.code, le.message)
358
367
  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.17.0
4
+ version: 1.50.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-07-23 00:00:00.000000000 Z
11
+ date: 2021-10-06 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.3.1
19
+ version: 1.4.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.3.1
26
+ version: 1.4.0
27
27
  description: Popbill API SDK
28
28
  email: code@linkhub.co.kr
29
29
  executables: []