usesmileid 13.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2759896be24ef979f47a9794d279fc97cf05390a43ae97b33af18b787b413a3d
4
- data.tar.gz: 9ae56e3aea45fc59a10ef8a3f5ddd6e04e97694251eb07ad71dae49cc293527d
3
+ metadata.gz: ef9c80ff14d7111a54188f1f55f0f1100980f208b340550b8bf087d58418f9b9
4
+ data.tar.gz: e34e8a6b4065116996befb25dba0ca5c022bc13a9c685188cd977903e59bb3d1
5
5
  SHA512:
6
- metadata.gz: 3fdcfad5606923a87f00e7ff43a0adc5bb970d0344bac3b0ef66f6220d4a9816acce9b4ce9343c396c24589bcaf9476ddc727dbdecc5c1435cf9a329711a337f
7
- data.tar.gz: 9926babc0a54d80f5a68ec95c2e871f837a98d11c0cbbda153a031572eb93ef44e111be484c00d0d885b0b79428445255d7be17e9e19c4dc55eefd7e7ced95a2
6
+ metadata.gz: 62621fa7634131df0c3c631d4e43995c1a783937ccbff1d7ce9dd3c43c38ab23c6abb87466bbda062118a0e55551108f35e82b1fa10ed20def5fa8c4c7c7b829
7
+ data.tar.gz: 8586ecce01774bee002b100b1c317b2238f409388db2f9a8626539b4c5f77180ba939df0a64cc6f1afa37657e6f9ec2a6fe545d4fe3044445e8e079975574874
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.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
+
10
19
  ## [13.2.0] - 2026-11-24
11
20
 
12
21
  ### Added
@@ -86,7 +95,8 @@ First public release.
86
95
  - Typed errors under `SmileID::Errors`, keyed on HTTP status.
87
96
  - Bank codes, supported ID types and supported documents lookups.
88
97
 
89
- [Unreleased]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v13.2.0...HEAD
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
90
100
  [13.2.0]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v13.1.0...v13.2.0
91
101
  [13.1.0]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v13.0.0...v13.1.0
92
102
  [13.0.0]: https://github.com/smileidentity/smileid-sdk-ruby/compare/v12.1.0...v13.0.0
data/README.md CHANGED
@@ -207,6 +207,47 @@ news = smile.aml_monitoring.news("a1b2c3d4e5", "ref_001", news_category: "financ
207
207
  news.news.first.title
208
208
  ```
209
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
+
210
251
  ### Document verification
211
252
 
212
253
  ```ruby
@@ -63,6 +63,18 @@ module SmileID
63
63
  @aml_monitoring ||= Resources::AmlMonitoring.new(self)
64
64
  end
65
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
+
66
78
  def services
67
79
  @services ||= Resources::Services.new(self)
68
80
  end
@@ -329,6 +329,139 @@ module SmileID
329
329
  end
330
330
  end
331
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
+
332
465
  # POST /v3/aml and /v3/aml/sync
333
466
  class Aml < Base
334
467
  # Queues a One-Time AML screening. The result arrives on callback_url.
@@ -277,6 +277,71 @@ module SmileID
277
277
  end
278
278
  end
279
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
+
280
345
  # Service responses (spec section 5.2). Nested collections are exposed as
281
346
  # plain hashes with string keys, exactly as they arrive on the wire.
282
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?
@@ -109,6 +109,38 @@ module SmileID
109
109
  success_statuses: [200],
110
110
  product: 'aml'
111
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
+ ),
112
144
  status: Operation.new(
113
145
  http_method: :get, path: '/v3/status/{job_id}', authenticated: true,
114
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.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmileID
4
- VERSION = '13.2.0'
4
+ VERSION = '13.3.0'
5
5
  end
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.2.0
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-24 00:00:00.000000000 Z
11
+ date: 2026-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday