straddle 1.0.0 → 1.1.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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +65 -0
  3. data/README.md +84 -89
  4. data/SKILL.md +4 -2
  5. data/api.md +26 -26
  6. data/lib/straddle/client.rb +24 -7
  7. data/lib/straddle/errors.rb +40 -0
  8. data/lib/straddle/file_part.rb +13 -1
  9. data/lib/straddle/internal/transport/base_client.rb +186 -42
  10. data/lib/straddle/internal/transport/connection_pool.rb +160 -0
  11. data/lib/straddle/internal/transport/pooled_net_requester.rb +77 -10
  12. data/lib/straddle/internal/type/base_model.rb +69 -18
  13. data/lib/straddle/internal/type/base_page.rb +14 -0
  14. data/lib/straddle/internal/type/boolean.rb +3 -1
  15. data/lib/straddle/internal/type/converter.rb +13 -3
  16. data/lib/straddle/internal/type/enum.rb +9 -4
  17. data/lib/straddle/internal/type/file_input.rb +8 -2
  18. data/lib/straddle/internal/type/hash_of.rb +3 -1
  19. data/lib/straddle/internal/type/union.rb +21 -7
  20. data/lib/straddle/internal/type/unknown.rb +3 -1
  21. data/lib/straddle/internal/util.rb +273 -15
  22. data/lib/straddle/internal/webhook_verifier.rb +240 -0
  23. data/lib/straddle/internal.rb +5 -1
  24. data/lib/straddle/models/capability_request_create_params.rb +18 -18
  25. data/lib/straddle/models/paykey.rb +3 -2
  26. data/lib/straddle/models/paykey_created_v1_webhook_event.rb +7 -2
  27. data/lib/straddle/models/paykey_event_v1_webhook_event.rb +7 -2
  28. data/lib/straddle/models/payout.rb +14 -14
  29. data/lib/straddle/models/unmasked_payout.rb +14 -14
  30. data/lib/straddle/models/webhook_unwrap_params.rb +2 -0
  31. data/lib/straddle/models.rb +30 -31
  32. data/lib/straddle/request_options.rb +13 -5
  33. data/lib/straddle/resources/accounts.rb +11 -12
  34. data/lib/straddle/resources/bridge.rb +8 -4
  35. data/lib/straddle/resources/capability_requests.rb +4 -5
  36. data/lib/straddle/resources/charges.rb +18 -15
  37. data/lib/straddle/resources/customers/review.rb +5 -6
  38. data/lib/straddle/resources/customers.rb +34 -35
  39. data/lib/straddle/resources/funding_events.rb +20 -20
  40. data/lib/straddle/resources/linked_bank_accounts.rb +9 -11
  41. data/lib/straddle/resources/organizations.rb +6 -6
  42. data/lib/straddle/resources/paykeys/review.rb +5 -6
  43. data/lib/straddle/resources/paykeys.rb +34 -39
  44. data/lib/straddle/resources/payments.rb +8 -7
  45. data/lib/straddle/resources/payouts.rb +18 -15
  46. data/lib/straddle/resources/representatives.rb +7 -6
  47. data/lib/straddle/resources/webhooks.rb +63 -6
  48. data/lib/straddle/version.rb +1 -1
  49. data/lib/straddle.rb +5 -6
  50. data/rbi/straddle/client.rbi +13 -0
  51. data/rbi/straddle/errors.rbi +25 -27
  52. data/rbi/straddle/internal/transport/base_client.rbi +45 -54
  53. data/rbi/straddle/internal/transport/connection_pool.rbi +44 -0
  54. data/rbi/straddle/internal/transport/pooled_net_requester.rbi +15 -16
  55. data/rbi/straddle/internal/type/base_model.rbi +24 -38
  56. data/rbi/straddle/internal/type/base_page.rbi +5 -0
  57. data/rbi/straddle/internal/type/converter.rbi +9 -42
  58. data/rbi/straddle/internal/type/enum.rbi +1 -5
  59. data/rbi/straddle/internal/type/request_parameters.rbi +1 -3
  60. data/rbi/straddle/internal/type/union.rbi +2 -11
  61. data/rbi/straddle/internal/util.rbi +101 -115
  62. data/rbi/straddle/internal/webhook_verifier.rbi +86 -0
  63. data/rbi/straddle/internal.rbi +1 -2
  64. data/rbi/straddle/models/capability_request_create_params.rbi +18 -18
  65. data/rbi/straddle/models/paykey.rbi +4 -2
  66. data/rbi/straddle/models/paykey_created_v1_webhook_event.rbi +6 -2
  67. data/rbi/straddle/models/paykey_event_v1_webhook_event.rbi +6 -2
  68. data/rbi/straddle/models/payout.rbi +18 -18
  69. data/rbi/straddle/models/unmasked_payout.rbi +18 -18
  70. data/rbi/straddle/models/webhook_unwrap_params.rbi +2 -0
  71. data/rbi/straddle/models.rbi +2 -0
  72. data/rbi/straddle/request_options.rbi +4 -10
  73. data/rbi/straddle/resources/accounts.rbi +2 -1
  74. data/rbi/straddle/resources/bridge.rbi +8 -4
  75. data/rbi/straddle/resources/charges.rbi +4 -2
  76. data/rbi/straddle/resources/customers.rbi +7 -3
  77. data/rbi/straddle/resources/funding_events.rbi +5 -2
  78. data/rbi/straddle/resources/organizations.rbi +2 -1
  79. data/rbi/straddle/resources/paykeys.rbi +2 -1
  80. data/rbi/straddle/resources/payments.rbi +3 -1
  81. data/rbi/straddle/resources/payouts.rbi +4 -2
  82. data/rbi/straddle/resources/representatives.rbi +3 -1
  83. data/rbi/straddle/resources/webhooks.rbi +107 -2
  84. data/sig/straddle/client.rbs +4 -0
  85. data/sig/straddle/errors.rbs +13 -0
  86. data/sig/straddle/internal/transport/base_client.rbs +19 -1
  87. data/sig/straddle/internal/transport/connection_pool.rbs +19 -0
  88. data/sig/straddle/internal/transport/pooled_net_requester.rbs +11 -1
  89. data/sig/straddle/internal/type/base_model.rbs +4 -0
  90. data/sig/straddle/internal/type/base_page.rbs +2 -0
  91. data/sig/straddle/internal/util.rbs +29 -1
  92. data/sig/straddle/internal/webhook_verifier.rbs +53 -0
  93. data/sig/straddle/models/capability_request_create_params.rbs +24 -24
  94. data/sig/straddle/models/payout.rbs +12 -12
  95. data/sig/straddle/models/unmasked_payout.rbs +12 -12
  96. data/sig/straddle/models/webhook_unwrap_params.rbs +4 -0
  97. data/sig/straddle/models.rbs +2 -0
  98. data/sig/straddle/resources/webhooks.rbs +59 -1
  99. metadata +12 -60
@@ -0,0 +1,86 @@
1
+ # typed: strong
2
+
3
+ module StandardWebhooks
4
+ class StandardWebhooksError < StandardError
5
+ end
6
+
7
+ class WebhookVerificationError < StandardWebhooksError
8
+ end
9
+ end
10
+
11
+ module Straddle
12
+ module Errors
13
+ class WebhookVerificationError < ::StandardWebhooks::WebhookVerificationError
14
+ sig { params(message: T.nilable(String)).void }
15
+ def initialize(message = nil)
16
+ end
17
+ end
18
+ end
19
+
20
+ module Internal
21
+ # @api private
22
+ module WebhookVerifier
23
+ SECRET_PREFIX = "whsec_"
24
+
25
+ TOLERANCE_SECONDS = T.let(T.unsafe(nil), Integer)
26
+
27
+ DEFAULT_ALGORITHM = "hmac-sha256"
28
+
29
+ HMAC_DIGESTS = T.let(T.unsafe(nil), T::Hash[String, String])
30
+
31
+ class << self
32
+ # @api private
33
+ sig do
34
+ params(
35
+ payload: String,
36
+ headers: T::Hash[T.any(String, Symbol), T.any(String, T::Array[String])],
37
+ secret: String,
38
+ algorithm: String,
39
+ id_header: String,
40
+ timestamp_header: String,
41
+ signature_header: String,
42
+ tolerance: Integer,
43
+ decoder: T.nilable(String)
44
+ ).void
45
+ end
46
+ def verify!(
47
+ payload,
48
+ headers,
49
+ secret,
50
+ algorithm: DEFAULT_ALGORITHM,
51
+ id_header: "webhook-id",
52
+ timestamp_header: "webhook-timestamp",
53
+ signature_header: "webhook-signature",
54
+ tolerance: TOLERANCE_SECONDS,
55
+ decoder: nil
56
+ )
57
+ end
58
+
59
+ # @api private
60
+ sig do
61
+ params(
62
+ headers: T::Hash[T.any(String, Symbol), T.any(String, T::Array[String])],
63
+ name: String
64
+ ).returns(T.nilable(String))
65
+ end
66
+ private def header_value(headers, name)
67
+ end
68
+
69
+ # @api private
70
+ sig { params(secret: String).returns(String) }
71
+ private def decode_secret(secret)
72
+ end
73
+
74
+ # @api private
75
+ sig { params(msg_timestamp: String, tolerance: Integer).void }
76
+ private def verify_timestamp!(msg_timestamp, tolerance = TOLERANCE_SECONDS)
77
+ end
78
+
79
+ # @api private
80
+ sig { params(expected: String, signature: T.nilable(String)).returns(T::Boolean) }
81
+ private def secure_compare(expected, signature)
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -8,8 +8,7 @@ module Straddle
8
8
  # this alias might be refined in the future.
9
9
  AnyHash = T.type_alias { T::Hash[Symbol, T.anything] }
10
10
 
11
- FileInput =
12
- T.type_alias { T.any(Pathname, StringIO, IO, String, Straddle::FilePart) }
11
+ FileInput = T.type_alias { T.any(Pathname, StringIO, IO, String, Straddle::FilePart) }
13
12
 
14
13
  OMIT = T.let(Object.new.freeze, T.anything)
15
14
  end
@@ -220,7 +220,7 @@ module Straddle
220
220
  end
221
221
 
222
222
  # Daily charge amount limit in cents.
223
- sig { returns(Float) }
223
+ sig { returns(Integer) }
224
224
  attr_accessor :daily_amount
225
225
 
226
226
  # Whether to enable or disable charges for the account.
@@ -228,11 +228,11 @@ module Straddle
228
228
  attr_accessor :enable
229
229
 
230
230
  # Maximum amount in cents for one charge.
231
- sig { returns(Float) }
231
+ sig { returns(Integer) }
232
232
  attr_accessor :max_amount
233
233
 
234
234
  # Monthly charge amount limit in cents.
235
- sig { returns(Float) }
235
+ sig { returns(Integer) }
236
236
  attr_accessor :monthly_amount
237
237
 
238
238
  # Maximum number of charges per calendar month.
@@ -242,10 +242,10 @@ module Straddle
242
242
  # Requested charge capability and limits.
243
243
  sig do
244
244
  params(
245
- daily_amount: Float,
245
+ daily_amount: Integer,
246
246
  enable: T::Boolean,
247
- max_amount: Float,
248
- monthly_amount: Float,
247
+ max_amount: Integer,
248
+ monthly_amount: Integer,
249
249
  monthly_count: Integer
250
250
  ).returns(T.attached_class)
251
251
  end
@@ -266,10 +266,10 @@ module Straddle
266
266
  sig do
267
267
  override.returns(
268
268
  {
269
- daily_amount: Float,
269
+ daily_amount: Integer,
270
270
  enable: T::Boolean,
271
- max_amount: Float,
272
- monthly_amount: Float,
271
+ max_amount: Integer,
272
+ monthly_amount: Integer,
273
273
  monthly_count: Integer
274
274
  }
275
275
  )
@@ -340,7 +340,7 @@ module Straddle
340
340
  end
341
341
 
342
342
  # Daily payout amount limit in cents.
343
- sig { returns(Float) }
343
+ sig { returns(Integer) }
344
344
  attr_accessor :daily_amount
345
345
 
346
346
  # Whether to enable or disable payouts for the account.
@@ -348,11 +348,11 @@ module Straddle
348
348
  attr_accessor :enable
349
349
 
350
350
  # Maximum amount in cents for one payout.
351
- sig { returns(Float) }
351
+ sig { returns(Integer) }
352
352
  attr_accessor :max_amount
353
353
 
354
354
  # Monthly payout amount limit in cents.
355
- sig { returns(Float) }
355
+ sig { returns(Integer) }
356
356
  attr_accessor :monthly_amount
357
357
 
358
358
  # Maximum number of payouts per calendar month.
@@ -362,10 +362,10 @@ module Straddle
362
362
  # Requested payout capability and limits.
363
363
  sig do
364
364
  params(
365
- daily_amount: Float,
365
+ daily_amount: Integer,
366
366
  enable: T::Boolean,
367
- max_amount: Float,
368
- monthly_amount: Float,
367
+ max_amount: Integer,
368
+ monthly_amount: Integer,
369
369
  monthly_count: Integer
370
370
  ).returns(T.attached_class)
371
371
  end
@@ -386,10 +386,10 @@ module Straddle
386
386
  sig do
387
387
  override.returns(
388
388
  {
389
- daily_amount: Float,
389
+ daily_amount: Integer,
390
390
  enable: T::Boolean,
391
- max_amount: Float,
392
- monthly_amount: Float,
391
+ max_amount: Integer,
392
+ monthly_amount: Integer,
393
393
  monthly_count: Integer
394
394
  }
395
395
  )
@@ -24,7 +24,8 @@ module Straddle
24
24
  sig { returns(String) }
25
25
  attr_accessor :label
26
26
 
27
- # Masked paykey value.
27
+ # Paykey value. Paykey create responses return the full value for creating
28
+ # payments. Store it securely. Other responses return it masked.
28
29
  sig { returns(String) }
29
30
  attr_accessor :paykey
30
31
 
@@ -113,7 +114,8 @@ module Straddle
113
114
  created_at:,
114
115
  # Human-readable label for the paykey.
115
116
  label:,
116
- # Masked paykey value.
117
+ # Paykey value. Paykey create responses return the full value for creating
118
+ # payments. Store it securely. Other responses return it masked.
117
119
  paykey:,
118
120
  source:,
119
121
  status:,
@@ -302,7 +302,9 @@ module Straddle
302
302
  sig { returns(Straddle::PaykeyBalanceRefreshStatus::TaggedSymbol) }
303
303
  attr_accessor :status
304
304
 
305
- # Most recently retrieved account balance in dollars.
305
+ # Most recently retrieved account balance in dollars. Unlike REST paykey
306
+ # responses, which report `account_balance` in cents, this webhook field uses
307
+ # dollars.
306
308
  sig { returns(T.nilable(Float)) }
307
309
  attr_accessor :account_balance
308
310
 
@@ -319,7 +321,9 @@ module Straddle
319
321
  end
