didit-sdk 1.0.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 (234) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +25 -0
  3. data/LICENSE +21 -0
  4. data/README.md +277 -0
  5. data/lib/didit/authentication/base64_url.rb +34 -0
  6. data/lib/didit/authentication/cache.rb +201 -0
  7. data/lib/didit/authentication/http.rb +150 -0
  8. data/lib/didit/authentication/issuer.rb +115 -0
  9. data/lib/didit/authentication/jws.rb +231 -0
  10. data/lib/didit/authentication/key_set.rb +89 -0
  11. data/lib/didit/authentication/pkce.rb +64 -0
  12. data/lib/didit/authentication/types.rb +175 -0
  13. data/lib/didit/authentication.rb +546 -0
  14. data/lib/didit/client.rb +211 -0
  15. data/lib/didit/errors.rb +153 -0
  16. data/lib/didit/file_part.rb +85 -0
  17. data/lib/didit/internal/config.rb +94 -0
  18. data/lib/didit/internal/errors.rb +83 -0
  19. data/lib/didit/internal/log.rb +41 -0
  20. data/lib/didit/internal/multipart.rb +60 -0
  21. data/lib/didit/internal/request.rb +322 -0
  22. data/lib/didit/internal/transport.rb +198 -0
  23. data/lib/didit/internal/util.rb +76 -0
  24. data/lib/didit/internal.rb +15 -0
  25. data/lib/didit/model.rb +199 -0
  26. data/lib/didit/page.rb +130 -0
  27. data/lib/didit/raw_response.rb +57 -0
  28. data/lib/didit/resource.rb +15 -0
  29. data/lib/didit/resources/account.rb +309 -0
  30. data/lib/didit/resources/address_validation.rb +73 -0
  31. data/lib/didit/resources/age_estimation.rb +110 -0
  32. data/lib/didit/resources/aml.rb +166 -0
  33. data/lib/didit/resources/aml_monitoring.rb +30 -0
  34. data/lib/didit/resources/analytics.rb +87 -0
  35. data/lib/didit/resources/bank.rb +65 -0
  36. data/lib/didit/resources/billing.rb +61 -0
  37. data/lib/didit/resources/biometric_templates.rb +234 -0
  38. data/lib/didit/resources/blocklist.rb +130 -0
  39. data/lib/didit/resources/business_sessions.rb +29 -0
  40. data/lib/didit/resources/businesses.rb +471 -0
  41. data/lib/didit/resources/cases.rb +2116 -0
  42. data/lib/didit/resources/customization.rb +153 -0
  43. data/lib/didit/resources/database_validation.rb +327 -0
  44. data/lib/didit/resources/document_ai.rb +145 -0
  45. data/lib/didit/resources/email.rb +254 -0
  46. data/lib/didit/resources/face_match.rb +103 -0
  47. data/lib/didit/resources/face_search.rb +103 -0
  48. data/lib/didit/resources/fraud_checks.rb +130 -0
  49. data/lib/didit/resources/id_verification.rb +163 -0
  50. data/lib/didit/resources/id_wallets.rb +1468 -0
  51. data/lib/didit/resources/investigator.rb +419 -0
  52. data/lib/didit/resources/ip.rb +68 -0
  53. data/lib/didit/resources/kyb.rb +256 -0
  54. data/lib/didit/resources/lists.rb +332 -0
  55. data/lib/didit/resources/monitoring_events.rb +466 -0
  56. data/lib/didit/resources/networks.rb +427 -0
  57. data/lib/didit/resources/passive_liveness.rb +103 -0
  58. data/lib/didit/resources/phone.rb +271 -0
  59. data/lib/didit/resources/pricing.rb +40 -0
  60. data/lib/didit/resources/proof_of_address.rb +167 -0
  61. data/lib/didit/resources/questionnaires.rb +170 -0
  62. data/lib/didit/resources/regulatory_reports.rb +314 -0
  63. data/lib/didit/resources/report_templates.rb +146 -0
  64. data/lib/didit/resources/sessions.rb +2820 -0
  65. data/lib/didit/resources/transactions.rb +981 -0
  66. data/lib/didit/resources/travel_rule.rb +1202 -0
  67. data/lib/didit/resources/users.rb +521 -0
  68. data/lib/didit/resources/wallet_screening.rb +190 -0
  69. data/lib/didit/resources/webhooks.rb +396 -0
  70. data/lib/didit/resources/workflows.rb +214 -0
  71. data/lib/didit/resources.rb +263 -0
  72. data/lib/didit/types/account.rb +11 -0
  73. data/lib/didit/types/account_components.rb +105 -0
  74. data/lib/didit/types/address_validation.rb +8 -0
  75. data/lib/didit/types/age_estimation.rb +89 -0
  76. data/lib/didit/types/aml.rb +193 -0
  77. data/lib/didit/types/aml_monitoring.rb +73 -0
  78. data/lib/didit/types/analytics.rb +62 -0
  79. data/lib/didit/types/bank.rb +8 -0
  80. data/lib/didit/types/billing.rb +18 -0
  81. data/lib/didit/types/biometric_templates.rb +292 -0
  82. data/lib/didit/types/blocklist.rb +31 -0
  83. data/lib/didit/types/businesses.rb +45 -0
  84. data/lib/didit/types/cases.rb +368 -0
  85. data/lib/didit/types/components.rb +12206 -0
  86. data/lib/didit/types/customization.rb +8 -0
  87. data/lib/didit/types/database_validation.rb +177 -0
  88. data/lib/didit/types/document_ai.rb +135 -0
  89. data/lib/didit/types/email.rb +116 -0
  90. data/lib/didit/types/face_match.rb +93 -0
  91. data/lib/didit/types/face_search.rb +129 -0
  92. data/lib/didit/types/fraud_checks.rb +8 -0
  93. data/lib/didit/types/id_verification.rb +231 -0
  94. data/lib/didit/types/id_wallets.rb +8 -0
  95. data/lib/didit/types/investigator.rb +221 -0
  96. data/lib/didit/types/ip.rb +8 -0
  97. data/lib/didit/types/kyb.rb +1391 -0
  98. data/lib/didit/types/lists.rb +111 -0
  99. data/lib/didit/types/monitoring_events.rb +235 -0
  100. data/lib/didit/types/networks.rb +120 -0
  101. data/lib/didit/types/passive_liveness.rb +95 -0
  102. data/lib/didit/types/phone.rb +69 -0
  103. data/lib/didit/types/proof_of_address.rb +166 -0
  104. data/lib/didit/types/questionnaires.rb +29 -0
  105. data/lib/didit/types/regulatory_reports.rb +100 -0
  106. data/lib/didit/types/report_templates.rb +41 -0
  107. data/lib/didit/types/sessions.rb +1441 -0
  108. data/lib/didit/types/transactions.rb +245 -0
  109. data/lib/didit/types/travel_rule.rb +168 -0
  110. data/lib/didit/types/users.rb +180 -0
  111. data/lib/didit/types/wallet_screening.rb +49 -0
  112. data/lib/didit/types/webhooks.rb +355 -0
  113. data/lib/didit/types/workflows.rb +32 -0
  114. data/lib/didit/types.rb +1681 -0
  115. data/lib/didit/version.rb +5 -0
  116. data/lib/didit/webhooks/canonical_json.rb +187 -0
  117. data/lib/didit/webhooks/client_methods.rb +23 -0
  118. data/lib/didit/webhooks/events.rb +221 -0
  119. data/lib/didit/webhooks/headers.rb +83 -0
  120. data/lib/didit/webhooks/verifier.rb +260 -0
  121. data/lib/didit/webhooks.rb +99 -0
  122. data/lib/didit-sdk.rb +4 -0
  123. data/lib/didit.rb +31 -0
  124. data/sig/didit/authentication/base64_url.rbs +10 -0
  125. data/sig/didit/authentication/cache.rbs +60 -0
  126. data/sig/didit/authentication/http.rbs +37 -0
  127. data/sig/didit/authentication/issuer.rbs +17 -0
  128. data/sig/didit/authentication/jws.rbs +41 -0
  129. data/sig/didit/authentication/jwt.rbs +14 -0
  130. data/sig/didit/authentication/key_set.rbs +25 -0
  131. data/sig/didit/authentication/pkce.rbs +20 -0
  132. data/sig/didit/authentication/types.rbs +114 -0
  133. data/sig/didit/authentication.rbs +81 -0
  134. data/sig/didit/client.rbs +61 -0
  135. data/sig/didit/errors.rbs +80 -0
  136. data/sig/didit/file_part.rbs +19 -0
  137. data/sig/didit/internal.rbs +199 -0
  138. data/sig/didit/model.rbs +42 -0
  139. data/sig/didit/page.rbs +34 -0
  140. data/sig/didit/raw_response.rbs +20 -0
  141. data/sig/didit/resource.rbs +8 -0
  142. data/sig/didit/resources/account.rbs +23 -0
  143. data/sig/didit/resources/address_validation.rbs +9 -0
  144. data/sig/didit/resources/age_estimation.rbs +9 -0
  145. data/sig/didit/resources/aml.rbs +10 -0
  146. data/sig/didit/resources/aml_monitoring.rbs +9 -0
  147. data/sig/didit/resources/analytics.rbs +9 -0
  148. data/sig/didit/resources/bank.rbs +9 -0
  149. data/sig/didit/resources/billing.rbs +10 -0
  150. data/sig/didit/resources/biometric_templates.rbs +13 -0
  151. data/sig/didit/resources/blocklist.rbs +11 -0
  152. data/sig/didit/resources/business_sessions.rbs +9 -0
  153. data/sig/didit/resources/businesses.rbs +22 -0
  154. data/sig/didit/resources/cases.rbs +103 -0
  155. data/sig/didit/resources/customization.rbs +10 -0
  156. data/sig/didit/resources/database_validation.rbs +9 -0
  157. data/sig/didit/resources/document_ai.rbs +9 -0
  158. data/sig/didit/resources/email.rbs +11 -0
  159. data/sig/didit/resources/face_match.rbs +9 -0
  160. data/sig/didit/resources/face_search.rbs +9 -0
  161. data/sig/didit/resources/fraud_checks.rbs +11 -0
  162. data/sig/didit/resources/id_verification.rbs +9 -0
  163. data/sig/didit/resources/id_wallets.rbs +37 -0
  164. data/sig/didit/resources/investigator.rbs +23 -0
  165. data/sig/didit/resources/ip.rbs +9 -0
  166. data/sig/didit/resources/kyb.rbs +12 -0
  167. data/sig/didit/resources/lists.rbs +20 -0
  168. data/sig/didit/resources/monitoring_events.rbs +16 -0
  169. data/sig/didit/resources/networks.rbs +25 -0
  170. data/sig/didit/resources/passive_liveness.rbs +9 -0
  171. data/sig/didit/resources/phone.rbs +11 -0
  172. data/sig/didit/resources/pricing.rbs +9 -0
  173. data/sig/didit/resources/proof_of_address.rbs +9 -0
  174. data/sig/didit/resources/questionnaires.rbs +13 -0
  175. data/sig/didit/resources/regulatory_reports.rbs +16 -0
  176. data/sig/didit/resources/report_templates.rbs +13 -0
  177. data/sig/didit/resources/sessions.rbs +78 -0
  178. data/sig/didit/resources/transactions.rbs +43 -0
  179. data/sig/didit/resources/travel_rule.rbs +62 -0
  180. data/sig/didit/resources/users.rbs +21 -0
  181. data/sig/didit/resources/wallet_screening.rbs +11 -0
  182. data/sig/didit/resources/webhooks.rbs +23 -0
  183. data/sig/didit/resources/workflows.rbs +13 -0
  184. data/sig/didit/resources.rbs +50 -0
  185. data/sig/didit/types/account.rbs +22 -0
  186. data/sig/didit/types/account_components.rbs +94 -0
  187. data/sig/didit/types/address_validation.rbs +7 -0
  188. data/sig/didit/types/age_estimation.rbs +80 -0
  189. data/sig/didit/types/aml.rbs +174 -0
  190. data/sig/didit/types/aml_monitoring.rbs +67 -0
  191. data/sig/didit/types/analytics.rbs +57 -0
  192. data/sig/didit/types/bank.rbs +9 -0
  193. data/sig/didit/types/billing.rbs +19 -0
  194. data/sig/didit/types/biometric_templates.rbs +268 -0
  195. data/sig/didit/types/blocklist.rbs +33 -0
  196. data/sig/didit/types/businesses.rbs +54 -0
  197. data/sig/didit/types/cases.rbs +414 -0
  198. data/sig/didit/types/components.rbs +10920 -0
  199. data/sig/didit/types/customization.rbs +7 -0
  200. data/sig/didit/types/database_validation.rbs +152 -0
  201. data/sig/didit/types/document_ai.rbs +123 -0
  202. data/sig/didit/types/email.rbs +112 -0
  203. data/sig/didit/types/face_match.rbs +86 -0
  204. data/sig/didit/types/face_search.rbs +112 -0
  205. data/sig/didit/types/fraud_checks.rbs +9 -0
  206. data/sig/didit/types/id_verification.rbs +196 -0
  207. data/sig/didit/types/id_wallets.rbs +55 -0
  208. data/sig/didit/types/investigator.rbs +212 -0
  209. data/sig/didit/types/ip.rbs +7 -0
  210. data/sig/didit/types/kyb.rbs +1254 -0
  211. data/sig/didit/types/lists.rbs +106 -0
  212. data/sig/didit/types/monitoring_events.rbs +234 -0
  213. data/sig/didit/types/networks.rbs +113 -0
  214. data/sig/didit/types/passive_liveness.rbs +87 -0
  215. data/sig/didit/types/phone.rbs +65 -0
  216. data/sig/didit/types/proof_of_address.rbs +144 -0
  217. data/sig/didit/types/questionnaires.rbs +30 -0
  218. data/sig/didit/types/regulatory_reports.rbs +101 -0
  219. data/sig/didit/types/report_templates.rbs +42 -0
  220. data/sig/didit/types/sessions.rbs +1349 -0
  221. data/sig/didit/types/transactions.rbs +273 -0
  222. data/sig/didit/types/travel_rule.rbs +188 -0
  223. data/sig/didit/types/users.rbs +181 -0
  224. data/sig/didit/types/wallet_screening.rbs +40 -0
  225. data/sig/didit/types/webhooks.rbs +311 -0
  226. data/sig/didit/types/workflows.rbs +30 -0
  227. data/sig/didit/webhooks/canonical_json.rbs +25 -0
  228. data/sig/didit/webhooks/client_methods.rbs +11 -0
  229. data/sig/didit/webhooks/events.rbs +125 -0
  230. data/sig/didit/webhooks/headers.rbs +22 -0
  231. data/sig/didit/webhooks/verifier.rbs +54 -0
  232. data/sig/didit/webhooks.rbs +37 -0
  233. data/sig/didit.rbs +20 -0
  234. metadata +300 -0
