yoti 1.9.0 → 1.10.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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/lib/yoti.rb +9 -0
  4. data/lib/yoti/activity_details.rb +3 -5
  5. data/lib/yoti/configuration.rb +1 -1
  6. data/lib/yoti/data_type/document_details.rb +1 -1
  7. data/lib/yoti/data_type/image.rb +1 -1
  8. data/lib/yoti/data_type/media.rb +3 -0
  9. data/lib/yoti/doc_scan/client.rb +6 -2
  10. data/lib/yoti/doc_scan/constants.rb +4 -0
  11. data/lib/yoti/doc_scan/session/create/document_filter.rb +1 -1
  12. data/lib/yoti/doc_scan/session/create/objective/objective.rb +31 -0
  13. data/lib/yoti/doc_scan/session/create/objective/proof_of_address_objective.rb +31 -0
  14. data/lib/yoti/doc_scan/session/create/requested_check.rb +1 -1
  15. data/lib/yoti/doc_scan/session/create/requested_supplementary_doc_text_extraction_task.rb +94 -0
  16. data/lib/yoti/doc_scan/session/create/requested_task.rb +1 -1
  17. data/lib/yoti/doc_scan/session/create/required_document.rb +1 -1
  18. data/lib/yoti/doc_scan/session/create/required_supplementary_document.rb +90 -0
  19. data/lib/yoti/doc_scan/session/retrieve/file_response.rb +21 -0
  20. data/lib/yoti/doc_scan/session/retrieve/generated_supplementary_document_text_data_check_response.rb +12 -0
  21. data/lib/yoti/doc_scan/session/retrieve/get_session_result.rb +18 -0
  22. data/lib/yoti/doc_scan/session/retrieve/page_response.rb +10 -0
  23. data/lib/yoti/doc_scan/session/retrieve/resource_container.rb +25 -6
  24. data/lib/yoti/doc_scan/session/retrieve/resource_response.rb +2 -0
  25. data/lib/yoti/doc_scan/session/retrieve/supplementary_document_resource_response.rb +57 -0
  26. data/lib/yoti/doc_scan/session/retrieve/supplementary_document_text_data_check_response.rb +12 -0
  27. data/lib/yoti/doc_scan/session/retrieve/supplementary_document_text_extraction_task_response.rb +18 -0
  28. data/lib/yoti/doc_scan/session/retrieve/task_response.rb +2 -0
  29. data/lib/yoti/dynamic_share_service/dynamic_scenario.rb +5 -0
  30. data/lib/yoti/dynamic_share_service/extension/extension.rb +3 -0
  31. data/lib/yoti/dynamic_share_service/extension/location_constraint_extension.rb +3 -0
  32. data/lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb +4 -0
  33. data/lib/yoti/dynamic_share_service/policy/dynamic_policy.rb +3 -0
  34. data/lib/yoti/dynamic_share_service/policy/wanted_anchor.rb +3 -0
  35. data/lib/yoti/dynamic_share_service/policy/wanted_attribute.rb +5 -0
  36. data/lib/yoti/http/request.rb +1 -1
  37. data/lib/yoti/http/signed_request.rb +1 -1
  38. data/lib/yoti/protobuf/main.rb +8 -8
  39. data/lib/yoti/share/attribute_issuance_details.rb +6 -0
  40. data/lib/yoti/ssl.rb +2 -2
  41. data/lib/yoti/util/age_processor.rb +1 -1
  42. data/lib/yoti/util/anchor_processor.rb +1 -1
  43. data/lib/yoti/util/log.rb +1 -1
  44. data/lib/yoti/version.rb +1 -1
  45. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62813310617665f67200974ba737f52d7c9bd2c1b139657b5ec672253ab3d133
4
- data.tar.gz: 474d9dff07562499e19ec35d261dadbc056dbe7818bf35620ba7247ea7169569
3
+ metadata.gz: 76c473c29aaa7900698cd353fd4efbadf1d58e2e71e02e5ab13671a0da360334
4
+ data.tar.gz: 542da906f9709554119c66fa81d0b2629ab0c783f9412c70c4fa754330cc2199
5
5
  SHA512:
6
- metadata.gz: 5c9c3ddc325973e5da3598c289428f01ccb7964ef7faed15b56faa7d9067b5f34f20a2b3336e1b357fb388898810595ccdc1bc2b2665213c44513b9ef493cf90
7
- data.tar.gz: eb86020139c4e892f289f70a5eb9dfa15b8f2daee955d67ff16a3d93e6eab57e2847eac54f57545b9430b6c6373185fdf485c6fe726831d63b24c5e982b4931c
6
+ metadata.gz: c3fa9ca3fbe4953ca94543bac7bf5edb663b751065bdb8395f963274302c6290be51c45baa2c90a5094b9b7efb15f90c2e5b8af17531ecf25dd6b64691b3079d
7
+ data.tar.gz: dd28ffbcdfa70f9d9b4ccc95163582c41a2113189376912e68f3bd622b95931465f9ef68788b7ead2f4841240144811207bd6f1ca0df64ff011cb78c2d9fe9c9
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'guard'
4
4
  gem 'guard-rspec'
5
- gem 'rubocop'
5
+ gem 'rubocop', '~> 1.1', require: false
6
6
  gem 'rubocop-performance'
7
7
 
8
8
  gemspec
