yoti 1.6.4 → 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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +22 -224
- data/lib/yoti.rb +63 -1
- data/lib/yoti/activity_details.rb +3 -5
- data/lib/yoti/client.rb +13 -4
- data/lib/yoti/configuration.rb +8 -3
- data/lib/yoti/data_type/age_verification.rb +1 -1
- data/lib/yoti/data_type/base_profile.rb +1 -1
- data/lib/yoti/data_type/document_details.rb +1 -1
- data/lib/yoti/data_type/image.rb +4 -12
- data/lib/yoti/data_type/image_jpeg.rb +2 -0
- data/lib/yoti/data_type/image_png.rb +2 -0
- data/lib/yoti/data_type/media.rb +22 -0
- data/lib/yoti/data_type/signed_time_stamp.rb +1 -1
- data/lib/yoti/doc_scan/client.rb +191 -0
- data/lib/yoti/doc_scan/constants.rb +35 -0
- data/lib/yoti/doc_scan/errors.rb +81 -0
- data/lib/yoti/doc_scan/session/create/create_session_result.rb +50 -0
- data/lib/yoti/doc_scan/session/create/document_filter.rb +31 -0
- data/lib/yoti/doc_scan/session/create/document_restrictions_filter.rb +140 -0
- data/lib/yoti/doc_scan/session/create/notification_config.rb +142 -0
- data/lib/yoti/doc_scan/session/create/objective/objective.rb +31 -0
- data/lib/yoti/doc_scan/session/create/objective/proof_of_address_objective.rb +31 -0
- data/lib/yoti/doc_scan/session/create/orthogonal_restrictions_filter.rb +150 -0
- data/lib/yoti/doc_scan/session/create/requested_check.rb +39 -0
- data/lib/yoti/doc_scan/session/create/requested_document_authenticity_check.rb +95 -0
- data/lib/yoti/doc_scan/session/create/requested_face_match_check.rb +95 -0
- data/lib/yoti/doc_scan/session/create/requested_id_document_comparison_check.rb +53 -0
- data/lib/yoti/doc_scan/session/create/requested_liveness_check.rb +108 -0
- data/lib/yoti/doc_scan/session/create/requested_supplementary_doc_text_extraction_task.rb +94 -0
- data/lib/yoti/doc_scan/session/create/requested_task.rb +39 -0
- data/lib/yoti/doc_scan/session/create/requested_text_extraction_task.rb +116 -0
- data/lib/yoti/doc_scan/session/create/required_document.rb +31 -0
- data/lib/yoti/doc_scan/session/create/required_id_document.rb +53 -0
- data/lib/yoti/doc_scan/session/create/required_supplementary_document.rb +90 -0
- data/lib/yoti/doc_scan/session/create/sdk_config.rb +221 -0
- data/lib/yoti/doc_scan/session/create/session_specification.rb +221 -0
- data/lib/yoti/doc_scan/session/retrieve/authenticity_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/breakdown_response.rb +38 -0
- data/lib/yoti/doc_scan/session/retrieve/check_response.rb +63 -0
- data/lib/yoti/doc_scan/session/retrieve/details_response.rb +28 -0
- data/lib/yoti/doc_scan/session/retrieve/document_fields_response.rb +21 -0
- data/lib/yoti/doc_scan/session/retrieve/document_id_photo_response.rb +21 -0
- data/lib/yoti/doc_scan/session/retrieve/face_map_response.rb +21 -0
- data/lib/yoti/doc_scan/session/retrieve/face_match_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/file_response.rb +21 -0
- data/lib/yoti/doc_scan/session/retrieve/frame_response.rb +21 -0
- data/lib/yoti/doc_scan/session/retrieve/generated_check_response.rb +28 -0
- data/lib/yoti/doc_scan/session/retrieve/generated_media.rb +28 -0
- data/lib/yoti/doc_scan/session/retrieve/generated_supplementary_document_text_data_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/generated_text_data_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/get_session_result.rb +145 -0
- data/lib/yoti/doc_scan/session/retrieve/id_document_comparison_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/id_document_resource_response.rb +57 -0
- data/lib/yoti/doc_scan/session/retrieve/liveness_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/liveness_resource_response.rb +24 -0
- data/lib/yoti/doc_scan/session/retrieve/media_response.rb +38 -0
- data/lib/yoti/doc_scan/session/retrieve/page_response.rb +37 -0
- data/lib/yoti/doc_scan/session/retrieve/recommendation_response.rb +34 -0
- data/lib/yoti/doc_scan/session/retrieve/report_response.rb +31 -0
- data/lib/yoti/doc_scan/session/retrieve/resource_container.rb +69 -0
- data/lib/yoti/doc_scan/session/retrieve/resource_response.rb +41 -0
- data/lib/yoti/doc_scan/session/retrieve/supplementary_document_resource_response.rb +57 -0
- data/lib/yoti/doc_scan/session/retrieve/supplementary_document_text_data_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/supplementary_document_text_extraction_task_response.rb +18 -0
- data/lib/yoti/doc_scan/session/retrieve/task_response.rb +89 -0
- data/lib/yoti/doc_scan/session/retrieve/text_data_check_response.rb +12 -0
- data/lib/yoti/doc_scan/session/retrieve/text_extraction_task_response.rb +18 -0
- data/lib/yoti/doc_scan/session/retrieve/zoom_liveness_resource_response.rb +33 -0
- data/lib/yoti/doc_scan/support/supported_documents.rb +60 -0
- data/lib/yoti/dynamic_share_service/dynamic_scenario.rb +5 -0
- data/lib/yoti/dynamic_share_service/extension/extension.rb +3 -0
- data/lib/yoti/dynamic_share_service/extension/location_constraint_extension.rb +3 -0
- data/lib/yoti/dynamic_share_service/extension/thirdparty_attribute_extension.rb +1 -1
- data/lib/yoti/dynamic_share_service/extension/transactional_flow_extension.rb +4 -0
- data/lib/yoti/dynamic_share_service/policy/dynamic_policy.rb +74 -9
- data/lib/yoti/dynamic_share_service/policy/wanted_anchor.rb +3 -0
- data/lib/yoti/dynamic_share_service/policy/wanted_attribute.rb +5 -0
- data/lib/yoti/dynamic_share_service/share_url.rb +26 -33
- data/lib/yoti/errors.rb +15 -2
- data/lib/yoti/http/aml_check_request.rb +12 -6
- data/lib/yoti/http/payloads/aml_address.rb +4 -0
- data/lib/yoti/http/payloads/aml_profile.rb +7 -1
- data/lib/yoti/http/profile_request.rb +11 -6
- data/lib/yoti/http/request.rb +219 -18
- data/lib/yoti/http/signed_request.rb +13 -4
- data/lib/yoti/protobuf/main.rb +8 -8
- data/lib/yoti/share/attribute_issuance_details.rb +6 -0
- data/lib/yoti/ssl.rb +4 -4
- data/lib/yoti/util/age_processor.rb +1 -1
- data/lib/yoti/util/anchor_processor.rb +2 -2
- data/lib/yoti/util/log.rb +1 -1
- data/lib/yoti/util/validation.rb +41 -0
- data/lib/yoti/version.rb +1 -1
- data/yoti.gemspec +18 -6
- metadata +69 -33
- data/.github/ISSUE_TEMPLATE.md +0 -17
- data/.gitignore +0 -39
- data/CONTRIBUTING.md +0 -98
- data/Guardfile +0 -11
- data/Rakefile +0 -54
- data/login_flow.png +0 -0
- data/rubocop.yml +0 -57
- data/yardstick.yml +0 -9
@@ -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 instance_of?(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 instance_of?(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
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yoti
|
4
|
+
module DocScan
|
5
|
+
module Session
|
6
|
+
module Create
|
7
|
+
class RequiredIdDocument < RequiredDocument
|
8
|
+
#
|
9
|
+
# @param [DocumentFilter] filter
|
10
|
+
#
|
11
|
+
def initialize(filter = nil)
|
12
|
+
super(Constants::ID_DOCUMENT)
|
13
|
+
|
14
|
+
Validation.assert_is_a(DocumentFilter, filter, 'filter', true)
|
15
|
+
@filter = filter
|
16
|
+
end
|
17
|
+
|
18
|
+
def as_json(*_args)
|
19
|
+
json = super
|
20
|
+
json[:filter] = @filter.as_json unless @filter.nil?
|
21
|
+
json
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# @return [RequiredIdDocumentBuilder]
|
26
|
+
#
|
27
|
+
def self.builder
|
28
|
+
RequiredIdDocumentBuilder.new
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class RequiredIdDocumentBuilder
|
33
|
+
#
|
34
|
+
# @param [DocumentFilter] filter
|
35
|
+
#
|
36
|
+
# @return [self]
|
37
|
+
#
|
38
|
+
def with_filter(filter)
|
39
|
+
@filter = filter
|
40
|
+
self
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# @return [RequiredIdDocument]
|
45
|
+
#
|
46
|
+
def build
|
47
|
+
RequiredIdDocument.new(@filter)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -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,221 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yoti
|
4
|
+
module DocScan
|
5
|
+
module Session
|
6
|
+
module Create
|
7
|
+
class SdkConfig
|
8
|
+
#
|
9
|
+
# @param [String] allowed_capture_methods
|
10
|
+
# @param [String] primary_colour
|
11
|
+
# @param [String] secondary_colour
|
12
|
+
# @param [String] font_colour
|
13
|
+
# @param [String] locale
|
14
|
+
# @param [String] preset_issuing_country
|
15
|
+
# @param [String] success_url
|
16
|
+
# @param [String] error_url
|
17
|
+
#
|
18
|
+
def initialize(
|
19
|
+
allowed_capture_methods,
|
20
|
+
primary_colour,
|
21
|
+
secondary_colour,
|
22
|
+
font_colour,
|
23
|
+
locale,
|
24
|
+
preset_issuing_country,
|
25
|
+
success_url,
|
26
|
+
error_url
|
27
|
+
)
|
28
|
+
Validation.assert_is_a(String, allowed_capture_methods, 'allowed_capture_methods', true)
|
29
|
+
@allowed_capture_methods = allowed_capture_methods
|
30
|
+
|
31
|
+
Validation.assert_is_a(String, primary_colour, 'primary_colour', true)
|
32
|
+
@primary_colour = primary_colour
|
33
|
+
|
34
|
+
Validation.assert_is_a(String, secondary_colour, 'secondary_colour', true)
|
35
|
+
@secondary_colour = secondary_colour
|
36
|
+
|
37
|
+
Validation.assert_is_a(String, font_colour, 'font_colour', true)
|
38
|
+
@font_colour = font_colour
|
39
|
+
|
40
|
+
Validation.assert_is_a(String, locale, 'locale', true)
|
41
|
+
@locale = locale
|
42
|
+
|
43
|
+
Validation.assert_is_a(String, preset_issuing_country, 'preset_issuing_country', true)
|
44
|
+
@preset_issuing_country = preset_issuing_country
|
45
|
+
|
46
|
+
Validation.assert_is_a(String, success_url, 'success_url', true)
|
47
|
+
@success_url = success_url
|
48
|
+
|
49
|
+
Validation.assert_is_a(String, error_url, 'error_url', true)
|
50
|
+
@error_url = error_url
|
51
|
+
end
|
52
|
+
|
53
|
+
def to_json(*_args)
|
54
|
+
as_json.to_json
|
55
|
+
end
|
56
|
+
|
57
|
+
def as_json(*_args)
|
58
|
+
{
|
59
|
+
allowed_capture_methods: @allowed_capture_methods,
|
60
|
+
primary_colour: @primary_colour,
|
61
|
+
secondary_colour: @secondary_colour,
|
62
|
+
font_colour: @font_colour,
|
63
|
+
locale: @locale,
|
64
|
+
preset_issuing_country: @preset_issuing_country,
|
65
|
+
success_url: @success_url,
|
66
|
+
error_url: @error_url
|
67
|
+
}.compact
|
68
|
+
end
|
69
|
+
|
70
|
+
#
|
71
|
+
# @return [SdkConfigBuilder]
|
72
|
+
#
|
73
|
+
def self.builder
|
74
|
+
SdkConfigBuilder.new
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
# Builder to assist in the creation of {SdkConfig}.
|
80
|
+
#
|
81
|
+
class SdkConfigBuilder
|
82
|
+
def initialize
|
83
|
+
@topics = []
|
84
|
+
end
|
85
|
+
|
86
|
+
#
|
87
|
+
# Sets the allowed capture method to "CAMERA"
|
88
|
+
#
|
89
|
+
# @return [self]
|
90
|
+
#
|
91
|
+
def with_allows_camera
|
92
|
+
with_allowed_capture_methods(Constants::CAMERA)
|
93
|
+
end
|
94
|
+
|
95
|
+
#
|
96
|
+
# Sets the allowed capture method to "CAMERA_AND_UPLOAD"
|
97
|
+
#
|
98
|
+
# @return [self]
|
99
|
+
#
|
100
|
+
def with_allows_camera_and_upload
|
101
|
+
with_allowed_capture_methods(Constants::CAMERA_AND_UPLOAD)
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# Sets the allowed capture method
|
106
|
+
#
|
107
|
+
# @param [String] allowed_capture_methods
|
108
|
+
#
|
109
|
+
# @return [self]
|
110
|
+
#
|
111
|
+
def with_allowed_capture_methods(allowed_capture_methods)
|
112
|
+
@allowed_capture_methods = allowed_capture_methods
|
113
|
+
self
|
114
|
+
end
|
115
|
+
|
116
|
+
#
|
117
|
+
# Sets the primary colour to be used by the web/native client
|
118
|
+
#
|
119
|
+
# @param [String] primary_colour
|
120
|
+
#
|
121
|
+
# @return [self]
|
122
|
+
#
|
123
|
+
def with_primary_colour(primary_colour)
|
124
|
+
@primary_colour = primary_colour
|
125
|
+
self
|
126
|
+
end
|
127
|
+
|
128
|
+
#
|
129
|
+
# Sets the secondary colour to be used by the web/native client (used on the button)
|
130
|
+
#
|
131
|
+
# @param [String] secondary_colour
|
132
|
+
#
|
133
|
+
# @return [self]
|
134
|
+
#
|
135
|
+
def with_secondary_colour(secondary_colour)
|
136
|
+
@secondary_colour = secondary_colour
|
137
|
+
self
|
138
|
+
end
|
139
|
+
|
140
|
+
#
|
141
|
+
# Sets the font colour to be used by the web/native client (used on the button)
|
142
|
+
#
|
143
|
+
# @param [String] font_colour
|
144
|
+
#
|
145
|
+
# @return [self]
|
146
|
+
#
|
147
|
+
def with_font_colour(font_colour)
|
148
|
+
@font_colour = font_colour
|
149
|
+
self
|
150
|
+
end
|
151
|
+
|
152
|
+
#
|
153
|
+
# Sets the locale on the builder
|
154
|
+
#
|
155
|
+
# @param [String] locale
|
156
|
+
#
|
157
|
+
# @return [self]
|
158
|
+
#
|
159
|
+
def with_locale(locale)
|
160
|
+
@locale = locale
|
161
|
+
self
|
162
|
+
end
|
163
|
+
|
164
|
+
#
|
165
|
+
# Sets the preset issuing country on the builder
|
166
|
+
#
|
167
|
+
# @param [String] preset_issuing_country
|
168
|
+
#
|
169
|
+
# @return [self]
|
170
|
+
#
|
171
|
+
def with_preset_issuing_country(preset_issuing_country)
|
172
|
+
@preset_issuing_country = preset_issuing_country
|
173
|
+
self
|
174
|
+
end
|
175
|
+
|
176
|
+
#
|
177
|
+
# Sets the success URL for the redirect that follows the web/native client
|
178
|
+
# uploading documents successfully
|
179
|
+
#
|
180
|
+
# @param [String] success_url
|
181
|
+
#
|
182
|
+
# @return [self]
|
183
|
+
#
|
184
|
+
def with_success_url(success_url)
|
185
|
+
@success_url = success_url
|
186
|
+
self
|
187
|
+
end
|
188
|
+
|
189
|
+
#
|
190
|
+
# Sets the error URL for the redirect that follows the web/native client
|
191
|
+
# uploading documents unsuccessfully
|
192
|
+
#
|
193
|
+
# @param [String] error_url
|
194
|
+
#
|
195
|
+
# @return [self]
|
196
|
+
#
|
197
|
+
def with_error_url(error_url)
|
198
|
+
@error_url = error_url
|
199
|
+
self
|
200
|
+
end
|
201
|
+
|
202
|
+
#
|
203
|
+
# @return [SdkConfig]
|
204
|
+
#
|
205
|
+
def build
|
206
|
+
SdkConfig.new(
|
207
|
+
@allowed_capture_methods,
|
208
|
+
@primary_colour,
|
209
|
+
@secondary_colour,
|
210
|
+
@font_colour,
|
211
|
+
@locale,
|
212
|
+
@preset_issuing_country,
|
213
|
+
@success_url,
|
214
|
+
@error_url
|
215
|
+
)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|