@@ -0,0 +1,153 @@
1
+ # Code generated by codegen from openapi/*.json. DO NOT EDIT.
2
+ # frozen_string_literal: true
3
+
4
+ module Didit
5
+ module Resources
6
+ # The +customization+ resource.
7
+ class Customization < Didit::Resource
8
+ # Get branding customization
9
+ #
10
+ # Returns the white-label branding for the application resolved from the API key: colors, fonts, border radii,
11
+ # logo URLs and UI/UX options. Custom domain and white-label email settings are managed only in the Business
12
+ # Console and are not part of this response.
13
+ #
14
+ # +GET /v3/customization/+
15
+ #
16
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
17
+ # @return [Didit::Types::BrandingCustomization]
18
+ def retrieve(request_options: nil)
19
+ @client.request(
20
+ :get,
21
+ "/v3/customization/",
22
+ response: Types::BrandingCustomization,
23
+ request_options: request_options
24
+ )
25
+ end
26
+
27
+ # Update branding customization
28
+ #
29
+ # Partial update of the application's white-label branding. Send `application/json` to change colors, fonts,
30
+ # radii and UI options, or `multipart/form-data` to upload logo images. Only the fields you include are changed.
31
+ # Custom domain and white-label email cannot be set through this endpoint - use the Business Console for those.
32
+ #
33
+ # +PATCH /v3/customization/+
34
+ #
35
+ # @param color_primary [String] Headers / primary text color.
36
+ # @param color_secondary [String] Paragraph / secondary text color.
37
+ # @param color_background [String] Page background color.
38
+ # @param color_panel [String] Panel / accent color.
39
+ # @param color_panel_10 [String] Panel color at 10% opacity.
40
+ # @param color_on_panel_1 [String] Support text color on panels.
41
+ # @param color_on_panel_2 [String] Pill / badge color on panels.
42
+ # @param color_on_background [String] Text color on background.
43
+ # @param color_button_1 [String] Primary button color.
44
+ # @param color_button_2 [String] Secondary button color.
45
+ # @param color_button_text_1 [String] Primary button text color.
46
+ # @param color_button_text_2 [String] Secondary button text color.
47
+ # @param color_pill_text [String] Text color for pills, inputs and selectors.
48
+ # @param border_radius_panel [Integer] Panel corner radius in pixels.
49
+ # @param border_radius_buttons [Integer] Button corner radius in pixels.
50
+ # @param font_family [String] Google Font family name (e.g. `Inter`, `AR One Sans`).
51
+ # @param font_weight [String] Font weight available for the selected family (e.g. `regular`, `500`, `700`).
52
+ # @param app_public_name [String, nil] Public name shown in the verification flow.
53
+ # @param privacy_policy_url [String, nil] Privacy policy URL shown to the end user.
54
+ # @param skip_welcome_screen [Boolean] Skip the initial welcome screen.
55
+ # @param disable_login_with_didit [Boolean] Continue as guest instead of showing the login-with-Didit screen.
56
+ # Cannot be set back to `false` while a custom domain is configured (400).
57
+ # @param hide_progress_bar [Boolean] Hide the progress bar during the flow.
58
+ # @param callback_seconds [Integer] Delay (seconds) before redirecting to the callback URL.
59
+ # @param delete_logo_square [Boolean] When `true`, removes the current square logo.
60
+ # @param delete_logo_rectangular [Boolean] When `true`, removes the current rectangular logo.
61
+ # @param delete_logo_rectangular_dark [Boolean] When `true`, removes the current dark-mode logo, and
62
+ # `logo_rectangular_dark` then reads `null`. If the same multipart request also uploads
63
+ # `image_rectangular_dark`, the upload wins.
64
+ # @param delete_favicon [Boolean] When `true`, removes the current favicon.
65
+ # @param image_square [Pathname, IO, String, Didit::FilePart] Square logo (1:1 aspect ratio). PNG, JPG or WebP,
66
+ # at least 512 px on the long side, at most **1 MB**.
67
+ # @param image_rectangular [Pathname, IO, String, Didit::FilePart] Rectangular logo (2:1 aspect ratio). PNG, JPG
68
+ # or WebP, at least 512 px on the long side, at most **1 MB**.
69
+ # @param image_rectangular_dark [Pathname, IO, String, Didit::FilePart] Rectangular logo for dark mode (2:1
70
+ # aspect ratio), shown on a dark background. PNG, JPG or WebP, at least 512 px on the long side, at most **1
71
+ # MB**. Returned as `logo_rectangular_dark`.
72
+ # @param image_favicon [Pathname, IO, String, Didit::FilePart] Favicon image. Max **500 KB**.
73
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
74
+ # @return [Didit::Types::BrandingCustomization]
75
+ def update(
76
+ color_primary: OMIT,
77
+ color_secondary: OMIT,
78
+ color_background: OMIT,
79
+ color_panel: OMIT,
80
+ color_panel_10: OMIT,
81
+ color_on_panel_1: OMIT,
82
+ color_on_panel_2: OMIT,
83
+ color_on_background: OMIT,
84
+ color_button_1: OMIT,
85
+ color_button_2: OMIT,
86
+ color_button_text_1: OMIT,
87
+ color_button_text_2: OMIT,
88
+ color_pill_text: OMIT,
89
+ border_radius_panel: OMIT,
90
+ border_radius_buttons: OMIT,
91
+ font_family: OMIT,
92
+ font_weight: OMIT,
93
+ app_public_name: OMIT,
94
+ privacy_policy_url: OMIT,
95
+ skip_welcome_screen: OMIT,
96
+ disable_login_with_didit: OMIT,
97
+ hide_progress_bar: OMIT,
98
+ callback_seconds: OMIT,
99
+ delete_logo_square: OMIT,
100
+ delete_logo_rectangular: OMIT,
101
+ delete_logo_rectangular_dark: OMIT,
102
+ delete_favicon: OMIT,
103
+ image_square: OMIT,
104
+ image_rectangular: OMIT,
105
+ image_rectangular_dark: OMIT,
106
+ image_favicon: OMIT,
107
+ request_options: nil
108
+ )
109
+ @client.request(
110
+ :patch,
111
+ "/v3/customization/",
112
+ body: {
113
+ "color_primary" => color_primary,
114
+ "color_secondary" => color_secondary,
115
+ "color_background" => color_background,
116
+ "color_panel" => color_panel,
117
+ "color_panel_10" => color_panel_10,
118
+ "color_on_panel_1" => color_on_panel_1,
119
+ "color_on_panel_2" => color_on_panel_2,
120
+ "color_on_background" => color_on_background,
121
+ "color_button_1" => color_button_1,
122
+ "color_button_2" => color_button_2,
123
+ "color_button_text_1" => color_button_text_1,
124
+ "color_button_text_2" => color_button_text_2,
125
+ "color_pill_text" => color_pill_text,
126
+ "border_radius_panel" => border_radius_panel,
127
+ "border_radius_buttons" => border_radius_buttons,
128
+ "font_family" => font_family,
129
+ "font_weight" => font_weight,
130
+ "app_public_name" => app_public_name,
131
+ "privacy_policy_url" => privacy_policy_url,
132
+ "skip_welcome_screen" => skip_welcome_screen,
133
+ "disable_login_with_didit" => disable_login_with_didit,
134
+ "hide_progress_bar" => hide_progress_bar,
135
+ "callback_seconds" => callback_seconds,
136
+ "delete_logo_square" => delete_logo_square,
137
+ "delete_logo_rectangular" => delete_logo_rectangular,
138
+ "delete_logo_rectangular_dark" => delete_logo_rectangular_dark,
139
+ "delete_favicon" => delete_favicon,
140
+ "image_square" => image_square,
141
+ "image_rectangular" => image_rectangular,
142
+ "image_rectangular_dark" => image_rectangular_dark,
143
+ "image_favicon" => image_favicon
144
+ },
145
+ encoding: :auto,
146
+ file_fields: %w[image_favicon image_rectangular image_rectangular_dark image_square],
147
+ response: Types::BrandingCustomization,
148
+ request_options: request_options
149
+ )
150
+ end
151
+ end
152
+ end
153
+ end
@@ -0,0 +1,327 @@
1
+ # Code generated by codegen from openapi/*.json. DO NOT EDIT.
2
+ # frozen_string_literal: true
3
+
4
+ module Didit
5
+ module Resources
6
+ # The +database_validation+ resource.
7
+ class DatabaseValidation < Didit::Resource
8
+ # Database Validation (standalone)
9
+ #
10
+ # Validate a person's identity data against official government and registry sources - CPF in Brazil, RENAPER in
11
+ # Argentina, DNI registries in Spain and Peru, INE in Mexico, and 100+ more services across 60+ countries.
12
+ #
13
+ # **Service selection.** Each country exposes one or more catalog services identified by a `service_id` (e.g.
14
+ # `bra_cpf`, `arg_renaper`, `pan_cedula_sib`). Pin the services you want with the `services` array - if you omit
15
+ # it, exactly **one** default service runs (the longest-established live service for the country). Sending
16
+ # `services` also switches the response to the extended shape with `services_used` and `match_score`. Discover
17
+ # services, their required fields, and prices via `GET /v1/organization/database-validation-countries/` (a
18
+ # catalog endpoint not documented in this spec) or the Business Console workflow editor. Some services are
19
+ # flagged `requires_consent=true` in the catalog and demand `consent=true`; others require onboarding for your
20
+ # organization before they can be called.
21
+ #
22
+ # **Input fields.** `identification_number` is a universal field that maps to the right country-specific field
23
+ # automatically (see its description). Country format rules are enforced before any provider is called (e.g. BRA
24
+ # CPF must be exactly 11 digits) and format failures are never billed. Biometric services need a `selfie` upload
25
+ # (multipart only); Argentina RENAPER additionally requires `gender`.
26
+ #
27
+ # **Results.** Each service returns a field-by-field `validation` map plus a vendor-neutral `outcome_code`
28
+ # (`MATCH`, `PARTIAL_MATCH`, `NO_MATCH`, `DOCUMENT_NOT_FOUND`, `INVALID_DOCUMENT_FORMAT`, `INVALID_INPUT`,
29
+ # `MINOR_BLOCKED`, `DECEASED`, `BIOMETRIC_NO_MATCH`, `BIOMETRIC_IMAGE_UNUSABLE`, `INCONCLUSIVE`,
30
+ # `DOCUMENT_SUPERSEDED`, `REGISTRY_UNAVAILABLE`, `REGISTRY_ERROR`). Note the distinctions: `NO_MATCH` is a
31
+ # definitive mismatch, `INCONCLUSIVE` means the registry could not confirm either way (review, not decline), and
32
+ # `BIOMETRIC_IMAGE_UNUSABLE` is a technical selfie problem (retake), unlike the definitive `BIOMETRIC_NO_MATCH`.
33
+ # The overall `match_type` aggregates across services (any full → `full_match`, else any partial →
34
+ # `partial_match`, else `no_match`) and `no_match_action`/`partial_match_action` translate it into the final
35
+ # `status`. `validation_type` is derived: `two_by_two` when two or more distinct services produced a full match
36
+ # (on the identification number, on full name + date of birth together, or on the address without
37
+ # contradictions), else `one_by_one`.
38
+ #
39
+ # **Persistence.** `save_api_request` defaults to **true**: the result is stored as a session (`request_id`
40
+ # works with `GET /v3/session/{sessionId}/decision/`), appears in the console, and fires a `status.updated`
41
+ # webhook. It also controls the `validations` shape - per-service objects when saved, a merged `{field: match}`
42
+ # map when not.
43
+ #
44
+ # **Billing.** Per-service: each service that returns a billable result is charged its own catalog price. Failed
45
+ # or skipped services are not billed, and requests rejected with `400` cost nothing. The pre-flight balance
46
+ # check covers the sum of the selected services' prices (`403` when short).
47
+ #
48
+ # **Failures.** When no selected service returns a usable result, the API returns `400` with `validation_errors`
49
+ # if every unanswered attempt explicitly refused the input (`provider_rejected_input`, `retryable: false`).
50
+ # Correct the input before trying again. Otherwise it returns `502` with `validation_errors`
51
+ # (`empty_provider_response`, `retryable: true`), including mixed input rejection and unavailable fallback
52
+ # attempts; nothing is billed (a session is still recorded with status `Not Finished` when
53
+ # `save_api_request=true`). When only some services fail, the `200` response carries their failures in
54
+ # `database_validation.errors`.
55
+ #
56
+ # **Sandbox.** Keys from sandbox applications skip the registry calls and billing and return a static
57
+ # `full_match` response - the sandbox payload always includes `services_used` and `match_score: 100` regardless
58
+ # of how `services` was sent, so don't validate the live extended-shape gating or the 0.0-1.0 `match_score`
59
+ # fraction against sandbox responses.
60
+ #
61
+ # Send the request as `application/json`, or as `multipart/form-data` when uploading a `selfie`.
62
+ #
63
+ # +POST /v3/database-validation/+
64
+ #
65
+ # @param issuing_state [String] ISO 3166-1 **alpha-3** country code of the registry to validate against (e.g.
66
+ # `BRA`, `ESP`, `COL`). Determines which services are available. Unsupported codes return `400` with the full
67
+ # list of valid options.
68
+ # @param services [Array<String>] Catalog `service_id`s to run for this country (e.g. `["bra_cpf"]`). Also
69
+ # accepts a single string or a comma-separated/JSON-encoded string. **If omitted or empty, exactly one default
70
+ # service runs** - the longest-established live service for the country; newer, biometric, and pay-as-you-go
71
+ # services must be named explicitly. Sending `services` switches the response to the extended shape (adds
72
+ # `servi...
73
+ # @param validation_type [String] DEPRECATED. Accepted for backward compatibility but ignored - the response
74
+ # `validation_type` is now derived from how many services full-matched. Use `services` to pin specific services.
75
+ # @param consent [Boolean] Set to `true` when the end user has explicitly consented to the selected validation
76
+ # services. Required for services flagged `requires_consent=true` in the catalog - without it those services
77
+ # return `400` with `services_requiring_consent`.
78
+ # @param identification_number [String] Universal identification number - automatically mapped to the correct
79
+ # country-specific field, so you can use it instead of `personal_number`/`tax_number`/`document_number`:
80
+ # ARG→document_number (DNI), BOL→document_number (CI), BRA→tax_number (CPF, 11 digits), CHL→personal_number
81
+ # (RUT), COL→personal_number (Cédula), CRI→personal_number (Cédula), DOM→personal_number (Cédula, 11 digits),
82
+ # ECU→personal...
83
+ # @param first_name [String] The individual's first name. Required by some services/countries.
84
+ # @param last_name [String] The individual's last name. Required by some services/countries.
85
+ # @param middle_name [String] Middle name, used by some country services (AUS, NZL, …).
86
+ # @param full_name [String] Full name - some services accept this in lieu of first/last name (e.g. CHN services,
87
+ # which match the native-script name).
88
+ # @param date_of_birth [Date, String] Date of birth, `YYYY-MM-DD`. Required by many services.
89
+ # @param personal_number [String] Government-issued unique personal identifier. Used by: CHL (RUT), COL
90
+ # (Cédula), CRI, DOM, ECU, ESP (DNI/NIE), MEX (CURP), PAN (Cédula), PER (DNI), URY. Consider
91
+ # `identification_number` instead.
92
+ # @param tax_number [String] Tax identification number. Used by: BRA (CPF, 11 digits). Consider
93
+ # `identification_number` instead.
94
+ # @param document_number [String] Document number. Used by: ARG (DNI), BOL (CI), GTM (DPI), HND (DNI), PRY (CI),
95
+ # SLV (DUI), VEN (Cédula). Consider `identification_number` instead.
96
+ # @param document_type [String] Type of document being validated: `P` passport, `DL` driver license, `ID`
97
+ # national ID, `RP` residence permit (plus `SSC`, `HIC`, `WP`, `TC`, `VISA`, `PSC`, `BC`, `OTHER`). Required by
98
+ # some services (e.g. ESP).
99
+ # @param expiration_date [Date, String] Document expiration date, `YYYY-MM-DD`. Required for ESP (Spain)
100
+ # validation.
101
+ # @param date_of_issue [Date, String] Document issue date, `YYYY-MM-DD` (fecha de expedición). Required for COL
102
+ # (Colombia) cédula validation.
103
+ # @param nationality [String] Nationality as ISO 3166-1 alpha-3. Required by some services.
104
+ # @param gender [String] Gender: `M`, `F`, or `X` (other/unknown). Required for Argentina's RENAPER validation
105
+ # (`arg_renaper`).
106
+ # @param address [Hash, String] Residential address. Prefer the structured object `{"street_1":"123 Main
107
+ # St","street_2":"Apt 4B","city":"Springfield","region":"IL","postal_code":"62701","country":"US"}`; a complete
108
+ # single-line string is still accepted. Required by address-verification services; when a service defines
109
+ # address requirements, missing parts return `400` with `address_fields_required_by`.
110
+ # @param address_element_1 [String] Street address including street number and type. If omitted, derived from
111
+ # `address`.
112
+ # @param address_element_2 [String] Apartment, unit, building, floor, or extra address line. Only send when you
113
+ # have it explicitly.
114
+ # @param address_element_3 [String] City, suburb, district, locality, or neighborhood. If omitted, derived from
115
+ # `address`.
116
+ # @param address_element_4 [String] State, province, region, or town. If omitted, derived from `address`.
117
+ # @param address_element_5 [String] Postcode or postal code. `postal_code` is accepted as an alias.
118
+ # @param postal_code [String] Postal code for address-based services (alias of `address_element_5`).
119
+ # @param driver_license_number [String] Driver licence number for government document-verification services
120
+ # (AUS, NZL, IND).
121
+ # @param driver_license_card_number [String] Physical driver licence card number, where required separately from
122
+ # the licence number (AUS).
123
+ # @param driver_license_state [String] Driver licence state or territory of issue (AUS).
124
+ # @param driver_license_version [String] Driver licence version code (NZL).
125
+ # @param passport_number [String] Passport number for government passport-verification services (AUS, NZL, IND,
126
+ # CHN).
127
+ # @param passport_expiration_date [Date, String] Passport expiry date, `YYYY-MM-DD`, for passport-verification
128
+ # services.
129
+ # @param passport_file_number [String] Passport file number (IND).
130
+ # @param passport_issue_country [String] Issuing country of the passport (ISO 3166-1 alpha-3) for
131
+ # passport-verification services.
132
+ # @param medicare_card_number [String] Medicare card number (AUS).
133
+ # @param immi_card_number [String] Australian ImmiCard number.
134
+ # @param immi_card_expiry_date [Date, String] Australian ImmiCard expiry date.
135
+ # @param citizenship_certificate_number [String] Citizenship certificate number (AUS).
136
+ # @param birth_registration_number [String] Birth-certificate registration number (AUS).
137
+ # @param birth_registration_date [Date, String] Birth-certificate registration date (AUS).
138
+ # @param birth_registration_state [String] Birth-certificate registration state (AUS).
139
+ # @param marriage_certificate_number [String] Marriage certificate number (AUS).
140
+ # @param change_of_name_certificate_number [String] Change-of-name certificate number (AUS).
141
+ # @param first_partner_name [String] First name of the partner on a marriage certificate (AUS).
142
+ # @param last_partner_name [String] Last name of the partner on a marriage certificate (AUS).
143
+ # @param voter_id [String] Voter registration number (IND EPIC, IRL).
144
+ # @param epic_card [String] India EPIC voter card number.
145
+ # @param pan [String] India PAN (Permanent Account Number).
146
+ # @param national_id [String] National ID number (CHN, MYS, KEN, KHM, NGA, ZAF, …).
147
+ # @param cic [String] Mexican INE/IFE Código de Identificación de Credencial (CIC), 9 digits. Used by the MEX
148
+ # INE credential-validity service (`mex_ine_vigencia`).
149
+ # @param identificador_ciudadano [String] Mexican INE Identificador del Ciudadano (9 digits). Used with `cic`
150
+ # for modern INE models (E/F/G/H) in `mex_ine_vigencia`.
151
+ # @param ocr [String] Mexican INE OCR number (13 digits, back of card). Used with `cic` for Model D in
152
+ # `mex_ine_vigencia`.
153
+ # @param voter_number [String] Mexican INE Clave de Elector (18 chars). Used with `emission_number` for legacy
154
+ # IFE models (A/B/C) in `mex_ine_vigencia`.
155
+ # @param emission_number [String] Mexican INE Número de Emisión. Used with `voter_number` for legacy IFE models
156
+ # (A/B/C) in `mex_ine_vigencia`.
157
+ # @param bvn [String] Nigerian Bank Verification Number.
158
+ # @param bank_card_number [String] Bank card number (CHN bank-card verification).
159
+ # @param ssn [String] Social Security Number (USA).
160
+ # @param phone [String] Phone number for phone-verification services.
161
+ # @param landline [String] Landline number for phone-verification services.
162
+ # @param email [String] Email address for identity-verification services.
163
+ # @param country_of_residence [String] ISO 3166-1 alpha-2 country of residence. Used by global
164
+ # identity-enrichment services (e.g. `glb_identity_enrichment`) to focus the lookup.
165
+ # @param partial_match_action [String] What a `partial_match` does to `database_validation.status`. Defaults to
166
+ # `NO_ACTION` (status stays `Approved`, with a warning).
167
+ # @param no_match_action [String] What a `no_match` does to `database_validation.status`. Defaults to `DECLINE`.
168
+ # @param save_api_request [Boolean] Persist the validation as a session (console visibility, decision endpoint,
169
+ # `status.updated` webhook). Also changes the `validations` response shape: per-service objects when `true`
170
+ # (default), a merged field map when `false`.
171
+ # @param vendor_data [String] Your identifier for the validated user; echoed back and stored with the session.
172
+ # @param metadata [Hash, nil] Free-form JSON stored with the request and echoed back.
173
+ # @param selfie [Pathname, IO, String, Didit::FilePart] Selfie image (`jpg`, `jpeg`, `png`, `webp`; max 2 MB -
174
+ # images are compressed to ~1.5 MB before upload to the registry) for biometric validation services, e.g.
175
+ # Argentina RENAPER (`arg_renaper`) and Panama SIB (`pan_cedula_sib`, `pan_cedula_sib_plus`). Required whenever
176
+ # a selected service lists it as a required field. Only available via `multipart/form-data`.
177
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
178
+ # @return [Didit::Types::DatabaseValidationValidateResponse]
179
+ def validate(
180
+ issuing_state:,
181
+ services: OMIT,
182
+ validation_type: OMIT,
183
+ consent: OMIT,
184
+ identification_number: OMIT,
185
+ first_name: OMIT,
186
+ last_name: OMIT,
187
+ middle_name: OMIT,
188
+ full_name: OMIT,
189
+ date_of_birth: OMIT,
190
+ personal_number: OMIT,
191
+ tax_number: OMIT,
192
+ document_number: OMIT,
193
+ document_type: OMIT,
194
+ expiration_date: OMIT,
195
+ date_of_issue: OMIT,
196
+ nationality: OMIT,
197
+ gender: OMIT,
198
+ address: OMIT,
199
+ address_element_1: OMIT,
200
+ address_element_2: OMIT,
201
+ address_element_3: OMIT,
202
+ address_element_4: OMIT,
203
+ address_element_5: OMIT,
204
+ postal_code: OMIT,
205
+ driver_license_number: OMIT,
206
+ driver_license_card_number: OMIT,
207
+ driver_license_state: OMIT,
208
+ driver_license_version: OMIT,
209
+ passport_number: OMIT,
210
+ passport_expiration_date: OMIT,
211
+ passport_file_number: OMIT,
212
+ passport_issue_country: OMIT,
213
+ medicare_card_number: OMIT,
214
+ immi_card_number: OMIT,
215
+ immi_card_expiry_date: OMIT,
216
+ citizenship_certificate_number: OMIT,
217
+ birth_registration_number: OMIT,
218
+ birth_registration_date: OMIT,
219
+ birth_registration_state: OMIT,
220
+ marriage_certificate_number: OMIT,
221
+ change_of_name_certificate_number: OMIT,
222
+ first_partner_name: OMIT,
223
+ last_partner_name: OMIT,
224
+ voter_id: OMIT,
225
+ epic_card: OMIT,
226
+ pan: OMIT,
227
+ national_id: OMIT,
228
+ cic: OMIT,
229
+ identificador_ciudadano: OMIT,
230
+ ocr: OMIT,
231
+ voter_number: OMIT,
232
+ emission_number: OMIT,
233
+ bvn: OMIT,
234
+ bank_card_number: OMIT,
235
+ ssn: OMIT,
236
+ phone: OMIT,
237
+ landline: OMIT,
238
+ email: OMIT,
239
+ country_of_residence: OMIT,
240
+ partial_match_action: OMIT,
241
+ no_match_action: OMIT,
242
+ save_api_request: OMIT,
243
+ vendor_data: OMIT,
244
+ metadata: OMIT,
245
+ selfie: OMIT,
246
+ request_options: nil
247
+ )
248
+ @client.request(
249
+ :post,
250
+ "/v3/database-validation/",
251
+ body: {
252
+ "issuing_state" => issuing_state,
253
+ "services" => services,
254
+ "validation_type" => validation_type,
255
+ "consent" => consent,
256
+ "identification_number" => identification_number,
257
+ "first_name" => first_name,
258
+ "last_name" => last_name,
259
+ "middle_name" => middle_name,
260
+ "full_name" => full_name,
261
+ "date_of_birth" => date_of_birth,
262
+ "personal_number" => personal_number,
263
+ "tax_number" => tax_number,
264
+ "document_number" => document_number,
265
+ "document_type" => document_type,
266
+ "expiration_date" => expiration_date,
267
+ "date_of_issue" => date_of_issue,
268
+ "nationality" => nationality,
269
+ "gender" => gender,
270
+ "address" => address,
271
+ "address_element_1" => address_element_1,
272
+ "address_element_2" => address_element_2,
273
+ "address_element_3" => address_element_3,
274
+ "address_element_4" => address_element_4,
275
+ "address_element_5" => address_element_5,
276
+ "postal_code" => postal_code,
277
+ "driver_license_number" => driver_license_number,
278
+ "driver_license_card_number" => driver_license_card_number,
279
+ "driver_license_state" => driver_license_state,
280
+ "driver_license_version" => driver_license_version,
281
+ "passport_number" => passport_number,
282
+ "passport_expiration_date" => passport_expiration_date,
283
+ "passport_file_number" => passport_file_number,
284
+ "passport_issue_country" => passport_issue_country,
285
+ "medicare_card_number" => medicare_card_number,
286
+ "immi_card_number" => immi_card_number,
287
+ "immi_card_expiry_date" => immi_card_expiry_date,
288
+ "citizenship_certificate_number" => citizenship_certificate_number,
289
+ "birth_registration_number" => birth_registration_number,
290
+ "birth_registration_date" => birth_registration_date,
291
+ "birth_registration_state" => birth_registration_state,
292
+ "marriage_certificate_number" => marriage_certificate_number,
293
+ "change_of_name_certificate_number" => change_of_name_certificate_number,
294
+ "first_partner_name" => first_partner_name,
295
+ "last_partner_name" => last_partner_name,
296
+ "voter_id" => voter_id,
297
+ "epic_card" => epic_card,
298
+ "pan" => pan,
299
+ "national_id" => national_id,
300
+ "cic" => cic,
301
+ "identificador_ciudadano" => identificador_ciudadano,
302
+ "ocr" => ocr,
303
+ "voter_number" => voter_number,
304
+ "emission_number" => emission_number,
305
+ "bvn" => bvn,
306
+ "bank_card_number" => bank_card_number,
307
+ "ssn" => ssn,
308
+ "phone" => phone,
309
+ "landline" => landline,
310
+ "email" => email,
311
+ "country_of_residence" => country_of_residence,
312
+ "partial_match_action" => partial_match_action,
313
+ "no_match_action" => no_match_action,
314
+ "save_api_request" => save_api_request,
315
+ "vendor_data" => vendor_data,
316
+ "metadata" => metadata,
317
+ "selfie" => selfie
318
+ },
319
+ encoding: :auto,
320
+ file_fields: %w[selfie],
321
+ response: Types::DatabaseValidationValidateResponse,
322
+ request_options: request_options
323
+ )
324
+ end
325
+ end
326
+ end
327
+ end
@@ -0,0 +1,145 @@
1
+ # Code generated by codegen from openapi/*.json. DO NOT EDIT.
2
+ # frozen_string_literal: true
3
+
4
+ module Didit
5
+ module Resources
6
+ # The +document_ai+ resource.
7
+ class DocumentAi < Didit::Resource
8
+ # Document AI (custom field extraction + tamper checks)
9
+ #
10
+ # Extract the fields **you** define from any supporting document - payslips, proof of funds, source-of-wealth
11
+ # letters, tax statements, contracts, invoices - in one call. Send the file plus a `fields` definition (key,
12
+ # name, extraction instruction, type) and get back typed values (`text`, `number`, `date` as `YYYY-MM-DD`), an
13
+ # optional name-match score against the expected person or company, PDF/EXIF tamper signals, an
14
+ # `Approved`/`Declined`/`In Review` `status`, and a `warnings` list explaining every issue found. This is the
15
+ # server-to-server counterpart of the hosted Document AI workflow step (see
16
+ # `/core-technology/document-ai/overview`); it uses Didit's default extraction model and does not expose
17
+ # provider selection.
18
+ #
19
+ # **Latency.** Extraction is LLM-based: typical calls take **5-15 seconds**, multi-page PDFs up to **~30
20
+ # seconds**. Configure a client timeout of **at least 45 seconds** and do not retry before the call completes.
21
+ #
22
+ # **Request format.** `multipart/form-data` only. `fields` is **one JSON-encoded array string** (1-30 items, at
23
+ # most 16 KB); bracket-style form arrays are rejected with `400`. Each item is `{key, name, instruction, type,
24
+ # required, is_full_name}` - `key` is the JSON key you get back (`^[a-z0-9_]{1,64}$`, unique), `instruction`
25
+ # tells the model what to read, `type` is `text` (default) | `number` | `date`, `required` raises
26
+ # `DOCUMENT_AI_MISSING_REQUIRED_FIELDS` when the value cannot be read, and at most one field may set
27
+ # `is_full_name: true` to mark the value compared against the expected name.
28
+ #
29
+ # **Name matching.** Pass `expected_first_name` + `expected_last_name` (person) **or** `expected_company_name`
30
+ # (+ optional `expected_company_country`) - not both. The value of the `is_full_name` field (or, when none is
31
+ # marked, the first text field whose key looks like a name) is compared fuzzily; `name_match_score` (0-100) and
32
+ # `name_on_document` are always returned when both sides exist, and a score below
33
+ # `document_ai_name_match_score_threshold` (default 80) adds `DOCUMENT_AI_NAME_MISMATCH`, governed by
34
+ # `document_ai_name_mismatch_action`.
35
+ #
36
+ # **Decision logic.** Each risk maps to a configurable action: `DECLINE` → `status: "Declined"`, `REVIEW` →
37
+ # `status: "In Review"`, `NO_ACTION` → informational only. Defaults mirror the workflow step: unreadable
38
+ # document `REVIEW`, missing required fields `REVIEW`, suspected manipulation `DECLINE`, name mismatch
39
+ # `NO_ACTION`, unsupported file `REVIEW`. A document that cannot be processed at all returns `400`; a readable
40
+ # but problematic document returns `200` with `Declined`/`In Review` - always inspect `document_ai.status` and
41
+ # `document_ai.warnings`, not just the HTTP code.
42
+ #
43
+ # **Billing.** Each `200` response consumes one Document AI API credit - **$0.20 per document** at list, paid
44
+ # from your plan credit or top-up balance. When the organization's balance cannot cover the call, the endpoint
45
+ # returns `403` before any processing. Sandbox API keys return a deterministic mock response and are not
46
+ # charged.
47
+ #
48
+ # **Persistence.** With `save_api_request=true` (default) the call is stored as an API-type session: the
49
+ # document, the extracted values, the field definitions and the name-match snapshot are kept, the session shows
50
+ # up in the Business Console, and `request_id` works with `GET /v3/session/{sessionId}/decision/`.
51
+ #
52
+ # +POST /v3/document-ai/+
53
+ #
54
+ # @param document [Pathname, IO, String, Didit::FilePart] The document to read. Allowed extensions: `tiff`,
55
+ # `jpg`, `jpeg`, `png`, `pdf`, `webp`, `zip`. Maximum upload size: **30 MB** (larger files are rejected with
56
+ # `400`). Multi-page PDFs are supported (expect higher latency); encrypted PDFs are rejected with `400`. Images
57
+ # are automatically compressed before processing.
58
+ # @param fields [String] One JSON-encoded array string with **1-30** field definitions (maximum 16 KB). Each
59
+ # item: `key` (required, `^[a-z0-9_]{1,64}$`, unique - the key returned in `extracted_data`), `name` (≤100
60
+ # chars, shown in messages), `instruction` (≤500 chars, what the model should read), `type` (`text` default |
61
+ # `number` | `date`), `required` (boolean, default `false`), `is_full_name` (boolean, default `false`, a...
62
+ # @param expected_first_name [String] First name to verify against the document's name field (fuzzy match,
63
+ # transliteration-aware). Use together with `expected_last_name`; cannot be combined with
64
+ # `expected_company_name`.
65
+ # @param expected_last_name [String] Last name to verify against the document's name field, combined with
66
+ # `expected_first_name` for `name_match_score`.
67
+ # @param expected_company_name [String] Company name to verify against the document's name field (for business
68
+ # documents). Cannot be combined with `expected_first_name` / `expected_last_name` (no example value on purpose
69
+ # - the generated request sample uses the person fields; swap them for this one when verifying a business
70
+ # document).
71
+ # @param expected_company_country [String] Optional ISO 3166-1 alpha-2 country code (two ASCII letters, e.g.
72
+ # `FR`) that tunes company-name normalization for `expected_company_name`. Only used with
73
+ # `expected_company_name`.
74
+ # @param document_ai_name_match_score_threshold [Integer] Minimum `name_match_score` (0-100) to consider the
75
+ # name matched. A lower score adds `DOCUMENT_AI_NAME_MISMATCH`, governed by `document_ai_name_mismatch_action`.
76
+ # @param document_ai_unreadable_document_action [String] What to do when no field could be read from the
77
+ # document (`DOCUMENT_AI_UNREADABLE_DOCUMENT`).
78
+ # @param document_ai_missing_required_fields_action [String] What to do when at least one `required` field could
79
+ # not be read (`DOCUMENT_AI_MISSING_REQUIRED_FIELDS`; `additional_data.missing_fields` lists them).
80
+ # @param document_ai_document_tampering_action [String] What to do when PDF/EXIF forensics suspect manipulation
81
+ # - modified after digital signing, known PDF editor, overlay-text manipulation, suspicious re-export, image
82
+ # anomalies (`DOCUMENT_AI_SUSPECTED_MANIPULATION`).
83
+ # @param document_ai_name_mismatch_action [String] What to do when `name_match_score` is below the threshold
84
+ # (`DOCUMENT_AI_NAME_MISMATCH`).
85
+ # @param document_ai_unsupported_file_action [String] What to do when the upload is empty or not a processable
86
+ # file (`DOCUMENT_AI_UNSUPPORTED_FILE`).
87
+ # @param save_api_request [Boolean] When `true` (default), persists the call as an API-type session - visible in
88
+ # the Business Console, retrievable via `GET /v3/session/{sessionId}/decision/` using the returned `request_id`,
89
+ # with the uploaded document, the extracted values, the field definitions and the name-match snapshot stored.
90
+ # When `false`, nothing is stored and `request_id` is a transient UUID for response correlation only; the...
91
+ # @param vendor_data [String] Optional opaque string (your internal user id, email, UUID…) stored on the
92
+ # persisted session and echoed back in the response. Use it to correlate API calls with your own records and to
93
+ # filter sessions later.
94
+ # @param metadata [Hash] Optional JSON object stored with the session (when `save_api_request=true`) and echoed
95
+ # back in the response. In multipart requests, send it as a JSON-encoded string field (e.g.
96
+ # `metadata={"flow":"onboarding"}`) - it is parsed into an object.
97
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
98
+ # @return [Didit::Types::DocumentAiAnalyzeResponse]
99
+ def analyze(
100
+ document:,
101
+ fields:,
102
+ expected_first_name: OMIT,
103
+ expected_last_name: OMIT,
104
+ expected_company_name: OMIT,
105
+ expected_company_country: OMIT,
106
+ document_ai_name_match_score_threshold: OMIT,
107
+ document_ai_unreadable_document_action: OMIT,
108
+ document_ai_missing_required_fields_action: OMIT,
109
+ document_ai_document_tampering_action: OMIT,
110
+ document_ai_name_mismatch_action: OMIT,
111
+ document_ai_unsupported_file_action: OMIT,
112
+ save_api_request: OMIT,
113
+ vendor_data: OMIT,
114
+ metadata: OMIT,
115
+ request_options: nil
116
+ )
117
+ @client.request(
118
+ :post,
119
+ "/v3/document-ai/",
120
+ body: {
121
+ "document" => document,
122
+ "fields" => fields,
123
+ "expected_first_name" => expected_first_name,
124
+ "expected_last_name" => expected_last_name,
125
+ "expected_company_name" => expected_company_name,
126
+ "expected_company_country" => expected_company_country,
127
+ "document_ai_name_match_score_threshold" => document_ai_name_match_score_threshold,
128
+ "document_ai_unreadable_document_action" => document_ai_unreadable_document_action,
129
+ "document_ai_missing_required_fields_action" => document_ai_missing_required_fields_action,
130
+ "document_ai_document_tampering_action" => document_ai_document_tampering_action,
131
+ "document_ai_name_mismatch_action" => document_ai_name_mismatch_action,
132
+ "document_ai_unsupported_file_action" => document_ai_unsupported_file_action,
133
+ "save_api_request" => save_api_request,
134
+ "vendor_data" => vendor_data,
135
+ "metadata" => metadata
136
+ },
137
+ encoding: :multipart,
138
+ file_fields: %w[document],
139
+ response: Types::DocumentAiAnalyzeResponse,
140
+ request_options: request_options
141
+ )
142
+ end
143
+ end
144
+ end
145
+ end