barocert 1.2.3 → 1.3.1

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
  SHA256:
3
- metadata.gz: 8b3803230c3249b189b39e5fab16d923ee02f45b2800aa214057e673b365f46f
4
- data.tar.gz: 1c5e205db4f827aa43531981c8d72a419944efdbf22390ba6ee04bf02f597487
3
+ metadata.gz: cf7b604b1bbf8dafc4d899209c4dea9db0195b163c788ce55476313d5c8a5c94
4
+ data.tar.gz: f795573b59f420f2fcf5e4804ef8ec31b7eff4418ff8d09ac9377c433256ce2f
5
5
  SHA512:
6
- metadata.gz: 57de242aa52d067ca8604e4ddc0dffbe3a37f8f762ec5eda076b04f787b8612548da401a175ae6e5d3e5644f8fc368a914345b7e68c28406c207900782167c2b
7
- data.tar.gz: c9da9f81b02ad020f16a1d905de64ff24fb32399cdb0f56800740cbbf72c82313c4ee5b9e92c6070949553491090e646de17d437781dbeabef6dc4d1f375aca2
6
+ metadata.gz: 8f18d287ddd55c44cab41e20d4b0cfaedab5d267d1f1212250d428a5123fec55d5eea12dc7c7e03dd08c26da5eff343baf7a29002b506952f6d2c7423037f28d
7
+ data.tar.gz: 4ac4577cc71791d00abff1868cfb8e69b64ec9093ea9c9931ddccbbdbe1486aec0a56ebe660999c613cacdaa466ce2bf0b059259f8d5adba33ade541f3f7b164
@@ -20,6 +20,10 @@ class KakaocertService < BarocertService
20
20
  private :new
21
21
  end
22
22
 
23
+ def _sha256_base64url_file(target)
24
+ return self.sha256Base64urlFile(target)
25
+ end
26
+
23
27
  def _encrypt(plaintext)
24
28
  return aes256gcm(plaintext, @linkhub._secretKey)
25
29
  end
@@ -1,5 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require_relative '../barocert.rb'
3
+ require 'digest'
3
4
  require 'openssl'
4
5
  require 'base64'
5
6
 
@@ -13,11 +14,20 @@ class NavercertService < BarocertService
13
14
  @instance.addScope("421")
14
15
  @instance.addScope("422")
15
16
  @instance.addScope("423")
17
+ @instance.addScope("424")
16
18
  return @instance
17
19
  end
18
20
  private :new
19
21
  end
20
22
 
23
+ def _sha256_base64url(target)
24
+ return self.sha256Base64urlFile(target)
25
+ end
26
+
27
+ def _sha256_base64url_file(target)
28
+ return self.sha256Base64urlFile(target)
29
+ end
30
+
21
31
  def _encrypt(plaintext)
22
32
  return aes256gcm(plaintext, @linkhub._secretKey)
23
33
  end
@@ -338,6 +348,100 @@ class NavercertService < BarocertService
338
348
 
339
349
  httppost("/NAVER/MultiSign/#{clientCode}/#{receiptID}")
340
350
  end
