Class: PasscertService

Inherits:
BarocertService show all
Defined in:
lib/barocert/passcert.rb

Overview

passcert API BaseService class

Constant Summary

Constants inherited from BarocertService

BarocertService::APIVersion, BarocertService::BOUNDARY, BarocertService::ServiceID_REAL, BarocertService::ServiceURL, BarocertService::ServiceURL_Static

Instance Attribute Summary

Attributes inherited from BarocertService

#ipRestrictOnOff, #linkhub, #scopes, #token_table, #useLocalTimeYN, #useStaticIP

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BarocertService

#addScope, #getServiceURL, #getSession_Token, #gzip_parse, #httpget, #httppost, #setAuthURL, #setIpRestrictOnOff, #setServiceURL, #setUseLocalTimeYN, #setUseStaticIP

Class Method Details

.instance(linkID, secretKey) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/barocert/passcert.rb', line 10

def instance(linkID, secretKey)
  super(linkID, secretKey)
  @instance ||= new
  @instance.addScope("441")
  @instance.addScope("442")
  @instance.addScope("443")
  @instance.addScope("444")
  return @instance
end

Instance Method Details

#_encrypt(plaintext) ⇒ Object



22
23
24
# File 'lib/barocert/passcert.rb', line 22

def _encrypt(plaintext)
  return aes256gcm(plaintext, @linkhub._secretKey)
end

#aes256gcm(plaintext, key) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/barocert/passcert.rb', line 26

def aes256gcm(plaintext, key)
  iv = OpenSSL::Random.random_bytes(12)
  cipher = OpenSSL::Cipher.new('aes-256-gcm')
  cipher.encrypt
  cipher.key = Base64.decode64(key)
  cipher.iv = iv
  ciphertext = cipher.update(plaintext) + cipher.final
  return Base64.strict_encode64(iv + ciphertext + cipher.auth_tag)
end

#getCMSStatus(clientCode, receiptID) ⇒ Object



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/barocert/passcert.rb', line 297

def getCMSStatus(clientCode, receiptID)
  if clientCode.to_s == ''
    raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
  end
  if clientCode.is_i? == false
    raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
  end
  if clientCode.length != 12
    raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
  end
  if receiptID.to_s == ''
    raise BarocertException.new('-99999999', '접수아이디가 입력되지 않았습니다.')
  end
  if receiptID.is_i? == false
    raise BarocertException.new('-99999999', '접수아이디는 숫자만 입력할 수 있습니다.')
  end
  if receiptID.length != 32
    raise BarocertException.new('-99999999', '접수아이디는 32자 입니다.')
  end

  httpget("/PASS/CMS/#{clientCode}/#{receiptID}")
end

#getIdentityStatus(clientCode, receiptID) ⇒ Object



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/barocert/passcert.rb', line 106

def getIdentityStatus(clientCode, receiptID)
  puts receiptID
  if clientCode.to_s == ''
    raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
  end
  if clientCode.is_i? == false
    raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
  end
  if clientCode.length != 12
    raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
  end
  if receiptID.to_s == ''
    raise BarocertException.new('-99999999', '접수아이디가 입력되지 않았습니다.')
  end
  if receiptID.is_i? == false
    raise BarocertException.new('-99999999', '접수아이디는 숫자만 입력할 수 있습니다.')
  end
  if receiptID.length != 32
    raise BarocertException.new('-99999999', '접수아이디는 32자 입니다.')
  end

  httpget("/PASS/Identity/#{clientCode}/#{receiptID}")
end

#getLoginStatus(clientCode, receiptID) ⇒ Object



388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/barocert/passcert.rb', line 388

def getLoginStatus(clientCode, receiptID)
  puts receiptID
  if clientCode.to_s == ''
    raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
  end
  if clientCode.is_i? == false
    raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
  end
  if clientCode.length != 12
    raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
  end
  if receiptID.to_s == ''
    raise BarocertException.new('-99999999', '접수아이디가 입력되지 않았습니다.')
  end
  if receiptID.is_i? == false
    raise BarocertException.new('-99999999', '접수아이디는 숫자만 입력할 수 있습니다.')
  end
  if receiptID.length != 32
    raise BarocertException.new('-99999999', '접수아이디는 32자 입니다.')
  end

  httpget("/PASS/Login/#{clientCode}/#{receiptID}")