320
322
  def self.new(
321
323
  status:,
322
- # Most recently retrieved account balance in dollars.
324
+ # Most recently retrieved account balance in dollars. Unlike REST paykey
325
+ # responses, which report `account_balance` in cents, this webhook field uses
326
+ # dollars.
323
327
  account_balance: nil,
324
328
  # Timestamp of the most recent account balance update.
325
329
  updated_at: nil
@@ -295,7 +295,9 @@ module Straddle
295
295
  sig { returns(Straddle::PaykeyBalanceRefreshStatus::TaggedSymbol) }
296
296
  attr_accessor :status
297
297
 
298
- # Most recently retrieved account balance in dollars.
298
+ # Most recently retrieved account balance in dollars. Unlike REST paykey
299
+ # responses, which report `account_balance` in cents, this webhook field uses
300
+ # dollars.
299
301
  sig { returns(T.nilable(Float)) }
300
302
  attr_accessor :account_balance
301
303
 
@@ -312,7 +314,9 @@ module Straddle
312
314
  end
313
315
  def self.new(
314
316
  status:,
315
- # Most recently retrieved account balance in dollars.
317
+ # Most recently retrieved account balance in dollars. Unlike REST paykey
318
+ # responses, which report `account_balance` in cents, this webhook field uses
319
+ # dollars.
316
320
  account_balance: nil,
317
321
  # Timestamp of the most recent account balance update.
318
322
  updated_at: nil
@@ -21,6 +21,10 @@ module Straddle
21
21
  sig { params(config: Straddle::PayoutConfiguration::OrHash).void }
22
22
  attr_writer :config
23
23
 
24
+ # Timestamp when this payout was created.
25
+ sig { returns(Time) }
26
+ attr_accessor :created_at
27
+
24
28
  # Currency code. Only `USD` is supported.
25
29
  sig { returns(String) }
26
30
  attr_accessor :currency
@@ -86,9 +90,9 @@ module Straddle
86
90
  sig { returns(T::Hash[Symbol, String]) }
87
91
  attr_accessor :trace_ids
88
92
 
89
- # Timestamp when this payout was created.
90
- sig { returns(T.nilable(Time)) }
91
- attr_accessor :created_at
93
+ # Timestamp when this payout was last updated.
94
+ sig { returns(Time) }
95
+ attr_accessor :updated_at
92
96
 
93
97
  # Information about the customer associated with the payout.
94
98
  sig { returns(T.nilable(Straddle::CustomerDetails)) }
@@ -132,15 +136,12 @@ module Straddle
132
136
  sig { returns(T.nilable(T::Array[Straddle::RelatedPayment])) }
133
137
  attr_accessor :related_payments
134
138
 
135
- # Timestamp when this payout was last updated.
136
- sig { returns(T.nilable(Time)) }
137
- attr_accessor :updated_at
138
-
139
139
  sig do
140
140
  params(
141
141
  id: String,
142
142
  amount: Integer,
143
143
  config: Straddle::PayoutConfiguration::OrHash,
144
+ created_at: Time,
144
145
  currency: String,
145
146
  description: T.nilable(String),
146
147
  device: Straddle::MaskedPaymentDevice::OrHash,
@@ -155,7 +156,7 @@ module Straddle
155
156
  status_details: Straddle::PaymentStatusDetails::OrHash,
156
157
  status_history: T::Array[Straddle::PaymentStatusHistory::OrHash],
157
158
  trace_ids: T::Hash[Symbol, String],
158
- created_at: T.nilable(Time),
159
+ updated_at: Time,
159
160
  customer_details: Straddle::CustomerDetails::OrHash,
160
161
  documents:
161
162
  T.nilable(T::Array[Straddle::PaymentAuthorizationProof::OrHash]),
@@ -165,8 +166,7 @@ module Straddle
165
166
  payment_rail: Straddle::PaymentRail::OrSymbol,
166
167
  processed_at: T.nilable(Time),
167
168
  related_payments:
168
- T.nilable(T::Array[Straddle::RelatedPayment::OrHash]),
169
- updated_at: T.nilable(Time)
169
+ T.nilable(T::Array[Straddle::RelatedPayment::OrHash])
170
170
  ).returns(T.attached_class)
171
171
  end
172
172
  def self.new(
@@ -176,6 +176,8 @@ module Straddle
176
176
  amount:,
177
177
  # Configuration for the payout.
178
178
  config:,
179
+ # Timestamp when this payout was created.
180
+ created_at:,
179
181
  # Currency code. Only `USD` is supported.
180
182
  currency:,
181
183
  # A human-readable description of the payout.
@@ -205,8 +207,8 @@ module Straddle
205
207
  status_history:,
206
208
  # Trace identifiers from the payment network. Keys depend on the payment rail.
207
209
  trace_ids:,
208
- # Timestamp when this payout was created.
209
- created_at: nil,
210
+ # Timestamp when this payout was last updated.
211
+ updated_at:,
210
212
  # Information about the customer associated with the payout.
211
213
  customer_details: nil,
212
214
  # Authorization documents for this payout, ordered by upload time.
@@ -223,9 +225,7 @@ module Straddle
223
225
  # processed.
224
226
  processed_at: nil,
225
227
  # Related payments and their relationship to this payout.
226
- related_payments: nil,
227
- # Timestamp when this payout was last updated.
228
- updated_at: nil
228
+ related_payments: nil
229
229
  )
230
230
  end
231
231
 
@@ -235,6 +235,7 @@ module Straddle
235
235
  id: String,
236
236
  amount: Integer,
237
237
  config: Straddle::PayoutConfiguration,
238
+ created_at: Time,
238
239
  currency: String,
239
240
  description: T.nilable(String),
240
241
  device: Straddle::MaskedPaymentDevice,
@@ -249,7 +250,7 @@ module Straddle
249
250
  status_details: Straddle::PaymentStatusDetails,
250
251
  status_history: T::Array[Straddle::PaymentStatusHistory],
251
252
  trace_ids: T::Hash[Symbol, String],
252
- created_at: T.nilable(Time),
253
+ updated_at: Time,
253
254
  customer_details: Straddle::CustomerDetails,
254
255
  documents: T.nilable(T::Array[Straddle::PaymentAuthorizationProof]),
255
256
  effective_at: T.nilable(Time),
@@ -257,8 +258,7 @@ module Straddle
257
258
  paykey_details: Straddle::PaykeyDetails,
258
259
  payment_rail: Straddle::PaymentRail::TaggedSymbol,
259
260
  processed_at: T.nilable(Time),
260
- related_payments: T.nilable(T::Array[Straddle::RelatedPayment]),
261
- updated_at: T.nilable(Time)
261
+ related_payments: T.nilable(T::Array[Straddle::RelatedPayment])
262
262
  }
263
263
  )
