yoti 1.6.2 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -224
  3. data/lib/yoti.rb +52 -1
  4. data/lib/yoti/activity_details.rb +1 -0
  5. data/lib/yoti/client.rb +13 -4
  6. data/lib/yoti/configuration.rb +7 -2
  7. data/lib/yoti/data_type/age_verification.rb +1 -1
  8. data/lib/yoti/data_type/base_profile.rb +1 -1
  9. data/lib/yoti/data_type/image.rb +4 -12
  10. data/lib/yoti/data_type/image_jpeg.rb +2 -0
  11. data/lib/yoti/data_type/image_png.rb +2 -0
  12. data/lib/yoti/data_type/media.rb +19 -0
  13. data/lib/yoti/data_type/signed_time_stamp.rb +1 -1
  14. data/lib/yoti/doc_scan/client.rb +187 -0
  15. data/lib/yoti/doc_scan/constants.rb +30 -0
  16. data/lib/yoti/doc_scan/errors.rb +81 -0
  17. data/lib/yoti/doc_scan/session/create/create_session_result.rb +50 -0
  18. data/lib/yoti/doc_scan/session/create/document_filter.rb +31 -0
  19. data/lib/yoti/doc_scan/session/create/document_restrictions_filter.rb +140 -0
  20. data/lib/yoti/doc_scan/session/create/notification_config.rb +142 -0
  21. data/lib/yoti/doc_scan/session/create/orthogonal_restrictions_filter.rb +150 -0
  22. data/lib/yoti/doc_scan/session/create/requested_check.rb +39 -0
  23. data/lib/yoti/doc_scan/session/create/requested_document_authenticity_check.rb +53 -0
  24. data/lib/yoti/doc_scan/session/create/requested_face_match_check.rb +95 -0
  25. data/lib/yoti/doc_scan/session/create/requested_liveness_check.rb +108 -0
  26. data/lib/yoti/doc_scan/session/create/requested_task.rb +39 -0
  27. data/lib/yoti/doc_scan/session/create/requested_text_extraction_task.rb +116 -0
  28. data/lib/yoti/doc_scan/session/create/required_document.rb +31 -0
  29. data/lib/yoti/doc_scan/session/create/required_id_document.rb +53 -0
  30. data/lib/yoti/doc_scan/session/create/sdk_config.rb +221 -0
  31. data/lib/yoti/doc_scan/session/create/session_specification.rb +203 -0
  32. data/lib/yoti/doc_scan/session/retrieve/authenticity_check_response.rb +12 -0
  33. data/lib/yoti/doc_scan/session/retrieve/breakdown_response.rb +38 -0
  34. data/lib/yoti/doc_scan/session/retrieve/check_response.rb +63 -0
  35. data/lib/yoti/doc_scan/session/retrieve/details_response.rb +28 -0
  36. data/lib/yoti/doc_scan/session/retrieve/document_fields_response.rb +21 -0
  37. data/lib/yoti/doc_scan/session/retrieve/document_id_photo_response.rb +21 -0
  38. data/lib/yoti/doc_scan/session/retrieve/face_map_response.rb +21 -0
  39. data/lib/yoti/doc_scan/session/retrieve/face_match_check_response.rb +12 -0
  40. data/lib/yoti/doc_scan/session/retrieve/frame_response.rb +21 -0
  41. data/lib/yoti/doc_scan/session/retrieve/generated_check_response.rb +28 -0
  42. data/lib/yoti/doc_scan/session/retrieve/generated_media.rb +28 -0
  43. data/lib/yoti/doc_scan/session/retrieve/generated_text_data_check_response.rb +12 -0
  44. data/lib/yoti/doc_scan/session/retrieve/get_session_result.rb +113 -0
  45. data/lib/yoti/doc_scan/session/retrieve/id_document_resource_response.rb +57 -0
  46. data/lib/yoti/doc_scan/session/retrieve/liveness_check_response.rb +12 -0
  47. data/lib/yoti/doc_scan/session/retrieve/liveness_resource_response.rb +24 -0
  48. data/lib/yoti/doc_scan/session/retrieve/media_response.rb +38 -0
  49. data/lib/yoti/doc_scan/session/retrieve/page_response.rb +27 -0
  50. data/lib/yoti/doc_scan/session/retrieve/recommendation_response.rb +34 -0
  51. data/lib/yoti/doc_scan/session/retrieve/report_response.rb +31 -0
  52. data/lib/yoti/doc_scan/session/retrieve/resource_container.rb +50 -0
  53. data/lib/yoti/doc_scan/session/retrieve/resource_response.rb +39 -0
  54. data/lib/yoti/doc_scan/session/retrieve/task_response.rb +87 -0
  55. data/lib/yoti/doc_scan/session/retrieve/text_data_check_response.rb +12 -0
  56. data/lib/yoti/doc_scan/session/retrieve/text_extraction_task_response.rb +18 -0
  57. data/lib/yoti/doc_scan/session/retrieve/zoom_liveness_resource_response.rb +33 -0
  58. data/lib/yoti/doc_scan/support/supported_documents.rb +60 -0
  59. data/lib/yoti/dynamic_share_service/extension/thirdparty_attribute_extension.rb +62 -11
  60. data/lib/yoti/dynamic_share_service/policy/dynamic_policy.rb +84 -22
  61. data/lib/yoti/dynamic_share_service/share_url.rb +28 -33
  62. data/lib/yoti/errors.rb +15 -2
  63. data/lib/yoti/http/aml_check_request.rb +12 -6
  64. data/lib/yoti/http/payloads/aml_address.rb +4 -0
  65. data/lib/yoti/http/payloads/aml_profile.rb +7 -1
  66. data/lib/yoti/http/profile_request.rb +11 -6
  67. data/lib/yoti/http/request.rb +221 -18
  68. data/lib/yoti/http/signed_request.rb +13 -4
  69. data/lib/yoti/protobuf/main.rb +1 -1
  70. data/lib/yoti/ssl.rb +2 -2
  71. data/lib/yoti/util/anchor_processor.rb +1 -1
  72. data/lib/yoti/util/validation.rb +41 -0
  73. data/lib/yoti/version.rb +1 -1
  74. data/yoti.gemspec +18 -9
  75. metadata +55 -68
  76. data/.gitignore +0 -39
  77. data/CONTRIBUTING.md +0 -127
  78. data/Guardfile +0 -11
  79. data/Rakefile +0 -49
  80. data/lib/yoti/sandbox.rb +0 -4
  81. data/lib/yoti/sandbox/anchor.rb +0 -49
  82. data/lib/yoti/sandbox/attribute.rb +0 -52
  83. data/lib/yoti/sandbox/profile.rb +0 -171
  84. data/lib/yoti/sandbox/sandbox_client.rb +0 -40
  85. data/login_flow.png +0 -0
  86. data/rubocop.yml +0 -57
  87. data/yardstick.yml +0 -9
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ #
8
+ # Requests creation of a Document Authenticity Check
9
+ #
10
+ class RequestedDocumentAuthenticityCheck < RequestedCheck
11
+ def initialize(config)
12
+ Validation.assert_is_a(
13
+ RequestedDocumentAuthenticityCheckConfig,
14
+ config,
15
+ 'config'
16
+ )
17
+
18
+ super(Constants::ID_DOCUMENT_AUTHENTICITY, config)
19
+ end
20
+
21
+ #
22
+ # @return [RequestedDocumentAuthenticityCheckBuilder]
23
+ #
24
+ def self.builder
25
+ RequestedDocumentAuthenticityCheckBuilder.new
26
+ end
27
+ end
28
+
29
+ #
30
+ # The configuration applied when creating a {RequestedDocumentAuthenticityCheck}
31
+ #
32
+ class RequestedDocumentAuthenticityCheckConfig
33
+ def as_json(*_args)
34
+ {}
35
+ end
36
+ end
37
+
38
+ #
39
+ # Builder to assist the creation of {RequestedDocumentAuthenticityCheck}
40
+ #
41
+ class RequestedDocumentAuthenticityCheckBuilder
42
+ #
43
+ # @return [RequestedDocumentAuthenticityCheck]
44
+ #
45
+ def build
46
+ config = RequestedDocumentAuthenticityCheckConfig.new
47
+ RequestedDocumentAuthenticityCheck.new(config)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ #
8
+ # Requests creation of a Face Match Check
9
+ #
10
+ class RequestedFaceMatchCheck < RequestedCheck
11
+ #
12
+ # @param [RequestedFaceMatchCheckConfig] config
13
+ #
14
+ def initialize(config)
15
+ Validation.assert_is_a(
16
+ RequestedFaceMatchCheckConfig,
17
+ config,
18
+ 'config'
19
+ )
20
+
21
+ super(Constants::ID_DOCUMENT_FACE_MATCH, config)
22
+ end
23
+
24
+ #
25
+ # @return [RequestedFaceMatchCheckBuilder]
26
+ #
27
+ def self.builder
28
+ RequestedFaceMatchCheckBuilder.new
29
+ end
30
+ end
31
+
32
+ #
33
+ # The configuration applied when creating a {RequestedFaceMatchCheck}
34
+ #
35
+ class RequestedFaceMatchCheckConfig
36
+ #
37
+ # @param [String] manual_check
38
+ #
39
+ def initialize(manual_check)
40
+ Validation.assert_is_a(String, manual_check, 'manual_check')
41
+ @manual_check = manual_check
42
+ end
43
+
44
+ def as_json(*_args)
45
+ {
46
+ manual_check: @manual_check
47
+ }
48
+ end
49
+ end
50
+
51
+ #
52
+ # Builder to assist the creation of {RequestedFaceMatchCheck}
53
+ #
54
+ class RequestedFaceMatchCheckBuilder
55
+ #
56
+ # Requires that a manual follow-up check is always performed
57
+ #
58
+ # @return [self]
59
+ #
60
+ def with_manual_check_always
61
+ @manual_check = Constants::ALWAYS
62
+ self
63
+ end
64
+
65
+ #
66
+ # Requires that a manual follow-up check is performed only on failed Checks,
67
+ # and those with a low level of confidence
68
+ #
69
+ # @return [self]
70
+ #
71
+ def with_manual_check_fallback
72
+ @manual_check = Constants::FALLBACK
73
+ self
74
+ end
75
+
76
+ #
77
+ # Requires that only an automated Check is performed. No manual follow-up
78
+ # Check will ever be initiated
79
+ #
80
+ # @return [self]
81
+ #
82
+ def with_manual_check_never
83
+ @manual_check = Constants::NEVER
84
+ self
85
+ end
86
+
87
+ def build
88
+ config = RequestedFaceMatchCheckConfig.new(@manual_check)
89
+ RequestedFaceMatchCheck.new(config)
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ #
8
+ # Requests creation of a Liveness Check
9
+ #
10
+ class RequestedLivenessCheck < RequestedCheck
11
+ #
12
+ # @param [RequestedLivenessCheckConfig] config
13
+ #
14
+ def initialize(config)
15
+ Validation.assert_is_a(
16
+ RequestedLivenessCheckConfig,
17
+ config,
18
+ 'config'
19
+ )
20
+
21
+ super(Constants::LIVENESS, config)
22
+ end
23
+
24
+ #
25
+ # @return [RequestedLivenessCheckBuilder]
26
+ #
27
+ def self.builder
28
+ RequestedLivenessCheckBuilder.new
29
+ end
30
+ end
31
+
32
+ #
33
+ # The configuration applied when creating a {RequestedLivenessCheck}
34
+ #
35
+ class RequestedLivenessCheckConfig
36
+ #
37
+ # @param [String] liveness_type
38
+ # @param [String] max_retries
39
+ #
40
+ def initialize(liveness_type, max_retries)
41
+ Validation.assert_is_a(String, liveness_type, 'liveness_type')
42
+ @liveness_type = liveness_type
43
+
44
+ Validation.assert_is_a(Integer, max_retries, 'max_retries')
45
+ @max_retries = max_retries
46
+ end
47
+
48
+ def as_json(*_args)
49
+ {
50
+ liveness_type: @liveness_type,
51
+ max_retries: @max_retries
52
+ }
53
+ end
54
+ end
55
+
56
+ #
57
+ # Builder to assist the creation of {RequestedLivenessCheck}
58
+ #
59
+ class RequestedLivenessCheckBuilder
60
+ def initialize
61
+ @max_retries = 1
62
+ end
63
+
64
+ #
65
+ # Sets the type of the liveness check to the supplied value
66
+ #
67
+ # @param [String] liveness_type
68
+ #
69
+ # @return [self]
70
+ #
71
+ def for_liveness_type(liveness_type)
72
+ @liveness_type = liveness_type
73
+ self
74
+ end
75
+
76
+ #
77
+ # Sets the type to be of a ZOOM liveness check
78
+ #
79
+ # @return [self]
80
+ #
81
+ def for_zoom_liveness
82
+ for_liveness_type(Constants::ZOOM)
83
+ end
84
+
85
+ #
86
+ # Sets the maximum number of retries allowed by the user
87
+ #
88
+ # @param [Integer] max_retries
89
+ #
90
+ # @return [self]
91
+ #
92
+ def with_max_retries(max_retries)
93
+ @max_retries = max_retries
94
+ self
95
+ end
96
+
97
+ #
98
+ # @return [RequestedLivenessCheck]
99
+ #
100
+ def build
101
+ config = RequestedLivenessCheckConfig.new(@liveness_type, @max_retries)
102
+ RequestedLivenessCheck.new(config)
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ #
8
+ # Requests creation of a Task to be performed on each document
9
+ #
10
+ class RequestedTask
11
+ #
12
+ # @param [String] type The type of the Task to create
13
+ # @param [#as_json] config Configuration to apply to the Task
14
+ #
15
+ def initialize(type, config)
16
+ raise(TypeError, "#{self.class} cannot be instantiated") if self.class == RequestedTask
17
+
18
+ Validation.assert_is_a(String, type, 'type')
19
+ @type = type
20
+
21
+ Validation.assert_respond_to(:as_json, config, 'config')
22
+ @config = config
23
+ end
24
+
25
+ def to_json(*_args)
26
+ as_json.to_json
27
+ end
28
+
29
+ def as_json(*_args)
30
+ {
31
+ type: @type,
32
+ config: @config.as_json
33
+ }
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,116 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ class RequestedTextExtractionTask < RequestedTask
8
+ #
9
+ # @param [RequestedTextExtractionTaskConfig] config
10
+ #
11
+ def initialize(config)
12
+ Validation.assert_is_a(
13
+ RequestedTextExtractionTaskConfig,
14
+ config,
15
+ 'config'
16
+ )
17
+
18
+ super(Constants::ID_DOCUMENT_TEXT_DATA_EXTRACTION, config)
19
+ end
20
+
21
+ #
22
+ # @return [RequestedTextExtractionTaskBuilder]
23
+ #
24
+ def self.builder
25
+ RequestedTextExtractionTaskBuilder.new
26
+ end
27
+ end
28
+
29
+ #
30
+ # The configuration applied when creating each TextExtractionTask
31
+ #
32
+ class RequestedTextExtractionTaskConfig
33
+ #
34
+ # @param [String] manual_check
35
+ # Describes the manual fallback behaviour applied to each Task
36
+ # @param [String, nil] chip_data
37
+ # Describes the chip data requirement for each Task
38
+ #
39
+ def initialize(manual_check, chip_data)
40
+ Validation.assert_is_a(String, manual_check, 'manual_check')
41
+ @manual_check = manual_check
42
+
43
+ Validation.assert_is_a(String, chip_data, 'chip_data', true)
44
+ @chip_data = chip_data
45
+ end
46
+
47
+ def as_json(*_args)
48
+ {
49
+ manual_check: @manual_check,
50
+ chip_data: @chip_data
51
+ }.compact
52
+ end
53
+ end
54
+
55
+ #
56
+ # Builder to assist creation of {RequestedTextExtractionTask}
57
+ #
58
+ class RequestedTextExtractionTaskBuilder
59
+ #
60
+ # Requires that the Task is always followed by a manual TextDataCheck
61
+ #
62
+ # @return [self]
63
+ #
64
+ def with_manual_check_always
65
+ @manual_check = Constants::ALWAYS
66
+ self
67
+ end
68
+
69
+ #
70
+ # Requires that only failed Tasks are followed by a manual TextDataCheck
71
+ #
72
+ # @return [self]
73
+ #
74
+ def with_manual_check_fallback
75
+ @manual_check = Constants::FALLBACK
76
+ self
77
+ end
78
+
79
+ #
80
+ # The TextExtractionTask will never fallback to a manual TextDataCheck
81
+ #
82
+ # @return [self]
83
+ #
84
+ def with_manual_check_never
85
+ @manual_check = Constants::NEVER
86
+ self
87
+ end
88
+
89
+ #
90
+ # @return [self]
91
+ #
92
+ def with_chip_data_desired
93
+ @chip_data = Constants::DESIRED
94
+ self
95
+ end
96
+
97
+ #
98
+ # @return [self]
99
+ #
100
+ def with_chip_data_ignore
101
+ @chip_data = Constants::IGNORE
102
+ self
103
+ end
104
+
105
+ #
106
+ # @return [RequestedTextExtractionTask]
107
+ #
108
+ def build
109
+ config = RequestedTextExtractionTaskConfig.new(@manual_check, @chip_data)
110
+ RequestedTextExtractionTask.new(config)
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
116
+ 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 RequiredDocument
8
+ #
9
+ # @param [String] type
10
+ #
11
+ def initialize(type)
12
+ raise(TypeError, "#{self.class} cannot be instantiated") if self.class == RequiredDocument
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