popbill 1.17.1 → 1.51.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: 5941dd234478b21c065c39ac015d81e79f126f5e
4
- data.tar.gz: b1f1a0d3db4841240bce29ddc9988be2f7970e31
3
+ metadata.gz: ae4b466a64a5573085f006bcbc4f85954d4bd9bf
4
+ data.tar.gz: 054f4e021777a44ae5259c6715099305e09b6c6d
5
5
  SHA512:
6
- metadata.gz: 69f6950f5ade976ee99b51c7f5e19dffa3b7554f9e3954ddef650106d9d31781693f253a9998eb40c6749bfa85fabab3207d8d265cfe658a53f69882089dca5e
7
- data.tar.gz: 3574f57ebf829b54da40da845c7d247760ea620f546e2b330fabe5049d930c81034b019638d42f365c2138dd4b209ea2f5fc49209bf7871c26479f47c70be74c
6
+ metadata.gz: 0e0af45661b0621803248dbc7d5114746ce14266ee7b833d2e33cccaf78af4bd4e11f2130468dd9c57d4de06e24c0e4b3040704427d1ecee542af694c82d30fd
7
+ data.tar.gz: 8ba00567a3cdff2a71f346d58d8ae95599828464ffa8eb35dbd33e4a1046ab0436b52687585600a60bd8d19e15c520f04b40b77f37cf5a2a6e264093072f10e9
@@ -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
- httpget("/EasyFin/AccountCheck/ChargeInfo", corpNum, userID)
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
- httpget("/EasyFin/AccountCheck/UnitCost", corpNum, userID)['unitCost']
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 FaxService
90
+ end # end of AccountCheckService
@@ -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,28 @@ 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
+
366
+ def getPDFURL(corpNum, mgtKey, userID = '')
367
+ if corpNum.length != 10
368
+ raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
369
+ end
370
+ if mgtKey.to_s == ''
371
+ raise PopbillException.new('-99999999', '문서번호가 올바르지 않습니다.')
372
+ end
373
+
374
+ httpget("/Cashbill/#{mgtKey}?TG=PDF", corpNum, userID)['url']
375
+ end
376
+
355
377
  def getPrintURL(corpNum, mgtKey, userID = '')
356
378
  if corpNum.length != 10
357
379
  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
@@ -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 == ''
@@ -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
 
@@ -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', '사업자등록번호가 올바르지 않습니다.')
@@ -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 @useStaticIP
58
- return @isTest ? BaseService::ServiceURL_GA_TEST : BaseService::ServiceURL_GA_REAL
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
- files.each do |filePath|
226
- begin
227
- fileName = File.basename(filePath)
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 << File.read(filePath)
232
- rescue
233
- raise PopbillException.new(-99999999, "Failed to reading filedata from filepath")
285
+ post_body << fileData["fileData"]
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\r\n--#{BaseService::BOUNDARY}--\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.17.1
4
+ version: 1.51.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: 2022-01-04 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.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.3.1
26
+ version: 1.5.0
27
27
  description: Popbill API SDK
28
28
  email: code@linkhub.co.kr
29
29
  executables: []