onfido 6.2.0 → 6.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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +1 -1
  4. data/lib/onfido/api/default_api.rb +413 -0
  5. data/lib/onfido/api_client.rb +6 -2
  6. data/lib/onfido/models/biometric_token.rb +265 -0
  7. data/lib/onfido/models/biometric_token_data.rb +317 -0
  8. data/lib/onfido/models/biometric_token_response.rb +237 -0
  9. data/lib/onfido/models/biometric_token_updater.rb +262 -0
  10. data/lib/onfido/models/biometric_tokens_response.rb +239 -0
  11. data/lib/onfido/models/document_types.rb +3 -1
  12. data/lib/onfido/models/invalidated_biometric_token_response.rb +237 -0
  13. data/lib/onfido/models/invalidated_biometric_token_summary.rb +238 -0
  14. data/lib/onfido/models/invalidated_biometric_token_summary_deleted_items.rb +239 -0
  15. data/lib/onfido/models/invalidated_biometric_tokens_response.rb +237 -0
  16. data/lib/onfido/models/updated_biometric_token_response.rb +237 -0
  17. data/lib/onfido/models/watchlist_mesh_added_mentions.rb +247 -0
  18. data/lib/onfido/models/watchlist_mesh_alert_risk.rb +323 -0
  19. data/lib/onfido/models/watchlist_mesh_alert_risk1.rb +316 -0
  20. data/lib/onfido/models/watchlist_mesh_associate.rb +231 -0
  21. data/lib/onfido/models/watchlist_mesh_date_value.rb +231 -0
  22. data/lib/onfido/models/watchlist_mesh_field.rb +241 -0
  23. data/lib/onfido/models/watchlist_mesh_image.rb +231 -0
  24. data/lib/onfido/models/watchlist_mesh_lists.rb +309 -0
  25. data/lib/onfido/models/watchlist_mesh_media.rb +261 -0
  26. data/lib/onfido/models/watchlist_mesh_name.rb +231 -0
  27. data/lib/onfido/models/watchlist_mesh_pep.rb +369 -0
  28. data/lib/onfido/models/watchlist_mesh_person.rb +283 -0
  29. data/lib/onfido/models/watchlist_mesh_profile.rb +273 -0
  30. data/lib/onfido/models/watchlist_mesh_risk_decision.rb +43 -0
  31. data/lib/onfido/models/watchlist_mesh_risk_detail.rb +255 -0
  32. data/lib/onfido/models/watchlist_mesh_risk_indicators.rb +271 -0
  33. data/lib/onfido/models/watchlist_mesh_sanctions.rb +309 -0
  34. data/lib/onfido/models/webhook.rb +11 -1
  35. data/lib/onfido/models/webhook_builder.rb +11 -1
  36. data/lib/onfido/models/webhook_create.rb +11 -1
  37. data/lib/onfido/models/webhook_response.rb +11 -1
  38. data/lib/onfido/models/webhook_update.rb +11 -1
  39. data/lib/onfido/models/webhook_updater.rb +11 -1
  40. data/lib/onfido/version.rb +1 -1
  41. data/lib/onfido.rb +27 -0
  42. data/spec/integrations/biometric_token_spec.rb +122 -0
  43. data/spec/integrations/document_spec.rb +8 -1
  44. data/spec/integrations/media/nfc_data.json +11768 -0
  45. data/spec/integrations/watchlist_alert_risk_spec.rb +66 -0
  46. data/spec/shared_contexts/with_document.rb +0 -1
  47. data/spec/spec_helper.rb +6 -7
  48. metadata +55 -22
@@ -15,12 +15,16 @@ require 'time'
15
15
 
16
16
  module Onfido
17
17
  class WebhookCreate
18
+ # Name of the webhook.
19
+ attr_accessor :name
20
+
18
21
  # The url that will listen to notifications (must be https).
19
22
  attr_accessor :url
20
23
 
21
24
  # Attribute mapping from ruby-style variable name to JSON key.
22
25
  def self.attribute_map
23
26
  {
27
+ :'name' => :'name',
24
28
  :'url' => :'url'
25
29
  }
26
30
  end
@@ -38,6 +42,7 @@ module Onfido
38
42
  # Attribute type mapping.
39
43
  def self.openapi_types
40
44
  {
45
+ :'name' => :'String',
41
46
  :'url' => :'String'
42
47
  }
