smile-identity-core 2.2.2 → 2.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +12 -0
- data/.github/workflows/release.yml +1 -1
- data/.rubocop.yml +181 -8
- data/CHANGELOG.md +72 -52
- data/Gemfile.lock +5 -3
- data/README.md +7 -7
- data/examples/aml_check.rb +3 -2
- data/examples/biometric_kyc.rb +7 -7
- data/examples/business_verification.rb +3 -3
- data/examples/document_verification.rb +9 -9
- data/examples/enhanced_document_verification.rb +74 -0
- data/examples/enhanced_kyc.rb +4 -4
- data/examples/example-project/README.md +1 -1
- data/examples/example-project/smart_bank.rb +26 -25
- data/examples/get_web_token.rb +2 -2
- data/examples/smart_selfie_authentication.rb +6 -6
- data/lib/smile-identity-core/aml_check.rb +5 -3
- data/lib/smile-identity-core/business_verification.rb +2 -2
- data/lib/smile-identity-core/constants/env.rb +4 -4
- data/lib/smile-identity-core/constants/job_type.rb +4 -0
- data/lib/smile-identity-core/id_api.rb +11 -11
- data/lib/smile-identity-core/signature.rb +1 -1
- data/lib/smile-identity-core/utilities.rb +4 -6
- data/lib/smile-identity-core/validations.rb +2 -2
- data/lib/smile-identity-core/version.rb +1 -1
- data/lib/smile-identity-core/web_api.rb +50 -48
- data/smile-identity-core.gemspec +12 -11
- metadata +11 -8
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'smile-identity-core'
|
4
4
|
|
5
|
-
# See https://docs.
|
5
|
+
# See https://docs.usesmileid.com/server-to-server/ruby/products/document-verification for
|
6
6
|
# how to setup and retrieve configuation values for the WebApi class.
|
7
7
|
|
8
8
|
# Initialize
|
@@ -17,7 +17,7 @@ connection = SmileIdentityCore::WebApi.new(partner_id, default_callback, api_key
|
|
17
17
|
partner_params = {
|
18
18
|
user_id: '<put your unique ID for the user here>',
|
19
19
|
job_id: '<put your unique job ID here>',
|
20
|
-
job_type: 6
|
20
|
+
job_type: 6,
|
21
21
|
}
|
22
22
|
|
23
23
|
# Create image list
|
@@ -33,27 +33,27 @@ partner_params = {
|
|
33
33
|
image_details = [
|
34
34
|
{
|
35
35
|
image_type_id: '<0 | 2>',
|
36
|
-
image: '<full path to selfie image or base64image string>'
|
36
|
+
image: '<full path to selfie image or base64image string>',
|
37
37
|
},
|
38
38
|
{ # Not required if you don't require proof of life (note photo of photo check
|
39
39
|
# will still be performed on the uploaded selfie)
|
40
40
|
image_type_id: '<4 | 6>',
|
41
|
-
image: '<full path to liveness image or base64 image string>'
|
41
|
+
image: '<full path to liveness image or base64 image string>',
|
42
42
|
},
|
43
43
|
{
|
44
44
|
image_type_id: '<1 | 3>',
|
45
|
-
image: '<full path to front of id document image or base64image string>'
|
45
|
+
image: '<full path to front of id document image or base64image string>',
|
46
46
|
},
|
47
47
|
{ # Optional, only use if you're uploading the back of the id document image
|
48
48
|
image_type_id: '<5 | 7>',
|
49
|
-
image: '<full path to back of id document image or base64image string>'
|
50
|
-
}
|
49
|
+
image: '<full path to back of id document image or base64image string>',
|
50
|
+
},
|
51
51
|
]
|
52
52
|
|
53
53
|
# The ID Document Information
|
54
54
|
id_info = {
|
55
55
|
country: '<2-letter country code>', # The country where ID document was issued
|
56
|
-
id_type: '<id type>' # The ID document type
|
56
|
+
id_type: '<id type>', # The ID document type
|
57
57
|
}
|
58
58
|
|
59
59
|
# Set options for the job
|
@@ -67,7 +67,7 @@ options = {
|
|
67
67
|
# Set to true to receive links to the selfie and the photo it was compared to.
|
68
68
|
# You must set return_job_status to true to use this flag.
|
69
69
|
return_image_links: '<true |false>',
|
70
|
-
signature: true
|
70
|
+
signature: true,
|
71
71
|
}
|
72
72
|
|
73
73
|
# Submit the job
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'smile-identity-core'
|
4
|
+
|
5
|
+
# See https://docs.usesmileid.com/server-to-server/ruby/products/enhanced_document-verification for
|
6
|
+
# how to setup and retrieve configuation values for the WebApi class.
|
7
|
+
|
8
|
+
# Initialize
|
9
|
+
partner_id = '<Put your partner ID here>'; # login to the Smile Identity portal to view your partner id
|
10
|
+
default_callback = '<Put your default callback url here>'
|
11
|
+
api_key = '<Put your API key here>'; # copy your API key from the Smile Identity portal
|
12
|
+
sid_server = '<0 | 1>'; # Use '0' for the sandbox server, use '1' for production server
|
13
|
+
|
14
|
+
connection = SmileIdentityCore::WebApi.new(partner_id, default_callback, api_key, sid_server)
|
15
|
+
|
16
|
+
# Create required tracking parameters
|
17
|
+
partner_params = {
|
18
|
+
user_id: '<put your unique ID for the user here>',
|
19
|
+
job_id: '<put your unique job ID here>',
|
20
|
+
job_type: 11,
|
21
|
+
}
|
22
|
+
|
23
|
+
# Create image list
|
24
|
+
# image_type_id (Integer) - This infers to either a file or a base64 encoded image, but not both.
|
25
|
+
# 0 - Selfie image jpg or png (if you have the full path of the selfie)
|
26
|
+
# 2 - Selfie image jpg or png base64 encoded (if you have the base64image string of the selfie)
|
27
|
+
# 4 - Liveness image jpg or png (if you have the full path of the liveness image)
|
28
|
+
# 6 - Liveness image jpg or png base64 encoded (if you have the base64image string of the liveness image)
|
29
|
+
# 1 - Front of ID document image jpg or png (if you have the full path of the selfie)
|
30
|
+
# 3 - Front of ID document image jpg or png base64 encoded (if you have the base64image string of the selfie)
|
31
|
+
# 5 - Back of ID document image jpg or png (if you have the full path of the selfie)
|
32
|
+
# 7 - Back of ID document image jpg or png base64 encoded (if you have the base64image string of the selfie)
|
33
|
+
image_details = [
|
34
|
+
{
|
35
|
+
image_type_id: '<0 | 2>',
|
36
|
+
image: '<full path to selfie image or base64image string>',
|
37
|
+
},
|
38
|
+
{ # Not required if you don't require proof of life (note photo of photo check
|
39
|
+
# will still be performed on the uploaded selfie)
|
40
|
+
image_type_id: '<4 | 6>',
|
41
|
+
image: '<full path to liveness image or base64 image string>',
|
42
|
+
},
|
43
|
+
{
|
44
|
+
image_type_id: '<1 | 3>',
|
45
|
+
image: '<full path to front of id document image or base64image string>',
|
46
|
+
},
|
47
|
+
{ # Optional, only use if you're uploading the back of the id document image
|
48
|
+
image_type_id: '<5 | 7>',
|
49
|
+
image: '<full path to back of id document image or base64image string>',
|
50
|
+
},
|
51
|
+
]
|
52
|
+
|
53
|
+
# The ID Document Information
|
54
|
+
id_info = {
|
55
|
+
country: '<2-letter country code>', # The country where ID document was issued
|
56
|
+
id_type: '<id type>', # The ID document type
|
57
|
+
}
|
58
|
+
|
59
|
+
# Set options for the job
|
60
|
+
options = {
|
61
|
+
# Set to true if you want to get the job result in sync (in addition to the result
|
62
|
+
# been sent to your callback). If set to false, result is sent to callback url only.
|
63
|
+
return_job_status: '<true | false>',
|
64
|
+
# Set to true to receive all of the updates you would otherwise have received in your
|
65
|
+
# callback as opposed to only the final result. You must set return_job_status to true to use this flag.
|
66
|
+
return_history: '<true | false>',
|
67
|
+
# Set to true to receive links to the selfie and the photo it was compared to.
|
68
|
+
# You must set return_job_status to true to use this flag.
|
69
|
+
return_image_links: '<true |false>',
|
70
|
+
signature: true,
|
71
|
+
}
|
72
|
+
|
73
|
+
# Submit the job
|
74
|
+
connection.submit_job(partner_params, image_details, id_info, options)
|
data/examples/enhanced_kyc.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'smile-identity-core'
|
4
4
|
|
5
|
-
# See https://docs.
|
5
|
+
# See https://docs.usesmileid.com/server-to-server/ruby/products/enhanced-kyc for
|
6
6
|
# how to setup and retrieve configuation values for the IDApi class.
|
7
7
|
|
8
8
|
# Initialize
|
@@ -16,7 +16,7 @@ connection = SmileIdentityCore::IDApi.new(partner_id, api_key, sid_server)
|
|
16
16
|
partner_params = {
|
17
17
|
job_id: '<put your unique job ID here>',
|
18
18
|
user_id: '<put your unique ID for the user here>',
|
19
|
-
job_type: 5
|
19
|
+
job_type: 5,
|
20
20
|
}
|
21
21
|
|
22
22
|
# Create ID info
|
@@ -27,12 +27,12 @@ id_info = {
|
|
27
27
|
id_type: '<id type>',
|
28
28
|
id_number: '<valid id number>',
|
29
29
|
dob: '<date of birth>', # yyyy-mm-dd
|
30
|
-
phone_number: '<phone number>'
|
30
|
+
phone_number: '<phone number>',
|
31
31
|
}
|
32
32
|
|
33
33
|
# Set the options for the job
|
34
34
|
options = {
|
35
|
-
signature: true
|
35
|
+
signature: true,
|
36
36
|
}
|
37
37
|
|
38
38
|
# Submit the job
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Example Project
|
2
2
|
|
3
|
-
This project is an example implementation of the Smile Identity Ruby SDK on the server side. The example implements [Enhanced KYC](https://docs.
|
3
|
+
This project is an example implementation of the Smile Identity Ruby SDK on the server side. The example implements [Enhanced KYC](https://docs.usesmileid.com/products/identity-lookup), [Biometric KYC](https://docs.usesmileid.com/products/biometric-kyc), [Document Verification](https://docs.usesmileid.com/products/document-verification) and [SmartSelfieTM Authentication](https://docs.usesmileid.com/products/biometric-authentication) job types.
|
4
4
|
|
5
5
|
## Setup
|
6
6
|
|
@@ -11,11 +11,12 @@ class SmartBank
|
|
11
11
|
|
12
12
|
def initialize
|
13
13
|
# login to the Smile Identity portal to view your partner id
|
14
|
-
@partner_id = ENV
|
15
|
-
# See https://docs.
|
16
|
-
@default_callback = ENV
|
17
|
-
@api_key = ENV
|
18
|
-
|
14
|
+
@partner_id = ENV.fetch('SMILE_PARTNER_ID', nil)
|
15
|
+
# See https://docs.usesmileid.com/server-to-server/ruby/products/biometric-kyc#create-a-callback-endpoint
|
16
|
+
@default_callback = ENV.fetch('SMILE_JOB_CALLBACK_URL', nil)
|
17
|
+
@api_key = ENV.fetch('SMILE_API_KEY', nil) # copy your API key from the Smile Identity portal
|
18
|
+
# Use '0' for the sandbox server, use '1' for production server
|
19
|
+
@sid_server = ENV.fetch('SMILE_SERVER_ENVIRONMENT', nil)
|
19
20
|
@user_id = SecureRandom.uuid # your unique ID for the user
|
20
21
|
@job_id = SecureRandom.uuid # your unique job ID
|
21
22
|
end
|
@@ -35,12 +36,12 @@ class SmartBank
|
|
35
36
|
id_type: 'PASSPORT',
|
36
37
|
id_number: 'G0000000',
|
37
38
|
dob: '1992-12-07', # yyyy-mm-dd
|
38
|
-
phone_number: '00000000000'
|
39
|
+
phone_number: '00000000000',
|
39
40
|
}
|
40
41
|
|
41
42
|
# Set the options for the job
|
42
43
|
options = {
|
43
|
-
signature: true
|
44
|
+
signature: true,
|
44
45
|
}
|
45
46
|
|
46
47
|
# Submit the job
|
@@ -57,13 +58,13 @@ class SmartBank
|
|
57
58
|
image_details = [
|
58
59
|
{
|
59
60
|
image_type_id: SmileIdentityCore::ImageType::SELFIE_IMAGE_FILE,
|
60
|
-
image: '/path/to/selfie_image.jpeg'
|
61
|
+
image: '/path/to/selfie_image.jpeg',
|
61
62
|
},
|
62
63
|
{ # Not required if you don't require proof of life (note photo of photo check will
|
63
64
|
# still be performed on the uploaded selfie)
|
64
65
|
image_type_id: SmileIdentityCore::ImageType::LIVENESS_IMAGE_FILE,
|
65
|
-
image: '/path/to/liveness_image.jpeg'
|
66
|
-
}
|
66
|
+
image: '/path/to/liveness_image.jpeg',
|
67
|
+
},
|
67
68
|
]
|
68
69
|
|
69
70
|
# Create ID number info
|
@@ -74,7 +75,7 @@ class SmartBank
|
|
74
75
|
id_type: 'PASSPORT',
|
75
76
|
id_number: 'G0000000',
|
76
77
|
dob: '1992-12-07', # yyyy-mm-dd
|
77
|
-
entered: 'true' # must be a string
|
78
|
+
entered: 'true', # must be a string
|
78
79
|
}
|
79
80
|
|
80
81
|
# Submit the job
|
@@ -91,27 +92,27 @@ class SmartBank
|
|
91
92
|
image_details = [
|
92
93
|
{
|
93
94
|
image_type_id: SmileIdentityCore::ImageType::SELFIE_IMAGE_FILE,
|
94
|
-
image: '/path/to/selfie_image.jpeg'
|
95
|
+
image: '/path/to/selfie_image.jpeg',
|
95
96
|
},
|
96
97
|
{ # Not required if you don't require proof of life (note photo of photo
|
97
98
|
# check will still be performed on the uploaded selfie)
|
98
99
|
image_type_id: SmileIdentityCore::ImageType::LIVENESS_IMAGE_FILE,
|
99
|
-
image: '/path/to/liveness_image.jpeg'
|
100
|
+
image: '/path/to/liveness_image.jpeg',
|
100
101
|
},
|
101
102
|
{
|
102
103
|
image_type_id: SmileIdentityCore::ImageType::ID_CARD_IMAGE_FILE,
|
103
|
-
image: '/path/to/front_document_image.jpeg'
|
104
|
+
image: '/path/to/front_document_image.jpeg',
|
104
105
|
},
|
105
106
|
{ # Optional, only use if you're uploading the back of the id document image
|
106
107
|
image_type_id: SmileIdentityCore::ImageType::ID_CARD_BACK_IMAGE_FILE,
|
107
|
-
image: '/path/to/back_document_image.jpeg'
|
108
|
-
}
|
108
|
+
image: '/path/to/back_document_image.jpeg',
|
109
|
+
},
|
109
110
|
]
|
110
111
|
|
111
112
|
# The ID Document Information
|
112
113
|
id_info = {
|
113
114
|
country: 'GH', # The country where ID document was issued
|
114
|
-
id_type: 'PASSPORT' # The ID document type
|
115
|
+
id_type: 'PASSPORT', # The ID document type
|
115
116
|
}
|
116
117
|
|
117
118
|
# Submit the job
|
@@ -128,20 +129,20 @@ class SmartBank
|
|
128
129
|
partner_params = {
|
129
130
|
user_id: '512c9c37-a689-4959-a620-bed75fb41344', # previously registered user's user_id
|
130
131
|
job_id: SecureRandom.uuid, # new unique job ID
|
131
|
-
job_type: SmileIdentityCore::JobType::SMART_SELFIE_REGISTRATION
|
132
|
+
job_type: SmileIdentityCore::JobType::SMART_SELFIE_REGISTRATION,
|
132
133
|
}
|
133
134
|
|
134
135
|
# Create image list
|
135
136
|
image_details = [
|
136
137
|
{
|
137
138
|
image_type_id: SmileIdentityCore::ImageType::SELFIE_IMAGE_FILE,
|
138
|
-
image: '/path/to/selfie_image.jpeg'
|
139
|
+
image: '/path/to/selfie_image.jpeg',
|
139
140
|
},
|
140
141
|
{ # Not required if you don't require proof of life
|
141
142
|
# (note photo of photo check will still be performed on the uploaded selfie)
|
142
143
|
image_type_id: SmileIdentityCore::ImageType::LIVENESS_IMAGE_FILE,
|
143
|
-
image: '/path/to/liveness_image.jpeg'
|
144
|
-
}
|
144
|
+
image: '/path/to/liveness_image.jpeg',
|
145
|
+
},
|
145
146
|
]
|
146
147
|
|
147
148
|
# Submit the job
|
@@ -154,7 +155,7 @@ class SmartBank
|
|
154
155
|
{
|
155
156
|
user_id: user_id,
|
156
157
|
job_id: job_id,
|
157
|
-
job_type: job_type
|
158
|
+
job_type: job_type,
|
158
159
|
}
|
159
160
|
end
|
160
161
|
|
@@ -175,7 +176,7 @@ class SmartBank
|
|
175
176
|
# Set to true to receive links to the selfie and the photo it was compared to.
|
176
177
|
# You must set return_job_status to true to use this flag.
|
177
178
|
return_image_links: true,
|
178
|
-
signature: true
|
179
|
+
signature: true,
|
179
180
|
}
|
180
181
|
end
|
181
182
|
end
|
@@ -187,7 +188,7 @@ enhanced_kyc_response['success'] # => true
|
|
187
188
|
enhanced_kyc_response['result']['PartnerParams']['job_id'] # job_id
|
188
189
|
enhanced_kyc_response['result']['PartnerParams']['user_id'] # user_id
|
189
190
|
enhanced_kyc_response['result']['PartnerParams']['job_type'] # => 5
|
190
|
-
# See https://docs.
|
191
|
+
# See https://docs.usesmileid.com/products/for-individuals-kyc/identity-lookup#return-values
|
191
192
|
# for the full JSON response interpretation
|
192
193
|
|
193
194
|
# Biometric KYC
|
@@ -212,5 +213,5 @@ smart_selfie_auth_response['result']['PartnerParams']['user_id'] # user_id
|
|
212
213
|
smart_selfie_auth_response['result']['PartnerParams']['job_type'] # => 2
|
213
214
|
|
214
215
|
# All jobs submitted with a selfie has the same return values, result codes and texts. For example
|
215
|
-
# see https://docs.
|
216
|
+
# see https://docs.usesmileid.com/products/for-individuals-kyc/biometric-kyc#return-values.
|
216
217
|
# Save the returned user_id and job_id in your DB as you would need them later when you call other services.
|
data/examples/get_web_token.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'smile-identity-core'
|
4
4
|
require 'random/formatter'
|
5
5
|
|
6
|
-
# See https://docs.
|
6
|
+
# See https://docs.usesmileid.com/server-to-server/ruby/products/biometric-kyc for
|
7
7
|
# how to setup and retrieve configuation values for the WebApi class.
|
8
8
|
|
9
9
|
# Initialize
|
@@ -19,7 +19,7 @@ request_params = {
|
|
19
19
|
user_id: '<your unique user id>',
|
20
20
|
job_id: '<your unique job id>',
|
21
21
|
product: '<smile identity product type>',
|
22
|
-
callback_url: '<your callback url>'
|
22
|
+
callback_url: '<your callback url>',
|
23
23
|
}
|
24
24
|
|
25
25
|
# Get web token
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'smile-identity-core'
|
4
4
|
|
5
|
-
# See https://docs.
|
5
|
+
# See https://docs.usesmileid.com/server-to-server/ruby/products/smartselfie-tm-authentication for
|
6
6
|
# how to setup and retrieve configuation values for the WebApi class.
|
7
7
|
|
8
8
|
# Initialize
|
@@ -17,7 +17,7 @@ connection = SmileIdentityCore::WebApi.new(partner_id, default_callback, api_key
|
|
17
17
|
partner_params = {
|
18
18
|
user_id: '<put previously registered user"s user_id here>',
|
19
19
|
job_id: '<put your unique job ID here>',
|
20
|
-
job_type: 2
|
20
|
+
job_type: 2,
|
21
21
|
}
|
22
22
|
|
23
23
|
# Create image list
|
@@ -29,13 +29,13 @@ partner_params = {
|
|
29
29
|
image_details = [
|
30
30
|
{
|
31
31
|
image_type_id: '<0 | 2>',
|
32
|
-
image: '<full path to selfie image or base64image string>'
|
32
|
+
image: '<full path to selfie image or base64image string>',
|
33
33
|
},
|
34
34
|
{ # Not required if you don't require proof of life (note photo of photo check will
|
35
35
|
# still be performed on the uploaded selfie)
|
36
36
|
image_type_id: '<4 | 6>',
|
37
|
-
image: '<full path to liveness image or base64 image string>'
|
38
|
-
}
|
37
|
+
image: '<full path to liveness image or base64 image string>',
|
38
|
+
},
|
39
39
|
]
|
40
40
|
|
41
41
|
# Set options for the job
|
@@ -49,7 +49,7 @@ options = {
|
|
49
49
|
# Set to true to receive links to the selfie and the photo it was
|
50
50
|
# compared to. You must set return_job_status to true to use this flag.
|
51
51
|
return_image_links: '<true | false>',
|
52
|
-
signature: true
|
52
|
+
signature: true,
|
53
53
|
}
|
54
54
|
|
55
55
|
# Submit the job
|
@@ -8,7 +8,7 @@ module SmileIdentityCore
|
|
8
8
|
##
|
9
9
|
# The AML Check product allows you to perform due diligence on your customers by screening them against
|
10
10
|
# global watchlists, politically exposed persons lists, and adverse media publications.
|
11
|
-
# For more info visit https://docs.
|
11
|
+
# For more info visit https://docs.usesmileid.com/products/for-individuals-kyc/aml-check
|
12
12
|
class AmlCheck
|
13
13
|
include Validations
|
14
14
|
|
@@ -33,6 +33,7 @@ module SmileIdentityCore
|
|
33
33
|
# @option opts [Array] :countries An array that takes the customer’s known nationalities in 2-character
|
34
34
|
# (ISO 3166-1 alpha-2) format e.g. Nigeria is NG, Kenya is KE, etc
|
35
35
|
# @option opts [boolean] :search_existing_user If you intend to re-use the name and year of birth
|
36
|
+
# @option opts [boolean] :strict_match If you want to perform a strict match on the serach criteria.
|
36
37
|
# of a user’s previous KYC job
|
37
38
|
# @option opts [Hash] :optional_info Any optional data, this will be returned
|
38
39
|
# in partner_params.
|
@@ -51,6 +52,7 @@ module SmileIdentityCore
|
|
51
52
|
def build_payload
|
52
53
|
@payload = generate_signature
|
53
54
|
@payload.merge!(@params)
|
55
|
+
@payload[:strict_match] = true unless @params.key?(:strict_match)
|
54
56
|
add_partner_info
|
55
57
|
add_sdk_info
|
56
58
|
@payload
|
@@ -73,8 +75,8 @@ module SmileIdentityCore
|
|
73
75
|
|
74
76
|
def submit_requests
|
75
77
|
request = Typhoeus::Request.new("#{@url}/aml", method: 'POST',
|
76
|
-
|
77
|
-
|
78
|
+
headers: { 'Content-Type' => 'application/json' },
|
79
|
+
body: build_payload.to_json)
|
78
80
|
|
79
81
|
request.on_complete do |response|
|
80
82
|
return response.body if response.success?
|
@@ -8,7 +8,7 @@ module SmileIdentityCore
|
|
8
8
|
##
|
9
9
|
# The business verification product lets you search the business registration or
|
10
10
|
# tax information (available in Nigeria only) of a business from one of our supported countries.
|
11
|
-
# For more info visit https://docs.
|
11
|
+
# For more info visit https://docs.usesmileid.com/products/for-businesses-kyb/business-verification
|
12
12
|
class BusinessVerification
|
13
13
|
include Validations
|
14
14
|
|
@@ -85,7 +85,7 @@ module SmileIdentityCore
|
|
85
85
|
"#{@url}/business_verification",
|
86
86
|
method: 'POST',
|
87
87
|
headers: { 'Content-Type' => 'application/json' },
|
88
|
-
body: build_payload.to_json
|
88
|
+
body: build_payload.to_json,
|
89
89
|
)
|
90
90
|
|
91
91
|
request.on_complete do |response|
|
@@ -6,7 +6,7 @@ module SmileIdentityCore
|
|
6
6
|
module ENV
|
7
7
|
SID_SERVER_MAPPING = {
|
8
8
|
'0' => 'https://testapi.smileidentity.com/v1',
|
9
|
-
'1' => 'https://api.smileidentity.com/v1'
|
9
|
+
'1' => 'https://api.smileidentity.com/v1',
|
10
10
|
}.freeze
|
11
11
|
|
12
12
|
TEST = '0'
|
@@ -15,10 +15,10 @@ module SmileIdentityCore
|
|
15
15
|
module_function
|
16
16
|
|
17
17
|
def determine_url(sid_server)
|
18
|
-
if sid_server.to_s
|
19
|
-
SID_SERVER_MAPPING[sid_server.to_s] || sid_server
|
20
|
-
else
|
18
|
+
if sid_server.to_s =~ URI::DEFAULT_PARSER.make_regexp
|
21
19
|
sid_server
|
20
|
+
else
|
21
|
+
SID_SERVER_MAPPING[sid_server.to_s] || sid_server
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -25,5 +25,9 @@ module SmileIdentityCore
|
|
25
25
|
# Performs due diligence by screening against global watchlists,
|
26
26
|
# politically exposed persons lists, and adverse media publications
|
27
27
|
AML = 10
|
28
|
+
# Verifies the authenticity of Document IDs and confirms their validity
|
29
|
+
# with an ID authority, and uses biometric checks to confirm they
|
30
|
+
# belong to the user.
|
31
|
+
ENHANCED_DOCUMENT_VERIFICATION = 11
|
28
32
|
end
|
29
33
|
end
|
@@ -25,8 +25,8 @@ module SmileIdentityCore
|
|
25
25
|
|
26
26
|
if partner_params[:job_type] == JobType::BUSINESS_VERIFICATION
|
27
27
|
return SmileIdentityCore::BusinessVerification
|
28
|
-
|
29
|
-
|
28
|
+
.new(@partner_id, @api_key, @url)
|
29
|
+
.submit_job(partner_params, id_info)
|
30
30
|
end
|
31
31
|
|
32
32
|
options = symbolize_keys(options || {})
|
@@ -46,7 +46,7 @@ module SmileIdentityCore
|
|
46
46
|
"#{@url}/#{endpoint}",
|
47
47
|
method: 'POST',
|
48
48
|
headers: { 'Content-Type' => 'application/json' },
|
49
|
-
body: configure_json
|
49
|
+
body: configure_json,
|
50
50
|
)
|
51
51
|
|
52
52
|
request.on_complete do |response|
|
@@ -63,14 +63,14 @@ module SmileIdentityCore
|
|
63
63
|
|
64
64
|
def configure_json
|
65
65
|
signature_generator.generate_signature(Time.now.to_s)
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
66
|
+
.merge(@id_info)
|
67
|
+
.merge(
|
68
|
+
partner_id: @partner_id,
|
69
|
+
partner_params: @partner_params,
|
70
|
+
source_sdk: SmileIdentityCore::SOURCE_SDK,
|
71
|
+
source_sdk_version: SmileIdentityCore::VERSION,
|
72
|
+
)
|
73
|
+
.to_json
|
74
74
|
end
|
75
75
|
|
76
76
|
def signature_generator
|
@@ -17,7 +17,7 @@ module SmileIdentityCore
|
|
17
17
|
options[:return_image_links] ||= false
|
18
18
|
|
19
19
|
query_job_status(configure_job_query(user_id, job_id,
|
20
|
-
|
20
|
+
options).merge(@signature_connection.generate_signature(Time.now.to_s)))
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
@@ -29,9 +29,9 @@ module SmileIdentityCore
|
|
29
29
|
def query_job_status(request_json_data)
|
30
30
|
request = Typhoeus::Request.new(
|
31
31
|
"#{@url}/job_status",
|
32
|
-
headers: { 'Content-Type': 'application/json',
|
32
|
+
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
|
33
33
|
method: :post,
|
34
|
-
body: request_json_data.to_json
|
34
|
+
body: request_json_data.to_json,
|
35
35
|
)
|
36
36
|
|
37
37
|
request.on_complete do |response|
|
@@ -47,8 +47,6 @@ module SmileIdentityCore
|
|
47
47
|
raise 'Unable to confirm validity of the job_status response' unless valid
|
48
48
|
|
49
49
|
return body
|
50
|
-
rescue StandardError => e
|
51
|
-
raise e
|
52
50
|
end
|
53
51
|
|
54
52
|
request.run
|
@@ -62,7 +60,7 @@ module SmileIdentityCore
|
|
62
60
|
image_links: options[:return_image_links],
|
63
61
|
history: options[:return_history],
|
64
62
|
source_sdk: SmileIdentityCore::SOURCE_SDK,
|
65
|
-
source_sdk_version: SmileIdentityCore::VERSION
|
63
|
+
source_sdk_version: SmileIdentityCore::VERSION,
|
66
64
|
}
|
67
65
|
end
|
68
66
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module SmileIdentityCore
|
4
|
-
module Validations
|
4
|
+
module Validations # :nodoc:
|
5
5
|
def validate_partner_params(partner_params)
|
6
6
|
raise ArgumentError, 'Please ensure that you send through partner params' if partner_params.nil?
|
7
7
|
|
@@ -10,7 +10,7 @@ module SmileIdentityCore
|
|
10
10
|
%i[user_id job_id job_type].each do |key|
|
11
11
|
if partner_params[key].to_s.empty?
|
12
12
|
raise ArgumentError,
|
13
|
-
|
13
|
+
"Please make sure that #{key} is included in the partner params"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|