@@ -61,11 +61,15 @@ require_relative 'yoti/doc_scan/session/create/requested_face_match_check'
61
61
  require_relative 'yoti/doc_scan/session/create/requested_liveness_check'
62
62
  require_relative 'yoti/doc_scan/session/create/requested_task'
63
63
  require_relative 'yoti/doc_scan/session/create/requested_text_extraction_task'
64
+ require_relative 'yoti/doc_scan/session/create/requested_supplementary_doc_text_extraction_task'
65
+ require_relative 'yoti/doc_scan/session/create/objective/objective'
66
+ require_relative 'yoti/doc_scan/session/create/objective/proof_of_address_objective'
64
67
  require_relative 'yoti/doc_scan/session/create/document_filter'
65
68
  require_relative 'yoti/doc_scan/session/create/document_restrictions_filter'
66
69
  require_relative 'yoti/doc_scan/session/create/orthogonal_restrictions_filter'
67
70
  require_relative 'yoti/doc_scan/session/create/required_document'
68
71
  require_relative 'yoti/doc_scan/session/create/required_id_document'
72
+ require_relative 'yoti/doc_scan/session/create/required_supplementary_document'
69
73
  require_relative 'yoti/doc_scan/session/create/sdk_config'
70
74
  require_relative 'yoti/doc_scan/session/create/notification_config'
71
75
  require_relative 'yoti/doc_scan/session/create/session_specification'
@@ -80,12 +84,15 @@ require_relative 'yoti/doc_scan/session/retrieve/document_fields_response'
80
84
  require_relative 'yoti/doc_scan/session/retrieve/document_id_photo_response'
81
85
  require_relative 'yoti/doc_scan/session/retrieve/face_map_response'
82
86
  require_relative 'yoti/doc_scan/session/retrieve/face_match_check_response'
87
+ require_relative 'yoti/doc_scan/session/retrieve/file_response'
83
88
  require_relative 'yoti/doc_scan/session/retrieve/frame_response'
84
89
  require_relative 'yoti/doc_scan/session/retrieve/generated_check_response'
85
90
  require_relative 'yoti/doc_scan/session/retrieve/generated_media'
86
91
  require_relative 'yoti/doc_scan/session/retrieve/generated_text_data_check_response'
92
+ require_relative 'yoti/doc_scan/session/retrieve/generated_supplementary_document_text_data_check_response'
87
93
  require_relative 'yoti/doc_scan/session/retrieve/get_session_result'
88
94
  require_relative 'yoti/doc_scan/session/retrieve/id_document_resource_response'
95
+ require_relative 'yoti/doc_scan/session/retrieve/supplementary_document_resource_response'
89
96
  require_relative 'yoti/doc_scan/session/retrieve/liveness_check_response'
90
97
  require_relative 'yoti/doc_scan/session/retrieve/liveness_resource_response'
91
98
  require_relative 'yoti/doc_scan/session/retrieve/media_response'
@@ -97,6 +104,8 @@ require_relative 'yoti/doc_scan/session/retrieve/task_response'
97
104
  require_relative 'yoti/doc_scan/session/retrieve/text_data_check_response'
98
105
  require_relative 'yoti/doc_scan/session/retrieve/text_extraction_task_response'
99
106
  require_relative 'yoti/doc_scan/session/retrieve/zoom_liveness_resource_response'
107
+ require_relative 'yoti/doc_scan/session/retrieve/supplementary_document_text_data_check_response'
108
+ require_relative 'yoti/doc_scan/session/retrieve/supplementary_document_text_extraction_task_response'
100
109
 
101
110
  require_relative 'yoti/doc_scan/support/supported_documents'
102
111
 
@@ -61,7 +61,7 @@ module Yoti
61
61
  #
62
62
  # The age under/over attribute
63
63
  #
64
- # @deprecated 2.0.0 - replaced by:
64
+ # @deprecated will be removed in 2.0.0 - replaced by:
65
65
  # - Yoti::Profile#age_verifications
66
66
  # - Yoti::Profile#find_age_over_verification
67
67
  # - Yoti::Profile#find_age_under_verification
@@ -108,9 +108,7 @@ module Yoti
108
108
  @extended_user_profile = process_decrypted_profile(decrypted_profile)
109
109
  @extended_application_profile = process_decrypted_profile(decrypted_application_profile)
110
110
  @extra_data = extra_data
111
- @user_profile = @extended_user_profile.map do |name, attribute|
112
- [name, attribute.value]
113
- end.to_h
111
+ @user_profile = @extended_user_profile.transform_values(&:value)
114
112
  end
115
113
 
116
114
  #
@@ -195,7 +193,7 @@ module Yoti
195
193
  #
196
194
  # Processes age verification
197
195
  #
198
- # @deprecated 2.0.0
196
+ # @deprecated will be removed in 2.0.0
199
197
  #
200
198
  # @param [Yoti::Protobuf::Attrpubapi::Attribute] attribute
201
199
  #
@@ -56,7 +56,7 @@ module Yoti
56
56
 
57
57
  return if valid.any?
58
58
 
59
- config_list = required_configs.map { |conf| '`' + conf + '`' }.join(', ')
59
+ config_list = required_configs.map { |conf| "`#{conf}`" }.join(', ')
60
60
  message = "At least one of the configuration values has to be set: #{config_list}."
61
61
  raise ConfigurationError, message
62
62
  end