264
264
  end
@@ -22,6 +22,10 @@ module Straddle
22
22
  sig { params(config: Straddle::PayoutConfiguration::OrHash).void }
23
23
  attr_writer :config
24
24
 
25
+ # Timestamp when this payout was created.
26
+ sig { returns(Time) }
27
+ attr_accessor :created_at
28
+
25
29
  # Currency code. Only `USD` is supported.
26
30
  sig { returns(String) }
27
31
  attr_accessor :currency
@@ -85,9 +89,9 @@ module Straddle
85
89
  sig { returns(T::Hash[Symbol, String]) }
86
90
  attr_accessor :trace_ids
87
91
 
88
- # Timestamp when this payout was created.
89
- sig { returns(T.nilable(Time)) }
90
- attr_accessor :created_at
92
+ # Timestamp when this payout was last updated.
93
+ sig { returns(Time) }
94
+ attr_accessor :updated_at
91
95
 
92
96
  # Information about the customer associated with the charge or payout.
93
97
  sig { returns(T.nilable(Straddle::CustomerDetails)) }
@@ -130,15 +134,12 @@ module Straddle
130
134
  sig { returns(T.nilable(T::Array[Straddle::RelatedPayment])) }
131
135
  attr_accessor :related_payments
132
136
 
133
- # Timestamp when this payout was last updated.
134
- sig { returns(T.nilable(Time)) }
135
- attr_accessor :updated_at
136
-
137
137
  sig do
138
138
  params(
139
139
  id: String,
140
140
  amount: Integer,
141
141
  config: Straddle::PayoutConfiguration::OrHash,
142
+ created_at: Time,
142
143
  currency: String,
143
144
  description: T.nilable(String),
144
145
  device: Straddle::PaymentDevice::OrHash,
@@ -153,7 +154,7 @@ module Straddle
153
154
  status_details: Straddle::PaymentStatusDetails::OrHash,
154
155
  status_history: T::Array[Straddle::PaymentStatusHistory::OrHash],
155
156
  trace_ids: T::Hash[Symbol, String],
156
- created_at: T.nilable(Time),
157
+ updated_at: Time,
157
158
  customer_details: Straddle::CustomerDetails::OrHash,
158
159
  documents:
159
160
  T.nilable(T::Array[Straddle::PaymentAuthorizationProof::OrHash]),
@@ -163,8 +164,7 @@ module Straddle
163
164
  payment_rail: Straddle::PaymentRail::OrSymbol,
164
165
  processed_at: T.nilable(Time),
165
166
  related_payments:
166
- T.nilable(T::Array[Straddle::RelatedPayment::OrHash]),
167
- updated_at: T.nilable(Time)
167
+ T.nilable(T::Array[Straddle::RelatedPayment::OrHash])
168
168
  ).returns(T.attached_class)
169
169
  end
170
170
  def self.new(
@@ -173,6 +173,8 @@ module Straddle
173
173
  # Amount in cents.
174
174
  amount:,
175
175
  config:,
176
+ # Timestamp when this payout was created.
177
+ created_at:,
176
178
  # Currency code. Only `USD` is supported.
177
179
  currency:,
178
180
  # A human-readable description of the payout.
@@ -200,8 +202,8 @@ module Straddle
200
202
  status_history:,
201
203
  # Trace identifiers from the payment network. Keys depend on the payment rail.
202
204
  trace_ids:,
203
- # Timestamp when this payout was created.
204
- created_at: nil,
205
+ # Timestamp when this payout was last updated.
206
+ updated_at:,
205
207
  # Information about the customer associated with the charge or payout.
206
208
  customer_details: nil,
207
209
  # Authorization documents for this payout, ordered by upload time.
@@ -217,9 +219,7 @@ module Straddle
217
219
  # processed.
218
220
  processed_at: nil,
219
221
  # Related payments and their relationship to this payout.
220
- related_payments: nil,
221
- # Timestamp when this payout was last updated.
222
- updated_at: nil
222
+ related_payments: nil
223
223
  )
