usesmileid 13.1.0 → 13.2.0
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 +4 -4
- data/CHANGELOG.md +11 -1
- data/README.md +63 -2
- data/lib/usesmileid/client/client.rb +8 -2
- data/lib/usesmileid/client/resources.rb +100 -5
- data/lib/usesmileid/errors.rb +27 -2
- data/lib/usesmileid/generated/models.rb +95 -4
- data/lib/usesmileid/generated/operations.rb +18 -0
- data/lib/usesmileid/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2759896be24ef979f47a9794d279fc97cf05390a43ae97b33af18b787b413a3d
|
|
4
|
+
data.tar.gz: 9ae56e3aea45fc59a10ef8a3f5ddd6e04e97694251eb07ad71dae49cc293527d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3fdcfad5606923a87f00e7ff43a0adc5bb970d0344bac3b0ef66f6220d4a9816acce9b4ce9343c396c24589bcaf9476ddc727dbdecc5c1435cf9a329711a337f
|
|
7
|
+
data.tar.gz: 9926babc0a54d80f5a68ec95c2e871f837a98d11c0cbbda153a031572eb93ef44e111be484c00d0d885b0b79428445255d7be17e9e19c4dc55eefd7e7ced95a2
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [13.2.0] - 2026-11-24
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Basic KYC: `basic_kyc.verify` (async, result on the callback URL) and `basic_kyc.verify_sync` (result returned inline). The inline result is a `BasicKycResult` with a verdict per field in `match_results`, and it carries the `SmileID-Job-ID`, `User-ID`, `Response-Signature` and `Response-Timestamp` response headers. Both operations mint their token with the `basic_kyc` product claim.
|
|
15
|
+
- Enhanced KYC: `enhanced_kyc.verify_sync`, which runs the same verification as `enhanced_kyc.verify` and returns the result inline. It takes the same arguments, sends no default callback URL, and does not retry a 408, 424 or 500. The result is an `EnhancedKycResult` with the full callback payload in `raw`. Its `job_id` and `user_id` come from the `SmileID-Job-ID` and `User-ID` response headers, or from the body when a header is absent, and `response_signature` and `response_timestamp` from the `Response-Signature` and `Response-Timestamp` headers, for your own webhook verification code. Its token is minted with the `enhanced_kyc` product claim.
|
|
16
|
+
- `SmileIDError#job_id`: the job id from the `SmileID-Job-ID` response header, or `nil` when the response had none. It is set on every error raised from an HTTP response. When `basic_kyc.verify_sync` or `enhanced_kyc.verify_sync` fails with a 408 or 424, or a 500 with a `job_id`, read the outcome with `verifications.retrieve(error.job_id)` instead of resubmitting. When `aml.submit_sync` fails with a 408, resubmit; a 500 with a `job_id` can be read the same way.
|
|
17
|
+
- `SmileID::Errors.job_id_from` and `SmileID::Errors.header_value`, which read a response header by name, ignoring case. `BasicKycResult`, `EnhancedKycResult` and `OneTimeAmlResult` read their response headers this way, so `.from` also accepts a plain hash of headers in any casing.
|
|
18
|
+
|
|
10
19
|
## [13.1.0] - 2026-11-19
|
|
11
20
|
|
|
12
21
|
### Added
|
|
@@ -77,7 +86,8 @@ First public release.
|
|
|
77
86
|
- Typed errors under `SmileID::Errors`, keyed on HTTP status.
|
|
78
87
|
- Bank codes, supported ID types and supported documents lookups.
|
|
79
88
|
|
|
80
|
-
[Unreleased]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v13.
|
|
89
|
+
[Unreleased]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v13.2.0...HEAD
|
|
90
|
+
[13.2.0]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v13.1.0...v13.2.0
|
|
81
91
|
[13.1.0]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v13.0.0...v13.1.0
|
|
82
92
|
[13.0.0]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v12.1.0...v13.0.0
|
|
83
93
|
[12.1.0]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v12.0.0...v12.1.0
|
data/README.md
CHANGED
|
@@ -110,6 +110,67 @@ accepted.job_id # => "job_..."
|
|
|
110
110
|
accepted.accepted? # => true
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
`enhanced_kyc.verify_sync` takes the same arguments but returns the result in the response. The API ignores `callback_url` on this call, so the client's `default_callback_url` isn't sent. The result carries the `Response-Signature` and `Response-Timestamp` headers as `response_signature` and `response_timestamp`, so you can check them with your own webhook signature verification code. The SDK doesn't verify them. If the verification can't be completed, it raises `SmileID::Errors::SmileIDError` with `status_code` 424, 408 or 500. The job may still have run, and resubmitting runs and bills a second lookup, so don't resubmit automatically. On a 408 or 424 the job is recorded: read its outcome with `verifications.retrieve(error.job_id)`. Do the same for a 500 that has a `job_id`. A 500 with no `job_id` means the job wasn't created.
|
|
114
|
+
|
|
115
|
+
```ruby
|
|
116
|
+
result = smile.enhanced_kyc.verify_sync(
|
|
117
|
+
country: "NG", id_type: "NIN", id_number: "12345678901",
|
|
118
|
+
user_details: user_details, consent: consent
|
|
119
|
+
)
|
|
120
|
+
result.status # => "clear", "block", "attention" or "error"
|
|
121
|
+
result.raw # the full callback payload, including the ID authority's record
|
|
122
|
+
result.job_id # from the SmileID-Job-ID header, else the body's job_id
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```ruby
|
|
126
|
+
begin
|
|
127
|
+
result = smile.enhanced_kyc.verify_sync(...)
|
|
128
|
+
rescue SmileID::Errors::SmileIDError => e
|
|
129
|
+
# Only a 408, 424 or 500 that names a job has an outcome to read.
|
|
130
|
+
raise unless [408, 424, 500].include?(e.status_code) && e.job_id
|
|
131
|
+
|
|
132
|
+
status = smile.verifications.retrieve(e.job_id) # don't resubmit
|
|
133
|
+
end
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Basic KYC
|
|
137
|
+
|
|
138
|
+
Basic KYC checks the details you submit against the ID authority's record and reports a match verdict per field. It never returns the record itself. `basic_kyc.verify` takes the same arguments as Enhanced KYC, apart from `user_id`, and sends the result to your callback URL:
|
|
139
|
+
|
|
140
|
+
```ruby
|
|
141
|
+
accepted = smile.basic_kyc.verify(
|
|
142
|
+
country: "NG",
|
|
143
|
+
id_type: "NIN",
|
|
144
|
+
id_number: "12345678901",
|
|
145
|
+
user_details: user_details,
|
|
146
|
+
consent: consent,
|
|
147
|
+
callback_url: "https://example.com/callback" # optional if a default is configured
|
|
148
|
+
)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`basic_kyc.verify_sync` returns the result in the response. The API ignores `callback_url` on this call, so the client's `default_callback_url` isn't sent. If the verification can't be completed, it raises `SmileID::Errors::SmileIDError` with `status_code` 424, 408 or 500. The job may still have run, and resubmitting runs and bills a second lookup, so don't resubmit automatically. On a 408 or 424 the job is recorded: read its outcome with `verifications.retrieve(error.job_id)`. Do the same for a 500 that has a `job_id`. A 500 with no `job_id` means the job wasn't created.
|
|
152
|
+
|
|
153
|
+
```ruby
|
|
154
|
+
result = smile.basic_kyc.verify_sync(
|
|
155
|
+
country: "NG", id_type: "NIN", id_number: "12345678901",
|
|
156
|
+
user_details: user_details, consent: consent
|
|
157
|
+
)
|
|
158
|
+
result.status # => "clear", "block", "attention" or "error"
|
|
159
|
+
result.match_results["overall"] # => "exact_match", "partial_match", "transposed", "no_match" or "not_provided"
|
|
160
|
+
result.job_id # from the SmileID-Job-ID header
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
```ruby
|
|
164
|
+
begin
|
|
165
|
+
result = smile.basic_kyc.verify_sync(...)
|
|
166
|
+
rescue SmileID::Errors::SmileIDError => e
|
|
167
|
+
# Only a 408, 424 or 500 that names a job has an outcome to read.
|
|
168
|
+
raise unless [408, 424, 500].include?(e.status_code) && e.job_id
|
|
169
|
+
|
|
170
|
+
status = smile.verifications.retrieve(e.job_id) # don't resubmit
|
|
171
|
+
end
|
|
172
|
+
```
|
|
173
|
+
|
|
113
174
|
### AML screening
|
|
114
175
|
|
|
115
176
|
One-Time AML screens a name against sanctions, PEP and adverse-media lists. `aml.submit` queues the screening and the result goes to your callback URL:
|
|
@@ -124,7 +185,7 @@ accepted = smile.aml.submit(
|
|
|
124
185
|
)
|
|
125
186
|
```
|
|
126
187
|
|
|
127
|
-
`aml.submit_sync` takes the same arguments but returns the result in the response, so `callback_url` is optional. Pass an `idempotency_key:` (16 to 128 characters of `A-Z a-z 0-9 - _`) so a retry returns the original result instead of a second billed screening. A provider timeout raises `SmileID::Errors::SmileIDError` with `status_code` 408.
|
|
188
|
+
`aml.submit_sync` takes the same arguments but returns the result in the response, so `callback_url` is optional. Pass an `idempotency_key:` (16 to 128 characters of `A-Z a-z 0-9 - _`) so a retry returns the original result instead of a second billed screening. A provider timeout raises `SmileID::Errors::SmileIDError` with `status_code` 408. Nothing is billed and the job is final in `error`, so resubmit rather than reading its status, with the same `idempotency_key:` to make the resubmission safe to repeat. A 500 that has a `job_id` means the job exists: read its outcome with `verifications.retrieve(error.job_id)`.
|
|
128
189
|
|
|
129
190
|
```ruby
|
|
130
191
|
result = smile.aml.submit_sync(
|
|
@@ -358,7 +419,7 @@ Every API failure raises a typed error under `SmileID::Errors`, keyed on the HTT
|
|
|
358
419
|
| `TimeoutError` | `wait_until_complete` deadline passed (no HTTP response) |
|
|
359
420
|
| `UnexpectedResponseError` | a 2xx response whose body is not the expected JSON object, for example proxy interference |
|
|
360
421
|
|
|
361
|
-
Each error exposes `status_code`, `status`, `message`, `code`, `request_id` and `raw_body`.
|
|
422
|
+
Each error exposes `status_code`, `status`, `message`, `code`, `request_id`, `job_id` and `raw_body`. `job_id` comes from the `SmileID-Job-ID` response header and is `nil` when the response had none.
|
|
362
423
|
|
|
363
424
|
```ruby
|
|
364
425
|
begin
|
|
@@ -31,6 +31,10 @@ module SmileID
|
|
|
31
31
|
@enhanced_kyc ||= Resources::EnhancedKyc.new(self)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
def basic_kyc
|
|
35
|
+
@basic_kyc ||= Resources::BasicKyc.new(self)
|
|
36
|
+
end
|
|
37
|
+
|
|
34
38
|
def documents
|
|
35
39
|
@documents ||= Resources::Documents.new(self)
|
|
36
40
|
end
|
|
@@ -145,7 +149,8 @@ module SmileID
|
|
|
145
149
|
'token endpoint returned no token',
|
|
146
150
|
status_code: response.status,
|
|
147
151
|
request_id: Errors.request_id_from(response.headers),
|
|
148
|
-
raw_body: response.raw_body
|
|
152
|
+
raw_body: response.raw_body,
|
|
153
|
+
job_id: Errors.job_id_from(response.headers)
|
|
149
154
|
)
|
|
150
155
|
end
|
|
151
156
|
|
|
@@ -183,7 +188,8 @@ module SmileID
|
|
|
183
188
|
'expected a JSON object response body',
|
|
184
189
|
status_code: response.status,
|
|
185
190
|
request_id: Errors.request_id_from(response.headers),
|
|
186
|
-
raw_body: response.raw_body
|
|
191
|
+
raw_body: response.raw_body,
|
|
192
|
+
job_id: Errors.job_id_from(response.headers)
|
|
187
193
|
)
|
|
188
194
|
end
|
|
189
195
|
|
|
@@ -41,24 +41,117 @@ module SmileID
|
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
# POST /v3/enhanced_kyc
|
|
44
|
+
# POST /v3/enhanced_kyc and /v3/enhanced_kyc/sync
|
|
45
45
|
class EnhancedKyc < Base
|
|
46
|
+
# Queues an Enhanced KYC verification. The result arrives on callback_url.
|
|
46
47
|
def verify(country:, id_type:, id_number:, user_details:, consent:,
|
|
47
48
|
callback_url: nil, bank_code: nil, operator: nil,
|
|
48
49
|
partner_params: nil, metadata: nil, user_id: nil, timeout: nil)
|
|
49
|
-
form =
|
|
50
|
+
form = enhanced_kyc_form(
|
|
51
|
+
country: country, id_type: id_type, id_number: id_number,
|
|
52
|
+
user_details: user_details, consent: consent,
|
|
53
|
+
callback_url: resolve_callback(callback_url), bank_code: bank_code,
|
|
54
|
+
operator: operator, partner_params: partner_params, metadata: metadata
|
|
55
|
+
)
|
|
56
|
+
accepted(@client.call(:enhanced_kyc, form: form, user_id_header: user_id, timeout: timeout))
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Runs the same verification and returns the result in the response.
|
|
60
|
+
# The API ignores callback_url here, so the client's default callback
|
|
61
|
+
# URL is never sent; a callback_url passed on the call is checked and
|
|
62
|
+
# sent as given. A verification that could not be completed raises
|
|
63
|
+
# SmileIDError with status_code 424, 408 or 500. The job may still have
|
|
64
|
+
# run, and resubmitting runs and bills a second lookup, so don't
|
|
65
|
+
# resubmit automatically: read the outcome with
|
|
66
|
+
# verifications.retrieve(error.job_id). A 500 with no job_id means the
|
|
67
|
+
# job was not created.
|
|
68
|
+
def verify_sync(country:, id_type:, id_number:, user_details:, consent:,
|
|
69
|
+
callback_url: nil, bank_code: nil, operator: nil,
|
|
70
|
+
partner_params: nil, metadata: nil, user_id: nil, timeout: nil)
|
|
71
|
+
Config.validate_callback_url!(callback_url) if callback_url
|
|
72
|
+
form = enhanced_kyc_form(
|
|
73
|
+
country: country, id_type: id_type, id_number: id_number,
|
|
74
|
+
user_details: user_details, consent: consent, callback_url: callback_url,
|
|
75
|
+
bank_code: bank_code, operator: operator, partner_params: partner_params,
|
|
76
|
+
metadata: metadata
|
|
77
|
+
)
|
|
78
|
+
response = @client.call(:enhanced_kyc_sync, form: form, user_id_header: user_id, timeout: timeout)
|
|
79
|
+
Generated::Models::EnhancedKycResult.from(response.json, response.headers)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
private
|
|
83
|
+
|
|
84
|
+
def enhanced_kyc_form(country:, id_type:, id_number:, user_details:, consent:, callback_url:,
|
|
85
|
+
bank_code:, operator:, partner_params:, metadata:)
|
|
86
|
+
{
|
|
50
87
|
'country' => country,
|
|
51
88
|
'id_type' => id_type,
|
|
52
89
|
'id_number' => id_number,
|
|
53
90
|
'user_details' => coerce_user_details(user_details),
|
|
54
91
|
'consent' => coerce_consent(consent),
|
|
55
|
-
'callback_url' =>
|
|
92
|
+
'callback_url' => callback_url,
|
|
93
|
+
'bank_code' => bank_code,
|
|
94
|
+
'operator' => operator,
|
|
95
|
+
'partner_params' => partner_params,
|
|
96
|
+
'metadata' => metadata
|
|
97
|
+
}.compact
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# POST /v3/basic_kyc and /v3/basic_kyc/sync
|
|
102
|
+
class BasicKyc < Base
|
|
103
|
+
# Queues a Basic KYC verification. The result arrives on callback_url.
|
|
104
|
+
def verify(country:, id_type:, id_number:, user_details:, consent:,
|
|
105
|
+
callback_url: nil, bank_code: nil, operator: nil,
|
|
106
|
+
partner_params: nil, metadata: nil, timeout: nil)
|
|
107
|
+
form = basic_kyc_form(
|
|
108
|
+
country: country, id_type: id_type, id_number: id_number,
|
|
109
|
+
user_details: user_details, consent: consent,
|
|
110
|
+
callback_url: resolve_callback(callback_url), bank_code: bank_code,
|
|
111
|
+
operator: operator, partner_params: partner_params, metadata: metadata
|
|
112
|
+
)
|
|
113
|
+
accepted(@client.call(:basic_kyc, form: form, timeout: timeout))
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Runs the same verification and returns the result in the response.
|
|
117
|
+
# The API ignores callback_url here, so the client's default callback
|
|
118
|
+
# URL is never sent; a callback_url passed on the call is checked and
|
|
119
|
+
# sent as given. A verification that could not be completed raises
|
|
120
|
+
# SmileIDError with status_code 424, 408 or 500. The job may still have
|
|
121
|
+
# run, and resubmitting runs and bills a second lookup, so don't
|
|
122
|
+
# resubmit automatically: read the outcome with
|
|
123
|
+
# verifications.retrieve(error.job_id). A 500 with no job_id means the
|
|
124
|
+
# job was not created.
|
|
125
|
+
def verify_sync(country:, id_type:, id_number:, user_details:, consent:,
|
|
126
|
+
callback_url: nil, bank_code: nil, operator: nil,
|
|
127
|
+
partner_params: nil, metadata: nil, timeout: nil)
|
|
128
|
+
Config.validate_callback_url!(callback_url) if callback_url
|
|
129
|
+
form = basic_kyc_form(
|
|
130
|
+
country: country, id_type: id_type, id_number: id_number,
|
|
131
|
+
user_details: user_details, consent: consent, callback_url: callback_url,
|
|
132
|
+
bank_code: bank_code, operator: operator, partner_params: partner_params,
|
|
133
|
+
metadata: metadata
|
|
134
|
+
)
|
|
135
|
+
response = @client.call(:basic_kyc_sync, form: form, timeout: timeout)
|
|
136
|
+
Generated::Models::BasicKycResult.from(response.json, response.headers)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
private
|
|
140
|
+
|
|
141
|
+
def basic_kyc_form(country:, id_type:, id_number:, user_details:, consent:, callback_url:,
|
|
142
|
+
bank_code:, operator:, partner_params:, metadata:)
|
|
143
|
+
{
|
|
144
|
+
'country' => country,
|
|
145
|
+
'id_type' => id_type,
|
|
146
|
+
'id_number' => id_number,
|
|
147
|
+
'user_details' => coerce_user_details(user_details),
|
|
148
|
+
'consent' => coerce_consent(consent),
|
|
149
|
+
'callback_url' => callback_url,
|
|
56
150
|
'bank_code' => bank_code,
|
|
57
151
|
'operator' => operator,
|
|
58
152
|
'partner_params' => partner_params,
|
|
59
153
|
'metadata' => metadata
|
|
60
154
|
}.compact
|
|
61
|
-
accepted(@client.call(:enhanced_kyc, form: form, user_id_header: user_id, timeout: timeout))
|
|
62
155
|
end
|
|
63
156
|
end
|
|
64
157
|
|
|
@@ -256,7 +349,9 @@ module SmileID
|
|
|
256
349
|
# callback_url is optional: no callback is sent, but a given one is kept
|
|
257
350
|
# for replay. Send the same idempotency_key on a retry to get the original
|
|
258
351
|
# result instead of a second, billed screening. A provider timeout raises
|
|
259
|
-
# SmileIDError with status_code 408; nothing is billed
|
|
352
|
+
# SmileIDError with status_code 408; nothing is billed and the job is
|
|
353
|
+
# final in `error`, so resubmit rather than poll. A 500 with a job_id
|
|
354
|
+
# can be read with verifications.retrieve(error.job_id).
|
|
260
355
|
def submit_sync(countries:, full_name:, user_details:, consent:, birth_year: nil,
|
|
261
356
|
strict_match: nil, aliases: nil, search_existing_user: nil,
|
|
262
357
|
callback_url: nil, partner_params: nil, metadata: nil, user_id: nil,
|
data/lib/usesmileid/errors.rb
CHANGED
|
@@ -21,15 +21,20 @@ module SmileID
|
|
|
21
21
|
attr_reader :request_id
|
|
22
22
|
# The unparsed response body.
|
|
23
23
|
attr_reader :raw_body
|
|
24
|
+
# The Smile job id from the SmileID-Job-ID response header, or nil when
|
|
25
|
+
# the response had none. On a sync call that failed with 408, 424 or 500
|
|
26
|
+
# it names a job whose outcome verifications.retrieve can read.
|
|
27
|
+
attr_reader :job_id
|
|
24
28
|
|
|
25
29
|
def initialize(message = nil, status_code: nil, status: nil, code: nil,
|
|
26
|
-
request_id: nil, raw_body: nil)
|
|
30
|
+
request_id: nil, raw_body: nil, job_id: nil)
|
|
27
31
|
super(message)
|
|
28
32
|
@status_code = status_code
|
|
29
33
|
@status = status
|
|
30
34
|
@code = code
|
|
31
35
|
@request_id = request_id
|
|
32
36
|
@raw_body = raw_body
|
|
37
|
+
@job_id = job_id
|
|
33
38
|
end
|
|
34
39
|
end
|
|
35
40
|
|
|
@@ -89,6 +94,9 @@ module SmileID
|
|
|
89
94
|
# spec today; populate from a header if the backend ever sends one).
|
|
90
95
|
REQUEST_ID_HEADERS = %w[x-request-id smileid-request-id request-id].freeze
|
|
91
96
|
|
|
97
|
+
# The response header that carries the Smile job id.
|
|
98
|
+
JOB_ID_HEADER = 'SmileID-Job-ID'
|
|
99
|
+
|
|
92
100
|
# Select the error class for an HTTP status code.
|
|
93
101
|
def self.class_for(status_code)
|
|
94
102
|
return STATUS_CLASSES[status_code] if STATUS_CLASSES.key?(status_code)
|
|
@@ -108,7 +116,8 @@ module SmileID
|
|
|
108
116
|
status: body['status'],
|
|
109
117
|
code: body['code'],
|
|
110
118
|
request_id: request_id_from(headers),
|
|
111
|
-
raw_body: raw_body
|
|
119
|
+
raw_body: raw_body,
|
|
120
|
+
job_id: job_id_from(headers)
|
|
112
121
|
)
|
|
113
122
|
end
|
|
114
123
|
|
|
@@ -121,5 +130,21 @@ module SmileID
|
|
|
121
130
|
end
|
|
122
131
|
nil
|
|
123
132
|
end
|
|
133
|
+
|
|
134
|
+
# The SmileID-Job-ID response header with surrounding whitespace removed,
|
|
135
|
+
# or nil when it is absent or blank.
|
|
136
|
+
def self.job_id_from(headers)
|
|
137
|
+
job_id = header_value(headers, JOB_ID_HEADER).to_s.strip
|
|
138
|
+
job_id.empty? ? nil : job_id
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Looks a response header up by name, ignoring case. Returns nil when the
|
|
142
|
+
# header is absent or headers is not a hash.
|
|
143
|
+
def self.header_value(headers, name)
|
|
144
|
+
return nil unless headers.respond_to?(:each_pair)
|
|
145
|
+
|
|
146
|
+
headers.each_pair { |key, value| return value if key.to_s.casecmp?(name) }
|
|
147
|
+
nil
|
|
148
|
+
end
|
|
124
149
|
end
|
|
125
150
|
end
|
|
@@ -134,10 +134,10 @@ module SmileID
|
|
|
134
134
|
@consent = hash['consent']
|
|
135
135
|
@antifraud = hash['antifraud']
|
|
136
136
|
@device_signals = hash['device_signals']
|
|
137
|
-
@job_id = headers
|
|
138
|
-
@user_id = headers
|
|
139
|
-
@response_signature = headers
|
|
140
|
-
@response_timestamp = headers
|
|
137
|
+
@job_id = Errors.job_id_from(headers)
|
|
138
|
+
@user_id = Errors.header_value(headers, 'user-id')
|
|
139
|
+
@response_signature = Errors.header_value(headers, 'response-signature')
|
|
140
|
+
@response_timestamp = Errors.header_value(headers, 'response-timestamp')
|
|
141
141
|
@raw = hash
|
|
142
142
|
end
|
|
143
143
|
|
|
@@ -146,6 +146,97 @@ module SmileID
|
|
|
146
146
|
end
|
|
147
147
|
end
|
|
148
148
|
|
|
149
|
+
# Result of a Basic KYC verification: the body of POST /v3/basic_kyc/sync,
|
|
150
|
+
# which is the payload the async callback would have delivered. `status`
|
|
151
|
+
# is `clear`, `block`, `attention` or `error`. `match_results` is a plain
|
|
152
|
+
# hash with string keys: one verdict per submitted field (`overall`,
|
|
153
|
+
# `names`, `first_name`, `last_name`, `other_names`, `date_of_birth`,
|
|
154
|
+
# `gender`, `phone_number`, `secondary_id_number`), each one of
|
|
155
|
+
# `exact_match`, `partial_match`, `transposed`, `no_match` or
|
|
156
|
+
# `not_provided`. It is nil when no verdict was produced. Basic KYC never
|
|
157
|
+
# returns the ID record itself. The response headers are kept alongside
|
|
158
|
+
# the body, as for OneTimeAmlResult.
|
|
159
|
+
class BasicKycResult
|
|
160
|
+
attr_reader :status, :message, :reason, :created_at, :completed_at, :product,
|
|
161
|
+
:partner_params, :match_results, :user_provided_info, :consent,
|
|
162
|
+
:antifraud, :device_signals, :kyc_receipt,
|
|
163
|
+
:job_id, :user_id, :response_signature, :response_timestamp, :raw
|
|
164
|
+
|
|
165
|
+
def initialize(hash, headers = {})
|
|
166
|
+
@status = hash['status']
|
|
167
|
+
@message = hash['message']
|
|
168
|
+
@reason = hash['reason']
|
|
169
|
+
@created_at = hash['created_at']
|
|
170
|
+
@completed_at = hash['completed_at']
|
|
171
|
+
@product = hash['product']
|
|
172
|
+
@partner_params = hash['partner_params']
|
|
173
|
+
@match_results = hash['match_results']
|
|
174
|
+
@user_provided_info = hash['user_provided_info']
|
|
175
|
+
@consent = hash['consent']
|
|
176
|
+
@antifraud = hash['antifraud']
|
|
177
|
+
@device_signals = hash['device_signals']
|
|
178
|
+
@kyc_receipt = hash['kyc_receipt']
|
|
179
|
+
@job_id = Errors.job_id_from(headers)
|
|
180
|
+
@user_id = Errors.header_value(headers, 'user-id')
|
|
181
|
+
@response_signature = Errors.header_value(headers, 'response-signature')
|
|
182
|
+
@response_timestamp = Errors.header_value(headers, 'response-timestamp')
|
|
183
|
+
@raw = hash
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def self.from(hash, headers = {})
|
|
187
|
+
new(hash, headers)
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Result of an Enhanced KYC verification: the body of
|
|
192
|
+
# POST /v3/enhanced_kyc/sync, which is the payload the async callback
|
|
193
|
+
# would have delivered. `status` is `clear`, `block`, `attention` or
|
|
194
|
+
# `error`. The spec documents only the fields every callback shares, so
|
|
195
|
+
# those are read here; anything else the ID authority returned is in
|
|
196
|
+
# `raw`. `job_id` and `user_id` come from the SmileID-Job-ID and User-ID
|
|
197
|
+
# headers, or from the body when a header is absent or blank.
|
|
198
|
+
# `response_signature` and `response_timestamp` are the
|
|
199
|
+
# Response-Signature and Response-Timestamp headers, or nil.
|
|
200
|
+
class EnhancedKycResult
|
|
201
|
+
attr_reader :status, :message, :reason, :created_at, :completed_at, :product,
|
|
202
|
+
:partner_params, :user_provided_info, :consent, :antifraud,
|
|
203
|
+
:device_signals, :kyc_receipt,
|
|
204
|
+
:job_id, :user_id, :response_signature, :response_timestamp, :raw
|
|
205
|
+
|
|
206
|
+
def initialize(hash, headers = {})
|
|
207
|
+
@status = hash['status']
|
|
208
|
+
@message = hash['message']
|
|
209
|
+
@reason = hash['reason']
|
|
210
|
+
@created_at = hash['created_at']
|
|
211
|
+
@completed_at = hash['completed_at']
|
|
212
|
+
@product = hash['product']
|
|
213
|
+
@partner_params = hash['partner_params']
|
|
214
|
+
@user_provided_info = hash['user_provided_info']
|
|
215
|
+
@consent = hash['consent']
|
|
216
|
+
@antifraud = hash['antifraud']
|
|
217
|
+
@device_signals = hash['device_signals']
|
|
218
|
+
@kyc_receipt = hash['kyc_receipt']
|
|
219
|
+
@job_id = Errors.job_id_from(headers) || hash['job_id']
|
|
220
|
+
@user_id = header_text(headers, 'user-id') || hash['user_id']
|
|
221
|
+
@response_signature = Errors.header_value(headers, 'response-signature')
|
|
222
|
+
@response_timestamp = Errors.header_value(headers, 'response-timestamp')
|
|
223
|
+
@raw = hash
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def self.from(hash, headers = {})
|
|
227
|
+
new(hash, headers)
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
private
|
|
231
|
+
|
|
232
|
+
# A response header's value with surrounding whitespace removed, or
|
|
233
|
+
# nil when it is absent or blank.
|
|
234
|
+
def header_text(headers, name)
|
|
235
|
+
value = Errors.header_value(headers, name).to_s.strip
|
|
236
|
+
value.empty? ? nil : value
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
|
|
149
240
|
# One article in an AML Monitoring news response.
|
|
150
241
|
class AmlMonitoringNewsItem
|
|
151
242
|
attr_reader :body, :published_date, :publisher, :publisher_country_code,
|
|
@@ -25,6 +25,24 @@ module SmileID
|
|
|
25
25
|
success_statuses: [202],
|
|
26
26
|
product: 'enhanced_kyc'
|
|
27
27
|
),
|
|
28
|
+
enhanced_kyc_sync: Operation.new(
|
|
29
|
+
http_method: :post, path: '/v3/enhanced_kyc/sync', authenticated: true,
|
|
30
|
+
partner_id_header: false, body_kind: :multipart, idempotent: false,
|
|
31
|
+
success_statuses: [200],
|
|
32
|
+
product: 'enhanced_kyc'
|
|
33
|
+
),
|
|
34
|
+
basic_kyc: Operation.new(
|
|
35
|
+
http_method: :post, path: '/v3/basic_kyc', authenticated: true,
|
|
36
|
+
partner_id_header: false, body_kind: :multipart, idempotent: false,
|
|
37
|
+
success_statuses: [202],
|
|
38
|
+
product: 'basic_kyc'
|
|
39
|
+
),
|
|
40
|
+
basic_kyc_sync: Operation.new(
|
|
41
|
+
http_method: :post, path: '/v3/basic_kyc/sync', authenticated: true,
|
|
42
|
+
partner_id_header: false, body_kind: :multipart, idempotent: false,
|
|
43
|
+
success_statuses: [200],
|
|
44
|
+
product: 'basic_kyc'
|
|
45
|
+
),
|
|
28
46
|
document_verification: Operation.new(
|
|
29
47
|
http_method: :post, path: '/v3/document_verification', authenticated: true,
|
|
30
48
|
partner_id_header: true, body_kind: :multipart, idempotent: false,
|
data/lib/usesmileid/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: usesmileid
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 13.
|
|
4
|
+
version: 13.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Smile Identity
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|