@@ -1,7 +1,7 @@
1
1
  module Yoti
2
2
  class DocumentDetails
3
3
  #
4
- # @deprecated 2.0.0 pattern is no longer used for validation.
4
+ # @deprecated will be removed in 2.0.0 - pattern is no longer used for validation.
5
5
  #
6
6
  VALIDATION_PATTERN = '^([A-Za-z_]*) ([A-Za-z]{3}) ([A-Za-z0-9]{1}).*$'
7
7
 
@@ -3,7 +3,7 @@
3
3
  module Yoti
4
4
  class Image < Media
5
5
  def initialize(content, mime_type)
6
- raise(TypeError, "#{self.class} is an abstract class, so cannot be instantiated") if self.class == Image
6
+ raise(TypeError, "#{self.class} is an abstract class, so cannot be instantiated") if instance_of?(Image)
7
7
 
8
8
  super(content, mime_type)
9
9
  end
@@ -4,7 +4,10 @@ require 'base64'
4
4
 
5
5
  module Yoti
6
6
  class Media
7
+ # @return [String|bin]
7
8
  attr_reader :content
9
+
10
+ # @return [String]
8
11
  attr_reader :mime_type
9
12
 
10
13
  def initialize(content, mime_type)
@@ -84,7 +84,7 @@ module Yoti
84
84
  # @param [String] session_id
85
85
  # @param [String] media_id
86
86
  #
87
- # @return [Yoti::Media]
87
+ # @return [Yoti::Media|nil]
88
88
  #
89
89
  def get_media_content(session_id, media_id)
90
90
  Validation.assert_is_a(String, session_id, 'session_id')
@@ -99,9 +99,13 @@ module Yoti
99
99
  begin
100
100
  response = request.execute
101
101
 
102
+ content_type = response.get_fields('content-type')
103
+
104
+ return nil if response.code == 204 || content_type.nil?
105
+
102
106
  Yoti::Media.new(
103
107
  response.body,
104
- response.get_fields('content-type')[0]
108
+ content_type[0]
105
109
  )
106
110
  rescue Yoti::RequestError => e
107
111
  raise Yoti::DocScan::Error.wrap(e)
@@ -6,10 +6,13 @@ module Yoti
6
6
  ID_DOCUMENT_AUTHENTICITY = 'ID_DOCUMENT_AUTHENTICITY'
7
7
  ID_DOCUMENT_COMPARISON = 'ID_DOCUMENT_COMPARISON'
8
8
  ID_DOCUMENT_TEXT_DATA_CHECK = 'ID_DOCUMENT_TEXT_DATA_CHECK'
9
+ SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK = 'SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK'
9
10
  ID_DOCUMENT_FACE_MATCH = 'ID_DOCUMENT_FACE_MATCH'
10
11
  LIVENESS = 'LIVENESS'
11
12
  ID_DOCUMENT_TEXT_DATA_EXTRACTION = 'ID_DOCUMENT_TEXT_DATA_EXTRACTION'
13
+ SUPPLEMENTARY_DOCUMENT_TEXT_DATA_EXTRACTION = 'SUPPLEMENTARY_DOCUMENT_TEXT_DATA_EXTRACTION'
12
14
  ID_DOCUMENT = 'ID_DOCUMENT'
15
+ SUPPLEMENTARY_DOCUMENT = 'SUPPLEMENTARY_DOCUMENT'
13
16
  ORTHOGONAL_RESTRICTIONS = 'ORTHOGONAL_RESTRICTIONS'
14
17
  DOCUMENT_RESTRICTIONS = 'DOCUMENT_RESTRICTIONS'
15
18
  INCLUDE = 'WHITELIST'
@@ -26,6 +29,7 @@ module Yoti
26
29
  TASK_COMPLETION = 'TASK_COMPLETION'
27
30
  CHECK_COMPLETION = 'CHECK_COMPLETION'
28
31
  SESSION_COMPLETION = 'SESSION_COMPLETION'
32
+ PROOF_OF_ADDRESS = 'PROOF_OF_ADDRESS'
29
33
  end
30
34
  end
31
35
  end
@@ -9,7 +9,7 @@ module Yoti
9
9
  # @param [String] type
10
10
  #
11
11
  def initialize(type)
12
- raise(TypeError, "#{self.class} cannot be instantiated") if self.class == DocumentFilter
12
+ raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(DocumentFilter)
13
13
 
14
14
  Validation.assert_is_a(String, type, 'type')
15
15
  @type = type
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ class Objective
8
+ #
9
+ # @param [String] type
10
+ #
11
+ def initialize(type)
12
+ raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(Objective)
13
+
14
+ Validation.assert_is_a(String, type, 'type')
15
+ @type = type
16
+ end
17
+
18
+ def to_json(*_args)
19
+ as_json.to_json
20
+ end
21
+
22
+ def as_json(*_args)
23
+ {
24
+ type: @type
25
+ }
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ class ProofOfAddressObjective < Objective
8
+ def initialize
9
+ super(Constants::PROOF_OF_ADDRESS)
10
+ end
11
+
12
+ #
13
+ # @return [ProofOfAddressObjectiveBuilder]
14
+ #
15
+ def self.builder
16
+ ProofOfAddressObjectiveBuilder.new
17
+ end
18
+ end
19
+
20
+ class ProofOfAddressObjectiveBuilder
21
+ #
22
+ # @return [ProofOfAddressObjective]
23
+ #
24
+ def build
25
+ ProofOfAddressObjective.new
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -13,7 +13,7 @@ module Yoti
13
13
  # @param [#as_json] config The configuration to apply to the Check
