smile-identity-core 2.0.0 → 2.1.1

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
  SHA256:
3
- metadata.gz: 84fcac3562348da2011a2ccb7d84c2ca44ae2927284212f3430dbc164bd1a704
4
- data.tar.gz: 487c49c050a929a5339bc8dccbc44d3b117eca7af717d7a73e0fe6303a86608d
3
+ metadata.gz: cfb7b18b264e3489d0e51f3f9cae6c8557ef535fbf3b348e6b843695c748d76f
4
+ data.tar.gz: 0f1c92749d1a139f02bd8216136eab00842d718425e45a5ffbe7174a69d1cf8a
5
5
  SHA512:
6
- metadata.gz: afda841be8343b9c9708e08e2fefc57e384ef5e6adc3223f1b173371199dbdeba68a8a9bbbf89f5ece247c607ecb3f7b614f1ad973ecffc537443c59fe102e30
7
- data.tar.gz: 9f7b159ca49672cae6a81d6e6ce76259d5582592ee8b9bb924747161b7c829e562a866f9365d7774544790074bd5c96c1bde5566b41fb3765e4863839f2f428a
6
+ metadata.gz: 3d66bd0c015e777468b738e58116219ae48dfa99a98ef2b8a8d53abe2c7d6cc07804e23316aeb39aa0affc1c8be03307d4378c088831e37bb5084910d180713c
7
+ data.tar.gz: 5eec195935a7fbd2eaf0f85930f8ebbe5578a6be874ff7288b7cc43c120cae9e2666f40eaf043245824657bee3988a4deda19fc93fd59f35def7bb60430454ab
data/CHANGELOG.md CHANGED
@@ -6,16 +6,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.1.1] - 2022-12-13
10
+ ### Added
11
+ - Adds UPDATE_PHOTO and COMPARE_USER_INFO to JobType
12
+ ### Changed
13
+ - Fix wrong constant values for JobType SMART_SELFIE_AUTHENTICATION and SMART_SELFIE_REGISTRATION
14
+
15
+ # [2.1.0] - 2022-10-28
16
+ ## Changed
17
+ - Moved Business verification to IDApi
18
+
9
19
  # [2.0.0] - 2022-10-24
10
20
  ### Added
11
21
  - build: Adds support for ruby 3.1
12
22
  - docs: adds "examples" folder
13
- - Adds Business Verfication product
23
+ - Adds Business Verification product
14
24
 
15
25
  ### Changed
16
26
  - ci: Move from TravisCI to Github Actions
17
27
  - core: Enforces the use of signature on all API calls
18
- - core: Adds helper constants SMILE_IDENTITY_CORE::ENV, SMILE_IDENTITY_CORE::IMAGE_TYPE, SMILE_IDENTITY_CORE::JOB_TYPE
28
+ - core: Adds helper constants SMILE_IDENTITY_CORE::ENV, SMILE_IDENTITY_CORE::ImageType, SMILE_IDENTITY_CORE::JobType
19
29
  - Fixes invalid links in gemspec
20
30
 
21
31
  ### Removed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smile-identity-core (2.0.0)
4
+ smile-identity-core (2.1.1)
5
5
  rubyzip (~> 1.2, >= 1.2.3)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
@@ -11,12 +11,12 @@ default_callback = '<Put your default callback url here>'
11
11
  api_key = '<Put your API key here>'; # copy your API key from the Smile Identity portal
12
12
  sid_server = '<0 | 1>'; # Use '0' for the sandbox server, use '1' for production server
13
13
 
14
- connection = SmileIdentityCore::WebApi.new(partner_id, default_callback, api_key, sid_server)
14
+ connection = SmileIdentityCore::IDApi.new(partner_id, default_callback, api_key, sid_server)
15
15
 
16
16
  # Create required tracking parameters
17
17
  partner_params = {
18
- job_id: "job-#{SecureRandom.uuid}",
19
- user_id: "user-#{SecureRandom.uuid}",
18
+ job_id: '<put your unique job ID here>',
19
+ user_id: '<put your unique ID for the user here>',
20
20
  job_type: SmileIdentityCore::JobType::BUSINESS_VERIFICATION
21
21
  }