end

#getSignStatus(clientCode, receiptID) ⇒ Object



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/barocert/passcert.rb', line 199

def getSignStatus(clientCode, receiptID)
  if clientCode.to_s == ''
    raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
  end
  if clientCode.is_i? == false
    raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
  end
  if clientCode.length != 12
    raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
  end
  if receiptID.to_s == ''
    raise BarocertException.new('-99999999', '접수아이디가 입력되지 않았습니다.')
  end
  if receiptID.is_i? == false
    raise BarocertException.new('-99999999', '접수아이디는 숫자만 입력할 수 있습니다.')
  end
  if receiptID.length != 32
    raise BarocertException.new('-99999999', '접수아이디는 32자 입니다.')
  end

  httpget("/PASS/Sign/#{clientCode}/#{receiptID}")
end

#isNullorEmptyTitle(tokens) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/barocert/passcert.rb', line 40

def isNullorEmptyTitle(tokens)
  if tokens.nil?
    return true
  end
  tokens.each{ |token|
    if token.nil?
      return true
    end
    if token["reqTitle"].to_s == ''
      return true
    end
  }
  false
end

#isNullorEmptyToken(tokens) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/barocert/passcert.rb', line 55

def isNullorEmptyToken(tokens)
  if tokens.nil?
    return true
  end
  tokens.each{ |token|
    if token.nil?
      return true
    end
    if token["token"].to_s == ''
      return true
    end
  }
  false
end

#isNumber(str) ⇒ Object



36
37
38
# File 'lib/barocert/passcert.rb', line 36

def isNumber(str)
  return str.is_i?
end

#requestCMS(clientCode, cms) ⇒ Object



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/barocert/passcert.rb', line 254