14
14
  #
15
15
  def initialize(type, config)
16
- raise(TypeError, "#{self.class} cannot be instantiated") if self.class == RequestedCheck
16
+ raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(RequestedCheck)
17
17
 
18
18
  Validation.assert_is_a(String, type, 'type')
19
19
  @type = type
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ class RequestedSupplementaryDocTextExtractionTask < RequestedTask
8
+ #
9
+ # @param [RequestedSupplementaryDocTextExtractionTaskConfig] config
10
+ #
11
+ def initialize(config)
12
+ Validation.assert_is_a(
13
+ RequestedSupplementaryDocTextExtractionTaskConfig,
14
+ config,
15
+ 'config'
16
+ )
17
+
18
+ super(Constants::SUPPLEMENTARY_DOCUMENT_TEXT_DATA_EXTRACTION, config)
19
+ end
20
+
21
+ #
22
+ # @return [RequestedSupplementaryDocTextExtractionTaskBuilder]
23
+ #
24
+ def self.builder
25
+ RequestedSupplementaryDocTextExtractionTaskBuilder.new
26
+ end
27
+ end
28
+
29
+ #
30
+ # The configuration applied when creating each SupplementaryDocTextExtractionTask
31
+ #
32
+ class RequestedSupplementaryDocTextExtractionTaskConfig
33
+ #
34
+ # @param [String] manual_check
35
+ # Describes the manual fallback behaviour applied to each Task
36
+ #
37
+ def initialize(manual_check)
38
+ Validation.assert_is_a(String, manual_check, 'manual_check')
39
+ @manual_check = manual_check
40
+ end
41
+
42
+ def as_json(*_args)
43
+ {
44
+ manual_check: @manual_check
45
+ }.compact
46
+ end
47
+ end
48
+
49
+ #
50
+ # Builder to assist creation of {RequestedSupplementaryDocTextExtractionTask}
51
+ #
52
+ class RequestedSupplementaryDocTextExtractionTaskBuilder
53
+ #
54
+ # Requires that the Task is always followed by a manual TextDataCheck
55
+ #
56
+ # @return [self]
57
+ #
58
+ def with_manual_check_always
59
+ @manual_check = Constants::ALWAYS
60
+ self
61
+ end
62
+
63
+ #
64
+ # Requires that only failed Tasks are followed by a manual TextDataCheck
65
+ #
66
+ # @return [self]
67
+ #
68
+ def with_manual_check_fallback
69
+ @manual_check = Constants::FALLBACK
70
+ self
71
+ end
72
+
73
+ #
74
+ # The SupplementaryDocTextExtractionTask will never fallback to a manual TextDataCheck
75
+ #
76
+ # @return [self]
77
+ #
78
+ def with_manual_check_never
79
+ @manual_check = Constants::NEVER
80
+ self
81
+ end
82
+
83
+ #
84
+ # @return [RequestedSupplementaryDocTextExtractionTask]
85
+ #
86
+ def build
87
+ config = RequestedSupplementaryDocTextExtractionTaskConfig.new(@manual_check)
88
+ RequestedSupplementaryDocTextExtractionTask.new(config)
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -13,7 +13,7 @@ module Yoti
13
13
  # @param [#as_json] config Configuration to apply to the Task
14
14
  #
15
15
  def initialize(type, config)
16
- raise(TypeError, "#{self.class} cannot be instantiated") if self.class == RequestedTask
16
+ raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(RequestedTask)
17
17
 
18
18
  Validation.assert_is_a(String, type, 'type')
19
19
  @type = type
@@ -9,7 +9,7 @@ module Yoti
9
9
  # @param [String] type
10
10
  #
11
11
  def initialize(type)
12
- raise(TypeError, "#{self.class} cannot be instantiated") if self.class == RequiredDocument
12
+ raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(RequiredDocument)
13
13
 
14
14
  Validation.assert_is_a(String, type, 'type')
15
15
  @type = type
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ class RequiredSupplementaryDocument < RequiredDocument
8
+ #
9
+ # @param [Objective] objective
10
+ # @param [Array<String>] document_types
11
+ # @param [Array<String>] country_codes
12
+ #
13
+ def initialize(objective, document_types, country_codes)
14
+ super(Constants::SUPPLEMENTARY_DOCUMENT)
15
+
16
+ Validation.assert_is_a(Objective, objective, 'objective')
17
+ @objective = objective
18
+
19
+ Validation.assert_is_a(Array, document_types, 'document_types', true)
20
+ @document_types = document_types
21
+
22
+ Validation.assert_is_a(Array, country_codes, 'country_codes', true)
23
+ @country_codes = country_codes
24
+ end
25
+
26
+ def as_json(*_args)
27
+ json = super
28
+ json[:objective] = @objective.as_json
29
+ json[:document_types] = @document_types unless @document_types.nil?
30
+ json[:country_codes] = @country_codes unless @country_codes.nil?
31
+ json
32
+ end
33
+
34
+ #
35
+ # @return [RequiredSupplementaryDocumentBuilder]
36
+ #
37
+ def self.builder
38
+ RequiredSupplementaryDocumentBuilder.new
39
+ end
40
+ end
41
+
42
+ class RequiredSupplementaryDocumentBuilder
43
+ #
44
+ # @param [Objective] objective
45
+ #
46
+ # @return [self]
47
+ #
48
+ def with_objective(objective)
49
+ Validation.assert_is_a(Objective, objective, 'objective')
50
+ @objective = objective
51
+ self
52
+ end
53
+
54
+ #
55
+ # @param [Array<String>] country_codes
56
+ #
57
+ # @return [self]
58
+ #
59
+ def with_country_codes(country_codes)
60
+ Validation.assert_is_a(Array, country_codes, 'country_codes')
61
+ @country_codes = country_codes
62
+ self
63
+ end
64
+
65
+ #
66
+ # @param [Array<String>] document_types
67
+ #
68
+ # @return [self]
69
+ #
70
+ def with_document_types(document_types)
71
+ Validation.assert_is_a(Array, document_types, 'document_types')
72
+ @document_types = document_types
73
+ self
74
+ end
75
+
76
+ #
77
+ # @return [RequiredSupplementaryDocument]
78
+ #
79
+ def build
80
+ RequiredSupplementaryDocument.new(
81
+ @objective,
82
+ @document_types,
83
+ @country_codes
84
+ )
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Retrieve
7
+ class FileResponse
8
+ # @return [MediaResponse]
9
+ attr_reader :media
10
+
11
+ #
12
+ # @param [Hash] file
13
+ #
14
+ def initialize(file)
15
+ @media = MediaResponse.new(file['media']) unless file['media'].nil?
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Retrieve
7
+ class GeneratedSupplementaryDocumentTextDataCheckResponse < GeneratedCheckResponse
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -74,13 +74,29 @@ module Yoti
74
74
  @checks.select { |check| check.is_a?(FaceMatchCheckResponse) }
75
75
  end
76
76
 
77
+ #
78
+ # @deprecated replaced by id_document_text_data_checks
77
79
  #
78
80
  # @return [Array<TextDataCheckResponse>]
79
81
  #
80
82
  def text_data_checks
83
+ id_document_text_data_checks
84
+ end
85
+
86
+ #
87
+ # @return [Array<TextDataCheckResponse>]
88
+ #
89
+ def id_document_text_data_checks
81
90
  @checks.select { |check| check.is_a?(TextDataCheckResponse) }
82
91
  end
83
92
 
93
+ #
94
+ # @return [Array<SupplementaryDocumentTextDataCheckResponse>]
95
+ #
96
+ def supplementary_document_text_data_checks
97
+ @checks.select { |check| check.is_a?(SupplementaryDocumentTextDataCheckResponse) }
98
+ end
99
+
84
100
  #
85
101
  # @return [Array<LivenessCheckResponse>]
86
102
  #
@@ -115,6 +131,8 @@ module Yoti
115
131
  TextDataCheckResponse.new(check)
116
132
  when Constants::LIVENESS
117
133
  LivenessCheckResponse.new(check)
134
+ when Constants::SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK
135
+ SupplementaryDocumentTextDataCheckResponse.new(check)
118
136
  else
119
137
  CheckResponse.new(check)
120
138
  end
@@ -11,6 +11,9 @@ module Yoti
11
11
  # @return [MediaResponse]
12
12
  attr_reader :media
13
13
 
14
+ # @return [Array<FrameResponse>]
15
+ attr_reader :frames
16
+
14
17
  #
15
18
  # @param [Hash] page
16
19
  #
@@ -19,6 +22,13 @@ module Yoti
19
22
  @capture_method = page['capture_method']
20
23
 
21
24
  @media = MediaResponse.new(page['media']) unless page['media'].nil?
25
+
26
+ if page['frames'].nil?
27
+ @frames = []
28
+ else
29
+ Validation.assert_is_a(Array, page['frames'], 'frames')
30
+ @frames = page['frames'].map { |frame| FrameResponse.new(frame) }
31
+ end
22
32
  end
23
33
  end
24
34
  end
@@ -8,6 +8,9 @@ module Yoti
8
8
  # @return [Array<IdDocumentResourceResponse>]
9
9
  attr_reader :id_documents
10
10
 
11
+ # @return [Array<SupplementaryDocumentResourceResponse>]
12
+ attr_reader :supplementary_documents
13
+
11
14
  # @return [Array<LivenessResourceResponse>]
12
15
  attr_reader :liveness_capture
13
16
 
@@ -15,12 +18,8 @@ module Yoti
15
18
  # @param [Hash] resources
16
19
  #
17
20
  def initialize(resources)
18
- if resources['id_documents'].nil?
19
- @id_documents = []
20
- else
21
- Validation.assert_is_a(Array, resources['id_documents'], 'id_documents')
22
- @id_documents = resources['id_documents'].map { |resource| IdDocumentResourceResponse.new(resource) }
23
- end
21
+ @id_documents = parse_id_documents(resources)
22
+ @supplementary_documents = parse_supplementary_documents(resources)
24
23
 
25
24
  if resources['liveness_capture'].nil?
26
25
  @liveness_capture = []
@@ -43,6 +42,26 @@ module Yoti
43
42
  def zoom_liveness_resources
44
43
  @liveness_capture.select { |resource| resource.is_a?(ZoomLivenessResourceResponse) }
45
44
  end