43
48
  end
@@ -64,6 +69,10 @@ module Onfido
64
69
  h[k.to_sym] = v
65
70
  }
66
71
 
72
+ if attributes.key?(:'name')
73
+ self.name = attributes[:'name']
74
+ end
75
+
67
76
  if attributes.key?(:'url')
68
77
  self.url = attributes[:'url']
69
78
  else
@@ -106,6 +115,7 @@ module Onfido
106
115
  def ==(o)
107
116
  return true if self.equal?(o)
108
117
  self.class == o.class &&
118
+ name == o.name &&
109
119
  url == o.url
110
120
  end
111
121
 
@@ -118,7 +128,7 @@ module Onfido
118
128
  # Calculates hash code according to all attributes.
119
129
  # @return [Integer] Hash code
120
130
  def hash
121
- [url].hash
131
+ [name, url].hash
122
132
  end
123
133
 
124
134
  # Builds the object from hash
@@ -18,6 +18,9 @@ module Onfido
18
18
  # The unique identifier of the webhook.
19
19
  attr_accessor :id
20
20
 
21
+ # Name of the webhook.
22
+ attr_accessor :name
23
+
21
24
  # The url that will listen to notifications (must be https).
22
25
  attr_accessor :url
23
26
 
@@ -31,6 +34,7 @@ module Onfido
31
34
  def self.attribute_map
32
35
  {
33
36
  :'id' => :'id',
37
+ :'name' => :'name',
34
38
  :'url' => :'url',
35
39
  :'token' => :'token',
36
40
  :'href' => :'href'
@@ -51,6 +55,7 @@ module Onfido
51
55
  def self.openapi_types
52
56
  {
53
57
  :'id' => :'String',
58
+ :'name' => :'String',
54
59
  :'url' => :'String',
55
60
  :'token' => :'String',
56
61
  :'href' => :'String'
@@ -85,6 +90,10 @@ module Onfido
85
90
  self.id = nil
86
91
  end
87
92
 
93
+ if attributes.key?(:'name')
94
+ self.name = attributes[:'name']
95
+ end
96
+
88
97
  if attributes.key?(:'url')
89
98
  self.url = attributes[:'url']
90
99
  end
@@ -134,6 +143,7 @@ module Onfido
134
143
  return true if self.equal?(o)
135
144
  self.class == o.class &&
136
145
  id == o.id &&
146
+ name == o.name &&
137
147
  url == o.url &&
138
148
  token == o.token &&
139
149
  href == o.href
@@ -148,7 +158,7 @@ module Onfido
148
158
  # Calculates hash code according to all attributes.
149
159
  # @return [Integer] Hash code
150
160
  def hash
151
- [id, url, token, href].hash
161
+ [id, name, url, token, href].hash
152
162
  end
153
163
 
154
164
  # Builds the object from hash
@@ -15,12 +15,16 @@ require 'time'
15
15
 
16
16
  module Onfido
17
17
  class WebhookUpdate
18
+ # Name of the webhook.
19
+ attr_accessor :name
20
+
18
21
  # The url that will listen to notifications (must be https).
19
22
  attr_accessor :url
20
23
 
21
24
  # Attribute mapping from ruby-style variable name to JSON key.
22
25
  def self.attribute_map
23
26
  {
27
+ :'name' => :'name',
24
28
  :'url' => :'url'
25
29
  }
26
30
  end
@@ -38,6 +42,7 @@ module Onfido
38
42
  # Attribute type mapping.
39
43
  def self.openapi_types
40
44
  {
45
+ :'name' => :'String',
41
46
  :'url' => :'String'
42
47
  }
43
48
  end
@@ -64,6 +69,10 @@ module Onfido
64
69
  h[k.to_sym] = v
65
70
  }
66
71
 
72
+ if attributes.key?(:'name')
73
+ self.name = attributes[:'name']
74
+ end
75
+
67
76
  if attributes.key?(:'url')
68
77
  self.url = attributes[:'url']
69
78
  end
@@ -89,6 +98,7 @@ module Onfido
89
98
  def ==(o)
90
99
  return true if self.equal?(o)
91
100
  self.class == o.class &&
101
+ name == o.name &&
92
102
  url == o.url
93
103
  end
94
104
 
@@ -101,7 +111,7 @@ module Onfido
101
111
  # Calculates hash code according to all attributes.
102
112
  # @return [Integer] Hash code
103
113
  def hash
104
- [url].hash
114
+ [name, url].hash
105
115
  end
106
116
 
107
117
  # Builds the object from hash
@@ -42,6 +42,9 @@ module Onfido
42
42
  # The scopes to be sent when requesting the access token.
43
43
  attr_accessor :oauth_server_scope
44
44
 
45
+ # Name of the webhook.
46
+ attr_accessor :name
47
+
45
48
  # The url that will listen to notifications (must be https).
46
49
  attr_accessor :url
47
50
 
@@ -57,6 +60,7 @@ module Onfido
57
60
  :'oauth_server_client_id' => :'oauth_server_client_id',
58
61
  :'oauth_server_client_secret' => :'oauth_server_client_secret',
59
62
  :'oauth_server_scope' => :'oauth_server_scope',
63
+ :'name' => :'name',
60
64
  :'url' => :'url'
61
65
  }
