smile-identity-core 2.1.2 → 2.2.0

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: 1cd1f7ec1f9a1c9418ce0e3d5501eb8e32fcfaf029da9b9188145a16dbbdf70b
4
+ data.tar.gz: 4bb53eafd0b561c05599a33fda6450099ab7208d1800a7ed19f5f304745e9985
5
5
  SHA512:
6
- metadata.gz: d00a98b441dcf5b90a23256d6984320dce1045de4a2a7fc17d6cf4895c0b7f35d4f96ca4f9a027a6787906839407dcf1b029c93f80693069ecea6530baf0e146
7
- data.tar.gz: ad0d04857af60204f7f603debd7391aadab187311c46691f1d43eae213c043c5fc76dfd79093ef56f23580f48a1f345a5b22a3a5fd592c8ae6a0a626598207f2
6
+ metadata.gz: fd09fe7c7e6117497dada79d8132eae2b08e58fd36def75626cd8883f151138d54868c16eb3b5ad5f45977c5d0fe6c1e01e9184350d8147bde3dee6513da0ea2
7
+ data.tar.gz: b442ba3c424a3d0eaf5f2fedba6596825da09053bf4d4a9221d8999c5e18c7359dde3c8abc2db6f23154d0e306cf220aa654a4ad3e4c1d9afe5fcb34f5e1038e
@@ -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,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.2.0] - 2023-04-05
10
+ ### Added
11
+ - Adds support for AML check
12
+ ### Changed
13
+ - Fix business verification docstrings
14
+
9
15
  ## [2.1.2] - 2023-03-09
10
16
  ### Changed
11
17
  - 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.0)
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.0'
5
5
  SOURCE_SDK = 'Ruby'
6
6
  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.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smile Identity
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-09 00:00:00.000000000 Z
11
+ date: 2023-04-05 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
@@ -214,7 +216,7 @@ 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
219
+ rubygems_version: 3.4.10
218
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