45
+
46
+ private
47
+
48
+ def parse_id_documents(resources)
49
+ return [] if resources['id_documents'].nil?
50
+
51
+ Validation.assert_is_a(Array, resources['id_documents'], 'id_documents')
52
+ resources['id_documents'].map do |resource|
53
+ IdDocumentResourceResponse.new(resource)
54
+ end
55
+ end
56
+
57
+ def parse_supplementary_documents(resources)
58
+ return [] if resources['supplementary_documents'].nil?
59
+
60
+ Validation.assert_is_a(Array, resources['supplementary_documents'], 'supplementary_documents')
61
+ resources['supplementary_documents'].map do |resource|
62
+ SupplementaryDocumentResourceResponse.new(resource)
63
+ end
64
+ end
46
65
  end
47
66
  end
48
67
  end
@@ -26,6 +26,8 @@ module Yoti
26
26
  case task['type']
27
27
  when Constants::ID_DOCUMENT_TEXT_DATA_EXTRACTION
28
28
  TextExtractionTaskResponse.new(task)
29
+ when Constants::SUPPLEMENTARY_DOCUMENT_TEXT_DATA_EXTRACTION
30
+ SupplementaryDocumentTextExtractionTaskResponse.new(task)
29
31
  else
30
32
  TaskResponse.new(task)
31
33
  end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Retrieve
7
+ class SupplementaryDocumentResourceResponse < ResourceResponse
8
+ # @return [String]
9
+ attr_reader :document_type
10
+
11
+ # @return [String]
12
+ attr_reader :issuing_country
13
+
14
+ # @return [Array<PageResponse>]
15
+ attr_reader :pages
16
+
17
+ # @return [DocumentFieldsResponse]
18
+ attr_reader :document_fields
19
+
20
+ # @return [FileResponse]
21
+ attr_reader :document_file
22
+
23
+ #
24
+ # @param [Hash] resource
25
+ #
26
+ def initialize(resource)
27
+ super(resource)
28
+
29
+ Validation.assert_is_a(String, resource['document_type'], 'document_type', true)
30
+ @document_type = resource['document_type']
31
+
32
+ Validation.assert_is_a(String, resource['issuing_country'], 'issuing_country', true)
33
+ @issuing_country = resource['issuing_country']
34
+
35
+ if resource['pages'].nil?
36
+ @pages = []
37
+ else
38
+ Validation.assert_is_a(Array, resource['pages'], 'pages')
39
+ @pages = resource['pages'].map { |page| PageResponse.new(page) }
40
+ end
41
+
42
+ @document_fields = DocumentFieldsResponse.new(resource['document_fields']) unless resource['document_fields'].nil?
43
+
44
+ @document_file = FileResponse.new(resource['file']) unless resource['file'].nil?
45
+ end
46
+
47
+ #
48
+ # @return [Array<SupplementaryDocumentTextExtractionTaskResponse>]
49
+ #
50
+ def text_extraction_tasks
51
+ @tasks.select { |task| task.is_a?(SupplementaryDocumentTextExtractionTaskResponse) }
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Retrieve
7
+ class SupplementaryDocumentTextDataCheckResponse < CheckResponse
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Retrieve
7
+ class SupplementaryDocumentTextExtractionTaskResponse < TaskResponse
8
+ #
9
+ # @return [Array<GeneratedSupplementaryDocumentTextDataCheckResponse>]
10
+ #
11
+ def generated_text_data_checks
12
+ @generated_checks.select { |check| check.is_a?(GeneratedSupplementaryDocumentTextDataCheckResponse) }
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -75,6 +75,8 @@ module Yoti
75
75
  case check['type']
76
76
  when Constants::ID_DOCUMENT_TEXT_DATA_CHECK
77
77
  GeneratedTextDataCheckResponse.new(check)
78
+ when Constants::SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK
79
+ GeneratedSupplementaryDocumentTextDataCheckResponse.new(check)
78
80
  else
79
81
  GeneratedCheckResponse.new(check)
80
82
  end
@@ -4,8 +4,13 @@ module Yoti
4
4
  module DynamicSharingService
5
5
  # Describes a dynamic share
6
6
  class DynamicScenario
7
+ # @return [Yoti::DynamicSharingService::DynamicPolicy]
7
8
  attr_reader :policy
9
+
10
+ # @return [Array<Yoti::DynamicSharingService::Extension>]
8
11
  attr_reader :extensions
12
+
13
+ # @return [String]
9
14
  attr_reader :callback_endpoint
10
15
 
11
16
  def initialize
@@ -3,7 +3,10 @@
3
3
  module Yoti
4
4
  module DynamicSharingService
5
5
  class Extension
6
+ # @return [String]
6
7
  attr_reader :type
8
+
9
+ # @return [#to_json]
7
10
  attr_reader :content
8
11
 
9
12
  def to_json(*_args)
@@ -6,7 +6,10 @@ module Yoti
6
6
  class LocationConstraintExtension
7
7
  EXTENSION_TYPE = 'LOCATION_CONSTRAINT'
8
8
 
9
+ # @return [#to_json]
9
10
  attr_reader :content
11
+
12
+ # @return [String]
10
13
  attr_reader :type
11
14
 
12
15
  def initialize
@@ -5,7 +5,11 @@ module Yoti
5
5
  # Extension for transactional flows
6
6
  class TransactionalFlowExtension
