popbill 1.50.0 → 1.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44b33186b1d460756e62a2735a51e521906ffd6c
4
- data.tar.gz: 6e2409b253c1e15280d7e9a5425a0a14aa4e43dc
3
+ metadata.gz: ae4b466a64a5573085f006bcbc4f85954d4bd9bf
4
+ data.tar.gz: 054f4e021777a44ae5259c6715099305e09b6c6d
5
5
  SHA512:
6
- metadata.gz: 3b818a09da92f6bb0e62db04e0d32983e988e013da858352c25b964f88b3ffd37b84b9254b4b1191d98433b6c74237eaae0ca841fda12da33d7427e4b87e3224
7
- data.tar.gz: 2427ddf278d6d54e8c1e2e4e03a7b3022b8f7045d3f43403ea24760362a165bb0acbf628bd14e412a30f6d1a7ed7104a5d0102506fe5afbe2c6e17134903d3f9
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,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', '사업자등록번호가 올바르지 않습니다.')
@@ -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
@@ -19,7 +19,7 @@ class BaseService
19
19
  POPBILL_APIVersion = "1.0"
20
20
  BOUNDARY = "==POPBILL_RUBY_SDK=="
21
21
 
22
- attr_accessor :token_table, :scopes, :isTest, :linkhub, :ipRestrictOnOff, :useStaticIP, :useGAIP
22
+ attr_accessor :token_table, :scopes, :isTest, :linkhub, :ipRestrictOnOff, :useStaticIP, :useGAIP, :useLocalTimeYN
23
23
 
24
24
  # Generate Linkhub Class Singleton Instance
25
25
  class << self
@@ -31,6 +31,7 @@ class BaseService
31
31
  @instance.ipRestrictOnOff = true
32
32
  @instance.useStaticIP = false
33
33
  @instance.useGAIP = false
34
+ @instance.useLocalTimeYN = true
34
35
 
35
36
  return @instance
36
37
  end
@@ -60,6 +61,10 @@ class BaseService
60
61
  @useGAIP = value
61
62
  end
62
63
 
64
+ def setUseLocalTimeYN(value)
65
+ @useLocalTimeYN = value
66
+ end
67
+
63
68
  def getServiceURL()
64
69
  if @useGAIP
65
70
  return @isTest ? BaseService::ServiceURL_GA_TEST : BaseService::ServiceURL_GA_REAL
@@ -90,7 +95,7 @@ class BaseService
90
95
  else
91
96
  # Token's expireTime must use parse() because time format is hh:mm:ss.SSSZ
92
97
  expireTime = DateTime.parse(targetToken['expiration'])
93
- serverUTCTime = DateTime.strptime(@linkhub.getTime(@useStaticIP, @useGAIP))
98
+ serverUTCTime = DateTime.strptime(@linkhub.getTime(@useStaticIP, @useGAIP, @useLocalTimeYN))
94
99
  refresh = expireTime < serverUTCTime
95
100
  end
96
101
 
@@ -98,7 +103,7 @@ class BaseService
98
103
  begin
99
104
  # getSessionToken from Linkhub
100
105
  targetToken = @linkhub.getSessionToken(
101
- @isTest ? ServiceID_TEST : ServiceID_REAL, corpNum, @scopes, @ipRestrictOnOff ? "" : "*", @useStaticIP, @useGAIP)
106
+ @isTest ? ServiceID_TEST : ServiceID_REAL, corpNum, @scopes, @ipRestrictOnOff ? "" : "*", @useStaticIP, @useGAIP, @useLocalTimeYN)
102
107
 
103
108
  rescue LinkhubException => le
104
109
  raise PopbillException.new(le.code, le.message)
@@ -204,9 +209,50 @@ class BaseService
204
209
 
205
210
  #end of httppost
206
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
207
253
 
208
254
  # Request HTTP Post File
209
- def httppostfile(url, corpNum, form, files, userID)
255
+ def httppostfile(url, corpNum, form, files, userID, isBinary = false)
210
256
  headers = {
211
257
  "x-pb-version" => BaseService::POPBILL_APIVersion,
212
258
  "Content-Type" => "multipart/form-data;boundary=" + BaseService::BOUNDARY,
@@ -230,20 +276,29 @@ class BaseService
230
276
  post_body << "Content-Type: Application/json;\r\n\r\n"
231
277
  post_body << form.to_json + "\r\n"
232
278
  end
233
-
234
- files.each do |filePath|
235
- begin
236
- fileName = File.basename(filePath)
237
- 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"
238
283
  post_body << "Content-Disposition: form-data; name=\"file\"; filename=\"#{fileName}\"\r\n"
239
284
  post_body << "Content-Type: Application/octet-stream\r\n\r\n"
240
- post_body << File.read(filePath)
241
- rescue
242
- 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
243
298
  end
244
299
  end
245
300
 
246
- post_body << "\r\n\r\n--#{BaseService::BOUNDARY}--\r\n"
301
+ post_body << "\r\n--#{BaseService::BOUNDARY}--\r\n"
247
302
  # Add the file Data
248
303
 
249
304
  uri = URI(getServiceURL() + url)
@@ -387,6 +442,24 @@ class BaseService
387
442
  response['url']
388
443
  end
389
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
+
390
463
  # 팝빌 로그인 URL
391
464
  def getAccessURL(corpNum, userID)
392
465
  if corpNum.length != 10
@@ -415,6 +488,16 @@ class BaseService
415
488
  http_response = httpget("/Join?CorpNum=" + corpNum + "&LID=" + linkID, "", "")
416
489
  end
417
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
+
418
501
  # Get list Corp Contact
419
502
  def listContact(corpNum, userID = "")
420
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.50.0
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: 2021-10-06 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.4.0
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.4.0
26
+ version: 1.5.0
27
27
  description: Popbill API SDK
28
28
  email: code@linkhub.co.kr
29
29
  executables: []