351
+
352
+ def requestCMS(clientCode, cms)
353
+
354
+ if clientCode.to_s == ''
355
+ raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
356
+ end
357
+ if clientCode.is_i? == false
358
+ raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
359
+ end
360
+ if clientCode.length != 12
361
+ raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
362
+ end
363
+ if cms.nil?
364
+ raise BarocertException.new('-99999999', '본인인증 서명요청 정보가 입력되지 않았습니다.')
365
+ end
366
+ if cms["receiverHP"].to_s == ''
367
+ raise BarocertException.new('-99999999', '수신자 휴대폰번호가 입력되지 않았습니다.')
368
+ end
369
+ if cms["receiverName"].to_s == ''
370
+ raise BarocertException.new('-99999999', '수신자 성명이 입력되지 않았습니다.')
371
+ end
372
+ if cms["receiverBirthday"].to_s == ''
373
+ raise BarocertException.new('-99999999', '생년월일이 입력되지 않았습니다.')
374
+ end
375
+ if cms["callCenterNum"].to_s == ''
376
+ raise BarocertException.new('-99999999', '고객센터 연락처가 입력되지 않았습니다.')
377
+ end
378
+ if cms["expireIn"].to_s == ''
379
+ raise BarocertException.new('-99999999', '만료시간이 입력되지 않았습니다.')
380
+ end
381
+ if cms["requestCorp"].to_s == ''
382
+ raise BarocertException.new('-99999999', '청구기관명이 입력되지 않았습니다.')
383
+ end
384
+ if cms["bankName"].to_s == ''
385
+ raise BarocertException.new('-99999999', '은행명이 입력되지 않았습니다.')
386
+ end
387
+ if cms["bankAccountNum"].to_s == ''
388
+ raise BarocertException.new('-99999999', '계좌번호가 입력되지 않았습니다.')
389
+ end
390
+ if cms["bankAccountName"].to_s == ''
391
+ raise BarocertException.new('-99999999', '예금주명이 입력되지 않았습니다.')
392
+ end
393
+ if cms["bankAccountBirthday"].to_s == ''
394
+ raise BarocertException.new('-99999999', '예금주 생년월일이 입력되지 않았습니다.')
395
+ end
396
+ httppost("/NAVER/CMS/#{clientCode}", cms.to_json)
397
+ end
398
+
399
+ def getCMSStatus(clientCode, receiptID)
400
+ puts receiptID
401
+ if clientCode.to_s == ''
402
+ raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
403
+ end
404
+ if clientCode.is_i? == false
405
+ raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
406
+ end
407
+ if clientCode.length != 12
408
+ raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
409
+ end
410
+ if receiptID.to_s == ''
411
+ raise BarocertException.new('-99999999', '접수아이디가 입력되지 않았습니다.')
412
+ end
413
+ if receiptID.is_i? == false
414
+ raise BarocertException.new('-99999999', '접수아이디는 숫자만 입력할 수 있습니다.')
415
+ end
416
+ if receiptID.length != 32
417
+ raise BarocertException.new('-99999999', '접수아이디는 32자 입니다.')
418
+ end
419
+
420
+ httpget("/NAVER/CMS/#{clientCode}/#{receiptID}")
421
+ end
422
+
423
+ def verifyCMS(clientCode, receiptID)
424
+ if clientCode.to_s == ''
425
+ raise BarocertException.new('-99999999', '이용기관코드가 입력되지 않았습니다.')
426
+ end
427
+ if clientCode.is_i? == false
428
+ raise BarocertException.new('-99999999', '이용기관코드는 숫자만 입력할 수 있습니다.')
429
+ end
430
+ if clientCode.length != 12
431
+ raise BarocertException.new('-99999999', '이용기관코드는 12자 입니다.')
432
+ end
433
+ if receiptID.to_s == ''
434
+ raise BarocertException.new('-99999999', '접수아이디가 입력되지 않았습니다.')
435
+ end
436
+ if receiptID.is_i? == false
437
+ raise BarocertException.new('-99999999', '접수아이디는 숫자만 입력할 수 있습니다.')
438
+ end
439
+ if receiptID.length != 32
440
+ raise BarocertException.new('-99999999', '접수아이디는 32자 입니다.')
441
+ end
442
+
443
+ httppost("/NAVER/CMS/#{clientCode}/#{receiptID}")
444
+ end
341
445
  end
342
446
 
343
447
  class String
@@ -19,6 +19,10 @@ class PasscertService < BarocertService
19
19
  private :new
20
20
  end
21
21
 
22
+ def _sha256_base64url_file(target)
23
+ return self.sha256Base64urlFile(target)
24
+ end
25
+
22
26
  def _encrypt(plaintext)
23
27
  return aes256gcm(plaintext, @linkhub._secretKey)
24
28
  end
data/lib/barocert.rb CHANGED
@@ -4,6 +4,7 @@ require 'uri'
4
4
  require 'json'
5
5
  require 'date'
6
6
  require 'linkhub'
7
+ require 'digest'
7
8
 
8
9
  # Barocert API BaseService class
9
10
  class BarocertService
@@ -192,6 +193,11 @@ class BarocertService
192
193
  end
193
194
 
194
195
  #end of httppost
196
+
197
+ def sha256Base64urlFile(target)
198
+ hashed = Digest::SHA256.digest(target)
199
+ return Base64.urlsafe_encode64(hashed, padding:false)
200
+ end
195
201
  end
196
202
 
197
203
  # Barocert API Exception Handler class
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barocert
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Linkhub Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-28 00:00:00.000000000 Z
11
+ date: 2024-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: linkhub