7
7
  EXTENSION_TYPE = 'TRANSACTIONAL_FLOW'
8
+
9
+ # @return [#to_json]
8
10
  attr_reader :content
11
+
12
+ # @return [String]
9
13
  attr_reader :type
10
14
 
11
15
  def initialize
@@ -7,7 +7,10 @@ module Yoti
7
7
  SELFIE_AUTH_TYPE = 1
8
8
  PIN_AUTH_TYPE = 2
9
9
 
10
+ # @return [Array<Integer>]
10
11
  attr_reader :wanted_auth_types
12
+
13
+ # @return [Array<Yoti::DynamicSharingService::WantedAttribute>]
11
14
  attr_reader :wanted
12
15
 
13
16
  def wanted_remember_me
@@ -4,7 +4,10 @@ module Yoti
4
4
  module DynamicSharingService
5
5
  # A wanted anchor for a source based constraint
6
6
  class WantedAnchor
7
+ # @return [String]
7
8
  attr_reader :value
9
+
10
+ # @return [String]
8
11
  attr_reader :sub_type
9
12
 
10
13
  def initialize
@@ -4,8 +4,13 @@ module Yoti
4
4
  module DynamicSharingService
5
5
  # Describes a wanted attribute in a dynamic sharing policy
6
6
  class WantedAttribute
7
+ # @return [String]
7
8
  attr_reader :name
9
+
10
+ # @return [String]
8
11
  attr_reader :derivation
12
+
13
+ # @return [Array<#as_json>]
9
14
  attr_reader :constraints
10
15
 
11
16
  def initialize
@@ -186,7 +186,7 @@ module Yoti
186
186
  end
187
187
 
188
188
  params.map do |k, v|
189
- CGI.escape(k.to_s) + '=' + CGI.escape(v.to_s)
189
+ "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"
190
190
  end.join('&')
191
191
  end
192
192
  end
@@ -40,7 +40,7 @@ module Yoti
40
40
 
41
41
  payload_string = @payload.is_a?(String) ? @payload : @payload.to_json
42
42
 
43
- '&' + Base64.strict_encode64(payload_string)
43
+ "&#{Base64.strict_encode64(payload_string)}"
44
44
  end
45
45
  end
46
46
  end
@@ -3,12 +3,12 @@ $LOAD_PATH.unshift File.expand_path('./attrpubapi/', __dir__)
3
3
  require 'google/protobuf'
4
4
  require 'json'
5
5
 
6
- require_relative 'attrpubapi/List_pb.rb'
7
- require_relative 'compubapi/EncryptedData_pb.rb'
8
- require_relative 'compubapi/SignedTimestamp_pb.rb'
9
- require_relative 'sharepubapi/ExtraData_pb.rb'
10
- require_relative 'sharepubapi/IssuingAttributes_pb.rb'
11
- require_relative 'sharepubapi/ThirdPartyAttribute_pb.rb'
6
+ require_relative 'attrpubapi/List_pb'
7
+ require_relative 'compubapi/EncryptedData_pb'
8
+ require_relative 'compubapi/SignedTimestamp_pb'
9
+ require_relative 'sharepubapi/ExtraData_pb'
10
+ require_relative 'sharepubapi/IssuingAttributes_pb'
11
+ require_relative 'sharepubapi/ThirdPartyAttribute_pb'
12
12
 
13
13
  module Yoti
14
14
  module Protobuf
@@ -91,9 +91,9 @@ module Yoti
91
91
  private
92
92
 
93
93
  def convert_multi_value(value)
94
- proto_multi_value = Yoti::Protobuf::Attrpubapi::MultiValue.decode(value)
94
+ proto_multi_values = Yoti::Protobuf::Attrpubapi::MultiValue.decode(value).values
95
95
  items = []
96
- proto_multi_value.values.each do |item|
96
+ proto_multi_values.each do |item|
97
97
  items << value_based_on_content_type(item.data, item.content_type)
98
98
  end
99
99
  MultiValue.new(items)
@@ -5,6 +5,7 @@ require 'base64'
5
5
  module Yoti
6
6
  module Share
7
7
  class Definition
8
+ # @return [String]
8
9
  attr_reader :name
9
10
 
10
11
  #
@@ -18,8 +19,13 @@ module Yoti
18
19
  end
19
20
 
20
21
  class AttributeIssuanceDetails
22
+ # @return [String]
21
23
  attr_reader :token
24
+
25
+ # @return [Array<Yoti::Share::Definition>]
22
26
  attr_reader :attributes
27
+
28
+ # @return [DateTime|nil]
23
29
  attr_reader :expiry_date
24
30
 
25
31
  #
@@ -42,7 +42,7 @@ module Yoti
42
42
  # @param message [String] message to be signed
43
43
  # @return [String] signed message encoded in base 64
44
44
  def get_secure_signature(message)
45
- digest = OpenSSL::Digest::SHA256.new
45
+ digest = OpenSSL::Digest.new('SHA256')
46
46
  Base64.strict_encode64(private_key.sign(digest, message))
47
47
  end
48
48
 
@@ -60,7 +60,7 @@ module Yoti
60
60
  end
61
61
 
62
62
  # Reset and reload the Private Key used for SSL functions
63
- # @deprecated 2.0.0
63
+ # @deprecated will be removed in 2.0.0
64
64
  def reload!