62
66
  end
@@ -83,6 +87,7 @@ module Onfido
83
87
  :'oauth_server_client_id' => :'String',
84
88
  :'oauth_server_client_secret' => :'String',
85
89
  :'oauth_server_scope' => :'String',
90
+ :'name' => :'String',
86
91
  :'url' => :'String'
87
92
  }
88
93
  end
@@ -157,6 +162,10 @@ module Onfido
157
162
  self.oauth_server_scope = attributes[:'oauth_server_scope']
158
163
  end
159
164
 
165
+ if attributes.key?(:'name')
166
+ self.name = attributes[:'name']
167
+ end
168
+
160
169
  if attributes.key?(:'url')
161
170
  self.url = attributes[:'url']
162
171
  end
@@ -191,6 +200,7 @@ module Onfido
191
200
  oauth_server_client_id == o.oauth_server_client_id &&
192
201
  oauth_server_client_secret == o.oauth_server_client_secret &&
193
202
  oauth_server_scope == o.oauth_server_scope &&
203
+ name == o.name &&
194
204
  url == o.url
195
205
  end
196
206
 
@@ -203,7 +213,7 @@ module Onfido
203
213
  # Calculates hash code according to all attributes.
204
214
  # @return [Integer] Hash code
205
215
  def hash
206
- [enabled, events, environments, payload_version, oauth_enabled, oauth_server_url, oauth_server_client_id, oauth_server_client_secret, oauth_server_scope, url].hash
216
+ [enabled, events, environments, payload_version, oauth_enabled, oauth_server_url, oauth_server_client_id, oauth_server_client_secret, oauth_server_scope, name, url].hash
207
217
  end
208
218
 
209
219
  # Builds the object from hash
@@ -11,5 +11,5 @@ Generator version: 7.16.0
11
11
  =end
12
12
 
13
13
  module Onfido
14
- VERSION = '6.2.0'
14
+ VERSION = '6.3.0'
15
15
  end
data/lib/onfido.rb CHANGED
@@ -33,6 +33,11 @@ require 'onfido/models/applicant_shared'
33
33
  require 'onfido/models/applicant_update'
34
34
  require 'onfido/models/applicant_updater'
35
35
  require 'onfido/models/applicants_list'
36
+ require 'onfido/models/biometric_token'
37
+ require 'onfido/models/biometric_token_data'
38
+ require 'onfido/models/biometric_token_response'
39
+ require 'onfido/models/biometric_token_updater'
40
+ require 'onfido/models/biometric_tokens_response'
36
41
  require 'onfido/models/check'
37
42
  require 'onfido/models/check_builder'
38
43
  require 'onfido/models/check_request'
@@ -201,6 +206,10 @@ require 'onfido/models/india_pan_report_all_of_breakdown_device_breakdown'
201
206
  require 'onfido/models/india_pan_report_all_of_breakdown_device_breakdown_pan_valid'
202
207
  require 'onfido/models/india_pan_report_all_of_properties'
203
208
  require 'onfido/models/india_pan_report_all_of_properties_device'
209
+ require 'onfido/models/invalidated_biometric_token_response'
210
+ require 'onfido/models/invalidated_biometric_token_summary'
211
+ require 'onfido/models/invalidated_biometric_token_summary_deleted_items'
212
+ require 'onfido/models/invalidated_biometric_tokens_response'
204
213
  require 'onfido/models/known_faces_breakdown'
