smile-identity-core 2.1.2 → 2.2.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: 49f65644b6f79351210a6712dda9f2cd2ad4ac79018b07e7aaa7d1291fce0e64
4
- data.tar.gz: ce5e5242fac1cc29376d81f7ed10862d8b97011d09dfe49f4fb32079c87d709b
3
+ metadata.gz: 5436921cd5f8d337cec031b4b193f73a11d15389481ac860195e6c28164296a5
4
+ data.tar.gz: da6562fc3a5647137338336e5f9f710e042cba36451339e485a0f818532805a2
5
5
  SHA512:
6
- metadata.gz: d00a98b441dcf5b90a23256d6984320dce1045de4a2a7fc17d6cf4895c0b7f35d4f96ca4f9a027a6787906839407dcf1b029c93f80693069ecea6530baf0e146
7
- data.tar.gz: ad0d04857af60204f7f603debd7391aadab187311c46691f1d43eae213c043c5fc76dfd79093ef56f23580f48a1f345a5b22a3a5fd592c8ae6a0a626598207f2
6
+ metadata.gz: 28f93dbeab2f0aeb9a80145e245b583c0479dd6b17b0a96fdd0ef471623c401bcdd8112a407e90265716aa1bc4a51a84c7dade6b866a929001d9189c4c89e371
7
+ data.tar.gz: c910e027a0420cc594862676a42f4022b9ad1b45e657d63c5977a3f6b38db2f0280e079e74df233a63f5ba3c26fb4637eda6c30cb8bc7cde102ecb91878d2ae9
@@ -14,7 +14,7 @@ jobs:
14
14
  with:
15
15
  set-safe-directory: false
16
16
  - name: Release Gem
17
- uses: powerhome/publish-rubygems-action@git-safe-directory
17
+ uses: cadwallion/publish-rubygems-action@master
18
18
  env:
19
19
  RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
20
20
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
data/CHANGELOG.md CHANGED
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.2.1] - 2023-08-31
10
+ ### Changed
11
+ - Don't validate the presence of `id_type` and `id_number` for Document Verification jobs
12
+
13
+ ## [2.2.0] - 2023-04-05
14
+ ### Added
15
+ - Adds support for AML check
16
+ ### Changed
17
+ - Fix business verification docstrings
18
+
9
19
  ## [2.1.2] - 2023-03-09
10
20
  ### Changed
11
21
  - Fix `get_web_token` by ensuring signature merges to request_params
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smile-identity-core (2.1.2)
4
+ smile-identity-core (2.2.1)
5
5
  rubyzip (~> 1.2, >= 1.2.3)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'smile-identity-core'
