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,256 @@
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 +kyb+ resource.
7
+ class Kyb < Didit::Resource
8
+ # KYB registry company with shareholders (standalone)
9
+ #
10
+ # Retrieve the Lite profile **plus the direct shareholders** (natural persons and corporate entities, with their
11
+ # ownership bands) of one candidate returned by `POST /v3/kyb/search/`.
12
+ #
13
+ # **Pairing with search.** Pass the candidate's `kyb_response_id` exactly as returned by a search of the same
14
+ # application. The search runs on the Lite registry chain; when the country's ownership data lives at another
15
+ # registry Didit re-finds the company there by registration number, at no extra cost.
16
+ #
17
+ # **Billing.** Billed at the country's Shareholders price - see [KYB registry
18
+ # pricing](/getting-started/kyb-registry-pricing). When the registry holds no shareholder record for the company
19
+ # (or the country offers no ownership data at all) the Lite profile is delivered and billed instead: read
20
+ # `registry_tier_delivered` and `registry_ownership_status`. The balance is checked against the Shareholders
21
+ # price before any registry call (`403` when short).
22
+ #
23
+ # **Availability.** v3 only. Every call creates a business session (its id is the `request_id`).
24
+ #
25
+ # **Pending reports.** When a report is still being prepared, or the ownership section has not been retrieved
26
+ # from the registry yet, the endpoint returns 202 Accepted, kyb_registry.fetch_status=pending,
27
+ # kyb_registry.registry_ownership_status=pending, and registry_tier_delivered=null. Keep request_id and retrieve
28
+ # GET /v3/session/{request_id}/decision/ until registry_checks[0].company.fetch_status is resolved. Didit
29
+ # completes the report automatically and charges the delivered tier once it is ready. Do not repeat the purchase
30
+ # while it is pending; every new POST creates a separate request.
31
+ #
32
+ # +POST /v3/kyb/shareholders/+
33
+ #
34
+ # @param kyb_response_id [String] Candidate handle from `POST /v3/kyb/search/`
35
+ # (`kyb_registry.companies[].kyb_response_id`). Ephemeral - use it shortly after the search that produced it.
36
+ # @param vendor_data [String] Your identifier for this company; echoed back and stored with the business
37
+ # session.
38
+ # @param metadata [Hash, nil] Free-form JSON stored with the business session and echoed back.
39
+ # @param save_api_request [Boolean] Must be `true` (the default). KYB registry selects are always persisted so
40
+ # billing and retrieval can be tracked; `false` returns `400`.
41
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
42
+ # @return [Didit::Types::KybListShareholdersResponse, Didit::Types::KybListShareholdersResponse202]
43
+ def list_shareholders(
44
+ kyb_response_id:,
45
+ vendor_data: OMIT,
46
+ metadata: OMIT,
47
+ save_api_request: OMIT,
48
+ request_options: nil
49
+ )
50
+ @client.request(
51
+ :post,
52
+ "/v3/kyb/shareholders/",
53
+ body: {
54
+ "kyb_response_id" => kyb_response_id,
55
+ "vendor_data" => vendor_data,
56
+ "metadata" => metadata,
57
+ "save_api_request" => save_api_request
58
+ },
59
+ response: { 200 => Types::KybListShareholdersResponse, 202 => Types::KybListShareholdersResponse202 },
60
+ request_options: request_options
61
+ )
62
+ end
63
+
64
+ # KYB registry company with ultimate beneficial owners (standalone)
65
+ #
66
+ # Retrieve the Lite profile, the direct shareholders **and the ultimate beneficial owners** resolved through the
67
+ # ownership chain (`registry_data.ubo_resolution` carries the corporate parent chain) of one candidate returned
68
+ # by `POST /v3/kyb/search/`.
69
+ #
70
+ # **Pairing with search.** Pass the candidate's `kyb_response_id` exactly as returned by a search of the same
71
+ # application. The search runs on the Lite registry chain; when the country's ownership data lives at another
72
+ # registry Didit re-finds the company there by registration number, at no extra cost.
73
+ #
74
+ # **Billing.** Billed at the country's UBO price - see [KYB registry
75
+ # pricing](/getting-started/kyb-registry-pricing). The tier delivered is the highest the country and the
76
+ # registry can serve: Shareholders when the resolved report names no natural person as a beneficial owner, Lite
77
+ # when there is no ownership record at all; `registry_tier_delivered` names what was billed. The balance is
78
+ # checked against the UBO price before any registry call (`403` when short).
79
+ #
80
+ # **Availability.** v3 only. Every call creates a business session (its id is the `request_id`).
81
+ #
82
+ # **Pending reports.** When a report is still being prepared, or the ownership section has not been retrieved
83
+ # from the registry yet, the endpoint returns 202 Accepted, kyb_registry.fetch_status=pending,
84
+ # kyb_registry.registry_ownership_status=pending, and registry_tier_delivered=null. Keep request_id and retrieve
85
+ # GET /v3/session/{request_id}/decision/ until registry_checks[0].company.fetch_status is resolved. Didit
86
+ # completes the report automatically and charges the delivered tier once it is ready. Do not repeat the purchase
87
+ # while it is pending; every new POST creates a separate request.
88
+ #
89
+ # +POST /v3/kyb/ubo/+
90
+ #
91
+ # @param kyb_response_id [String] Candidate handle from `POST /v3/kyb/search/`
92
+ # (`kyb_registry.companies[].kyb_response_id`). Ephemeral - use it shortly after the search that produced it.
93
+ # @param vendor_data [String] Your identifier for this company; echoed back and stored with the business
94
+ # session.
95
+ # @param metadata [Hash, nil] Free-form JSON stored with the business session and echoed back.
96
+ # @param save_api_request [Boolean] Must be `true` (the default). KYB registry selects are always persisted so
97
+ # billing and retrieval can be tracked; `false` returns `400`.
98
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
99
+ # @return [Didit::Types::KybListUbosResponse, Didit::Types::KybListUbosResponse202]
100
+ def list_ubos(kyb_response_id:, vendor_data: OMIT, metadata: OMIT, save_api_request: OMIT, request_options: nil)
101
+ @client.request(
102
+ :post,
103
+ "/v3/kyb/ubo/",
104
+ body: {
105
+ "kyb_response_id" => kyb_response_id,
106
+ "vendor_data" => vendor_data,
107
+ "metadata" => metadata,
108
+ "save_api_request" => save_api_request
109
+ },
110
+ response: { 200 => Types::KybListUbosResponse, 202 => Types::KybListUbosResponse202 },
111
+ request_options: request_options
112
+ )
113
+ end
114
+
115
+ # KYB registry company search (standalone)
116
+ #
117
+ # Search official company registries for candidate companies by name and/or registration number. This is step 1
118
+ # of the two-step registry flow: **search** returns lightweight candidates, then `POST /v3/kyb/select/`
119
+ # retrieves the full profile of one candidate.
120
+ #
121
+ # **Search billing.** Successful searches using a paid company-data source cost USD 0.50 per request, regardless
122
+ # of candidate count. Empty results, failures and results served only by other sources are not charged. The
123
+ # applicable price is reserved before searching; insufficient balance returns 403 with code
124
+ # `insufficient_credits`. Contract rates apply where agreed, and an unconfigured contract search rate returns
125
+ # 403. Sandbox searches are free. Repeating a successful search can incur another charge; callback delivery does
126
+ # not add a charge. Profile retrieval is billed separately. This search fee also applies to v2. Candidates
127
+ # always come back with `fetch_status: "pending"`: the full company data is only fetched (and billed) on select.
128
+ #
129
+ # **`kyb_response_id` is ephemeral.** It is a per-search handle, not a stable company id. Select promptly after
130
+ # searching and re-search to get a fresh handle instead of storing it.
131
+ #
132
+ # **`tier` picks the provider chain.** `tier` names the registry tier the search runs on: `basic` (the default,
133
+ # the Lite chain), `shareholders` or `ubo`. The search uses the provider chain that serves that tier, and it is
134
+ # not always the same chain the Lite search reads, so an empty Lite search is not proof that the registry does
135
+ # not hold the company - search again at the tier you need. A country that does not offer the tier you name is
136
+ # searched at the highest tier it offers up to that one. Retrieve the candidate from the endpoint that sells
137
+ # that tier: `POST /v3/kyb/select/` (Lite), `POST /v3/kyb/shareholders/` or `POST /v3/kyb/ubo/`.
138
+ #
139
+ # **Authentication.** `POST /v3/kyb/search/` (and `/v2/`) takes your application's API key in the `x-api-key`
140
+ # header. The hosted `POST /v1/kyb/search/` is the session-authenticated route a hosted verification flow calls:
141
+ # it answers `403` to an API key and takes no `tier` - the workflow's KYB registry configuration picks the
142
+ # chain.
143
+ #
144
+ # **Two modes.**
145
+ # - *Synchronous (default):* the API polls the registry until the search resolves and returns the final
146
+ # candidate list (`search_resolved: true`).
147
+ # - *Asynchronous:* pass `webhook_url` and the API returns immediately - usually with `search_status: "pending"`
148
+ # and an empty candidate list - then POSTs a `kyb.registry_search.resolved` callback to your URL when the
149
+ # registry finishes. The callback body is `{"event_id", "event_type": "kyb.registry_search.resolved",
150
+ # "request_id", "vendor_data", "metadata", "search_status", "search_resolved", "kyb_registry", "timestamp",
151
+ # "created_at"}` - note `timestamp` and `created_at` in the callback are epoch integers, unlike this
152
+ # endpoint's ISO `created_at` - and is sent **unsigned** (header `X-Didit-Unsigned-Callback: true`, no
153
+ # `X-Signature`).
154
+ #
155
+ # **Country codes.** ISO 3166-1 alpha-2 (`GB`, `DE`), plus `XX-YY` subdivision codes where registries are
156
+ # regional - e.g. `US-CA` for California.
157
+ #
158
+ # **Sandbox.** Keys from sandbox applications return one static candidate without contacting any registry.
159
+ #
160
+ # +POST /v3/kyb/search/+
161
+ #
162
+ # @param country_code [String] ISO 3166-1 alpha-2 code of the country whose company registry to search. For
163
+ # example, `GB`. Where company registries operate at state or province level, append the ISO 3166-2 subdivision
164
+ # code as `XX-YY`: `US-CA` searches the California registry. United States searches always require the
165
+ # subdivision - a bare `US` is rejected. Case-insensitive; normalized to upper case.
166
+ # @param name [String] Company name to search for. Either `name` or `registration_number` is required.
167
+ # @param registration_number [String] Registry registration number to search for. Either `name` or
168
+ # `registration_number` is required.
169
+ # @param tier [String] Registry tier whose provider chain this search runs on. `basic` (default) searches the
170
+ # country's Lite chain; `shareholders` and `ubo` search that tier's ownership chain, which can be a different
171
+ # source, so an empty Lite search does not prove the registry lacks the company. A country that does not offer
172
+ # the named tier is searched at the highest tier it offers up to that one. Retrieve the candidate...
173
+ # @param search_type [String] Name-matching strategy applied by the registry search. `contains` is the only
174
+ # accepted value: no registry source behind the search offers a prefix or fuzzy mode, so `start_with` and
175
+ # `fuzzy` are rejected with `400` (`not a valid choice`).
176
+ # @param vendor_data [String] Your identifier for this lookup; echoed back and included in the webhook callback.
177
+ # @param metadata [Hash, nil] Free-form JSON; echoed back and included in the webhook callback.
178
+ # @param webhook_url [String] Switches the search to asynchronous mode: the API returns immediately and POSTs an
179
+ # unsigned `kyb.registry_search.resolved` callback to this URL when the candidate list is ready.
180
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
181
+ # @return [Didit::Types::KybSearchResponse]
182
+ def search(
183
+ country_code:,
184
+ name: OMIT,
185
+ registration_number: OMIT,
186
+ tier: OMIT,
187
+ search_type: OMIT,
188
+ vendor_data: OMIT,
189
+ metadata: OMIT,
190
+ webhook_url: OMIT,
191
+ request_options: nil
192
+ )
193
+ @client.request(
194
+ :post,
195
+ "/v3/kyb/search/",
196
+ body: {
197
+ "country_code" => country_code,
198
+ "name" => name,
199
+ "registration_number" => registration_number,
200
+ "tier" => tier,
201
+ "search_type" => search_type,
202
+ "vendor_data" => vendor_data,
203
+ "metadata" => metadata,
204
+ "webhook_url" => webhook_url
205
+ },
206
+ response: Types::KybSearchResponse,
207
+ request_options: request_options
208
+ )
209
+ end
210
+
211
+ # KYB registry company select - Lite tier (standalone)
212
+ #
213
+ # Retrieve the **Lite** registry profile of one candidate returned by `POST /v3/kyb/search/` - company details,
214
+ # registered address, identifiers, status, activity and the officers, plus the raw registry payload.
215
+ # Shareholders and ultimate beneficial owners are sold by `POST /v3/kyb/shareholders/` and `POST /v3/kyb/ubo/`.
216
+ #
217
+ # **Pairing with search.** Pass the candidate's `kyb_response_id` exactly as returned by a search of the same
218
+ # application. The handle is ephemeral and scoped to that search - select promptly, and re-search for a fresh
219
+ # handle rather than storing it.
220
+ #
221
+ # **Billing.** Each select is billed at the country's Lite price (any search fee is separate); see [KYB registry
222
+ # pricing](/getting-started/kyb-registry-pricing). The balance is checked before any registry call (`403` when
223
+ # short) and the charge is recorded against the created business session.
224
+ #
225
+ # **Persistence is mandatory.** Every select creates a business session (its id is the `request_id`) so billing
226
+ # and retrieval can be tracked; it appears in the console. `save_api_request` is accepted for symmetry but must
227
+ # be `true` (the default) - sending `false` returns `400`.
228
+ #
229
+ # +POST /v3/kyb/select/+
230
+ #
231
+ # @param kyb_response_id [String] Candidate handle from `POST /v3/kyb/search/`
232
+ # (`kyb_registry.companies[].kyb_response_id`). Ephemeral - use it shortly after the search that produced it.
233
+ # @param vendor_data [String] Your identifier for this company; echoed back and stored with the business
234
+ # session.
235
+ # @param metadata [Hash, nil] Free-form JSON stored with the business session and echoed back.
236
+ # @param save_api_request [Boolean] Must be `true` (the default). KYB registry selects are always persisted so
237
+ # billing and retrieval can be tracked; `false` returns `400`.
238
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
239
+ # @return [Didit::Types::KybSelectResponse]
240
+ def select(kyb_response_id:, vendor_data: OMIT, metadata: OMIT, save_api_request: OMIT, request_options: nil)
241
+ @client.request(
242
+ :post,
243
+ "/v3/kyb/select/",
244
+ body: {
245
+ "kyb_response_id" => kyb_response_id,
246
+ "vendor_data" => vendor_data,
247
+ "metadata" => metadata,
248
+ "save_api_request" => save_api_request
249
+ },
250
+ response: Types::KybSelectResponse,
251
+ request_options: request_options
252
+ )
253
+ end
254
+ end
255
+ end
256
+ end
@@ -0,0 +1,332 @@
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 +lists+ resource.
7
+ class Lists < Didit::Resource
8
+ # @return [Didit::Resources::Lists::Entries]
9
+ def entries
10
+ @entries ||= Entries.new(@client)
11
+ end
12
+
13
+ # Create a list
14
+ #
15
+ # Creates an allowlist or a custom list in the application the API key belongs to. Blocklists cannot be created:
16
+ # Didit provisions one system blocklist per entry type, and you add to it with [Create a list
17
+ # entry](https://docs.didit.me/management-api/lists/create-entry). `entry_type` cannot change after creation and
18
+ # decides how entry values are validated and matched. Allowlist entries mark matching items as trusted (for
19
+ # example, a face allowlist skips the duplicated-face action) and never override a blocklist match; reference
20
+ # any list from a workflow or transaction rule condition with `value_type: "list"`. A scoped API key needs
21
+ # `workflows: write`.
22
+ #
23
+ # +POST /v3/lists/+
24
+ #
25
+ # @param name [String] List name. Must differ from the name of every other list of the application, system lists
26
+ # included.
27
+ # @param list_type [String] `allowlist` or `custom`. `blocklist` is refused with `400`.
28
+ # @param entry_type [String] What the list holds: `face`, `document` (document number), `phone`, `email`,
29
+ # `ip_address` (IP address or CIDR range), `device_fingerprint`, `wallet_address`, `bank_account`, `country`
30
+ # (ISO 3166-1 alpha-3), `user` or `business` (your `vendor_data`), or `key` (any string). It decides how entry
31
+ # values are validated and matched. Cannot be changed later.
32
+ # @param description [String] Optional free-text description.
33
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
34
+ # @return [Didit::Types::ComplianceList]
35
+ def create(name:, list_type:, entry_type:, description: OMIT, request_options: nil)
36
+ @client.request(
37
+ :post,
38
+ "/v3/lists/",
39
+ body: {
40
+ "name" => name,
41
+ "list_type" => list_type,
42
+ "entry_type" => entry_type,
43
+ "description" => description
44
+ },
45
+ response: Types::ComplianceList,
46
+ request_options: request_options
47
+ )
48
+ end
49
+
50
+ # Delete a list
51
+ #
52
+ # Deletes an allowlist or custom list together with its entries. Deletion is irreversible: the list and its
53
+ # entries no longer appear in any read, and workflow and transaction rule conditions that reference the list
54
+ # evaluate it as an empty list from then on. Sessions and transactions already evaluated keep their results, and
55
+ # the name can be reused for a new list. System lists cannot be deleted and return `400`; to empty one, [delete
56
+ # its entries](https://docs.didit.me/management-api/lists/delete-entry). A scoped API key needs `workflows:
57
+ # write`.
58
+ #
59
+ # +DELETE /v3/lists/{list_uuid}/+
60
+ #
61
+ # @param list_uuid [String] UUID of the list, as returned by List lists or Create a list.
62
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
63
+ # @return [nil]
64
+ def delete(list_uuid, request_options: nil)
65
+ @client.request(
66
+ :delete,
67
+ "/v3/lists/{list_uuid}/",
68
+ path_params: { "list_uuid" => list_uuid },
69
+ request_options: request_options
70
+ )
71
+ end
72
+
73
+ # List lists
74
+ #
75
+ # Returns the application's lists, newest first: the system lists Didit provisions (one blocklist per entry
76
+ # type, the **High Risk Countries** custom list, and any system allowlist) and the allowlists and custom lists
77
+ # you created. Filter with `list_type` and `entry_type`; deleted lists never appear. Results are paginated with
78
+ # `limit` and `offset`. A scoped API key needs `workflows: read`. See
79
+ # [Lists](https://docs.didit.me/management-api/lists/overview) for what each list type does.
80
+ #
81
+ # +GET /v3/lists/+
82
+ #
83
+ # @param list_type [String] Only lists of this type.
84
+ # @param entry_type [String] Only lists of this entry type.
85
+ # @param ordering [String] Sort order: `-created_at` (newest first, the default) or `created_at` (oldest first).
86
+ # @param limit [Integer] Page size. Defaults to 50. A value above 1000000 returns `400`; zero, a negative or a
87
+ # non-numeric value falls back to 50.
88
+ # @param offset [Integer] Zero-based index of the first item to return. Prefer following `next`. A value above
89
+ # 1000000 returns `400`; a negative or non-numeric value falls back to 0.
90
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
91
+ # @return [Didit::Page<Didit::Types::ComplianceList>]
92
+ def list(list_type: OMIT, entry_type: OMIT, ordering: OMIT, limit: OMIT, offset: OMIT, request_options: nil)
93
+ @client.request(
94
+ :get,
95
+ "/v3/lists/",
96
+ query: {
97
+ "list_type" => list_type,
98
+ "entry_type" => entry_type,
99
+ "ordering" => ordering,
100
+ "limit" => limit,
101
+ "offset" => offset
102
+ },
103
+ page: Types::ComplianceList,
104
+ request_options: request_options
105
+ )
106
+ end
107
+
108
+ # Get a list
109
+ #
110
+ # Returns one list of the application with its entry count and when its newest entry was added. A list of
111
+ # another application, or one that was deleted, returns `404`. This returns the list only: read its values with
112
+ # [List list entries](https://docs.didit.me/management-api/lists/list-entries). A scoped API key needs
113
+ # `workflows: read`.
114
+ #
115
+ # +GET /v3/lists/{list_uuid}/+
116
+ #
117
+ # @param list_uuid [String] UUID of the list, as returned by List lists or Create a list.
118
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
119
+ # @return [Didit::Types::ComplianceList]
120
+ def retrieve(list_uuid, request_options: nil)
121
+ @client.request(
122
+ :get,
123
+ "/v3/lists/{list_uuid}/",
124
+ path_params: { "list_uuid" => list_uuid },
125
+ response: Types::ComplianceList,
126
+ request_options: request_options
127
+ )
128
+ end
129
+
130
+ # Update a list
131
+ #
132
+ # Renames a list or changes its description. Only `name` and `description` are read; any other field is ignored,
133
+ # so `list_type` and `entry_type` keep the values they were created with. System lists cannot be modified and
134
+ # return `400`. The response contains only `name` and `description`: call [Get a
135
+ # list](https://docs.didit.me/management-api/lists/get) for the full list. A scoped API key needs `workflows:
136
+ # write`.
137
+ #
138
+ # +PATCH /v3/lists/{list_uuid}/+
139
+ #
140
+ # @param list_uuid [String] UUID of the list, as returned by List lists or Create a list.
141
+ # @param name [String] New name. Must differ from the name of every other list of the application.
142
+ # @param description [String] New description. Send an empty string to clear it.
143
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
144
+ # @return [Didit::Types::ListsUpdateResponse]
145
+ def update(list_uuid, name: OMIT, description: OMIT, request_options: nil)
146
+ @client.request(
147
+ :patch,
148
+ "/v3/lists/{list_uuid}/",
149
+ path_params: { "list_uuid" => list_uuid },
150
+ body: {
151
+ "name" => name,
152
+ "description" => description
153
+ },
154
+ response: Types::ListsUpdateResponse,
155
+ request_options: request_options
156
+ )
157
+ end
158
+
159
+ # The +lists.entries+ resource.
160
+ class Entries < Didit::Resource
161
+ # Create a list entry
162
+ #
163
+ # Adds one entry to a list, in one of three ways: by `value`; from a verification session with
164
+ # `reference_session_id`, where Didit reads the value from the session's most recent record of the list's
165
+ # entry type and links the entry to it; or by `value` with a `reference_object_uuid` and
166
+ # `metadata.reference_type` pointing back to a transaction, user or business. On the system face, document,
167
+ # phone and email blocklists, the record read from the session is also flagged as blocklisted, so new matching
168
+ # sessions are declined; on the system user and business blocklists, matching users or businesses are set to
169
+ # `BLOCKED`. Sessions and transactions that already finished are not changed. A scoped API key needs
170
+ # `workflows: write`. See [Create a list entry](https://docs.didit.me/management-api/lists/create-entry) for
171
+ # each mode.
172
+ #
173
+ # +POST /v3/lists/{list_uuid}/entries/+
174
+ #
175
+ # @param list_uuid [String] UUID of the list to add to. For a face you only have as an image, use Upload a
176
+ # face to a list instead.
177
+ # @param value [String] The value to list, validated against the list's `entry_type`: `email` a valid email
178
+ # address; `phone` a valid international number, stored in E.164; `ip_address` an IP address or CIDR range
179
+ # (for example `10.0.0.0/8`); `device_fingerprint` at least 8 characters among letters, digits, `-`, `_`, `:`
180
+ # and `.` (a blocklist refuses a fingerprint that several distinct devices have reported); `country` an...
181
+ # @param reference_session_id [String] A person or business verification session of your application to take
182
+ # the value from. Didit reads the session's most recent record of the list's entry type (`face`, `document`,
183
+ # `phone`, `email`, `ip_address` or `device_fingerprint`), links the entry to the session and to that record,
184
+ # and fills `display_label` and `metadata` for documents. For a `device_fingerprint` blocklist, a session that
185
+ # only...
186
+ # @param reference_object_uuid [String] UUID of the record the entry stands for when it does not come from a
187
+ # session: a transaction UUID, or the `didit_internal_id` of a user or business. Pair it with
188
+ # `metadata.reference_type`. Replaced by the session's record when `reference_session_id` provides one.
189
+ # @param face_image_source [String] Face lists with `reference_session_id`: which of the session's images the
190
+ # face is taken from. `liveness` (default) is the liveness selfie. `front_image_camera_front` and
191
+ # `back_image_camera_front` are the selfies the front camera took while the user photographed the front or
192
+ # back of their document: accepted only on the system face blocklist, with `reference_session_id` and an empty
193
+ # `value`. Each s...
194
+ # @param reference_node_id [String, nil] With a document-capture `face_image_source`: the ID verification node
195
+ # whose selfie to use, for workflows with more than one. Defaults to the most recent ID verification that has
196
+ # that image. Refused with `liveness`.
197
+ # @param display_label [String] Human-readable label. When empty, Didit derives one from the session where it
198
+ # can (for example the holder's name and document number).
199
+ # @param comment [String] Free-text note, such as the reason for listing.
200
+ # @param metadata [Hash] Free-form JSON stored with the entry and returned as stored. Use `reference_type` and
201
+ # `reference_id` so the console links back to the source. `reference_image_url` and `front_image_url` are set
202
+ # by Didit only and are dropped if you send them. For an entry read from a session, Didit's keys are merged
203
+ # with yours.
204
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
205
+ # @return [Didit::Types::ComplianceListEntry]
206
+ def create(
207
+ list_uuid,
208
+ value: OMIT,
209
+ reference_session_id: OMIT,
210
+ reference_object_uuid: OMIT,
211
+ face_image_source: OMIT,
212
+ reference_node_id: OMIT,
213
+ display_label: OMIT,
214
+ comment: OMIT,
215
+ metadata: OMIT,
216
+ request_options: nil
217
+ )
218
+ @client.request(
219
+ :post,
220
+ "/v3/lists/{list_uuid}/entries/",
221
+ path_params: { "list_uuid" => list_uuid },
222
+ body: {
223
+ "value" => value,
224
+ "reference_session_id" => reference_session_id,
225
+ "reference_object_uuid" => reference_object_uuid,
226
+ "face_image_source" => face_image_source,
227
+ "reference_node_id" => reference_node_id,
228
+ "display_label" => display_label,
229
+ "comment" => comment,
230
+ "metadata" => metadata
231
+ },
232
+ response: Types::ComplianceListEntry,
233
+ request_options: request_options
234
+ )
235
+ end
236
+
237
+ # Delete a list entry
238
+ #
239
+ # Deletes one entry from a list, system lists included. The entry stops matching at once, and deletion is
240
+ # irreversible: to list the value again, create a new entry. On a system face, document, phone or email
241
+ # blocklist, the record the entry stands for is no longer flagged as blocklisted; on the system user or
242
+ # business blocklist, users or businesses of the application whose `vendor_data` equals the entry's value (or
243
+ # whose `didit_internal_id` equals its `reference_object_uuid`) and that are `BLOCKED` return to `ACTIVE`.
244
+ # Sessions and transactions that already finished keep their status. A scoped API key needs `workflows:
245
+ # write`.
246
+ #
247
+ # +DELETE /v3/lists/{list_uuid}/entries/{entry_uuid}/+
248
+ #
249
+ # @param list_uuid [String] UUID of the list that holds the entry.
250
+ # @param entry_uuid [String] UUID of the entry, as returned by List list entries or Create a list entry.
251
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
252
+ # @return [nil]
253
+ def delete(list_uuid, entry_uuid, request_options: nil)
254
+ @client.request(
255
+ :delete,
256
+ "/v3/lists/{list_uuid}/entries/{entry_uuid}/",
257
+ path_params: { "list_uuid" => list_uuid, "entry_uuid" => entry_uuid },
258
+ request_options: request_options
259
+ )
260
+ end
261
+
262
+ # List list entries
263
+ #
264
+ # Returns the current entries of one list, newest first. `search` matches part of an entry's `value` or
265
+ # `display_label` without regard to case, and `reference_session_id` narrows the results to the entries taken
266
+ # from one person verification session. Image URLs in `metadata` are short-lived signed URLs issued again on
267
+ # every call; a scoped API key without `media: read` receives `null` in their place. A scoped API key needs
268
+ # `workflows: read`.
269
+ #
270
+ # +GET /v3/lists/{list_uuid}/entries/+
271
+ #
272
+ # @param list_uuid [String] UUID of the list, as returned by List lists or Create a list.
273
+ # @param search [String] Case-insensitive text that the entry's `value` or `display_label` must contain.
274
+ # @param reference_session_id [String] Only the entries taken from this person verification session, for
275
+ # example to see which of its faces are already listed.
276
+ # @param limit [Integer] Page size. Defaults to 50. A value above 1000000 returns `400`; zero, a negative or a
277
+ # non-numeric value falls back to 50.
278
+ # @param offset [Integer] Zero-based index of the first item to return. Prefer following `next`. A value above
279
+ # 1000000 returns `400`; a negative or non-numeric value falls back to 0.
280
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
281
+ # @return [Didit::Page<Didit::Types::ComplianceListEntry>]
282
+ def list(list_uuid, search: OMIT, reference_session_id: OMIT, limit: OMIT, offset: OMIT, request_options: nil)
283
+ @client.request(
284
+ :get,
285
+ "/v3/lists/{list_uuid}/entries/",
286
+ path_params: { "list_uuid" => list_uuid },
287
+ query: {
288
+ "search" => search,
289
+ "reference_session_id" => reference_session_id,
290
+ "limit" => limit,
291
+ "offset" => offset
292
+ },
293
+ page: Types::ComplianceListEntry,
294
+ request_options: request_options
295
+ )
296
+ end
297
+
298
+ # Upload a face to a list
299
+ #
300
+ # Adds a face to a face blocklist or face allowlist from a base64-encoded JPEG or PNG image, for when you have
301
+ # no verification session to reference. Didit detects the faces in the image, uses the largest one, and
302
+ # creates an entry whose `value` and `reference_object_uuid` are the UUID of the new face. A blocklisted face
303
+ # declines new sessions whose face matches; an allowlisted face skips the duplicated-face action and never
304
+ # overrides a blocklist match. In a sandbox application the image is not analyzed and the entry matches
305
+ # nothing. A scoped API key needs `workflows: write`. To list a face from an existing session, use [Create a
306
+ # list entry](https://docs.didit.me/management-api/lists/create-entry) with `reference_session_id` instead.
307
+ #
308
+ # +POST /v3/lists/{list_uuid}/entries/face-upload/+
309
+ #
310
+ # @param list_uuid [String] UUID of a list with `entry_type: face` and `list_type: blocklist` or `allowlist`.
311
+ # @param image [String] Base64-encoded JPEG or PNG, at most 2 MB once decoded, showing a clearly visible face.
312
+ # Send the bare base64 string, without a `data:image/...;base64,` prefix.
313
+ # @param comment [String] Optional free-text note, such as the reason for listing.
314
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
315
+ # @return [Didit::Types::ComplianceListEntry]
316
+ def upload_face(list_uuid, image:, comment: OMIT, request_options: nil)
317
+ @client.request(
318
+ :post,
319
+ "/v3/lists/{list_uuid}/entries/face-upload/",
320
+ path_params: { "list_uuid" => list_uuid },
321
+ body: {
322
+ "image" => image,
323
+ "comment" => comment
324
+ },
325
+ response: Types::ComplianceListEntry,
326
+ request_options: request_options
327
+ )
328
+ end
329
+ end
330
+ end
331
+ end
332
+ end