205
214
  require 'onfido/models/known_faces_breakdown_image_integrity'
206
215
  require 'onfido/models/known_faces_breakdown_previously_seen_faces'
@@ -255,6 +264,7 @@ require 'onfido/models/signing_documents_list'
255
264
  require 'onfido/models/task'
256
265
  require 'onfido/models/task_item'
257
266
  require 'onfido/models/timeline_file_reference'
267
+ require 'onfido/models/updated_biometric_token_response'
258
268
  require 'onfido/models/us_driving_licence_breakdown'
259
269
  require 'onfido/models/us_driving_licence_breakdown_address'
260
270
  require 'onfido/models/us_driving_licence_breakdown_address_breakdown'
@@ -284,6 +294,23 @@ require 'onfido/models/watchlist_enhanced_properties_records_inner_event_inner'
284
294
  require 'onfido/models/watchlist_enhanced_properties_records_inner_event_inner_source'
285
295
  require 'onfido/models/watchlist_enhanced_properties_records_inner_source_inner'
286
296
  require 'onfido/models/watchlist_enhanced_report'
297
+ require 'onfido/models/watchlist_mesh_added_mentions'
298
+ require 'onfido/models/watchlist_mesh_alert_risk'
299
+ require 'onfido/models/watchlist_mesh_alert_risk1'
300
+ require 'onfido/models/watchlist_mesh_associate'
301
+ require 'onfido/models/watchlist_mesh_date_value'
302
+ require 'onfido/models/watchlist_mesh_field'
303
+ require 'onfido/models/watchlist_mesh_image'
304
+ require 'onfido/models/watchlist_mesh_lists'
305
+ require 'onfido/models/watchlist_mesh_media'
306
+ require 'onfido/models/watchlist_mesh_name'
307
+ require 'onfido/models/watchlist_mesh_pep'
308
+ require 'onfido/models/watchlist_mesh_person'
309
+ require 'onfido/models/watchlist_mesh_profile'
310
+ require 'onfido/models/watchlist_mesh_risk_decision'
311
+ require 'onfido/models/watchlist_mesh_risk_detail'
312
+ require 'onfido/models/watchlist_mesh_risk_indicators'
313
+ require 'onfido/models/watchlist_mesh_sanctions'
287
314
  require 'onfido/models/watchlist_monitor'
288
315
  require 'onfido/models/watchlist_monitor_builder'
289
316
  require 'onfido/models/watchlist_monitor_match'
