usesmileid 13.1.0 → 13.3.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 +21 -1
- data/README.md +104 -2
- data/lib/usesmileid/client/client.rb +20 -2
- data/lib/usesmileid/client/resources.rb +233 -5
- data/lib/usesmileid/errors.rb +27 -2
- data/lib/usesmileid/generated/models.rb +160 -4
- data/lib/usesmileid/generated/operations.rb +51 -1
- data/lib/usesmileid/helpers/multipart.rb +1 -1
- 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: ef9c80ff14d7111a54188f1f55f0f1100980f208b340550b8bf087d58418f9b9
|
|
4
|
+
data.tar.gz: e34e8a6b4065116996befb25dba0ca5c022bc13a9c685188cd977903e59bb3d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62621fa7634131df0c3c631d4e43995c1a783937ccbff1d7ce9dd3c43c38ab23c6abb87466bbda062118a0e55551108f35e82b1fa10ed20def5fa8c4c7c7b829
|
|
7
|
+
data.tar.gz: 8586ecce01774bee002b100b1c317b2238f409388db2f9a8626539b4c5f77180ba939df0a64cc6f1afa37657e6f9ec2a6fe545d4fe3044445e8e079975574874
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [13.3.0] - 2026-12-01
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Address verification: `address.verify` (`POST /v3/address`), async with the result on the callback URL. Its token is minted with the `address_verification` product claim.
|
|
15
|
+
- Phone verification: `phone.verify` (`POST /v3/phone`), async with the result on the callback URL. Its token is minted with the `phone_number_verification` product claim.
|
|
16
|
+
- Smile Links: `smile_links.create`, `smile_links.get`, `smile_links.list` and `smile_links.update`. They return `SmileLinkCreated`, `SmileLink` and `SmileLinkList`. These calls need no product claim.
|
|
17
|
+
- `id_types` is sent as a JSON multipart part.
|
|
18
|
+
|
|
19
|
+
## [13.2.0] - 2026-11-24
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- 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.
|
|
24
|
+
- 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.
|
|
25
|
+
- `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.
|
|
26
|
+
- `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.
|
|
27
|
+
|
|
10
28
|
## [13.1.0] - 2026-11-19
|
|
11
29
|
|
|
12
30
|
### Added
|
|
@@ -77,7 +95,9 @@ First public release.
|
|
|
77
95
|
- Typed errors under `SmileID::Errors`, keyed on HTTP status.
|
|
78
96
|
- Bank codes, supported ID types and supported documents lookups.
|
|
79
97
|
|
|
80
|
-
[Unreleased]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v13.
|
|
98
|
+
[Unreleased]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v13.3.0...HEAD
|
|
99
|
+
[13.3.0]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v13.2.0...v13.3.0
|
|
100
|
+
[13.2.0]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v13.1.0...v13.2.0
|
|
81
101
|
[13.1.0]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v13.0.0...v13.1.0
|
|
82
102
|
[13.0.0]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v12.1.0...v13.0.0
|
|
83
103
|
[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(
|
|
@@ -146,6 +207,47 @@ news = smile.aml_monitoring.news("a1b2c3d4e5", "ref_001", news_category: "financ
|
|
|
146
207
|
news.news.first.title
|
|
147
208
|
```
|
|
148
209
|
|
|
210
|
+
### Address and phone verification
|
|
211
|
+
|
|
212
|
+
`address.verify` checks an address against the address on record with a data provider. A Nigerian address is identified by `utility_number`, `utility_provider` and `utility_type` (`"PrePaid"` or `"PostPaid"`), a South African one by `id_number`. The result arrives on your callback URL:
|
|
213
|
+
|
|
214
|
+
```ruby
|
|
215
|
+
accepted = smile.address.verify(
|
|
216
|
+
address: "12 Marina Rd, Lagos", country: "NG",
|
|
217
|
+
utility_number: "45012345678", utility_provider: "ikeja_electric", utility_type: "PrePaid",
|
|
218
|
+
user_details: user_details, consent: consent,
|
|
219
|
+
callback_url: "https://example.com/callback" # optional if a default is configured
|
|
220
|
+
)
|
|
221
|
+
accepted.job_id
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
`phone.verify` checks that a phone number is registered to the person. `phone_number` is the number to check; `operator:` (`"MTN"`, `"VODAFONE"` or `"AIRTELTIGO"`) is required for Ghana and `id_number:` for Kenya:
|
|
225
|
+
|
|
226
|
+
```ruby
|
|
227
|
+
smile.phone.verify(country: "GH", phone_number: "+233241234567", operator: "MTN",
|
|
228
|
+
user_details: user_details, consent: consent)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Both take an optional `user_id:`, sent in the request body.
|
|
232
|
+
|
|
233
|
+
### Smile Links
|
|
234
|
+
|
|
235
|
+
`smile_links` manages hosted verification links. `create` returns the link URL and its `ref_id`; `get`, `list` and `update` work on a link by `ref_id`:
|
|
236
|
+
|
|
237
|
+
```ruby
|
|
238
|
+
created = smile.smile_links.create(
|
|
239
|
+
id_types: [{ country: "NG", id_type: "NIN", verification_method: "enhanced_kyc" }],
|
|
240
|
+
name: "Onboarding", notice_privacy_policy_url: "https://example.com/privacy",
|
|
241
|
+
is_single_use: false
|
|
242
|
+
)
|
|
243
|
+
created.link # the URL to give the end user
|
|
244
|
+
link = smile.smile_links.get(created.ref_id)
|
|
245
|
+
page = smile.smile_links.list(limit: 20, page: 1, single_use: false)
|
|
246
|
+
page.links.first.total_jobs # outcome counts are on listed links
|
|
247
|
+
page.meta["total_pages"]
|
|
248
|
+
smile.smile_links.update(created.ref_id, is_disabled: true) # or id_types: [...]
|
|
249
|
+
```
|
|
250
|
+
|
|
149
251
|
### Document verification
|
|
150
252
|
|
|
151
253
|
```ruby
|
|
@@ -358,7 +460,7 @@ Every API failure raises a typed error under `SmileID::Errors`, keyed on the HTT
|
|
|
358
460
|
| `TimeoutError` | `wait_until_complete` deadline passed (no HTTP response) |
|
|
359
461
|
| `UnexpectedResponseError` | a 2xx response whose body is not the expected JSON object, for example proxy interference |
|
|
360
462
|
|
|
361
|
-
Each error exposes `status_code`, `status`, `message`, `code`, `request_id` and `raw_body`.
|
|
463
|
+
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
464
|
|
|
363
465
|
```ruby
|
|
364
466
|
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
|
|
@@ -59,6 +63,18 @@ module SmileID
|
|
|
59
63
|
@aml_monitoring ||= Resources::AmlMonitoring.new(self)
|
|
60
64
|
end
|
|
61
65
|
|
|
66
|
+
def address
|
|
67
|
+
@address ||= Resources::Address.new(self)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def phone
|
|
71
|
+
@phone ||= Resources::Phone.new(self)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def smile_links
|
|
75
|
+
@smile_links ||= Resources::SmileLinks.new(self)
|
|
76
|
+
end
|
|
77
|
+
|
|
62
78
|
def services
|
|
63
79
|
@services ||= Resources::Services.new(self)
|
|
64
80
|
end
|
|
@@ -145,7 +161,8 @@ module SmileID
|
|
|
145
161
|
'token endpoint returned no token',
|
|
146
162
|
status_code: response.status,
|
|
147
163
|
request_id: Errors.request_id_from(response.headers),
|
|
148
|
-
raw_body: response.raw_body
|
|
164
|
+
raw_body: response.raw_body,
|
|
165
|
+
job_id: Errors.job_id_from(response.headers)
|
|
149
166
|
)
|
|
150
167
|
end
|
|
151
168
|
|
|
@@ -183,7 +200,8 @@ module SmileID
|
|
|
183
200
|
'expected a JSON object response body',
|
|
184
201
|
status_code: response.status,
|
|
185
202
|
request_id: Errors.request_id_from(response.headers),
|
|
186
|
-
raw_body: response.raw_body
|
|
203
|
+
raw_body: response.raw_body,
|
|
204
|
+
job_id: Errors.job_id_from(response.headers)
|
|
187
205
|
)
|
|
188
206
|
end
|
|
189
207
|
|
|
@@ -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
|
|
|
@@ -236,6 +329,139 @@ module SmileID
|
|
|
236
329
|
end
|
|
237
330
|
end
|
|
238
331
|
|
|
332
|
+
# POST /v3/address
|
|
333
|
+
class Address < Base
|
|
334
|
+
UTILITY_TYPES = %w[PrePaid PostPaid].freeze
|
|
335
|
+
|
|
336
|
+
# Queues an address verification. The result arrives on callback_url. A
|
|
337
|
+
# Nigerian address is identified by utility_number with utility_provider
|
|
338
|
+
# and utility_type; a South African one by id_number. user_id goes in the
|
|
339
|
+
# body, and is minted for you when omitted.
|
|
340
|
+
def verify(address:, country:, user_details:, consent:, id_number: nil, utility_number: nil,
|
|
341
|
+
utility_provider: nil, utility_type: nil, user_id: nil, callback_url: nil,
|
|
342
|
+
partner_params: nil, metadata: nil, timeout: nil)
|
|
343
|
+
if id_number.to_s.empty? && utility_number.to_s.empty?
|
|
344
|
+
raise Errors::ValidationError.new('either id_number or utility_number is required')
|
|
345
|
+
end
|
|
346
|
+
if utility_type && !UTILITY_TYPES.include?(utility_type.to_s)
|
|
347
|
+
raise Errors::ValidationError.new("utility_type must be one of #{UTILITY_TYPES.join(', ')}")
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
form = {
|
|
351
|
+
'address' => address,
|
|
352
|
+
'country' => country,
|
|
353
|
+
'id_number' => id_number,
|
|
354
|
+
'utility_number' => utility_number,
|
|
355
|
+
'utility_provider' => utility_provider,
|
|
356
|
+
'utility_type' => utility_type,
|
|
357
|
+
'user_id' => user_id,
|
|
358
|
+
'user_details' => coerce_user_details(user_details),
|
|
359
|
+
'consent' => coerce_consent(consent),
|
|
360
|
+
'callback_url' => resolve_callback(callback_url),
|
|
361
|
+
'partner_params' => partner_params,
|
|
362
|
+
'metadata' => metadata
|
|
363
|
+
}.compact
|
|
364
|
+
accepted(@client.call(:address_verification, form: form, timeout: timeout))
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# POST /v3/phone
|
|
369
|
+
class Phone < Base
|
|
370
|
+
OPERATORS = %w[MTN VODAFONE AIRTELTIGO].freeze
|
|
371
|
+
|
|
372
|
+
# Queues a phone number verification. The result arrives on callback_url.
|
|
373
|
+
# phone_number is the number to check, in E.164 format; the phone number in
|
|
374
|
+
# user_details is the person's contact number. operator is required for
|
|
375
|
+
# Ghana and id_number for Kenya. user_id goes in the body.
|
|
376
|
+
def verify(country:, phone_number:, user_details:, consent:, operator: nil, id_number: nil,
|
|
377
|
+
user_id: nil, callback_url: nil, partner_params: nil, metadata: nil, timeout: nil)
|
|
378
|
+
if country.to_s == 'KE' && id_number.to_s.empty?
|
|
379
|
+
raise Errors::ValidationError.new('id_number is required for KE')
|
|
380
|
+
end
|
|
381
|
+
if operator && !OPERATORS.include?(operator.to_s)
|
|
382
|
+
raise Errors::ValidationError.new("operator must be one of #{OPERATORS.join(', ')}")
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
form = {
|
|
386
|
+
'country' => country,
|
|
387
|
+
'phone_number' => phone_number,
|
|
388
|
+
'operator' => operator,
|
|
389
|
+
'id_number' => id_number,
|
|
390
|
+
'user_id' => user_id,
|
|
391
|
+
'user_details' => coerce_user_details(user_details),
|
|
392
|
+
'consent' => coerce_consent(consent),
|
|
393
|
+
'callback_url' => resolve_callback(callback_url),
|
|
394
|
+
'partner_params' => partner_params,
|
|
395
|
+
'metadata' => metadata
|
|
396
|
+
}.compact
|
|
397
|
+
accepted(@client.call(:phone_verification, form: form, timeout: timeout))
|
|
398
|
+
end
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
# /v3/smile_links: hosted verification links you hand to end users.
|
|
402
|
+
class SmileLinks < Base
|
|
403
|
+
# id_types is an array of { country:, id_type:, verification_method: }
|
|
404
|
+
# hashes. expires_at may be a Time or an ISO 8601 string. Returns a
|
|
405
|
+
# SmileLinkCreated; read the full link with get(ref_id).
|
|
406
|
+
def create(id_types:, name:, notice_privacy_policy_url:, is_single_use:, company_name: nil,
|
|
407
|
+
callback_url: nil, description: nil, expires_at: nil, logo_url: nil,
|
|
408
|
+
redirect_url: nil, theme_color: nil, partner_params: nil, user_id: nil, timeout: nil)
|
|
409
|
+
require_id_types!(id_types)
|
|
410
|
+
form = {
|
|
411
|
+
'id_types' => id_types,
|
|
412
|
+
'name' => name,
|
|
413
|
+
'company_name' => company_name,
|
|
414
|
+
'notice_privacy_policy_url' => notice_privacy_policy_url,
|
|
415
|
+
'is_single_use' => is_single_use,
|
|
416
|
+
'callback_url' => resolve_callback(callback_url),
|
|
417
|
+
'description' => description,
|
|
418
|
+
'expires_at' => expires_at.respond_to?(:getutc) ? expires_at.getutc.iso8601(3) : expires_at,
|
|
419
|
+
'logo_url' => logo_url,
|
|
420
|
+
'redirect_url' => redirect_url,
|
|
421
|
+
'theme_color' => theme_color,
|
|
422
|
+
'partner_params' => partner_params,
|
|
423
|
+
'user_id' => user_id
|
|
424
|
+
}.compact
|
|
425
|
+
response = @client.call(:create_smile_link, form: form, timeout: timeout)
|
|
426
|
+
Generated::Models::SmileLinkCreated.from(response.json)
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
# One page of links. limit is 1 to 100 (default 20) and page starts at 1.
|
|
430
|
+
# single_use: true or false filters; omit it to list both.
|
|
431
|
+
def list(limit: nil, page: nil, single_use: nil, timeout: nil)
|
|
432
|
+
query = { 'limit' => limit, 'page' => page, 'single_use' => single_use }.compact
|
|
433
|
+
response = @client.call(:list_smile_links, query: query, timeout: timeout)
|
|
434
|
+
Generated::Models::SmileLinkList.from(response.json)
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
def get(ref_id, timeout: nil)
|
|
438
|
+
response = @client.call(:get_smile_link, path_params: { 'ref_id' => ref_id }, timeout: timeout)
|
|
439
|
+
Generated::Models::SmileLink.from(response.json)
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
# Replaces the link's id_types, and/or disables (is_disabled: true) or
|
|
443
|
+
# re-enables (false) it. At least one is required. Returns the updated link.
|
|
444
|
+
def update(ref_id, id_types: nil, is_disabled: nil, timeout: nil)
|
|
445
|
+
if id_types.nil? && is_disabled.nil?
|
|
446
|
+
raise Errors::ValidationError.new('at least one of id_types or is_disabled is required')
|
|
447
|
+
end
|
|
448
|
+
|
|
449
|
+
require_id_types!(id_types) unless id_types.nil?
|
|
450
|
+
form = { 'id_types' => id_types, 'is_disabled' => is_disabled }.compact
|
|
451
|
+
response = @client.call(:update_smile_link, path_params: { 'ref_id' => ref_id },
|
|
452
|
+
form: form, timeout: timeout)
|
|
453
|
+
Generated::Models::SmileLink.from(response.json)
|
|
454
|
+
end
|
|
455
|
+
|
|
456
|
+
private
|
|
457
|
+
|
|
458
|
+
def require_id_types!(id_types)
|
|
459
|
+
return unless !id_types.is_a?(Array) || id_types.empty?
|
|
460
|
+
|
|
461
|
+
raise Errors::ValidationError.new('id_types must be a non-empty array')
|
|
462
|
+
end
|
|
463
|
+
end
|
|
464
|
+
|
|
239
465
|
# POST /v3/aml and /v3/aml/sync
|
|
240
466
|
class Aml < Base
|
|
241
467
|
# Queues a One-Time AML screening. The result arrives on callback_url.
|
|
@@ -256,7 +482,9 @@ module SmileID
|
|
|
256
482
|
# callback_url is optional: no callback is sent, but a given one is kept
|
|
257
483
|
# for replay. Send the same idempotency_key on a retry to get the original
|
|
258
484
|
# result instead of a second, billed screening. A provider timeout raises
|
|
259
|
-
# SmileIDError with status_code 408; nothing is billed
|
|
485
|
+
# SmileIDError with status_code 408; nothing is billed and the job is
|
|
486
|
+
# final in `error`, so resubmit rather than poll. A 500 with a job_id
|
|
487
|
+
# can be read with verifications.retrieve(error.job_id).
|
|
260
488
|
def submit_sync(countries:, full_name:, user_details:, consent:, birth_year: nil,
|
|
261
489
|
strict_match: nil, aliases: nil, search_existing_user: nil,
|
|
262
490
|
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,
|
|
@@ -186,6 +277,71 @@ module SmileID
|
|
|
186
277
|
end
|
|
187
278
|
end
|
|
188
279
|
|
|
280
|
+
# A Smile Link as read from GET /v3/smile_links/{ref_id} or the listing,
|
|
281
|
+
# or as returned by an update. Fields mirror the wire. The outcome counts
|
|
282
|
+
# (clear, block, attention, error, successful_jobs, failed_jobs,
|
|
283
|
+
# total_jobs) arrive only on listed links and are nil otherwise.
|
|
284
|
+
class SmileLink
|
|
285
|
+
FIELDS = %w[
|
|
286
|
+
ref_id link name company_name description id_types is_single_use callback_url
|
|
287
|
+
notice_privacy_policy_url logo_url redirect_url theme_color expires_at disabled_at
|
|
288
|
+
partner_params user_id token_provided_fields token_provided_values created_at
|
|
289
|
+
updated_at clear block attention error successful_jobs failed_jobs total_jobs
|
|
290
|
+
].freeze
|
|
291
|
+
|
|
292
|
+
attr_reader(*FIELDS.map(&:to_sym), :raw)
|
|
293
|
+
|
|
294
|
+
def initialize(hash)
|
|
295
|
+
FIELDS.each { |field| instance_variable_set(:"@#{field}", hash[field]) }
|
|
296
|
+
@raw = hash
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# True while the link is disabled.
|
|
300
|
+
def disabled?
|
|
301
|
+
!disabled_at.nil?
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
def self.from(hash)
|
|
305
|
+
new(hash)
|
|
306
|
+
end
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
# Acknowledgment from POST /v3/smile_links (HTTP 201). Read the full link
|
|
310
|
+
# with smile_links.get(ref_id).
|
|
311
|
+
class SmileLinkCreated
|
|
312
|
+
attr_reader :link, :message, :ref_id, :user_id, :raw
|
|
313
|
+
|
|
314
|
+
def initialize(link:, message: nil, ref_id: nil, user_id: nil, raw: nil)
|
|
315
|
+
@link = link
|
|
316
|
+
@message = message
|
|
317
|
+
@ref_id = ref_id
|
|
318
|
+
@user_id = user_id
|
|
319
|
+
@raw = raw
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
def self.from(hash)
|
|
323
|
+
new(link: hash['link'], message: hash['message'], ref_id: hash['ref_id'],
|
|
324
|
+
user_id: hash['user_id'], raw: hash)
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# One page of GET /v3/smile_links. `meta` is the pagination hash with
|
|
329
|
+
# string keys: current_page, limit, total_count and total_pages.
|
|
330
|
+
class SmileLinkList
|
|
331
|
+
attr_reader :links, :meta, :raw
|
|
332
|
+
|
|
333
|
+
def initialize(links:, meta:, raw: nil)
|
|
334
|
+
@links = links
|
|
335
|
+
@meta = meta
|
|
336
|
+
@raw = raw
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
def self.from(hash)
|
|
340
|
+
new(links: (hash['links'] || []).map { |item| SmileLink.from(item) },
|
|
341
|
+
meta: hash['meta'] || {}, raw: hash)
|
|
342
|
+
end
|
|
343
|
+
end
|
|
344
|
+
|
|
189
345
|
# Service responses (spec section 5.2). Nested collections are exposed as
|
|
190
346
|
# plain hashes with string keys, exactly as they arrive on the wire.
|
|
191
347
|
class BankCodesResponse
|
|
@@ -7,7 +7,7 @@ module SmileID
|
|
|
7
7
|
# to route auth, headers, body kind, and retry behaviour.
|
|
8
8
|
module Operations
|
|
9
9
|
Operation = Struct.new(
|
|
10
|
-
:http_method, # :get / :post
|
|
10
|
+
:http_method, # :get / :post / :put
|
|
11
11
|
:path, # path template, e.g. "/v3/status/{job_id}"
|
|
12
12
|
:authenticated, # attach SmileID-Token?
|
|
13
13
|
:partner_id_header, # attach SmileID-Partner-ID?
|
|
@@ -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,
|
|
@@ -91,6 +109,38 @@ module SmileID
|
|
|
91
109
|
success_statuses: [200],
|
|
92
110
|
product: 'aml'
|
|
93
111
|
),
|
|
112
|
+
address_verification: Operation.new(
|
|
113
|
+
http_method: :post, path: '/v3/address', authenticated: true,
|
|
114
|
+
partner_id_header: false, body_kind: :multipart, idempotent: false,
|
|
115
|
+
success_statuses: [202],
|
|
116
|
+
product: 'address_verification'
|
|
117
|
+
),
|
|
118
|
+
phone_verification: Operation.new(
|
|
119
|
+
http_method: :post, path: '/v3/phone', authenticated: true,
|
|
120
|
+
partner_id_header: false, body_kind: :multipart, idempotent: false,
|
|
121
|
+
success_statuses: [202],
|
|
122
|
+
product: 'phone_number_verification'
|
|
123
|
+
),
|
|
124
|
+
create_smile_link: Operation.new(
|
|
125
|
+
http_method: :post, path: '/v3/smile_links', authenticated: true,
|
|
126
|
+
partner_id_header: false, body_kind: :multipart, idempotent: false,
|
|
127
|
+
success_statuses: [201]
|
|
128
|
+
),
|
|
129
|
+
list_smile_links: Operation.new(
|
|
130
|
+
http_method: :get, path: '/v3/smile_links', authenticated: true,
|
|
131
|
+
partner_id_header: false, body_kind: nil, idempotent: true,
|
|
132
|
+
success_statuses: [200]
|
|
133
|
+
),
|
|
134
|
+
get_smile_link: Operation.new(
|
|
135
|
+
http_method: :get, path: '/v3/smile_links/{ref_id}', authenticated: true,
|
|
136
|
+
partner_id_header: false, body_kind: nil, idempotent: true,
|
|
137
|
+
success_statuses: [200]
|
|
138
|
+
),
|
|
139
|
+
update_smile_link: Operation.new(
|
|
140
|
+
http_method: :put, path: '/v3/smile_links/{ref_id}', authenticated: true,
|
|
141
|
+
partner_id_header: false, body_kind: :multipart, idempotent: false,
|
|
142
|
+
success_statuses: [200]
|
|
143
|
+
),
|
|
94
144
|
status: Operation.new(
|
|
95
145
|
http_method: :get, path: '/v3/status/{job_id}', authenticated: true,
|
|
96
146
|
partner_id_header: false, body_kind: nil, idempotent: true,
|
|
@@ -19,7 +19,7 @@ module SmileID
|
|
|
19
19
|
# item 4, the OpenAPI-Generator bug to avoid).
|
|
20
20
|
module Multipart
|
|
21
21
|
# Fields serialized as JSON parts.
|
|
22
|
-
JSON_PART_FIELDS = %w[consent user_details partner_params metadata countries aliases].freeze
|
|
22
|
+
JSON_PART_FIELDS = %w[consent user_details partner_params metadata countries aliases id_types].freeze
|
|
23
23
|
# Single binary fields.
|
|
24
24
|
BINARY_FIELDS = %w[selfie_image document document_back visa comparison_image].freeze
|
|
25
25
|
# Repeated binary fields.
|
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.3.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
|
+
date: 2026-12-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|