224
224
  end
225
225
 
@@ -229,6 +229,7 @@ module Straddle
229
229
  id: String,
230
230
  amount: Integer,
231
231
  config: Straddle::PayoutConfiguration,
232
+ created_at: Time,
232
233
  currency: String,
233
234
  description: T.nilable(String),
234
235
  device: Straddle::PaymentDevice,
@@ -243,7 +244,7 @@ module Straddle
243
244
  status_details: Straddle::PaymentStatusDetails,
244
245
  status_history: T::Array[Straddle::PaymentStatusHistory],
245
246
  trace_ids: T::Hash[Symbol, String],
246
- created_at: T.nilable(Time),
247
+ updated_at: Time,
247
248
  customer_details: Straddle::CustomerDetails,
248
249
  documents: T.nilable(T::Array[Straddle::PaymentAuthorizationProof]),
249
250
  effective_at: T.nilable(Time),
@@ -251,8 +252,7 @@ module Straddle
251
252
  paykey_details: Straddle::PaykeyDetails,
252
253
  payment_rail: Straddle::PaymentRail::TaggedSymbol,
253
254
  processed_at: T.nilable(Time),
254
- related_payments: T.nilable(T::Array[Straddle::RelatedPayment]),
255
- updated_at: T.nilable(Time)
255
+ related_payments: T.nilable(T::Array[Straddle::RelatedPayment])
256
256
  }
257
257
  )
258
258
  end
@@ -23,5 +23,7 @@ module Straddle
23
23
  def to_hash
24
24
  end
25
25
  end
26
+
27
+ WebhookParsedParams = WebhookUnwrapParams
26
28
  end
27
29
  end
@@ -472,5 +472,7 @@ module Straddle
472
472
 
473
473
  UserEventV1WebhookEvent = Straddle::Models::UserEventV1WebhookEvent
474
474
 
475
+ WebhookParsedParams = Straddle::Models::WebhookParsedParams
476
+
475
477
  WebhookUnwrapParams = Straddle::Models::WebhookUnwrapParams
476
478
  end
@@ -17,18 +17,14 @@ module Straddle
17
17
  def self.validate!(opts)
18
18
  end
19
19
 
20
- # Idempotency key to send with request and all associated retries. Will only be
21
- # sent for write requests.
20
+ # Idempotency key to send with this request and its retries when the client
21
+ # has an idempotency header configured.
22
22
  sig { returns(T.nilable(String)) }
23
23
  attr_accessor :idempotency_key
24
24
 
25
25
  # Extra query params to send with the request. These are `.merge`’d into any
26
26
  # `query` given at the client level.
27
- sig do
28
- returns(
29
- T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))])
30
- )
31
- end
27
+ sig { returns(T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))])) }
32
28
  attr_accessor :extra_query
33
29
 
34
30
  # Extra headers to send with the request. These are `.merged`’d into any
@@ -50,9 +46,7 @@ module Straddle
50
46
  attr_accessor :timeout
51
47
 
52
48
  # Returns a new instance of RequestOptions.
53
- sig do
54
- params(values: Straddle::Internal::AnyHash).returns(T.attached_class)
55
- end
49
+ sig { params(values: Straddle::Internal::AnyHash).returns(T.attached_class) }
56
50
  def self.new(values = {})
57
51
  end
58
52
  end
@@ -46,7 +46,8 @@ module Straddle
46
46
  )
47
47
  end
48
48
 
49
- # Returns the account with the specified ID.
49
+ # Returns the account with the specified `account_id`. Includes the account's
50
+ # status, business profile, capabilities, settings, and access level.
50
51
  sig do
