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, #sha256Base64urlFile

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



26
27
28
# File 'lib/barocert/passcert.rb', line 26

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

#_sha256_base64url_file(target) ⇒ Object



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

def _sha256_base64url_file(target)
	return self.sha256Base64urlFile(target)
end

#aes256gcm(plaintext, key) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/barocert/passcert.rb', line 30

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



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/barocert/passcert.rb', line 301

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



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/barocert/passcert.rb', line 110

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



392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/barocert/passcert.rb', line 392

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



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/barocert/passcert.rb', line 203

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



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/barocert/passcert.rb', line 44

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



59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/barocert/passcert.rb', line 59

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



40
41
42
# File 'lib/barocert/passcert.rb', line 40

def isNumber(str)
	return str.is_i?
end

#requestCMS(clientCode, cms) ⇒ Object



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
296
297
298
299
# File 'lib/barocert/passcert.rb', line 258

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



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
105
106
107
108
# File 'lib/barocert/passcert.rb', line 74

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



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
387
388
389
390
# File 'lib/barocert/passcert.rb', line 356

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



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
198
199
200
201
# File 'lib/barocert/passcert.rb', line 166

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



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
351
352
353
354
# File 'lib/barocert/passcert.rb', line 324

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/Verify/#{clientCode}/#{receiptID}", cmsVerify.to_json)
end

#verifyIdentity(clientCode, receiptID, identityVerify) ⇒ Object



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
161
162
163
164
# File 'lib/barocert/passcert.rb', line 134

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/Verify/#{clientCode}/#{receiptID}", identityVerify.to_json)
end

#verifyLogin(clientCode, receiptID, loginVerify) ⇒ Object



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
443
444
445
446
# File 'lib/barocert/passcert.rb', line 416

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/Verify/#{clientCode}/#{receiptID}", loginVerify.to_json)
end

#verifySign(clientCode, receiptID, signVerify) ⇒ Object



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
253
254
255
256
# File 'lib/barocert/passcert.rb', line 226

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/Verify/#{clientCode}/#{receiptID}", signVerify.to_json)
end