22
22
 
@@ -25,13 +25,21 @@ id_info = {
25
25
  # The country where ID document was issued
26
26
  country: '<2-letter country code>',
27
27
  # The ID document type
28
+ # Available types BASIC_BUSINESS_REGISTRATION, BUSINESS_REGISTRATION and TAX_INFORMATION
28
29
  id_type: '<id type>',
29
30
  # The business registration or tax number
30
- id_number: '<id number>',
31
+ id_number: '0000000',
31
32
  # The business incorporation type bn - business name, co - private/public limited, it - incorporated trustees
32
33
  # Only required for BASIC_BUSINESS_REGISTRATION and BUSINESS_REGISTRATION in Nigeria
33
- business_type: '<co | bn | it>'
34
+ business_type: 'co',
35
+ # Postal address of business. Only Required for BUSINESS_REGISTRATION in Kenya
36
+ postal_address: '<postal address>',
37
+ # Postal code of business. Only Required for BUSINESS_REGISTRATION in Kenya
38
+ postal_code: '<postal code>'
34
39
  }
35
40
 
41
+ # Set the options for the job
42
+ options = {}
43
+
36
44
  # Submit the job
37
- connection.submit_job(partner_params, [], id_info, {})
45
+ connection.submit_job(partner_params, id_info, options)
@@ -1,9 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
- require 'base64'
5
- require 'openssl'
6
- require 'uri'
7
4
  require 'typhoeus'
8
5
  require_relative 'validations'
9
6
 
@@ -2,12 +2,25 @@
2
2
 
3
3
  module SmileIdentityCore
4
4
  module JobType
5
+ # Compares a selfie to a selfie on file.
5
6
  BIOMETRIC_KYC = 1
6
- SMART_SELFIE_REGISTRATION = 2
7
- SMART_SELFIE_AUTHENTICATION = 4
7
+ # Compares a selfie to a selfie on file.
8
+ SMART_SELFIE_AUTHENTICATION = 2
9
+ # Creates an enrollee, associates a selfie with a partner_id, user_id
10
+ SMART_SELFIE_REGISTRATION = 4
11
+ # Verifies identity information of a person with their personal
12
+ # information and ID number from one of our supported ID Types.
8
13
  BASIC_KYC = 5
14
+ # Queries Identity Information of user using ID_number.
9
15
  ENHANCED_KYC = 5
16
+ # Verifies user info retrieved from the ID issuing authority.
10
17
  DOCUMENT_VERIFICATION = 6
18
+ # Verifies authenticity of Document IDs, confirms it's linked to the user
19
+ # using facial biometrics.
11
20
  BUSINESS_VERIFICATION = 7
21
+ # Updates the photo on file for an enrolled user
22
+ UPDATE_PHOTO = 8
23
+ # Compares document verification to an id check
24
+ COMPARE_USER_INFO = 9
12
25
  end
13
26
  end
@@ -1,8 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'validations'
4
+
3
5
  module SmileIdentityCore
4
6
  # Allows you to query the Identity Information for an individual using their ID number
5
7
  class IDApi
8
+ include Validations
9
+
10
+ REQUIRED_ID_INFO_FIELD = %i[country id_type id_number].freeze
11
+
6
12
  def initialize(partner_id, api_key, sid_server)
7
13
  @partner_id = partner_id.to_s
8
14
  @api_key = api_key
@@ -15,47 +21,23 @@ module SmileIdentityCore
15
21
  end
16
22
 
17
23
  def submit_job(partner_params, id_info, options = {})
18
- self.partner_params = symbolize_keys partner_params
19
- self.id_info = symbolize_keys id_info
20
- options = symbolize_keys(options || {})
21
- @use_async_endpoint = options.fetch(:async, false)
24
+ @partner_params = validate_partner_params(symbolize_keys(partner_params))
25
+ @id_info = validate_id_info(symbolize_keys(id_info), REQUIRED_ID_INFO_FIELD)
22
26
 