4
+ require 'securerandom'
5
+ # See https://docs.smileidentity.com/products/for-individuals-kyc/aml-check for
6
+ # more information on business verification
7
+
8
+ # Initialize
9
+ partner_id = '' # login to the Smile Identity portal to view your partner id
10
+ api_key = '' # copy your API key from the Smile Identity portal
11
+ sid_server = '0' # Use 0 for the sandbox server, use 1 for production server
12
+
13
+ connection = SmileIdentityCore::AmlCheck.new(partner_id, api_key, sid_server)
14
+
15
+ request_params = {
16
+ job_id: "job-#{SecureRandom.uuid}",
17
+ user_id: "user-#{SecureRandom.uuid}",
18
+ full_name: 'John Leo Doe',
19
+ countries: ['US'],
20
+ birth_year: '1984', # yyyy
21
+ search_existing_user: false
22
+ }
23
+
24
+ # Submit the job
25
+ pp connection.submit_job(request_params)
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'typhoeus'
5
+ require_relative 'validations'
6
+
7
+ module SmileIdentityCore
8
+ ##
9
+ # The AML Check product allows you to perform due diligence on your customers by screening them against
10
+ # global watchlists, politically exposed persons lists, and adverse media publications.
11
+ # For more info visit https://docs.smileidentity.com/products/for-individuals-kyc/aml-check
12
+ class AmlCheck
13
+ include Validations
14
+
15
+ ###
16
+ # Submit AML
17
+ # @param [String] :partner_id A unique number assigned by Smile ID to your account. Can be found in the portal
18
+ # @param [String] :api_key your API key from the Smile Identity portal
19
+ # @param [String] :sid_server Use 0 for the sandbox server, use 1 for production server
20
+ def initialize(partner_id, api_key, sid_server)
21
+ @partner_id = partner_id.to_s
22
+ @api_key = api_key
23
+ @sid_server = sid_server
24
+ @url = if sid_server !~ URI::DEFAULT_PARSER.make_regexp
25
+ SmileIdentityCore::ENV::SID_SERVER_MAPPING[sid_server.to_s]
26
+ else
27
+ sid_server
28
+ end
29
+ end
30
+
31
+ # Submit AML
32
+ # @param [Hash] params the options to create a job with.
33
+ # @option opts [String] :job_id A unique value generated by you to track jobs on your end.
34
+ # @option opts [String] :user_id A unique value generated by you.
35
+ # @option opts [String] :full_name The full name of the customer.
36
+ # @option opts [String] :birth_year The customer’s year of birth, in the format yyyy
37
+ # @option opts [Array] :countries An array that takes the customer’s known nationalities in 2-character
38
+ # (ISO 3166-1 alpha-2) format e.g. Nigeria is NG, Kenya is KE, etc
39
+ # @option opts [boolean] :search_existing_user If you intend to re-use the name and year of birth
40
+ # of a user’s previous KYC job
41
+ # @option opts [Hash] :optional_info Any optional data, this will be returned
42
+ # in partner_params.
43
+ def submit_job(params)
44
+ @params = symbolize_keys(params)
45
+ @optional_info = @params[:optional_info]
46
+ submit_requests
47
+ end
48
+
49
+ private
50
+
51
+ def symbolize_keys(params)
52
+ params.is_a?(Hash) ? params.transform_keys(&:to_sym) : params
53
+ end
54
+
55
+ def build_payload
56
+ @payload = generate_signature
57
+ @payload.merge!(@params)
58
+ add_partner_info
59
+ add_sdk_info
60
+ @payload
61
+ end
62
+
63
+ def add_partner_info
64
+ @payload[:partner_id] = @partner_id
65
+ @payload[:job_type] = SmileIdentityCore::JobType::AML
66
+ @payload[:partner_params] = @optional_info if @optional_info
67
+ end
68
+
69
+ def add_sdk_info
70
+ @payload[:source_sdk] = SmileIdentityCore::SOURCE_SDK
71
+ @payload[:source_sdk_version] = SmileIdentityCore::VERSION
72
+ end
73
+
74
+ def generate_signature
75
+ SmileIdentityCore::Signature.new(@partner_id, @api_key).generate_signature
76
+ end
77
+
78
+ def submit_requests
79
+ request = Typhoeus::Request.new("#{@url}/aml", method: 'POST',
80
+ headers: { 'Content-Type' => 'application/json' },
81
+ body: build_payload.to_json)
82
+
83
+ request.on_complete do |response|
84
+ return response.body if response.success?
85
+
86
+ raise "#{response.code}: #{response.body}"
87
+ end
88
+ request.run
89
+ end
90
+ end
91
+ end
@@ -20,10 +20,9 @@ module SmileIdentityCore
20
20
 
21
21
  ###
22
22
  # Submit business verification
23
- # @param [Hash] partner_params the options to create a message with.
24
- # @option opts [String] :job_type The job type, this should be 7
25
- # @option opts [String] :job_id A unique value generated by you to track jobs on your end.
26
- # @option opts [String] :user_id A unique value generated by you.
23
+ # @param [String] :partner_id A unique number assigned by Smile ID to your account. Can be found in the portal
24
+ # @param [String] :api_key your API key from the Smile Identity portal
25
+ # @param [String] :sid_server Use 0 for the sandbox server, use 1 for production server
27
26
  def initialize(partner_id, api_key, sid_server)
28
27
  @partner_id = partner_id.to_s
29
28
  @api_key = api_key
@@ -22,5 +22,8 @@ module SmileIdentityCore
22
22
  UPDATE_PHOTO = 8
23
23
  # Compares document verification to an id check
24
24
  COMPARE_USER_INFO = 9
