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,981 @@
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 +transactions+ resource.
7
+ class Transactions < Didit::Resource
8
+ # @return [Didit::Resources::Transactions::Notes]
9
+ def notes
10
+ @notes ||= Notes.new(@client)
11
+ end
12
+
13
+ # @return [Didit::Resources::Transactions::Rules]
14
+ def rules
15
+ @rules ||= Rules.new(@client)
16
+ end
17
+
18
+ # @return [Didit::Resources::Transactions::TravelRule]
19
+ def travel_rule
20
+ @travel_rule ||= TravelRule.new(@client)
21
+ end
22
+
23
+ # Batch delete transactions
24
+ #
25
+ # Delete one or more transactions permanently. Select them with `transaction_uuids`, or delete every transaction
26
+ # in the application with `delete_all: true`.
27
+ #
28
+ # A deleted transaction goes with the records that are only its own: its parties, tags, notes, payment method
29
+ # links, documents and every stored version of their files, rule runs, alerts, provider results, network
30
+ # snapshot and Travel Rule data. Cases, people and companies stay; their link to the deleted transaction is
31
+ # cleared. Draft regulatory reports stop listing it and are rebuilt without it. Deletion is permanent and
32
+ # irreversible; there is no undo endpoint.
33
+ #
34
+ # If any selected transaction is listed in a finalized regulatory report, the whole request is refused with
35
+ # `409` and nothing is deleted. The body uses `code: in_filed_report` and names each transaction and the reports
36
+ # that list it. Delete those reports, then repeat the request.
37
+ #
38
+ # +DELETE /v3/organization/{organization_id}/application/{application_id}/transactions/delete/+
39
+ #
40
+ # @param body [Hash]
41
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
42
+ # @return [nil]
43
+ def batch_delete(body:, request_options: nil)
44
+ @client.request(
45
+ :delete,
46
+ "/v3/organization/{organization_id}/application/{application_id}/transactions/delete/",
47
+ body: body,
48
+ scope: :application,
49
+ request_options: request_options
50
+ )
51
+ end
52
+
53
+ # Create transaction
54
+ #
55
+ # Submit a transaction for synchronous AML/risk monitoring. The transaction is created `APPROVED`, then your
56
+ # rules (and crypto screening, when applicable) run inline and may flip the returned `status` to `IN_REVIEW` or
57
+ # `DECLINED`. **`transaction_id` is your idempotency key** (max 128 chars, unique per app); reusing it returns
58
+ # 400. A `transaction.created` webhook is dispatched on success for live applications. Sandbox applications are
59
+ # not billed and do not emit `transaction.created` or `transaction.status.updated` webhooks. Sandbox Travel Rule
60
+ # exchanges do emit `travel_rule.status.updated` webhooks with `environment: sandbox`. A Travel Rule transfer is
61
+ # stored and returned before any counterparty is contacted: `travel_rule.status` comes back
62
+ # `AWAITING_COUNTERPARTY` (or `NOT_APPLICABLE` below your threshold, `UNCONFIRMED_OWNERSHIP` for a declared
63
+ # self-hosted wallet, `COMPLETED` when the other wallet is your own verified wallet) and `travel_rule.protocol`
64
+ # is null. Didit then chooses the rail and sends the exchange, and every later status change of the transfer,
65
+ # including `COUNTERPARTY_VASP_NOT_FOUND` when no rail reaches the counterparty, arrives as a
66
+ # `travel_rule.status.updated` webhook. Your rules run again when the rail or the status changes.
67
+ #
68
+ # +POST /v3/transactions/+
69
+ #
70
+ # @param transaction_id [String] Your unique identifier for this transaction (max 128 characters).
71
+ # @param transaction_category [String] Category of the transaction. CamelCase aliases (`travelRule`,
72
+ # `userPlatformEvent`, `gamblingBet`, …) are also accepted; the stored/echoed value is camelCase for multi-word
73
+ # categories.
74
+ # @param transaction_details [Hash] Core financial details of the transaction.
75
+ # @param subject [Hash] The subject (applicant) of the transaction.
76
+ # @param transaction_at [Time, String] When the transaction occurred. Defaults to now if omitted.
77
+ # @param time_zone [String] IANA time zone identifier, e.g. `Europe/Madrid`.
78
+ # @param counterparty [Hash] The counterparty of the transaction (optional).
79
+ # @param custom_properties [Hash] Arbitrary key-value pairs attached to the transaction. Each key can be
80
+ # referenced in rule conditions with the field path `custom_values.<key>`.
81
+ # @param travel_rule_details [Hash] Travel Rule data. When Travel Rule is enabled and transaction_category is
82
+ # travel_rule, Didit runs the exchange itself: it ignores status, protocol, required and obligations_count, and
83
+ # uses originator_data, beneficiary_data and metadata. Otherwise Didit stores these values as a passive Travel
84
+ # Rule record. While Travel Rule is on, an outbound transfer at or above your threshold must carry what its...
85
+ # @param network_snapshot [Hash] Pre-computed network graph snapshot.
86
+ # @param include_crypto_screening [Boolean, nil] Per-transaction override for crypto blockchain analytics
87
+ # screening. When `true`, crypto screening is performed regardless of the application default. When `false`,
88
+ # crypto screening is skipped even if enabled in the application settings. When omitted or `null`, the
89
+ # application-level default configured in the Console is used. Crypto screening requires
90
+ # `transaction_details.direction`, `currency_kind...
91
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
92
+ # @return [Didit::Types::TransactionDetail]
93
+ def create(
94
+ transaction_id:,
95
+ transaction_category:,
96
+ transaction_details:,
97
+ subject:,
98
+ transaction_at: OMIT,
99
+ time_zone: OMIT,
100
+ counterparty: OMIT,
101
+ custom_properties: OMIT,
102
+ travel_rule_details: OMIT,
103
+ network_snapshot: OMIT,
104
+ include_crypto_screening: OMIT,
105
+ request_options: nil
106
+ )
107
+ @client.request(
108
+ :post,
109
+ "/v3/transactions/",
110
+ body: {
111
+ "transaction_id" => transaction_id,
112
+ "transaction_category" => transaction_category,
113
+ "transaction_details" => transaction_details,
114
+ "subject" => subject,
115
+ "transaction_at" => transaction_at,
116
+ "time_zone" => time_zone,
117
+ "counterparty" => counterparty,
118
+ "custom_properties" => custom_properties,
119
+ "travel_rule_details" => travel_rule_details,
120
+ "network_snapshot" => network_snapshot,
121
+ "include_crypto_screening" => include_crypto_screening
122
+ },
123
+ response: Types::TransactionDetail,
124
+ request_options: request_options
125
+ )
126
+ end
127
+
128
+ # Mint an SDK transaction token
129
+ #
130
+ # Mint a short-lived scoped token your app passes to the Didit SDKs so they can submit transactions directly
131
+ # from the end-user's device via `POST /v1/transactions/`. The token is bound to one `vendor_data` (your user
132
+ # id): every transaction submitted with it has its subject identity enforced server-side from that binding, so a
133
+ # tampered client cannot submit on behalf of another user. Mint tokens from your backend - never ship the API
134
+ # key itself in an app. camelCase aliases (`vendorData`, `ttlSeconds`, `maxUses`) are also accepted.
135
+ #
136
+ # +POST /v3/transactions/sdk-token/+
137
+ #
138
+ # @param vendor_data [String] Your internal identifier for the end user this token is scoped to. Enforced as the
139
+ # subject identity of every transaction submitted with the token.
140
+ # @param ttl_seconds [Integer] Token lifetime in seconds. Defaults to 900 (15 minutes); maximum 86400 (24
141
+ # hours).
142
+ # @param max_uses [Integer, nil] Maximum number of successful submissions allowed with this token. Omit or null
143
+ # for unlimited uses within the TTL.
144
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
145
+ # @return [Didit::Types::TransactionsCreateSdkTokenResponse]
146
+ def create_sdk_token(vendor_data:, ttl_seconds: OMIT, max_uses: OMIT, request_options: nil)
147
+ @client.request(
148
+ :post,
149
+ "/v3/transactions/sdk-token/",
150
+ body: {
151
+ "vendor_data" => vendor_data,
152
+ "ttl_seconds" => ttl_seconds,
153
+ "max_uses" => max_uses
154
+ },
155
+ response: Types::TransactionsCreateSdkTokenResponse,
156
+ request_options: request_options
157
+ )
158
+ end
159
+
160
+ # Download a transaction PDF report
161
+ #
162
+ # Render one monitored transaction as a PDF report: overview and verdict, parties and payment methods, custom
163
+ # properties, alerts and rule runs, screening and Travel Rule results, the network summary, the cost breakdown,
164
+ # up to 50 related transactions and the 20 most recent activity entries. The body is the PDF itself
165
+ # (`application/pdf`), not JSON.
166
+ #
167
+ # The report is rendered from the transaction's current data on every call, so request it again after a status
168
+ # change. Nothing is stored and nothing is billed. Rendering can take a few seconds, so use a generous client
169
+ # timeout.
170
+ #
171
+ # This endpoint lives on an application-scoped path: put your organization ID and the ID of the application your
172
+ # API key belongs to in the URL ([find your organization
173
+ # ID](https://docs.didit.me/getting-started/api-authentication#find-your-organization-id)). A PDF report counts
174
+ # as media: a scoped API key needs `media: read` and `transactions: read`, and a key limited to some workflows
175
+ # or to approved sessions cannot call it.
176
+ #
177
+ # +GET /v3/organization/{organization_id}/application/{application_id}/transactions/{transaction_uuid}/pdf/+
178
+ #
179
+ # @param transaction_uuid [String] Didit transaction UUID: the `uuid` returned by `POST /v3/transactions/` and
180
+ # `GET /v3/transactions/`. Your own `txn_id` is not accepted.
181
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
182
+ # @return [String, nil] the body bytes, or nil when a block receives the chunks
183
+ def generate_pdf(transaction_uuid, request_options: nil, &block)
184
+ @client.request(
185
+ :get,
186
+ "/v3/organization/{organization_id}/application/{application_id}/transactions/{transaction_uuid}/pdf/",
187
+ path_params: { "transaction_uuid" => transaction_uuid },
188
+ scope: :application,
189
+ response: :binary,
190
+ accept: "application/pdf, application/json",
191
+ request_options: request_options, &block
192
+ )
193
+ end
194
+
195
+ # List transactions
196
+ #
197
+ # Paginated list of monitored transactions, newest first (`txn_date` desc). `count` is capped at 100; use
198
+ # `total_transactions` for the true row count. This endpoint does not support filtering or search parameters.
199
+ #
200
+ # +GET /v3/transactions/+
201
+ #
202
+ # @param limit [Integer] Page size. Defaults to 50 when omitted. There is no enforced maximum, but keep pages
203
+ # small for latency.
204
+ # @param offset [Integer] Zero-based offset of the first record to return. Prefer following the `next` URL from
205
+ # the previous page.
206
+ # @param travel_rule_status [String] Return only transactions whose Travel Rule transfer is in this exact status
207
+ # (for example `ON_HOLD` or `AWAITING_COUNTERPARTY`). `count` follows this filter; `total_transactions` still
208
+ # counts every transaction in the application.
209
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
210
+ # @return [Didit::Page<Didit::Types::TransactionsListResponseResults>]
211
+ def list(limit: OMIT, offset: OMIT, travel_rule_status: OMIT, request_options: nil)
212
+ @client.request(
213
+ :get,
214
+ "/v3/transactions/",
215
+ query: {
216
+ "limit" => limit,
217
+ "offset" => offset,
218
+ "travel_rule_status" => travel_rule_status
219
+ },
220
+ page: Types::TransactionsListResponseResults,
221
+ request_options: request_options
222
+ )
223
+ end
224
+
225
+ # List networks for a transaction
226
+ #
227
+ # List the networks the transaction's backing KYC/KYB subject belongs to (resolved through the transaction's
228
+ # session or business session).
229
+ #
230
+ # +GET /v3/organization/{organization_id}/application/{application_id}/transactions/{transaction_uuid}/networks/+
231
+ #
232
+ # @param transaction_uuid [String] Transaction UUID.
233
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
234
+ # @return [Didit::Types::EntityNetworkMembershipList]
235
+ def list_networks(transaction_uuid, request_options: nil)
236
+ @client.request(
237
+ :get,
238
+ "/v3/organization/{organization_id}/application/{application_id}/transactions/{transaction_uuid}/networks/",
239
+ path_params: { "transaction_uuid" => transaction_uuid },
240
+ scope: :application,
241
+ response: Types::EntityNetworkMembershipList,
242
+ request_options: request_options
243
+ )
244
+ end
245
+
246
+ # List networks for a transaction party
247
+ #
248
+ # List the networks a transaction party (remitter, beneficiary, or counterparty) belongs to, resolved through
249
+ # the party itself rather than through the transaction's backing session.
250
+ #
251
+ # +GET /v3/organization/{organization_id}/application/{application_id}/transactions/{transaction_uuid}/parties/{transaction_party_uuid}/networks/+
252
+ #
253
+ # @param transaction_uuid [String] Transaction UUID.
254
+ # @param transaction_party_uuid [String] Transaction party UUID.
255
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
256
+ # @return [Didit::Types::EntityNetworkMembershipList]
257
+ def list_party_networks(transaction_uuid, transaction_party_uuid, request_options: nil)
258
+ @client.request(
259
+ :get,
260
+ "/v3/organization/{organization_id}/application/{application_id}/transactions/{transaction_uuid}/parties/{transaction_party_uuid}/networks/",
261
+ path_params: { "transaction_uuid" => transaction_uuid, "transaction_party_uuid" => transaction_party_uuid },
262
+ scope: :application,
263
+ response: Types::EntityNetworkMembershipList,
264
+ request_options: request_options
265
+ )
266
+ end
267
+
268
+ # List related transactions
269
+ #
270
+ # List the other transactions in your application that involve the same people or companies as this one. A
271
+ # transaction is related when any of its parties, in any role, has the same `vendor_data` as one of this
272
+ # transaction's parties. The transaction itself is never returned, and parties without `vendor_data` are
273
+ # ignored: when none of this transaction's parties has one, the result is always empty.
274
+ #
275
+ # Results use the summary shape of `GET /v3/transactions/`, newest first (`txn_date`, then `created_at`).
276
+ # Paginated with `limit` and `offset`; `count` is exact up to 100 and capped at 100 above that, so follow `next`
277
+ # until it is `null`.
278
+ #
279
+ # A scoped API key needs `transactions: read`; a key limited to some workflows or to approved sessions cannot
280
+ # call this endpoint. Send the same `vendor_data` for the same person or company on every
281
+ # [transaction](https://docs.didit.me/transaction-monitoring/transactions#subject-and-counterparty) to make this
282
+ # list complete.
283
+ #
284
+ # +GET /v3/transactions/{transaction_id}/related/+
285
+ #
286
+ # @param transaction_id [String] Didit transaction UUID: the `uuid` returned by `POST /v3/transactions/` and
287
+ # `GET /v3/transactions/`. Your own `txn_id` is not accepted.
288
+ # @param limit [Integer] Number of transactions per page. Defaults to 50. A value that is not a positive integer
289
+ # falls back to 50; a value above 1000000 returns `400`.
290
+ # @param offset [Integer] Zero-based position of the first transaction to return. Prefer following `next`. A
291
+ # value that is not a whole number falls back to 0; a value above 1000000 returns `400`.
292
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
293
+ # @return [Didit::Page<Didit::Types::TransactionSummary>]
294
+ def list_related(transaction_id, limit: OMIT, offset: OMIT, request_options: nil)
295
+ @client.request(
296
+ :get,
297
+ "/v3/transactions/{transaction_id}/related/",
298
+ path_params: { "transaction_id" => transaction_id },
299
+ query: {
300
+ "limit" => limit,
301
+ "offset" => offset
302
+ },
303
+ page: Types::TransactionSummary,
304
+ request_options: request_options
305
+ )
306
+ end
307
+
308
+ # Get transaction
309
+ #
310
+ # Retrieve the full monitoring record for one transaction: parties, score/severity, rule runs, alerts, Travel
311
+ # Rule outcome, remediation session.
312
+ #
313
+ # +GET /v3/transactions/{transaction_id}/+
314
+ #
315
+ # @param transaction_id [String] Didit-stable transaction UUID (the `uuid` returned from create / list, **not**
316
+ # your `txn_id`).
317
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
318
+ # @return [Didit::Types::TransactionDetail]
319
+ def retrieve(transaction_id, request_options: nil)
320
+ @client.request(
321
+ :get,
322
+ "/v3/transactions/{transaction_id}/",
323
+ path_params: { "transaction_id" => transaction_id },
324
+ response: Types::TransactionDetail,
325
+ request_options: request_options
326
+ )
327
+ end
328
+
329
+ # The +transactions.notes+ resource.
330
+ class Notes < Didit::Resource
331
+ # Create transaction note
332
+ #
333
+ # Add a plain-text note to a monitored transaction's review timeline, where Console reviewers see it. A note
334
+ # is context, not a decision: the transaction's `status`, `score` and alerts do not change, no webhook is
335
+ # sent, and nothing is billed. The transaction's `activities` gain a `TRANSACTION_NOTE_ADDED` entry.
336
+ #
337
+ # Notes created with an API key have no author: `actor_email` and `actor_name` are `null`, so put the author
338
+ # in the text if you need it. Every address in `mentioned_emails` must belong to a member of your
339
+ # organization, otherwise the whole request fails with `400`; mentions are stored lower-cased and
340
+ # de-duplicated, and this endpoint does not notify the mentioned members.
341
+ #
342
+ # Each call creates a new note, so retrying a timed-out request can add it twice: list the notes before
343
+ # retrying. There is no API endpoint to edit or remove a note. A scoped API key needs `transactions: write`; a
344
+ # key limited to some workflows or to approved sessions cannot call this endpoint.
345
+ #
346
+ # +POST /v3/transactions/{transaction_id}/notes/+
347
+ #
348
+ # @param transaction_id [String] Didit transaction UUID: the `uuid` returned by `POST /v3/transactions/` and
349
+ # `GET /v3/transactions/`. Your own `txn_id` is not accepted.
350
+ # @param note [String] Plain-text note. Leading and trailing whitespace is trimmed and a blank note is
351
+ # rejected. No length limit.
352
+ # @param mentioned_emails [Array<String>] Emails of members of your organization to mention. Each must be a
353
+ # valid email of an organization member.
354
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
355
+ # @return [Didit::Types::TransactionNote]
356
+ def create(transaction_id, note:, mentioned_emails: OMIT, request_options: nil)
357
+ @client.request(
358
+ :post,
359
+ "/v3/transactions/{transaction_id}/notes/",
360
+ path_params: { "transaction_id" => transaction_id },
361
+ body: {
362
+ "note" => note,
363
+ "mentioned_emails" => mentioned_emails
364
+ },
365
+ response: Types::TransactionNote,
366
+ request_options: request_options
367
+ )
368
+ end
369
+
370
+ # List transaction notes
371
+ #
372
+ # List the notes on one monitored transaction, newest first (`created_at` descending): notes you add through
373
+ # the API, notes and status changes reviewers make in the Console, and notes Didit adds automatically (a
374
+ # rule's `add_note` action, or a problem creating the user-action verification session), which carry
375
+ # `actor_name` `Rule Engine`. `metadata` tells the note types apart.
376
+ #
377
+ # Paginated with `limit` and `offset`. `count` is exact up to 100 and capped at 100 above that, so follow
378
+ # `next` until it is `null` instead of computing pages from `count`. This is a read with no side effects.
379
+ #
380
+ # A scoped API key needs `transactions: read`; a key limited to some workflows or to approved sessions cannot
381
+ # call this endpoint. Reviewers see the same list under **Notes** on the [transaction
382
+ # detail](https://docs.didit.me/transaction-monitoring/console#transaction-detail).
383
+ #
384
+ # +GET /v3/transactions/{transaction_id}/notes/+
385
+ #
386
+ # @param transaction_id [String] Didit transaction UUID: the `uuid` returned by `POST /v3/transactions/` and
387
+ # `GET /v3/transactions/`. Your own `txn_id` is not accepted.
388
+ # @param limit [Integer] Number of notes per page. Defaults to 50. A value that is not a positive integer
389
+ # falls back to 50; a value above 1000000 returns `400`.
390
+ # @param offset [Integer] Zero-based position of the first note to return. Prefer following `next`. A value
391
+ # that is not a whole number falls back to 0; a value above 1000000 returns `400`.
392
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
393
+ # @return [Didit::Page<Didit::Types::TransactionNote>]
394
+ def list(transaction_id, limit: OMIT, offset: OMIT, request_options: nil)
395
+ @client.request(
396
+ :get,
397
+ "/v3/transactions/{transaction_id}/notes/",
398
+ path_params: { "transaction_id" => transaction_id },
399
+ query: {
400
+ "limit" => limit,
401
+ "offset" => offset
402
+ },
403
+ page: Types::TransactionNote,
404
+ request_options: request_options
405
+ )
406
+ end
407
+ end
408
+
409
+ # The +transactions.rules+ resource.
410
+ class Rules < Didit::Resource
411
+ # Backtest rule configuration
412
+ #
413
+ # Evaluate a hypothetical rule configuration against your recent transactions (most recent first, up to the
414
+ # backtest cap) without creating a rule or touching any transaction. Use it before activating a rule to see
415
+ # how often it would have matched and how many subjects it would have affected.
416
+ #
417
+ # +POST /v3/transactions/rules/backtest/+
418
+ #
419
+ # @param conditions [Array<Hash>]
420
+ # @param aggregation [Array<Hash>]
421
+ # @param evaluation_mode [String]
422
+ # @param scope [Hash] Which transactions the rule applies to. Only these three keys are accepted.
423
+ # @param period_days [Integer]
424
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
425
+ # @return [Didit::Types::TransactionRuleBacktestResult]
426
+ def backtest(
427
+ conditions: OMIT,
428
+ aggregation: OMIT,
429
+ evaluation_mode: OMIT,
430
+ scope: OMIT,
431
+ period_days: OMIT,
432
+ request_options: nil
433
+ )
434
+ @client.request(
435
+ :post,
436
+ "/v3/transactions/rules/backtest/",
437
+ body: {
438
+ "conditions" => conditions,
439
+ "aggregation" => aggregation,
440
+ "evaluation_mode" => evaluation_mode,
441
+ "scope" => scope,
442
+ "period_days" => period_days
443
+ },
444
+ response: Types::TransactionRuleBacktestResult,
445
+ request_options: request_options
446
+ )
447
+ end
448
+
449
+ # Create rule
450
+ #
451
+ # Create a CUSTOM transaction-monitoring rule. Titles are unique per application (duplicate -> 400). A
452
+ # `change_status` action targeting `AWAITING_USER` must carry `workflow_id`. Rules created in ACTIVE mode
453
+ # apply to new transactions immediately - the recommended workflow is create in TEST mode, backtest, then
454
+ # switch mode to ACTIVE.
455
+ #
456
+ # +POST /v3/transactions/rules/+
457
+ #
458
+ # @param title [String] Rule name. Unique per application among non-deleted rules; duplicates return 400.
459
+ # @param category [String] Risk theme used for grouping and reporting, e.g. finance, aml_ctf,
460
+ # anomaly_detection, fatf, device_intelligence, crypto_monitoring, travel_rule, responsible_gaming,
461
+ # e_commerce.
462
+ # @param mode [String] ACTIVE evaluates live. TEST evaluates and records rule runs but never touches score or
463
+ # status - the recommended starting mode. DISABLED is skipped.
464
+ # @param description [String, nil]
465
+ # @param evaluation_mode [String] Whether every condition must match (ALL) or at least one (ANY). Ignored when
466
+ # conditions use group_index.
467
+ # @param scope [Hash] Which transactions the rule applies to. Only these three keys are accepted.
468
+ # @param conditions [Array<Hash>]
469
+ # @param aggregation [Array<Hash>]
470
+ # @param actions [Array<Hash>]
471
+ # @param metadata [Hash] Free-form metadata stored on the rule.
472
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
473
+ # @return [Didit::Types::TransactionRuleDetail]
474
+ def create(
475
+ title:,
476
+ category:,
477
+ mode:,
478
+ description: OMIT,
479
+ evaluation_mode: OMIT,
480
+ scope: OMIT,
481
+ conditions: OMIT,
482
+ aggregation: OMIT,
483
+ actions: OMIT,
484
+ metadata: OMIT,
485
+ request_options: nil
486
+ )
487
+ @client.request(
488
+ :post,
489
+ "/v3/transactions/rules/",
490
+ body: {
491
+ "title" => title,
492
+ "category" => category,
493
+ "mode" => mode,
494
+ "description" => description,
495
+ "evaluation_mode" => evaluation_mode,
496
+ "scope" => scope,
497
+ "conditions" => conditions,
498
+ "aggregation" => aggregation,
499
+ "actions" => actions,
500
+ "metadata" => metadata
501
+ },
502
+ response: Types::TransactionRuleDetail,
503
+ request_options: request_options
504
+ )
505
+ end
506
+
507
+ # Delete rule
508
+ #
509
+ # Delete a CUSTOM rule. Deletion is immediate and permanent: the rule stops evaluating for new transactions
510
+ # and disappears from listings, while past rule runs on already-evaluated transactions keep their recorded
511
+ # results. Library rules cannot be deleted - uninstall them via the install endpoint instead (they can always
512
+ # be reinstalled from the library).
513
+ #
514
+ # +DELETE /v3/transactions/rules/{rule_uuid}/+
515
+ #
516
+ # @param rule_uuid [String] The rule's uuid from list or create.
517
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
518
+ # @return [nil]
519
+ def delete(rule_uuid, request_options: nil)
520
+ @client.request(
521
+ :delete,
522
+ "/v3/transactions/rules/{rule_uuid}/",
523
+ path_params: { "rule_uuid" => rule_uuid },
524
+ request_options: request_options
525
+ )
526
+ end
527
+
528
+ # Install library rules
529
+ #
530
+ # Install one or more presets onto the application, by `library_keys` or a whole `bundle`. An installed preset
531
+ # is active at once while transaction monitoring is on, and disabled otherwise; already-installed keys are
532
+ # skipped. A library rule whose conditions read data the rules engine cannot evaluate yet is withheld until it
533
+ # can run. A request that names one in `library_keys` answers 400 and installs nothing ("These library rules
534
+ # cannot run yet: their conditions read data the rules engine cannot evaluate." followed by the keys), and a
535
+ # `bundle` install skips it. A withheld rule comes back on its own once its conditions can be evaluated. A
536
+ # `library_keys` entry that is not in the library is skipped, not refused.
537
+ #
538
+ # +POST /v3/transactions/rules/install/+
539
+ #
540
+ # @param library_keys [Array<String>] Specific presets to install or uninstall.
541
+ # @param bundle [String] Install or uninstall every preset in this bundle instead.
542
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
543
+ # @return [Didit::Types::TransactionRuleInstallResult]
544
+ def install_library(library_keys: OMIT, bundle: OMIT, request_options: nil)
545
+ @client.request(
546
+ :post,
547
+ "/v3/transactions/rules/install/",
548
+ body: {
549
+ "library_keys" => library_keys,
550
+ "bundle" => bundle
551
+ },
552
+ response: Types::TransactionRuleInstallResult,
553
+ request_options: request_options
554
+ )
555
+ end
556
+
557
+ # List rules
558
+ #
559
+ # List the application's transaction-monitoring rules: your custom rules plus any library presets you have
560
+ # installed. Filter by source, category, mode, bundle or free-text search; order with `ordering` (run_count,
561
+ # approved_pct, reviewed_pct, declined_pct, latest_triggered_at, title, created_at, source, each with an
562
+ # optional `-` prefix).
563
+ #
564
+ # +GET /v3/transactions/rules/+
565
+ #
566
+ # @param source [String] PRESET or CUSTOM
567
+ # @param category [String] Filter by rule category
568
+ # @param mode [String] ACTIVE, DISABLED or TEST
569
+ # @param bundle [String] Filter presets by bundle
570
+ # @param search [String] Case-insensitive match against title and description
571
+ # @param ordering [String] Comma-separated ordering fields, default source,-run_count
572
+ # @param limit [Integer] Page size
573
+ # @param offset [Integer] Page offset
574
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
575
+ # @return [Didit::Page<Didit::Types::TransactionRuleDetail>]
576
+ def list(
577
+ source: OMIT,
578
+ category: OMIT,
579
+ mode: OMIT,
580
+ bundle: OMIT,
581
+ search: OMIT,
582
+ ordering: OMIT,
583
+ limit: OMIT,
584
+ offset: OMIT,
585
+ request_options: nil
586
+ )
587
+ @client.request(
588
+ :get,
589
+ "/v3/transactions/rules/",
590
+ query: {
591
+ "source" => source,
592
+ "category" => category,
593
+ "mode" => mode,
594
+ "bundle" => bundle,
595
+ "search" => search,
596
+ "ordering" => ordering,
597
+ "limit" => limit,
598
+ "offset" => offset
599
+ },
600
+ page: Types::TransactionRuleDetail,
601
+ request_options: request_options
602
+ )
603
+ end
604
+
605
+ # List rule library
606
+ #
607
+ # Browse the full preset rule library (150+ rules) with each entry's complete configuration and an
608
+ # `is_installed` flag for this application. Filter by bundle, category, or free-text search. A library rule
609
+ # whose conditions read data the rules engine cannot evaluate yet is withheld until it can run. Withheld rules
610
+ # are not listed.
611
+ #
612
+ # +GET /v3/transactions/rules/library/+
613
+ #
614
+ # @param bundle [String] Filter by bundle, e.g. finance, aml_ctf, crypto_monitoring, travel_rule
615
+ # @param category [String] Filter by category
616
+ # @param search [String] Case-insensitive match against title and description
617
+ # @param limit [Integer] Page size
618
+ # @param offset [Integer] Page offset
619
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
620
+ # @return [Didit::Page<Didit::Types::TransactionRuleLibraryEntry>]
621
+ def list_library(bundle: OMIT, category: OMIT, search: OMIT, limit: OMIT, offset: OMIT, request_options: nil)
622
+ @client.request(
623
+ :get,
624
+ "/v3/transactions/rules/library/",
625
+ query: {
626
+ "bundle" => bundle,
627
+ "category" => category,
628
+ "search" => search,
629
+ "limit" => limit,
630
+ "offset" => offset
631
+ },
632
+ page: Types::TransactionRuleLibraryEntry,
633
+ request_options: request_options
634
+ )
635
+ end
636
+
637
+ # Get rule
638
+ #
639
+ # Retrieve one rule with its full configuration and execution counters.
640
+ #
641
+ # +GET /v3/transactions/rules/{rule_uuid}/+
642
+ #
643
+ # @param rule_uuid [String] The rule's uuid from list or create.
644
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
645
+ # @return [Didit::Types::TransactionRuleDetail]
646
+ def retrieve(rule_uuid, request_options: nil)
647
+ @client.request(
648
+ :get,
649
+ "/v3/transactions/rules/{rule_uuid}/",
650
+ path_params: { "rule_uuid" => rule_uuid },
651
+ response: Types::TransactionRuleDetail,
652
+ request_options: request_options
653
+ )
654
+ end
655
+
656
+ # Uninstall library rules
657
+ #
658
+ # Remove installed presets from the application, by `library_keys` or a whole `bundle`. Uninstalled presets
659
+ # stop evaluating immediately and can be reinstalled from the library at any time.
660
+ #
661
+ # +DELETE /v3/transactions/rules/install/+
662
+ #
663
+ # @param library_keys [Array<String>] Specific presets to install or uninstall.
664
+ # @param bundle [String] Install or uninstall every preset in this bundle instead.
665
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
666
+ # @return [Didit::Types::TransactionRuleInstallResult]
667
+ def uninstall_library(library_keys: OMIT, bundle: OMIT, request_options: nil)
668
+ @client.request(
669
+ :delete,
670
+ "/v3/transactions/rules/install/",
671
+ body: {
672
+ "library_keys" => library_keys,
673
+ "bundle" => bundle
674
+ },
675
+ response: Types::TransactionRuleInstallResult,
676
+ request_options: request_options
677
+ )
678
+ end
679
+
680
+ # Update rule
681
+ #
682
+ # Partially update a rule. Custom rules accept every configuration field. Library (PRESET) rules accept only
683
+ # `mode` - use it to activate, disable, or switch a preset to TEST; any other field returns 400. An installed
684
+ # copy of a withheld library rule is switched off: setting its `mode` to anything but `DISABLED` answers 400
685
+ # ("This library rule cannot run yet: its conditions read data the rules engine cannot evaluate.").
686
+ #
687
+ # +PATCH /v3/transactions/rules/{rule_uuid}/+
688
+ #
689
+ # @param rule_uuid [String] The rule's uuid from list or create.
690
+ # @param title [String] Rule name. Unique per application among non-deleted rules; duplicates return 400.
691
+ # @param description [String, nil]
692
+ # @param category [String] Risk theme used for grouping and reporting, e.g. finance, aml_ctf,
693
+ # anomaly_detection, fatf, device_intelligence, crypto_monitoring, travel_rule, responsible_gaming,
694
+ # e_commerce.
695
+ # @param mode [String] ACTIVE evaluates live. TEST evaluates and records rule runs but never touches score or
696
+ # status - the recommended starting mode. DISABLED is skipped.
697
+ # @param evaluation_mode [String] Whether every condition must match (ALL) or at least one (ANY). Ignored when
698
+ # conditions use group_index.
699
+ # @param scope [Hash] Which transactions the rule applies to. Only these three keys are accepted.
700
+ # @param conditions [Array<Hash>]
701
+ # @param aggregation [Array<Hash>]
702
+ # @param actions [Array<Hash>]
703
+ # @param metadata [Hash] Free-form metadata stored on the rule.
704
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
705
+ # @return [Didit::Types::TransactionRuleDetail]
706
+ def update(
707
+ rule_uuid,
708
+ title: OMIT,
709
+ description: OMIT,
710
+ category: OMIT,
711
+ mode: OMIT,
712
+ evaluation_mode: OMIT,
713
+ scope: OMIT,
714
+ conditions: OMIT,
715
+ aggregation: OMIT,
716
+ actions: OMIT,
717
+ metadata: OMIT,
718
+ request_options: nil
719
+ )
720
+ @client.request(
721
+ :patch,
722
+ "/v3/transactions/rules/{rule_uuid}/",
723
+ path_params: { "rule_uuid" => rule_uuid },
724
+ body: {
725
+ "title" => title,
726
+ "description" => description,
727
+ "category" => category,
728
+ "mode" => mode,
729
+ "evaluation_mode" => evaluation_mode,
730
+ "scope" => scope,
731
+ "conditions" => conditions,
732
+ "aggregation" => aggregation,
733
+ "actions" => actions,
734
+ "metadata" => metadata
735
+ },
736
+ response: Types::TransactionRuleDetail,
737
+ request_options: request_options
738
+ )
739
+ end
740
+ end
741
+
742
+ # The +transactions.travel_rule+ resource.
743
+ class TravelRule < Didit::Resource
744
+ # Confirm or deny wallet ownership
745
+ #
746
+ # Resolve a transfer that waits on wallet ownership: call it on your own side of the transfer when it is
747
+ # UNCONFIRMED_OWNERSHIP, or when it is an inbound transfer in ON_HOLD. Confirming marks the matching wallet
748
+ # address book entry as ownership-verified (for an inbound ON_HOLD transfer with no entry, Didit creates one
749
+ # from beneficiary_data.wallet_address) and runs the beneficiary name match on both sides of the transfer;
750
+ # denying declines both sides. An inbound transfer whose deposit already settled moves on to FINISHED when the
751
+ # match succeeds. When the counterparty wallet was declared self-hosted
752
+ # (counterparty.payment_method.method_type: unhosted_wallet), confirming records that the customer verified
753
+ # who controls that wallet and completes the transfer (COMPLETED) in both directions, or FINISHED for an
754
+ # inbound deposit whose on-chain hash is already known. The wallet verified is the counterparty's: the
755
+ # destination of an outbound withdrawal, or the source (originator's wallet) of an inbound deposit. If it is
756
+ # not in your wallet address book yet, Didit adds it as ownership-verified under the counterparty's name; if
757
+ # the book already holds it under a different holder name, the transfer moves to COUNTERPARTY_MISMATCHED_DATA.
758
+ # For an inbound TRP transfer in UNCONFIRMED_OWNERSHIP, ON_HOLD or COUNTERPARTY_MISMATCHED_DATA, Didit sends
759
+ # your decision to the originating VASP instead: approving returns the payment address (wallet_address, or the
760
+ # matched entry's address) and moves the transfer to COMPLETED, and denying declines it. The same call also
761
+ # decides an inbound transfer that a GTR or Sygna Bridge counterparty sent and that waits for your review
762
+ # (`UNCONFIRMED_OWNERSHIP`, `ON_HOLD` or `COUNTERPARTY_MISMATCHED_DATA`): `confirmed: true` approves it (pass
763
+ # `wallet_address` when the transfer names none) and `confirmed: false` declines it, and the network is
764
+ # answered after the response, with retries. VerifyVASP takes its answer when it asks, so a VerifyVASP
765
+ # transfer that would need your review is declined at once and cannot be decided later.
766
+ #
767
+ # +POST /v3/transactions/{transaction_id}/travel-rule/ownership/+
768
+ #
769
+ # @param transaction_id [String] Didit-stable UUID of the transaction your application holds for this
770
+ # transfer: the beneficiary side's transaction on an INTERNAL-rail transfer, or the transaction you created
771
+ # (outbound or inbound) when the counterparty wallet was declared self-hosted.
772
+ # @param confirmed [Boolean] true to confirm ownership, false to deny it.
773
+ # @param wallet_address [String] Inbound TRP transfers: the payment address Didit returns to the originating
774
+ # VASP when you approve. Defaults to the matched address book entry's address, then
775
+ # beneficiary_data.wallet_address. On a declared self-hosted wallet transfer that names no counterparty
776
+ # wallet, the wallet whose ownership you verified; without it the request is rejected with 400. Ignored for
777
+ # other transfers.
778
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
779
+ # @return [Didit::Types::TravelRuleTransferDetail]
780
+ def confirm_ownership(transaction_id, confirmed:, wallet_address: OMIT, request_options: nil)
781
+ @client.request(
782
+ :post,
783
+ "/v3/transactions/{transaction_id}/travel-rule/ownership/",
784
+ path_params: { "transaction_id" => transaction_id },
785
+ body: {
786
+ "confirmed" => confirmed,
787
+ "wallet_address" => wallet_address
788
+ },
789
+ response: Types::TravelRuleTransferDetail,
790
+ request_options: request_options
791
+ )
792
+ end
793
+
794
+ # Send a Travel Rule message or document request
795
+ #
796
+ # Sends a message or a document request to the counterparty VASP. Works on INTERNAL transfers (the other Didit
797
+ # customer sees it on its side of the pair) and EMAIL transfers (the counterparty is emailed and answers in
798
+ # the pickup portal). A transfer over TRP, GTR, TRUST, VerifyVASP or Sygna carries no messages, because those
799
+ # protocols have none. Limits: 100 messages per transfer, 5000 characters per body, 10 requested documents, 5
800
+ # files of 10 MB each.
801
+ #
802
+ # +POST /v3/transactions/{transaction_id}/travel-rule/messages/+
803
+ #
804
+ # @param transaction_id [String] Didit-stable transaction UUID that owns the transfer.
805
+ # @param kind [String]
806
+ # @param body [String] Required for a MESSAGE unless a file is attached.
807
+ # @param requested_documents [Array<String>] Required (at least one) for a DOCUMENT_REQUEST, and only allowed
808
+ # there.
809
+ # @param reply_to [String, nil] A message of the same transfer. A reply that carries a document fulfils the
810
+ # document request it answers.
811
+ # @param files [Array<Pathname, IO, String, Didit::FilePart>] Multipart only. Up to 5 files of 10 MB each.
812
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
813
+ # @return [Didit::Types::TravelRuleMessage]
814
+ def create_message(
815
+ transaction_id,
816
+ kind: OMIT,
817
+ body: OMIT,
818
+ requested_documents: OMIT,
819
+ reply_to: OMIT,
820
+ files: OMIT,
821
+ request_options: nil
822
+ )
823
+ @client.request(
824
+ :post,
825
+ "/v3/transactions/{transaction_id}/travel-rule/messages/",
826
+ path_params: { "transaction_id" => transaction_id },
827
+ body: {
828
+ "kind" => kind,
829
+ "body" => body,
830
+ "requested_documents" => requested_documents,
831
+ "reply_to" => reply_to,
832
+ "files" => files
833
+ },
834
+ response: Types::TravelRuleMessage,
835
+ request_options: request_options
836
+ )
837
+ end
838
+
839
+ # List Travel Rule messages
840
+ #
841
+ # Messages and document requests exchanged with the counterparty VASP about this transfer.
842
+ #
843
+ # +GET /v3/transactions/{transaction_id}/travel-rule/messages/+
844
+ #
845
+ # @param transaction_id [String] Didit-stable transaction UUID that owns the transfer.
846
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
847
+ # @return [Array<Didit::Types::TravelRuleMessage>]
848
+ def list_messages(transaction_id, request_options: nil)
849
+ @client.request(
850
+ :get,
851
+ "/v3/transactions/{transaction_id}/travel-rule/messages/",
852
+ path_params: { "transaction_id" => transaction_id },
853
+ response: [:array, Types::TravelRuleMessage],
854
+ request_options: request_options
855
+ )
856
+ end
857
+
858
+ # Trigger an inbound transfer from the Didit Test VASP (sandbox)
859
+ #
860
+ # Sandbox applications only. The Didit Test VASP sends your application an inbound Travel Rule transfer, so
861
+ # you can exercise the receiving side of an exchange end to end before going live. The transfer is booked and
862
+ # decided by the same logic a real inbound transfer from a network runs against your wallet address book, so
863
+ # the inbox, the decision and the wallet ownership flow behave as they do live. Nothing leaves Didit. A live
864
+ # application receives 400. Send the same `reference` again to get the transfer the first call booked instead
865
+ # of a second one.
866
+ #
867
+ # +POST /v3/travel-rule/test-vasp/inbound/+
868
+ #
869
+ # @param beneficiary_wallet_address [String] The destination wallet address. The Didit Test VASP sends to it,
870
+ # matched against your wallet address book on the chain of the asset. A wallet with no matching entry is
871
+ # accepted and the inbound transaction is booked ON_HOLD.
872
+ # @param scenario [String] What the Didit Test VASP declares the beneficiary to be. `accept` declares the
873
+ # holder's own name; `name_mismatch` declares a name no holder agrees with. The decision itself is always
874
+ # yours.
875
+ # @param chain [String] Chain of the asset.
876
+ # @param amount [String] Amount as a decimal string.
877
+ # @param currency [String] Asset code.
878
+ # @param reference [String] Optional idempotency key. A repeat with the same value returns the transfer the
879
+ # first call booked.
880
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
881
+ # @return [Didit::Types::TravelRuleTestVaspInboundResponse]
882
+ def trigger_test_vasp_inbound(
883
+ beneficiary_wallet_address:,
884
+ scenario: OMIT,
885
+ chain: OMIT,
886
+ amount: OMIT,
887
+ currency: OMIT,
888
+ reference: OMIT,
889
+ request_options: nil
890
+ )
891
+ @client.request(
892
+ :post,
893
+ "/v3/travel-rule/test-vasp/inbound/",
894
+ body: {
895
+ "beneficiary_wallet_address" => beneficiary_wallet_address,
896
+ "scenario" => scenario,
897
+ "chain" => chain,
898
+ "amount" => amount,
899
+ "currency" => currency,
900
+ "reference" => reference
901
+ },
902
+ response: Types::TravelRuleTestVaspInboundResponse,
903
+ request_options: request_options
904
+ )
905
+ end
906
+
907
+ # Finish, cancel, resend, or update the originator wallet of a Travel Rule transfer
908
+ #
909
+ # Provide `payment_txn_id` to report the on-chain hash and move an outbound COMPLETED transfer to FINISHED
910
+ # (its INTERNAL-rail counterpart also moves to FINISHED), `{"action": "cancel"}` to cancel a non-terminal
911
+ # transfer, or `{"action": "resend"}` to route an outbound transfer stuck in COUNTERPARTY_VASP_NOT_FOUND,
912
+ # COUNTERPARTY_VASP_NOT_REACHABLE, or NOT_ENOUGH_COUNTERPARTY_DATA again (improve the counterparty data first,
913
+ # e.g. add a travel_address to the destination wallet entry). resend applies to outbound transfers only.
914
+ # `{"action": "update_compliance_email", "compliance_email": "desk@example.com"}` replaces the compliance
915
+ # email of an outbound transfer in one of those three statuses, the fix for `reason: email_undeliverable`: the
916
+ # status does not change, and the next `resend` sends the request to that address. A resend is queued, not run
917
+ # inside the request: the response shows the transfer back in AWAITING_COUNTERPARTY with a `resend queued`
918
+ # timeline entry and a queued `delivery`, and where it went arrives as a `travel_rule.status.updated` webhook.
919
+ # When the transfer went over GTR, VerifyVASP or Sygna Bridge, the network learns the on-chain hash or the
920
+ # cancellation after the response, with retries; `delivery` shows how that message stands. `{"action":
921
+ # "update_originator_wallet", "wallet_address": "..."}` records the wallet the funds actually left from on an
922
+ # outbound transfer, for example the address a UTXO withdrawal was broadcast from rather than the main wallet
923
+ # you declared. It changes the record only: nothing is sent to the counterparty again and the status stays.
924
+ # The originator becomes `chain_details.originator` with `source: updated`, the change is added to the
925
+ # `timeline` with the previous and the new wallet, and the INTERNAL-rail counterpart of the transfer is
926
+ # updated the same way. `{"action": "beneficiary_vasp", "beneficiary_vasp": "<directory VASP id>"}` names the
927
+ # counterparty yourself when discovery could not, on an outbound transfer in COUNTERPARTY_VASP_NOT_FOUND,
928
+ # COUNTERPARTY_VASP_NOT_REACHABLE or NOT_ENOUGH_COUNTERPARTY_DATA: the transfer is routed to that VASP and
929
+ # sent again.
930
+ #
931
+ # +PATCH /v3/transactions/{transaction_id}/travel-rule/+
932
+ #
933
+ # @param transaction_id [String] Didit-stable transaction UUID that owns the transfer.
934
+ # @param payment_txn_id [String] The on-chain transaction hash. Requires the transfer to be an outbound
935
+ # transfer in COMPLETED status.
936
+ # @param action [String] "cancel" cancels a non-terminal transfer. "resend" re-runs routing for an outbound
937
+ # transfer stuck in COUNTERPARTY_VASP_NOT_FOUND, COUNTERPARTY_VASP_NOT_REACHABLE, or
938
+ # NOT_ENOUGH_COUNTERPARTY_DATA. "update_compliance_email" replaces the compliance email the request goes to,
939
+ # on an outbound transfer in one of those three statuses; send "resend" afterwards. "update_originator_wallet"
940
+ # records the walle...
941
+ # @param compliance_email [String] Required with `action: update_compliance_email`. Kept as this transfer's
942
+ # `beneficiary_data.counterparty_vasp_email`: it belongs to this transfer only and joins no directory entry
943
+ # and no contact list.
944
+ # @param wallet_address [String] With `action: update_originator_wallet`: the wallet the funds left from. When
945
+ # the transfer's UTXO inputs are known it must be one of them.
946
+ # @param memo [String] With `action: update_originator_wallet`: the wallet's memo or tag on a memo network.
947
+ # Optional.
948
+ # @param beneficiary_vasp [String] Required with action=beneficiary_vasp: the `id` of a directory VASP, from
949
+ # `GET /v3/travel-rule/vasps/`. Your choice outranks every automatic discovery step, which never overrides it.
950
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
951
+ # @return [Didit::Types::TravelRuleTransferDetail]
952
+ def update_transfer(
953
+ transaction_id,
954
+ payment_txn_id: OMIT,
955
+ action: OMIT,
956
+ compliance_email: OMIT,
957
+ wallet_address: OMIT,
958
+ memo: OMIT,
959
+ beneficiary_vasp: OMIT,
960
+ request_options: nil
961
+ )
962
+ @client.request(
963
+ :patch,
964
+ "/v3/transactions/{transaction_id}/travel-rule/",
965
+ path_params: { "transaction_id" => transaction_id },
966
+ body: {
967
+ "payment_txn_id" => payment_txn_id,
968
+ "action" => action,
969
+ "compliance_email" => compliance_email,
970
+ "wallet_address" => wallet_address,
971
+ "memo" => memo,
972
+ "beneficiary_vasp" => beneficiary_vasp
973
+ },
974
+ response: Types::TravelRuleTransferDetail,
975
+ request_options: request_options
976
+ )
977
+ end
978
+ end
979
+ end
980
+ end
981
+ end