51
52
  params(
52
53
  account_id: String,
@@ -5,7 +5,8 @@ module Straddle
5
5
  # Bridge connects customer bank accounts and creates paykeys from supported
6
6
  # provider tokens or bank account details.
7
7
  class Bridge
8
- # Creates a paykey from a routing number, account number, and account type.
8
+ # Creates a paykey directly from a customer's `routing_number`, `account_number`,
9
+ # and `account_type`. Returns the new paykey with its status and bank details.
9
10
  sig do
10
11
  params(
11
12
  account_number: String,
@@ -51,7 +52,8 @@ module Straddle
51
52
  )
52
53
  end
53
54
 
54
- # Creates a paykey from a Plaid processor token.
55
+ # Creates a paykey from a customer's `plaid_token`. Returns the created paykey
56
+ # with its status, institution name, and bank details.
55
57
  sig do
56
58
  params(
57
59
  customer_id: String,
@@ -92,7 +94,8 @@ module Straddle
92
94
  )
93
95
  end
94
96
 
95
- # Creates a paykey from a Quiltt processor token.
97
+ # Creates a paykey from a customer's `quiltt_token`. Returns the created paykey
98
+ # with its unmasked `paykey` value, status, and bank details.
96
99
  sig do
97
100
  params(
98
101
  customer_id: String,
@@ -133,7 +136,8 @@ module Straddle
133
136
  )
134
137
  end
135
138
 
136
- # Creates a session token for the Bridge widget.
139
+ # Creates a `bridge_token` for a customer to initialize the Bridge widget. Use
140
+ # this token to connect bank accounts and create paykeys.
137
141
  sig do
138
142
  params(
139
143
  customer_id: String,
@@ -62,7 +62,8 @@ module Straddle
62
62
  )
63
63
  end
64
64
 
65
- # Returns a charge by its unique identifier.
65
+ # Returns a charge by its unique `id`. Includes payment amount, status history,
66
+ # customer and paykey details, funding IDs, and trace IDs.
66
67
  sig do
67
68
  params(
68
69
  id: String,
@@ -191,7 +192,8 @@ module Straddle
191
192
  )
192
193
  end
193
194
 
194
- # Return a charge with its sensitive fields unmasked.
195
+ # Returns a charge by `id` with sensitive fields unmasked, including the full
196
+ # `paykey` value. Includes payment status history, funding IDs, and trace IDs.
195
197
  sig do
196
198
  params(
197
199
  id: String,
@@ -10,7 +10,9 @@ module Straddle
10
10
  sig { returns(Straddle::Resources::Customers::Review) }
11
11
  attr_reader :review
12
12
 
13
- # Creates a customer and starts identity, fraud, and risk assessments.
13
+ # Creates a customer record and starts identity, fraud, and risk assessments.
14
+ # Returns the created customer with its status, profile details, compliance
15
+ # profile, and configuration.
14
16
  sig do
15
17
  params(
16
18
  device: Straddle::CustomerDevice::OrHash,
@@ -74,7 +76,8 @@ module Straddle
74
76
  )
75
77
  end
76
78
 
77
- # Returns a customer by `id`.
79
+ # Returns a customer by its unique `id`. Includes the customer's profile,
80
+ # verification status, compliance profile, and metadata.
78
81
  sig do
79
82
  params(
80
83
  id: String,
@@ -97,7 +100,8 @@ module Straddle
97
100
  )
98
101
  end
99
102
 
100
- # Updates an existing customer's profile, status, and metadata.
103
+ # Updates an existing customer's profile, status, compliance profile, and
104
+ # metadata. Returns the updated customer record.
101
105
  sig do
102
106
  params(
103
107
  id: String,
@@ -29,7 +29,9 @@ module Straddle
29
29
  )
30
30
  end
31
31
 
32
- # Returns a paginated list of funding events that match the specified filters.
32
+ # Returns a paginated list of funding event summaries matching the specified
33
+ # filters. Supports filtering by direction, event type, status, trace ID, and
34
+ # creation dates.
33
35
  sig do
34
36
  params(
35
37
  created_from: T.nilable(Date),
@@ -96,7 +98,8 @@ module Straddle
96
98
  )
97
99
  end
98
100
 
99
- # Returns a paginated list of payments included in the funding event.
101
+ # Returns a paginated list of payments included in the specified funding event
102
+ # `id`. Includes each payment's type, status, amounts, and trace IDs.
100
103
  sig do
101
104
  params(
102
105
  id: String,
@@ -35,7 +35,8 @@ module Straddle
35
35
  )
36
36
  end
37
37
 
38
- # Returns the organization with the specified ID.
38
+ # Returns the organization with the specified `organization_id`. Includes the
39
+ # organization's name, `external_id`, metadata, and timestamps.
39
40
  sig do
40
41
  params(
41
42
  organization_id: String,