@@ -0,0 +1,122 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'securerandom'
4
+
5
+ require_relative '../shared_contexts/with_onfido'
6
+
7
+ describe Onfido::BiometricToken do
8
+ describe 'Biometric tokens' do
9
+ include_context 'with onfido'
10
+
11
+ let(:biometric_workflow_id) { 'b79dcf69-41a0-412d-b803-d1a618730f72' }
12
+ let(:customer_user_id) { "test-user-id-#{SecureRandom.uuid}" }
13
+ let(:unique_suffix) { SecureRandom.hex(4) }
14
+ let(:applicant_builder) do
15
+ Onfido::ApplicantBuilder.new(
16
+ first_name: "First#{unique_suffix}",
17
+ last_name: "Last#{unique_suffix}",
18
+ email: "first.last.#{unique_suffix}@example.com",
19
+ consents: [
20
+ Onfido::ApplicantConsentBuilder.new(
21
+ name: Onfido::ApplicantConsentName::PRIVACY_NOTICES_READ,
22
+ granted: true,
23
+ ),
24
+ ],
25
+ )
26
+ end
27
+ let(:applicant_id) { onfido_api.create_applicant(applicant_builder).id }
28
+ let(:live_photo_file) { File.open('spec/integrations/media/sample_photo.png') }
29
+ let(:live_photo) do
30
+ onfido_api.upload_live_photo(
31
+ applicant_id: applicant_id,
32
+ file: live_photo_file,
33
+ )
34
+ end
35
+ let(:workflow_run_builder) do
36
+ Onfido::WorkflowRunBuilder.new(
37
+ applicant_id: applicant_id,
38
+ workflow_id: biometric_workflow_id,
39
+ customer_user_id: customer_user_id,
40
+ custom_data: {
41
+ media_ids: [
42
+ {
43
+ id: live_photo.id,
44
+ },
45
+ ],
46
+ },
47
+ )
48
+ end
49
+ let(:workflow_run) { onfido_api.create_workflow_run(workflow_run_builder) }
50
+ let(:biometric_tokens) do
51
+ created_workflow_run = workflow_run
52
+
53
+ expect(created_workflow_run.customer_user_id).to eq(customer_user_id)
54
+
55
+ repeat_request_until_biometric_tokens_created(customer_user_id)
56
+ end
57
+ let(:biometric_token) { biometric_tokens.biometric_tokens.first }
58
+ let(:biometric_token_id) { biometric_token.uuid }
59
+
60
+ def repeat_request_until_biometric_tokens_created(user_id, max_retries = 10, interval = 3)
61
+ attempts = 0
62
+
63
+ loop do
64
+ response = onfido_api.list_biometric_tokens(user_id)
65
+ return response if response.biometric_tokens.any?
66
+
67
+ raise 'Biometric tokens were not created in time' if attempts >= max_retries
68
+
69
+ attempts += 1
70
+ sleep(interval)
71
+ end
72
+ end
73
+
74
+ it 'lists biometric tokens' do
75
+ expect(biometric_tokens).to be_an_instance_of(Onfido::BiometricTokensResponse)
76
+ expect(biometric_tokens.biometric_tokens.length).to be > 0
77
+ expect(biometric_token.uuid).not_to be_nil
78
+ expect(biometric_token.data.status).not_to be_nil
79
+ end
80
+
81
+ it 'finds a biometric token' do
82
+ biometric_token_response = onfido_api.find_biometric_token(customer_user_id, biometric_token_id)
83
+
84
+ expect(biometric_token_response).to be_an_instance_of(Onfido::BiometricTokenResponse)
85
+ expect(biometric_token_response.biometric_token.uuid).to eq(biometric_token_id)
86
+ expect(biometric_token_response.biometric_token.data.status).not_to be_nil
87
+ end
88
+
89
+ it 'updates a biometric token status' do
90
+ approved_status = 'approved'
91
+
92
+ updated_biometric_token = onfido_api.update_biometric_token(
93
+ customer_user_id,
94
+ biometric_token_id,
95
+ Onfido::BiometricTokenUpdater.new(status: approved_status),
96
+ )
97
+
98
+ expect(updated_biometric_token).to be_an_instance_of(Onfido::UpdatedBiometricTokenResponse)
99
+ expect(updated_biometric_token.biometric_token.uuid).to eq(biometric_token_id)
100
+ expect(updated_biometric_token.biometric_token.data.status).to eq(approved_status)
101
+ end
102
+
103
+ it 'invalidates a biometric token successfully' do
104
+ invalidated_biometric_token, status_code, = onfido_api.invalidate_biometric_token_with_http_info(
105
+ customer_user_id,
106
+ biometric_token_id,
107
+ debug_return_type: 'Object',
108
+ )
109
+
110
+ expect(invalidated_biometric_token).to be_a(Hash)
111
+ expect(status_code).to eq(200)
112
+ end
113
+
114
+ it 'invalidates biometric tokens successfully' do
115
+ invalidated_biometric_tokens, status_code, = onfido_api.invalidate_biometric_tokens_with_http_info(customer_user_id)
116
+
117
+ expect(invalidated_biometric_tokens).to be_an_instance_of(Onfido::InvalidatedBiometricTokensResponse)
118
+ expect(invalidated_biometric_tokens.biometric_tokens.deleted_items.count).to eq(0)
119
+ expect(status_code).to eq(200)
120
+ end
121
+ end
122
+ end
@@ -43,7 +43,14 @@ describe Onfido::Document do
43
43
  end
44
44
 
45
45
  describe 'downloading an NFC face' do
46
- let(:file) { onfido_api.download_nfc_face(nfc_face_id) }
46
+ let(:nfc_document) do
47
+ onfido_api.upload_document(
48
+ Onfido::DocumentTypes::PASSPORT,
49
+ applicant_id,
50
+ File.open('spec/integrations/media/nfc_data.json')
51
+ )
52
+ end
53
+ let(:file) { onfido_api.download_nfc_face(nfc_document.id) }
47
54
 
48
55
  it_behaves_like "a valid PNG file", 471345
49
56
  end