def requestCMS(clientCode, cms)
  if clientCode.to_s == ''
    raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
  end
  if clientCode.is_i? == false
    raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
  end
  if clientCode.length != 12
    raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
  end
  if cms.nil?
    raise BarocertException.new('-99999999', '출금동의 요청정보가 입력되지 않았습니다.')
  end
  if cms["receiverHP"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 휴대폰번호가 입력되지 않았습니다.')
  end
  if cms["receiverName"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 성명이 입력되지 않았습니다.')
  end
  if cms["reqTitle"].to_s == ''
    raise BarocertException.new('-99999999', '인증요청 메시지 제목이 입력되지 않았습니다.')
  end
  if cms["callCenterNum"].to_s == ''
    raise BarocertException.new('-99999999', '고객센터 연락처가 입력되지 않았습니다.')
  end
  if cms["expireIn"].to_s == ''
    raise BarocertException.new('-99999999', '만료시간이 입력되지 않았습니다.')
  end
  if cms["bankName"].to_s == ''
    raise BarocertException.new('-99999999', '출금은행명이 입력되지 않았습니다.')
  end
  if cms["bankAccountNum"].to_s == ''
    raise BarocertException.new('-99999999', '출금계좌번호가 입력되지 않았습니다.')
  end
  if cms["bankAccountName"].to_s == ''
    raise BarocertException.new('-99999999', '출금계좌 예금주명이 입력되지 않았습니다.')
  end
  if cms["bankServiceType"].to_s == ''
    raise BarocertException.new('-99999999', '출금 유형이 입력되지 않았습니다.')
  end
  httppost("/PASS/CMS/#{clientCode}", cms.to_json)
end

#requestIdentity(clientCode, identity) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/barocert/passcert.rb', line 70

def requestIdentity(clientCode, identity)

  if clientCode.to_s == ''
    raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
  end
  if clientCode.is_i? == false
    raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
  end
  if clientCode.length != 12
    raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
  end
  if identity.nil?
    raise BarocertException.new('-99999999', '본인인증 요청정보가 입력되지 않았습니다.')
  end
  if identity["receiverHP"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 휴대폰번호가 입력되지 않았습니다.')
  end
  if identity["receiverName"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 성명이 입력되지 않았습니다.')
  end
  if identity["reqTitle"].to_s == ''
    raise BarocertException.new('-99999999', '인증요청 메시지 제목이 입력되지 않았습니다.')
  end
  if identity["callCenterNum"].to_s == ''
    raise BarocertException.new('-99999999', '고객센터 연락처가 입력되지 않았습니다.')
  end
  if identity["expireIn"].to_s == ''
    raise BarocertException.new('-99999999', '만료시간이 입력되지 않았습니다.')
  end
  if identity["token"].to_s == ''
    raise BarocertException.new('-99999999', '토큰 원문이 입력되지 않았습니다.')
  end

  httppost("/PASS/Identity/#{clientCode}", identity.to_json)
end

#requestLogin(clientCode, login) ⇒ Object



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/barocert/passcert.rb', line 352

def requestLogin(clientCode, )

  if clientCode.to_s == ''
    raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
  end
  if clientCode.is_i? == false
    raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
  end
  if clientCode.length != 12
    raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
  end
  if .nil?
    raise BarocertException.new('-99999999', '간편로그인 요청정보가 입력되지 않았습니다.s')
  end
  if ["receiverHP"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 휴대폰번호가 입력되지 않았습니다.')
  end
  if ["receiverName"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 성명이 입력되지 않았습니다.')
  end
  if ["reqTitle"].to_s == ''
    raise BarocertException.new('-99999999', '인증요청 메시지 제목이 입력되지 않았습니다.')
  end
  if ["callCenterNum"].to_s == ''
    raise BarocertException.new('-99999999', '고객센터 연락처가 입력되지 않았습니다.')
  end
  if ["expireIn"].to_s == ''
    raise BarocertException.new('-99999999', '만료시간이 입력되지 않았습니다.')
  end
  if ["token"].to_s == ''
    raise BarocertException.new('-99999999', '토큰 원문이 입력되지 않았습니다.')
  end

  httppost("/PASS/Login/#{clientCode}", .to_json)
end

#requestSign(clientCode, sign) ⇒ Object



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/barocert/passcert.rb', line 162

def requestSign(clientCode, sign)
  if clientCode.to_s == ''
    raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
  end
  if clientCode.is_i? == false
    raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
  end
  if clientCode.length != 12
    raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
  end
  if sign.nil?
    raise BarocertException.new('-99999999', '전자서명 요청정보가 입력되지 않았습니다.')
  end
  if sign["receiverHP"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 휴대폰번호가 입력되지 않았습니다.')
  end
  if sign["receiverName"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 성명이 입력되지 않았습니다.')
  end
  if sign["reqTitle"].to_s == ''
    raise BarocertException.new('-99999999', '인증요청 메시지 제목이 입력되지 않았습니다.')
  end
  if sign["callCenterNum"].to_s == ''
    raise BarocertException.new('-99999999', '고객센터 연락처가 입력되지 않았습니다.')
  end
  if sign["expireIn"].to_s == ''
    raise BarocertException.new('-99999999', '만료시간이 입력되지 않았습니다.')
  end
  if sign["token"].to_s == ''
    raise BarocertException.new('-99999999', '토큰 원문이 입력되지 않았습니다.')
  end
  if sign["tokenType"].to_s == ''
    raise BarocertException.new('-99999999', '원문 유형이 입력되지 않았습니다.')
  end
  httppost("/PASS/Sign/#{clientCode}", sign.to_json)
end

#verifyCMS(clientCode, receiptID, cmsVerify) ⇒ Object



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/barocert/passcert.rb', line 320

def verifyCMS(clientCode, receiptID, cmsVerify)
  if clientCode.to_s == ''
    raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
  end
  if clientCode.is_i? == false
    raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
  end
  if clientCode.length != 12
    raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
  end
  if receiptID.to_s == ''
    raise BarocertException.new('-99999999', '접수아이디가 입력되지 않았습니다.')
  end
  if receiptID.is_i? == false
    raise BarocertException.new('-99999999', '접수아이디는 숫자만 입력할 수 있습니다.')
  end
  if receiptID.length != 32
    raise BarocertException.new('-99999999', '접수아이디는 32자 입니다.')
  end
  if cmsVerify.nil?
    raise BarocertException.new('-99999999', '출금동의 검증 요청 정보가 입력되지 않았습니다.')
  end
  if cmsVerify["receiverHP"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 휴대폰번호가 입력되지 않았습니다.')
  end
  if cmsVerify["receiverName"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 성명이 입력되지 않았습니다.')
  end

  httppost("/PASS/CMS/#{clientCode}/#{receiptID}", cmsVerify.to_json)
end

#verifyIdentity(clientCode, receiptID, identityVerify) ⇒ Object



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/barocert/passcert.rb', line 130

def verifyIdentity(clientCode, receiptID, identityVerify)
  if clientCode.to_s == ''
    raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
  end
  if clientCode.is_i? == false
    raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
  end
  if clientCode.length != 12
    raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
  end
  if receiptID.to_s == ''
    raise BarocertException.new('-99999999', '접수아이디가 입력되지 않았습니다.')
  end
  if receiptID.is_i? == false
    raise BarocertException.new('-99999999', '접수아이디는 숫자만 입력할 수 있습니다.')
  end
  if receiptID.length != 32
    raise BarocertException.new('-99999999', '접수아이디는 32자 입니다.')
  end
  if identityVerify.nil?
    raise BarocertException.new('-99999999', '본인인증 검증 요청 정보가 입력되지 않았습니다.')
  end
  if identityVerify["receiverHP"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 휴대폰번호가 입력되지 않았습니다.')
  end
  if identityVerify["receiverName"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 성명이 입력되지 않았습니다.')
  end

  httppost("/PASS/Identity/#{clientCode}/#{receiptID}", identityVerify.to_json)
end

#verifyLogin(clientCode, receiptID, loginVerify) ⇒ Object



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/barocert/passcert.rb', line 412

def verifyLogin(clientCode, receiptID, loginVerify)
  if clientCode.to_s == ''
    raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
  end
  if clientCode.is_i? == false
    raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
  end
  if clientCode.length != 12
    raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
  end
  if receiptID.to_s == ''
    raise BarocertException.new('-99999999', '접수아이디가 입력되지 않았습니다.')
  end
  if receiptID.is_i? == false
    raise BarocertException.new('-99999999', '접수아이디는 숫자만 입력할 수 있습니다.')
  end
  if receiptID.length != 32
    raise BarocertException.new('-99999999', '접수아이디는 32자 입니다.')
  end
  if loginVerify.nil?
    raise BarocertException.new('-99999999', '간편로그인 검증 요청 정보가 입력되지 않았습니다.')
  end
  if loginVerify["receiverHP"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 휴대폰번호가 입력되지 않았습니다.')
  end
  if loginVerify["receiverName"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 성명이 입력되지 않았습니다.')
  end

  httppost("/PASS/Login/#{clientCode}/#{receiptID}", loginVerify.to_json)
end

#verifySign(clientCode, receiptID, signVerify) ⇒ Object



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/barocert/passcert.rb', line 222

def verifySign(clientCode, receiptID, signVerify)
  if clientCode.to_s == ''
    raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
  end
  if clientCode.is_i? == false
    raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
  end
  if clientCode.length != 12
    raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
  end
  if receiptID.to_s == ''
    raise BarocertException.new('-99999999', '접수아이디가 입력되지 않았습니다.')
  end
  if receiptID.is_i? == false
    raise BarocertException.new('-99999999', '접수아이디는 숫자만 입력할 수 있습니다.')
  end
  if receiptID.length != 32
    raise BarocertException.new('-99999999', '접수아이디는 32자 입니다.')
  end
  if signVerify.nil?
    raise BarocertException.new('-99999999', '전자서명 검증 요청 정보가 입력되지 않았습니다.')
  end
  if signVerify["receiverHP"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 휴대폰번호가 입력되지 않았습니다.')
  end
  if signVerify["receiverName"].to_s == ''
    raise BarocertException.new('-99999999', '수신자 성명이 입력되지 않았습니다.')
  end

  httppost("/PASS/Sign/#{clientCode}/#{receiptID}", signVerify.to_json)
end