didit-sdk 2.31.0 → 2.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9b9fe57b1e954e24e8b10a4655cb91a88826f91b8e3fd01f5771a85a7ea9539
4
- data.tar.gz: 7b8b02bb528aa50f60d67def59093d7dccabc9e4efda60bce30cdb02d2364cdc
3
+ metadata.gz: feebf4d057ad1b0edf9833789a19105ca8004ee9887c5b41a64d4aa94651a9a2
4
+ data.tar.gz: fa469796c25acda59792b999868c24f53ef2281b9dd53cc3cfba8311d51de18d
5
5
  SHA512:
6
- metadata.gz: abb3032b80f9b03a907fba8b4a75bc339c11dd5883a976f6a287f52b3bd22aaaa5397c292a482be06364bcb0760f6a8c084f66aa5f233e15c5bc976fb0ffb297
7
- data.tar.gz: c8dee5b0542a74af89f14ac8d2c07dbca2b47640e94501c9afabd2ad195610eac62538bd1fafcc49d68b3be362b1c17c48fc9d5d42f023a703a174129ab7d5cc
6
+ metadata.gz: 5d1b3d351c186a5e0a46bec11f8bf9f01f0d04a9e87958b5650322c96974d8ca2d155bd2a8b959342830666a17adfa125c8f62554e711dd1c914493432a827d9
7
+ data.tar.gz: 4973e8c66b43ecc89147a1a112abcdd2cfa43ca948a58ac5246836dbb99bf7ca6beb0a9ed4a89d41eecf186c4ad009623ded4fa1867dedcabb9040ccc5a6f10a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.33.0](https://github.com/didit-protocol/sdk-ruby/compare/v2.32.0...v2.33.0) (2026-11-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * **spec:** sync API spec 2026-11-23 ([c6974d8](https://github.com/didit-protocol/sdk-ruby/commit/c6974d882e15c5cd686497386a543fdff3269a48))
9
+ * **spec:** sync API spec 2026-11-23 ([2f3aada](https://github.com/didit-protocol/sdk-ruby/commit/2f3aada196817eeb6bff71fdfba6a93e9c256cf1))
10
+
11
+ ## [2.32.0](https://github.com/didit-protocol/sdk-ruby/compare/v2.31.0...v2.32.0) (2026-11-23)
12
+
13
+
14
+ ### Features
15
+
16
+ * **bank:** Bank data operations and typed bank.* webhook events ([#111](https://github.com/didit-protocol/sdk-ruby/issues/111)) ([a784b44](https://github.com/didit-protocol/sdk-ruby/commit/a784b44b5c55a27033b124122868f2b882f1f42b))
17
+
3
18
  ## [2.31.0](https://github.com/didit-protocol/sdk-ruby/compare/v2.30.0...v2.31.0) (2026-11-22)
4
19
 
5
20
 
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  The official [Didit](https://didit.me) Ruby library.
4
4
  Identity verification (KYC), business verification (KYB), AML screening, biometrics, transaction monitoring, Travel Rule and customer authentication, from your backend.
5
5
 
6
- - Every Didit server API: sessions, standalone checks, KYB, users and businesses, workflows, webhooks, cases, transactions, wallet screening, Travel Rule and account management.
6
+ - Every Didit server API: sessions, standalone checks, KYB, users and businesses, workflows, webhooks, cases, bank data, transactions, wallet screening, Travel Rule and account management.
7
7
  - Typed results with RBS signatures (checked with Steep), generated from the [OpenAPI contract](openapi/).
8
8
  - Webhook verification and Didit Authentication (OpenID Connect) token verification built in.
9
9
  - Standard library `net/http` with persistent connections, retries and timeouts. The only dependency is `jwt`, and only the Authentication module loads it.
@@ -51,7 +51,7 @@ else nil
51
51
  end
52
52
  ```
53
53
 
54
- [`examples/quickstart.rb`](examples/quickstart.rb) runs the same steps. [`examples/`](examples/) also has standalone ID verification, AML screening, transaction screening, Travel Rule, Authentication, and webhook receivers for Rails, Sinatra and Rack.
54
+ [`examples/quickstart.rb`](examples/quickstart.rb) runs the same steps. [`examples/`](examples/) also has standalone ID verification, AML screening, transaction screening, Travel Rule, Bank data, Authentication, and webhook receivers for Rails, Sinatra and Rack.
55
55
 
56
56
  ## Configuration
57
57
 
@@ -185,11 +185,36 @@ event = Didit::Webhooks.verify(raw_body, headers, [new_secret, old_secret]) # du
185
185
  - `verify_parsed(payload, headers, secret)` is for frameworks that only give you the parsed JSON; it can check `X-Signature-V2` only.
186
186
  - The deprecated `X-Signature-Simple` counts only with `allow_simple: true`; then `event.body_authenticated?` is false and you should re-fetch the record from the API.
187
187
  - Failures raise `Didit::WebhookVerificationError` with `reason`: `:missing_signature`, `:invalid_signature`, `:missing_timestamp`, `:timestamp_mismatch`, `:timestamp_out_of_tolerance` or `:invalid_payload`.
188
- - Events are typed: `StatusUpdatedEvent`, `DataUpdatedEvent`, `UserStatusUpdatedEvent`, `UserDataUpdatedEvent`, `BusinessStatusUpdatedEvent`, `BusinessDataUpdatedEvent`, `ActivityCreatedEvent`, `TransactionCreatedEvent`, `TransactionStatusUpdatedEvent`, `TravelRuleStatusUpdatedEvent`, `WorkflowComplianceChangedEvent`, `KybRegistrySearchResolvedEvent`, and `UnknownEvent` for anything else. Session events carry the typed `decision`.
188
+ - Events are typed: `StatusUpdatedEvent`, `DataUpdatedEvent`, `UserStatusUpdatedEvent`, `UserDataUpdatedEvent`, `BusinessStatusUpdatedEvent`, `BusinessDataUpdatedEvent`, `ActivityCreatedEvent`, `TransactionCreatedEvent`, `TransactionStatusUpdatedEvent`, `TravelRuleStatusUpdatedEvent`, `WorkflowComplianceChangedEvent`, `KybRegistrySearchResolvedEvent`, the `Bank*Event` classes for every `bank.*` type, and `UnknownEvent` for anything else. Session events carry the typed `decision`.
189
189
  - `kyb.registry_search.resolved` callbacks arrive unsigned, so `verify` rejects them (with `:missing_signature`, or a timestamp reason when their timestamp fails the checks that come first). `Didit::Webhooks.parse_event(JSON.parse(body))` reads one without verifying it; treat it as untrusted and re-fetch the data from the API.
190
190
 
191
191
  See [`examples/webhooks/`](examples/webhooks/) for Rails, Sinatra and Rack receivers. In a Rails controller that inherits from `ActionController::Base`, skip CSRF protection for the webhook action.
192
192
 
193
+ ## Bank data
194
+
195
+ `didit.bank` runs account checks and reads bank data after the person connects a bank once.
196
+
197
+ ```ruby
198
+ link = didit.bank.create_link(access: "ongoing", data: ["accounts"])
199
+ # Deliver link.url privately to the person connecting their bank.
200
+
201
+ # In the webhook handler, using the link ID saved for this person:
202
+ event = didit.webhooks.verify(raw_body, headers, ENV.fetch("DIDIT_WEBHOOK_SECRET"))
203
+ if event.is_a?(Didit::Webhooks::BankConnectionCreatedEvent) && event.connection_id &&
204
+ didit.bank.get_link(link.id).connection_id == event.connection_id
205
+ accounts = didit.bank.list_accounts(event.connection_id, limit: 50)
206
+ accounts.items.size # accounts on this page
207
+ end
208
+ ```
209
+
210
+ - `create_link` returns the hosted `url`, a `client_token` for Bank Link in a modal or inline, `expires_at` and `quote`. A completed link creates a connection (`bank.connection.created`) or a `bank.link.failed` event with its `error_code`.
211
+ - Cursor lists (`list_accounts`, `list_connections`) return `items` and `next_cursor`; `list_transactions` returns `items`, `next_page_token` and `has_more`. `sync_transactions` reads the change feed from a `cursor`.
212
+ - Bank data needs the `bank-data` permission on the API key: without it the API answers `403` with code `bank_data_access_denied`. A live sync past the bank's daily limit answers `429` with code `refresh_limit_reached` and `Retry-After`.
213
+ - `delete_connection` stops access at the bank and deletes the stored accounts, balances and transactions; it cannot be undone. `revoke_connection` stops access; stored data stays readable until the retention window ends.
214
+ - In production Bank data is on for sandbox applications first; a live application's calls answer `404` until it is enabled.
215
+
216
+ [`examples/bank_connection.ru`](examples/bank_connection.ru) runs the same steps.
217
+
193
218
  ## Transactions and Travel Rule
194
219
 
195
220
  ```ruby
@@ -131,11 +131,13 @@ module Didit
131
131
  # @param mode [String] `connect` (default) creates a new connection. `renew` needs `connection_id` and reuses
132
132
  # that connection's settings.
133
133
  # @param connection_id [String] The connection to renew. Only with `mode: renew`.
134
- # @param access [String] `one_time` (default) reads the data once. `ongoing` keeps access open until the consent
135
- # ends or someone stops it. With `institution_id` set, a bank that cannot keep access open answers `400
136
- # ongoing_access_not_available` before any screen. Without it, the bank picker lists only banks that can.
134
+ # @param access [String] `one_time` (default) reads the data once: when the read completes the connection ends
135
+ # itself and reads `status: revoked` with `status_reason: collection_complete`, and its data stays readable
136
+ # until `consent.retain_until`. `ongoing` keeps access open until the consent ends or someone stops it. With
137
+ # `institution_id` set, a bank that cannot keep access open answers `400 ongoing_access_not_available`...
137
138
  # @param country [String] Optional. Without it the person picks among the countries your application enabled. It
138
- # has to be a country Bank Link serves; any other, `ZZZ` included, answers `400 invalid_request` with `field:
139
+ # has to be a country Bank Link serves; a malformed value answers `400 invalid_request`, and a country the
140
+ # product does not serve, or where no bank is offered, answers `400 country_not_available`, both with `field:
139
141
  # country`. An empty request body stays valid.
140
142
  # @param institution_id [String] Optional bank to preselect, from `list_institutions`. Skips the picker.
141
143
  # @param segment [String] Filters the picker and tells the bank which login to open where the bank separates
@@ -704,7 +706,9 @@ module Didit
704
706
  # something. A key with full access does not include it: grant it explicitly when you create the key, or the
705
707
  # call answers `403 bank_data_access_denied`.
706
708
  #
707
- # Refreshing a deleted connection answers `409 connection_not_active`.
709
+ # Refreshing a deleted connection answers `409 connection_not_active`. A one-time connection is read once and
710
+ # its access then ends, so refreshing it answers `409 one_time_connection`: create a new link to read the bank
711
+ # again.
708
712
  #
709
713
  # +POST /v3/bank/connections/{id}/refresh/+
710
714
  #
@@ -735,8 +739,13 @@ module Didit
735
739
  # Creates a renew link for this connection, a shortcut for `create_link` with `mode: renew`. The connection id
736
740
  # and every account id stay the same.
737
741
  #
738
- # Opening the returned link on the hosted page is not available yet: the page that lets the person renew is
739
- # still to be built.
742
+ # Send the returned `url` to the person: the hosted page shows what continues to be shared and until when, the
743
+ # person signs in at their bank once and returns to your `redirect_url`, and `bank.connection.renewed` confirms
744
+ # it. Afterwards the connection's `consent` shows a new `version`, `renewed_count`, `expires_at` and `renew_by`,
745
+ # with `renewal_action` `bank_auth`.
746
+ #
747
+ # A one-time connection has no consent to renew: it answers `409 one_time_connection`, and a new link reads the
748
+ # bank again.
740
749
  #
741
750
  # Until the consent has 30 days left or fewer it answers `409 renewal_not_needed`; after
742
751
  # `consent.renewable_until` it answers `409 renewal_window_expired` and the person connects again.
@@ -787,7 +796,9 @@ module Didit
787
796
  #
788
797
  # Stops access to the bank. Bank fetches stop the moment you ask, even while the bank's confirmation is pending:
789
798
  # the consent reads `revocation_pending`, then `revoked` once the bank confirms access is terminated, or
790
- # `revocation_failed` while the call is retried automatically. `consent.ended_by` is `customer`.
799
+ # `revocation_failed` while the call is retried automatically. `consent.ended_by` is `customer`. Until the bank
800
+ # confirms, `status` keeps its value and `status_reason` is `null`; once `status` is `revoked`, `status_reason`
801
+ # is `revoked_by_customer`.
791
802
  #
792
803
  # Revoking does not delete anything: stored accounts, balances and transactions stay readable until
793
804
  # `consent.retain_until`, the retention setting of your application, and nothing is charged. To delete them now,
@@ -3,9 +3,11 @@
3
3
 
4
4
  module Didit
5
5
  module Types
6
- # `one_time` (default) reads the data once. `ongoing` keeps access open until the consent ends or someone stops
7
- # it. With `institution_id` set, a bank that cannot keep access open answers `400 ongoing_access_not_available`
8
- # before any screen. Without it, the bank picker lists only banks that can.
6
+ # `one_time` (default) reads the data once: when the read completes the connection ends itself and reads `status:
7
+ # revoked` with `status_reason: collection_complete`, and its data stays readable until `consent.retain_until`.
8
+ # `ongoing` keeps access open until the consent ends or someone stops it. With `institution_id` set, a bank that
9
+ # cannot keep access open answers `400 ongoing_access_not_available` before any screen. Without it, the bank
10
+ # picker lists only banks that can.
9
11
  module BankCreateLinkParamsAccess
10
12
  ONE_TIME = "one_time"
11
13
  ONGOING = "ongoing"
@@ -449,14 +449,16 @@ module Didit
449
449
  VALUES = [CONNECTION_MONTH, ONE_TIME].freeze
450
450
  end
451
451
 
452
- # Who ended access, set from evidence. `unknown` when neither the bank nor the sync says.
452
+ # Who ended access, set from evidence. `system` when Didit ended it by design: a one-time connection once its read
453
+ # is complete. `unknown` when neither the bank nor the sync says.
453
454
  module BankConnectionConsentEndedBy
454
455
  END_USER = "end_user"
455
456
  BANK = "bank"
456
457
  CUSTOMER = "customer"
458
+ SYSTEM = "system"
457
459
  UNKNOWN = "unknown"
458
460
 
459
- VALUES = [END_USER, BANK, CUSTOMER, UNKNOWN].freeze
461
+ VALUES = [END_USER, BANK, CUSTOMER, SYSTEM, UNKNOWN].freeze
460
462
  end
461
463
 
462
464
  # How a renewal works: `reconfirm` is the person confirming on Didit's screen with no bank sign-in, where the bank
@@ -563,8 +565,9 @@ module Didit
563
565
 
564
566
  # `pending`: first sync running. `active`: consent valid. `renewal_required`: the consent ended or the bank wants
565
567
  # the person to sign in again, data readable as last synced and nothing charged. `paused`: balance too low for the
566
- # month. `revoked`: access stopped by the person, the bank or you. `deleted`: only `id`, `status`,
567
- # `status_reason`, `created_at` and `erasure` remain. `failed`: the first sync never succeeded.
568
+ # month. `revoked`: access stopped by the person, the bank or you, or ended because the read of a one-time
569
+ # connection is complete. `deleted`: only `id`, `status`, `status_reason`, `created_at` and `erasure` remain.
570
+ # `failed`: the first sync never succeeded.
568
571
  module BankConnectionStatus
569
572
  PENDING = "pending"
570
573
  ACTIVE = "active"
@@ -577,8 +580,9 @@ module Didit
577
580
  VALUES = [PENDING, ACTIVE, RENEWAL_REQUIRED, PAUSED, REVOKED, DELETED, FAILED].freeze
578
581
  end
579
582
 
580
- # Why the connection is in this status. `paused_by_customer` is reserved. On a `deleted` connection:
581
- # `deleted_by_customer`, `consent_lapsed`, `retention_elapsed` or `application_deleted`.
583
+ # Why the connection is in this status. `collection_complete`: a one-time connection whose read is complete, so
584
+ # its access has ended. `paused_by_customer` is reserved. On a `deleted` connection: `deleted_by_customer`,
585
+ # `consent_lapsed`, `retention_elapsed` or `application_deleted`.
582
586
  module BankConnectionStatusReason
583
587
  COLLECTION_COMPLETE = "collection_complete"
584
588
  CONSENT_EXPIRED = "consent_expired"
data/lib/didit/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Didit
4
- VERSION = "2.31.0" # x-release-please-version
4
+ VERSION = "2.33.0" # x-release-please-version
5
5
  end
@@ -197,6 +197,206 @@ module Didit
197
197
  field :kyb_registry, "kyb_registry", :any
198
198
  end
199
199
 
200
+ # The link fields of the four +bank.link.*+ events. The backend nests them under +data+,
201
+ # unlike the connection, data and sync events, whose fields sit next to the envelope.
202
+ class BankLinkEventData < Didit::Model
203
+ field :link_id, "link_id", :string
204
+ # +"completed"+, +"cancelled"+, +"expired"+ or +"failed"+.
205
+ field :status, "status", :string
206
+ # The connection the link created or renewed, when there is one.
207
+ field :connection_id, "connection_id", :string
208
+ # The ownership result, when one was asked for.
209
+ field :check_id, "check_id", :string
210
+ # With +bank.link.failed+, for example +"consent_declined"+.
211
+ field :error_code, "error_code", :string
212
+ end
213
+
214
+ # Fields of the Bank Link events; ids and statuses only, fetch the link from the API to read it.
215
+ # The payload keeps them under +data+: read {#data}, or the readers, which look there.
216
+ class BankLinkEvent < Event
217
+ field :data, "data", BankLinkEventData
218
+
219
+ def link_id
220
+ link_data&.link_id
221
+ end
222
+
223
+ def status
224
+ link_data&.status
225
+ end
226
+
227
+ def connection_id
228
+ link_data&.connection_id
229
+ end
230
+
231
+ def check_id
232
+ link_data&.check_id
233
+ end
234
+
235
+ def error_code
236
+ link_data&.error_code
237
+ end
238
+
239
+ # Pattern matching reads the link fields too, although they live under +data+.
240
+ def deconstruct_keys(keys)
241
+ out = super
242
+ names = BankLinkEventData.fields.keys
243
+ names &= keys if keys
244
+ names.each { |name| out[name] = public_send(name) }
245
+ out
246
+ end
247
+
248
+ private
249
+
250
+ def link_data
251
+ value = data
252
+ value if value.is_a?(BankLinkEventData)
253
+ end
254
+ end
255
+
256
+ # +bank.link.completed+: the person finished Bank Link.
257
+ class BankLinkCompletedEvent < BankLinkEvent
258
+ WEBHOOK_TYPE = "bank.link.completed"
259
+ end
260
+
261
+ # +bank.link.cancelled+: the person cancelled Bank Link.
262
+ class BankLinkCancelledEvent < BankLinkEvent
263
+ WEBHOOK_TYPE = "bank.link.cancelled"
264
+ end
265
+
266
+ # +bank.link.expired+: Bank Link expired before the person finished.
267
+ class BankLinkExpiredEvent < BankLinkEvent
268
+ WEBHOOK_TYPE = "bank.link.expired"
269
+ end
270
+
271
+ # +bank.link.failed+: Bank Link failed; +error_code+ says why.
272
+ class BankLinkFailedEvent < BankLinkEvent
273
+ WEBHOOK_TYPE = "bank.link.failed"
274
+ end
275
+
276
+ # Fields shared by the Bank connection events; ids and statuses only.
277
+ class BankConnectionEvent < Event
278
+ field :connection_id, "connection_id", :string
279
+ end
280
+
281
+ # +bank.connection.created+: the first sync of a connection finished.
282
+ class BankConnectionCreatedEvent < BankConnectionEvent
283
+ WEBHOOK_TYPE = "bank.connection.created"
284
+
285
+ # +"succeeded"+ or +"partial"+.
286
+ field :initial_status, "initial_status", :string
287
+ end
288
+
289
+ # +bank.connection.updated+: a connection changed status; +revocation_status+ is +"pending"+
290
+ # while a revocation waits for the bank.
291
+ class BankConnectionUpdatedEvent < BankConnectionEvent
292
+ WEBHOOK_TYPE = "bank.connection.updated"
293
+
294
+ field :status, "status", :string
295
+ field :revocation_status, "revocation_status", :string
296
+ end
297
+
298
+ # +bank.connection.consent_expiring+: the consent ends in 14, 7 or 1 day.
299
+ class BankConnectionConsentExpiringEvent < BankConnectionEvent
300
+ WEBHOOK_TYPE = "bank.connection.consent_expiring"
301
+
302
+ field :days_left, "days_left", :integer
303
+ field :consent_expires_at, "consent_expires_at", :datetime
304
+ # Renew before this moment for no gap.
305
+ field :renew_by, "renew_by", :datetime
306
+ end
307
+
308
+ # +bank.connection.renewal_required+: the consent ended or the bank asks the person to sign in.
309
+ class BankConnectionRenewalRequiredEvent < BankConnectionEvent
310
+ WEBHOOK_TYPE = "bank.connection.renewal_required"
311
+
312
+ field :status, "status", :string
313
+ # +"consent_expired"+ or +"bank_requires_sign_in"+.
314
+ field :reason, "reason", :string
315
+ field :renew_by, "renew_by", :datetime
316
+ # The last moment the same connection can be revived.
317
+ field :renewable_until, "renewable_until", :datetime
318
+ end
319
+
320
+ # +bank.connection.renewed+: a renew link completed and the connection is readable again.
321
+ class BankConnectionRenewedEvent < BankConnectionEvent
322
+ WEBHOOK_TYPE = "bank.connection.renewed"
323
+
324
+ field :status, "status", :string
325
+ field :consent_version, "consent_version", :integer
326
+ # The renew link that completed, when there is one.
327
+ field :link_id, "link_id", :string
328
+ field :consent_expires_at, "consent_expires_at", :datetime
329
+ end
330
+
331
+ # +bank.connection.revoked+: access ended and the bank confirmed it.
332
+ class BankConnectionRevokedEvent < BankConnectionEvent
333
+ WEBHOOK_TYPE = "bank.connection.revoked"
334
+
335
+ field :status, "status", :string
336
+ # +"end_user"+, +"bank"+, +"customer"+ or +"unknown"+.
337
+ field :ended_by, "ended_by", :string
338
+ field :status_reason, "status_reason", :string
339
+ field :ended_at, "ended_at", :datetime
340
+ # How long the stored data stays readable.
341
+ field :retain_until, "retain_until", :datetime
342
+ end
343
+
344
+ # +bank.connection.deleted+: the stored data of a connection was deleted.
345
+ class BankConnectionDeletedEvent < BankConnectionEvent
346
+ WEBHOOK_TYPE = "bank.connection.deleted"
347
+
348
+ field :status, "status", :string
349
+ field :erasure_status, "erasure_status", :string
350
+ field :reason, "reason", :string
351
+ field :erased_at, "erased_at", :datetime
352
+ end
353
+
354
+ # +bank.connection.history_complete+: the history backfill of a connection ended.
355
+ class BankConnectionHistoryCompleteEvent < BankConnectionEvent
356
+ WEBHOOK_TYPE = "bank.connection.history_complete"
357
+
358
+ field :status, "status", :string
359
+ end
360
+
361
+ # +bank.data.updated+: a sync stored new or changed bank data.
362
+ class BankDataUpdatedEvent < BankConnectionEvent
363
+ WEBHOOK_TYPE = "bank.data.updated"
364
+
365
+ field :sync_id, "sync_id", :string
366
+ # +"initial"+, +"scheduled"+ or +"requested"+.
367
+ field :trigger, "trigger", :string
368
+ # One entry per changed account: +account_id+, +added+, +modified+ and +removed+.
369
+ field :accounts, "accounts", :any
370
+ field :balances_changed, "balances_changed", :boolean
371
+ end
372
+
373
+ # +bank.sync.completed+: a sync ended.
374
+ class BankSyncCompletedEvent < BankConnectionEvent
375
+ WEBHOOK_TYPE = "bank.sync.completed"
376
+
377
+ field :sync_id, "sync_id", :string
378
+ field :trigger, "trigger", :string
379
+ # +"succeeded"+, +"partial"+ or +"failed"+.
380
+ field :outcome, "outcome", :string
381
+ field :changed, "changed", :boolean
382
+ end
383
+
384
+ # +bank.sync.failed+: a sync failed; +failing_since+ says when the failures started.
385
+ class BankSyncFailedEvent < BankConnectionEvent
386
+ WEBHOOK_TYPE = "bank.sync.failed"
387
+
388
+ field :sync_id, "sync_id", :string
389
+ field :error_code, "error_code", :string
390
+ field :failing_since, "failing_since", :datetime
391
+ end
392
+
393
+ # +bank.sync.recovered+: a sync succeeded after failures.
394
+ class BankSyncRecoveredEvent < BankConnectionEvent
395
+ WEBHOOK_TYPE = "bank.sync.recovered"
396
+
397
+ field :sync_id, "sync_id", :string
398
+ end
399
+
200
400
  # An event type this version of the SDK does not know; the whole payload stays readable
201
401
  # with #[] and #to_h.
202
402
  class UnknownEvent < Event
@@ -215,7 +415,23 @@ module Didit
215
415
  TransactionStatusUpdatedEvent::WEBHOOK_TYPE => TransactionStatusUpdatedEvent,
216
416
  TravelRuleStatusUpdatedEvent::WEBHOOK_TYPE => TravelRuleStatusUpdatedEvent,
217
417
  WorkflowComplianceChangedEvent::WEBHOOK_TYPE => WorkflowComplianceChangedEvent,
218
- KybRegistrySearchResolvedEvent::WEBHOOK_TYPE => KybRegistrySearchResolvedEvent
418
+ KybRegistrySearchResolvedEvent::WEBHOOK_TYPE => KybRegistrySearchResolvedEvent,
419
+ BankLinkCompletedEvent::WEBHOOK_TYPE => BankLinkCompletedEvent,
420
+ BankLinkCancelledEvent::WEBHOOK_TYPE => BankLinkCancelledEvent,
421
+ BankLinkExpiredEvent::WEBHOOK_TYPE => BankLinkExpiredEvent,
422
+ BankLinkFailedEvent::WEBHOOK_TYPE => BankLinkFailedEvent,
423
+ BankConnectionCreatedEvent::WEBHOOK_TYPE => BankConnectionCreatedEvent,
424
+ BankConnectionUpdatedEvent::WEBHOOK_TYPE => BankConnectionUpdatedEvent,
425
+ BankConnectionConsentExpiringEvent::WEBHOOK_TYPE => BankConnectionConsentExpiringEvent,
426
+ BankConnectionRenewalRequiredEvent::WEBHOOK_TYPE => BankConnectionRenewalRequiredEvent,
427
+ BankConnectionRenewedEvent::WEBHOOK_TYPE => BankConnectionRenewedEvent,
428
+ BankConnectionRevokedEvent::WEBHOOK_TYPE => BankConnectionRevokedEvent,
429
+ BankConnectionDeletedEvent::WEBHOOK_TYPE => BankConnectionDeletedEvent,
430
+ BankConnectionHistoryCompleteEvent::WEBHOOK_TYPE => BankConnectionHistoryCompleteEvent,
431
+ BankDataUpdatedEvent::WEBHOOK_TYPE => BankDataUpdatedEvent,
432
+ BankSyncCompletedEvent::WEBHOOK_TYPE => BankSyncCompletedEvent,
433
+ BankSyncFailedEvent::WEBHOOK_TYPE => BankSyncFailedEvent,
434
+ BankSyncRecoveredEvent::WEBHOOK_TYPE => BankSyncRecoveredEvent
219
435
  }.freeze
220
436
  end
221
437
  end
@@ -398,6 +398,7 @@ module Didit
398
398
  END_USER: String
399
399
  BANK: String
400
400
  CUSTOMER: String
401
+ SYSTEM: String
401
402
  UNKNOWN: String
402
403
 
403
404
  VALUES: Array[String]
@@ -121,5 +121,139 @@ module Didit
121
121
 
122
122
  class UnknownEvent < Event
123
123
  end
124
+
125
+ class BankLinkEventData < Didit::Model
126
+ def link_id: () -> String?
127
+ def status: () -> String?
128
+ def connection_id: () -> String?
129
+ def check_id: () -> String?
130
+ def error_code: () -> String?
131
+ end
132
+
133
+ class BankLinkEvent < Event
134
+ def data: () -> BankLinkEventData?
135
+ private def link_data: () -> BankLinkEventData?
136
+ def link_id: () -> String?
137
+ def status: () -> String?
138
+ def connection_id: () -> String?
139
+ def check_id: () -> String?
140
+ def error_code: () -> String?
141
+ end
142
+
143
+ class BankLinkCompletedEvent < BankLinkEvent
144
+ WEBHOOK_TYPE: String
145
+ end
146
+
147
+ class BankLinkCancelledEvent < BankLinkEvent
148
+ WEBHOOK_TYPE: String
149
+ end
150
+
151
+ class BankLinkExpiredEvent < BankLinkEvent
152
+ WEBHOOK_TYPE: String
153
+ end
154
+
155
+ class BankLinkFailedEvent < BankLinkEvent
156
+ WEBHOOK_TYPE: String
157
+ end
158
+
159
+ class BankConnectionEvent < Event
160
+ def connection_id: () -> String?
161
+ end
162
+
163
+ class BankConnectionCreatedEvent < BankConnectionEvent
164
+ WEBHOOK_TYPE: String
165
+
166
+ def initial_status: () -> String?
167
+ end
168
+
169
+ class BankConnectionUpdatedEvent < BankConnectionEvent
170
+ WEBHOOK_TYPE: String
171
+
172
+ def status: () -> String?
173
+ def revocation_status: () -> String?
174
+ end
175
+
176
+ class BankConnectionConsentExpiringEvent < BankConnectionEvent
177
+ WEBHOOK_TYPE: String
178
+
179
+ def days_left: () -> Integer?
180
+ def consent_expires_at: () -> Time?
181
+ def renew_by: () -> Time?
182
+ end
183
+
184
+ class BankConnectionRenewalRequiredEvent < BankConnectionEvent
185
+ WEBHOOK_TYPE: String
186
+
187
+ def status: () -> String?
188
+ def reason: () -> String?
189
+ def renew_by: () -> Time?
190
+ def renewable_until: () -> Time?
191
+ end
192
+
193
+ class BankConnectionRenewedEvent < BankConnectionEvent
194
+ WEBHOOK_TYPE: String
195
+
196
+ def status: () -> String?
197
+ def consent_version: () -> Integer?
198
+ def link_id: () -> String?
199
+ def consent_expires_at: () -> Time?
200
+ end
201
+
202
+ class BankConnectionRevokedEvent < BankConnectionEvent
203
+ WEBHOOK_TYPE: String
204
+
205
+ def status: () -> String?
206
+ def ended_by: () -> String?
207
+ def status_reason: () -> String?
208
+ def ended_at: () -> Time?
209
+ def retain_until: () -> Time?
210
+ end
211
+
212
+ class BankConnectionDeletedEvent < BankConnectionEvent
213
+ WEBHOOK_TYPE: String
214
+
215
+ def status: () -> String?
216
+ def erasure_status: () -> String?
217
+ def reason: () -> String?
218
+ def erased_at: () -> Time?
219
+ end
220
+
221
+ class BankConnectionHistoryCompleteEvent < BankConnectionEvent
222
+ WEBHOOK_TYPE: String
223
+
224
+ def status: () -> String?
225
+ end
226
+
227
+ class BankDataUpdatedEvent < BankConnectionEvent
228
+ WEBHOOK_TYPE: String
229
+
230
+ def sync_id: () -> String?
231
+ def trigger: () -> String?
232
+ def accounts: () -> untyped
233
+ def balances_changed: () -> bool?
234
+ end
235
+
236
+ class BankSyncCompletedEvent < BankConnectionEvent
237
+ WEBHOOK_TYPE: String
238
+
239
+ def sync_id: () -> String?
240
+ def trigger: () -> String?
241
+ def outcome: () -> String?
242
+ def changed: () -> bool?
243
+ end
244
+
245
+ class BankSyncFailedEvent < BankConnectionEvent
246
+ WEBHOOK_TYPE: String
247
+
248
+ def sync_id: () -> String?
249
+ def error_code: () -> String?
250
+ def failing_since: () -> Time?
251
+ end
252
+
253
+ class BankSyncRecoveredEvent < BankConnectionEvent
254
+ WEBHOOK_TYPE: String
255
+
256
+ def sync_id: () -> String?
257
+ end
124
258
  end
125
259
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: didit-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.31.0
4
+ version: 2.33.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didit