23
- if @partner_params[:job_type].to_i != 5
24
- raise ArgumentError, 'Please ensure that you are setting your job_type to 5 to query ID Api'
27
+ unless [JobType::ENHANCED_KYC, JobType::BUSINESS_VERIFICATION].include?(@partner_params[:job_type].to_i)
28
+ raise ArgumentError, 'Please ensure that you are setting your job_type to 5 or 7 to query ID Api'
25
29
  end
26
30
 
27
- setup_requests
28
- end
29
-
30
- def partner_params=(partner_params)
31
- raise ArgumentError, 'Please ensure that you send through partner params' if partner_params.nil?
32
-
33
- raise ArgumentError, 'Partner params needs to be a hash' unless partner_params.is_a?(Hash)
34
-
35
- %i[user_id job_id job_type].each do |key|
36
- if partner_params[key].to_s.empty?
37
- raise ArgumentError,
38
- "Please make sure that #{key} is included in the partner params"
39
- end
31
+ if partner_params[:job_type] == JobType::BUSINESS_VERIFICATION
32
+ return SmileIdentityCore::BusinessVerification
33
+ .new(@partner_id, @api_key, @url)
34
+ .submit_job(partner_params, id_info)
40
35
  end
41
36
 
42
- @partner_params = partner_params
43
- end
44
-
45
- def id_info=(id_info)
46
- updated_id_info = id_info
47
-
48
- if updated_id_info.nil? || updated_id_info.keys.length.zero?
49
- raise ArgumentError, 'Please make sure that id_info not empty or nil'
50
- end
51
-
52
- %i[country id_type id_number].each do |key|
53
- unless updated_id_info[key] && !updated_id_info[key].nil? && !updated_id_info[key].empty?
54
- raise ArgumentError, "Please make sure that #{key} is included in the id_info"
55
- end
56
- end
37
+ options = symbolize_keys(options || {})
38
+ @use_async_endpoint = options.fetch(:async, false)
57
39
 
58
- @id_info = updated_id_info
40
+ setup_requests
59
41
  end
60
42
 
61
43
  private
@@ -18,7 +18,7 @@ module SmileIdentityCore
18
18
  end
19
19
 
20
20
  def validate_id_info(id_info, required_id_info_fields)
21
- raise ArgumentError, 'Please make sure that id_info not empty or nil' if id_info.nil? || id_info.empty?
21
+ raise ArgumentError, 'Please make sure that id_info is not empty or nil' if id_info.nil? || id_info.empty?
22
22
 
23
23
  raise ArgumentError, 'Id info needs to be a hash' unless id_info.is_a?(Hash)
24
24
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmileIdentityCore
4
- VERSION = '2.0.0'
4
+ VERSION = '2.1.1'
5
5
  SOURCE_SDK = 'Ruby'
6
6
  end
@@ -25,14 +25,9 @@ module SmileIdentityCore
25
25
 
26
26
  def submit_job(partner_params, images, id_info, options)
27
27
  self.partner_params = symbolize_keys partner_params
28
- if @partner_params[:job_type].to_i == JobType::ENHANCED_KYC
29
- return SmileIdentityCore::IDApi.new(@partner_id, @api_key, @sid_server).submit_job(partner_params, id_info)
30
- end
31
28
 
32
- if @partner_params[:job_type].to_i == JobType::BUSINESS_VERIFICATION
33
- return SmileIdentityCore::BusinessVerification.new(@partner_id, @api_key, @sid_server).submit_job(
34
- partner_params, id_info
35
- )
29
+ if [JobType::ENHANCED_KYC, JobType::BUSINESS_VERIFICATION].include?(@partner_params[:job_type].to_i)
30
+ return SmileIdentityCore::IDApi.new(@partner_id, @api_key, @sid_server).submit_job(partner_params, id_info)
36
31
  end
37
32
 
38
33
  self.images = images
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smile-identity-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smile Identity
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-24 00:00:00.000000000 Z
11
+ date: 2022-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  - !ruby/object:Gem::Version
214
214
  version: '0'
215
215
  requirements: []
216
- rubygems_version: 3.3.7
216
+ rubygems_version: 3.3.26
217
217
  signing_key:
218
218
  specification_version: 4
219
219
  summary: The Smile Identity Web API allows the user to access\ most of the features