25
+ # Performs due diligence by screening against global watchlists,
26
+ # politically exposed persons lists, and adverse media publications
27
+ AML = 10
25
28
  end
26
29
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmileIdentityCore
4
- VERSION = '2.1.2'
4
+ VERSION = '2.2.1'
5
5
  SOURCE_SDK = 'Ruby'
6
6
  end
@@ -91,8 +91,15 @@ module SmileIdentityCore
91
91
  # if it's a boolean
92
92
  updated_id_info[:entered] = id_info[:entered].to_s if !updated_id_info[:entered].nil? == updated_id_info[:entered]
93
93
 
94
- if updated_id_info[:entered] && updated_id_info[:entered] == 'true'
95
- %i[country id_type id_number].each do |key|
94
+ is_jt6 = @partner_params[:job_type].to_i == JobType::DOCUMENT_VERIFICATION
95
+ keys = if is_jt6
96
+ %i[country]
97
+ else
98
+ %i[country id_type id_number]
99
+ end
100
+
101
+ if updated_id_info[:entered] == 'true' || is_jt6
102
+ keys.each do |key|
96
103
  raise ArgumentError, "Please make sure that #{key} is included in the id_info" if id_info[key].to_s.empty?
97
104
  end
98
105
  end
@@ -1,14 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'smile-identity-core/version'
4
- require 'smile-identity-core/web_api'
5
- require 'smile-identity-core/id_api'
6
- require 'smile-identity-core/signature'
7
- require 'smile-identity-core/utilities'
8
- require 'smile-identity-core/business_verification'
9
- require 'smile-identity-core/constants/env'
10
- require 'smile-identity-core/constants/image_type'
11
- require 'smile-identity-core/constants/job_type'
3
+ require_relative 'smile-identity-core/version'
4
+ require_relative 'smile-identity-core/web_api'
5
+ require_relative 'smile-identity-core/id_api'
6
+ require_relative 'smile-identity-core/aml_check'
7
+ require_relative 'smile-identity-core/signature'
8
+ require_relative 'smile-identity-core/utilities'
9
+ require_relative 'smile-identity-core/business_verification'
10
+ require_relative 'smile-identity-core/constants/env'
11
+ require_relative 'smile-identity-core/constants/image_type'
12
+ require_relative 'smile-identity-core/constants/job_type'
12
13
 
13
14
  module SmileIdentityCore
14
15
  class Error < StandardError; end
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.1.2
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smile Identity
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-09 00:00:00.000000000 Z
11
+ date: 2023-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -168,6 +168,7 @@ files:
168
168
  - Rakefile
169
169
  - bin/console
170
170
  - bin/setup
171
+ - examples/aml_check.rb
171
172
  - examples/biometric_kyc.rb
172
173
  - examples/business_verification.rb
173
174
  - examples/document_verification.rb
@@ -180,6 +181,7 @@ files:
180
181
  - examples/get_web_token.rb
181
182
  - examples/smart_selfie_authentication.rb
182
183
  - lib/smile-identity-core.rb
184
+ - lib/smile-identity-core/aml_check.rb
183
185
  - lib/smile-identity-core/business_verification.rb
184
186
  - lib/smile-identity-core/constants/env.rb
185
187
  - lib/smile-identity-core/constants/image_type.rb
@@ -199,7 +201,7 @@ metadata:
199
201
  source_code_uri: https://github.com/smileidentity/smile-identity-core-ruby
200
202
  documentation_uri: https://docs.smileidentity.com
201
203
  changelog_uri: https://github.com/smileidentity/smile-identity-core-ruby/blob/master/CHANGELOG.md
202
- post_install_message:
204
+ post_install_message:
203
205
  rdoc_options: []
204
206
  require_paths:
205
207
  - lib
@@ -214,8 +216,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
216
  - !ruby/object:Gem::Version
215
217
  version: '0'
216
218
  requirements: []
217
- rubygems_version: 3.4.6
218
- signing_key:
219
+ rubygems_version: 3.4.10
220
+ signing_key:
219
221
  specification_version: 4
220
222
  summary: The Smile Identity Web API allows the user to access\ most of the features
221
223
  of the Smile Identity system through direct server to server queries.