65
65
  @private_key = nil
66
66
  @pem = nil
@@ -2,7 +2,7 @@ module Yoti
2
2
  #
3
3
  # Process age attribute
4
4
  #
5
- # @deprecated 2.0.0 - replaced by Yoti::AgeVerification
5
+ # @deprecated will be removed in 2.0.0 - replaced by Yoti::AgeVerification
6
6
  #
7
7
  class AgeProcessor
8
8
  AGE_PATTERN = 'age_(over|under):[1-9][0-9]?[0-9]?'
@@ -20,7 +20,7 @@ module Yoti
20
20
  # @return [Array<Yoti::Anchor>]
21
21
  #
22
22
  def process
23
- result_data = ANCHOR_LIST_KEYS.map { |key, _value| [key, []] }.to_h
23
+ result_data = ANCHOR_LIST_KEYS.transform_values { |_value| [] }
24
24
 
25
25
  @anchors_list.each do |anchor|
26
26
  x509_certs_list = convert_certs_list_to_X509(anchor.origin_server_certs)
@@ -4,7 +4,7 @@ module Yoti
4
4
  module Log
5
5
  class << self
6
6
  def logger
7
- @logger || create_logger(STDOUT)
7
+ @logger || create_logger($stdout)
8
8
  end
9
9
 
10
10
  def output(output_stream)
@@ -1,4 +1,4 @@
1
1
  module Yoti
2
2
  # @return [String] the gem's current version
3
- VERSION = '1.9.0'.freeze
3
+ VERSION = '1.10.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yoti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-21 00:00:00.000000000 Z
11
+ date: 2020-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -189,16 +189,20 @@ files:
189
189
  - lib/yoti/doc_scan/session/create/document_filter.rb
190
190
  - lib/yoti/doc_scan/session/create/document_restrictions_filter.rb
191
191
  - lib/yoti/doc_scan/session/create/notification_config.rb
192
+ - lib/yoti/doc_scan/session/create/objective/objective.rb
193
+ - lib/yoti/doc_scan/session/create/objective/proof_of_address_objective.rb
192
194
  - lib/yoti/doc_scan/session/create/orthogonal_restrictions_filter.rb
193
195
  - lib/yoti/doc_scan/session/create/requested_check.rb
194
196
  - lib/yoti/doc_scan/session/create/requested_document_authenticity_check.rb
195
197
  - lib/yoti/doc_scan/session/create/requested_face_match_check.rb
196
198
  - lib/yoti/doc_scan/session/create/requested_id_document_comparison_check.rb
197
199
  - lib/yoti/doc_scan/session/create/requested_liveness_check.rb
200
+ - lib/yoti/doc_scan/session/create/requested_supplementary_doc_text_extraction_task.rb
198
201
  - lib/yoti/doc_scan/session/create/requested_task.rb
199
202
  - lib/yoti/doc_scan/session/create/requested_text_extraction_task.rb
200
203
  - lib/yoti/doc_scan/session/create/required_document.rb
201
204
  - lib/yoti/doc_scan/session/create/required_id_document.rb
205
+ - lib/yoti/doc_scan/session/create/required_supplementary_document.rb
202
206
  - lib/yoti/doc_scan/session/create/sdk_config.rb
203
207
  - lib/yoti/doc_scan/session/create/session_specification.rb
204
208
  - lib/yoti/doc_scan/session/retrieve/authenticity_check_response.rb
@@ -209,9 +213,11 @@ files:
209
213
  - lib/yoti/doc_scan/session/retrieve/document_id_photo_response.rb
210
214
  - lib/yoti/doc_scan/session/retrieve/face_map_response.rb
211
215
  - lib/yoti/doc_scan/session/retrieve/face_match_check_response.rb
216
+ - lib/yoti/doc_scan/session/retrieve/file_response.rb
212
217
  - lib/yoti/doc_scan/session/retrieve/frame_response.rb
213
218
  - lib/yoti/doc_scan/session/retrieve/generated_check_response.rb
214
219
  - lib/yoti/doc_scan/session/retrieve/generated_media.rb
220
+ - lib/yoti/doc_scan/session/retrieve/generated_supplementary_document_text_data_check_response.rb
215
221
  - lib/yoti/doc_scan/session/retrieve/generated_text_data_check_response.rb
216
222
  - lib/yoti/doc_scan/session/retrieve/get_session_result.rb
217
223
  - lib/yoti/doc_scan/session/retrieve/id_document_comparison_check_response.rb
@@ -224,6 +230,9 @@ files:
224
230
  - lib/yoti/doc_scan/session/retrieve/report_response.rb
225
231
  - lib/yoti/doc_scan/session/retrieve/resource_container.rb
226
232
  - lib/yoti/doc_scan/session/retrieve/resource_response.rb
233
+ - lib/yoti/doc_scan/session/retrieve/supplementary_document_resource_response.rb
234
+ - lib/yoti/doc_scan/session/retrieve/supplementary_document_text_data_check_response.rb
235
+ - lib/yoti/doc_scan/session/retrieve/supplementary_document_text_extraction_task_response.rb
227
236
  - lib/yoti/doc_scan/session/retrieve/task_response.rb
228
237
  - lib/yoti/doc_scan/session/retrieve/text_data_check_response.rb
229
238
  - lib/yoti/doc_scan/session/retrieve/text_extraction_task_response.rb