straddle 1.0.4 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +84 -89
- data/SKILL.md +4 -2
- data/api.md +23 -23
- data/lib/straddle/client.rb +24 -7
- data/lib/straddle/errors.rb +40 -0
- data/lib/straddle/file_part.rb +13 -1
- data/lib/straddle/internal/transport/base_client.rb +186 -42
- data/lib/straddle/internal/transport/connection_pool.rb +160 -0
- data/lib/straddle/internal/transport/pooled_net_requester.rb +77 -10
- data/lib/straddle/internal/type/base_model.rb +69 -18
- data/lib/straddle/internal/type/base_page.rb +14 -0
- data/lib/straddle/internal/type/boolean.rb +3 -1
- data/lib/straddle/internal/type/converter.rb +13 -3
- data/lib/straddle/internal/type/enum.rb +9 -4
- data/lib/straddle/internal/type/file_input.rb +8 -2
- data/lib/straddle/internal/type/hash_of.rb +3 -1
- data/lib/straddle/internal/type/union.rb +21 -7
- data/lib/straddle/internal/type/unknown.rb +3 -1
- data/lib/straddle/internal/util.rb +273 -15
- data/lib/straddle/internal/webhook_verifier.rb +240 -0
- data/lib/straddle/internal.rb +5 -1
- data/lib/straddle/models/capability_request_create_params.rb +18 -18
- data/lib/straddle/models/paykey.rb +3 -2
- data/lib/straddle/models/paykey_created_v1_webhook_event.rb +7 -2
- data/lib/straddle/models/paykey_event_v1_webhook_event.rb +7 -2
- data/lib/straddle/models/webhook_unwrap_params.rb +2 -0
- data/lib/straddle/models.rb +30 -31
- data/lib/straddle/request_options.rb +13 -5
- data/lib/straddle/resources/accounts.rb +11 -12
- data/lib/straddle/resources/bridge.rb +8 -4
- data/lib/straddle/resources/capability_requests.rb +4 -5
- data/lib/straddle/resources/charges.rb +18 -15
- data/lib/straddle/resources/customers/review.rb +5 -6
- data/lib/straddle/resources/customers.rb +34 -35
- data/lib/straddle/resources/funding_events.rb +20 -20
- data/lib/straddle/resources/linked_bank_accounts.rb +9 -11
- data/lib/straddle/resources/organizations.rb +6 -6
- data/lib/straddle/resources/paykeys/review.rb +5 -6
- data/lib/straddle/resources/paykeys.rb +34 -39
- data/lib/straddle/resources/payments.rb +8 -7
- data/lib/straddle/resources/payouts.rb +18 -15
- data/lib/straddle/resources/representatives.rb +7 -6
- data/lib/straddle/resources/webhooks.rb +63 -6
- data/lib/straddle/version.rb +1 -1
- data/lib/straddle.rb +5 -6
- data/rbi/straddle/client.rbi +13 -0
- data/rbi/straddle/errors.rbi +25 -27
- data/rbi/straddle/internal/transport/base_client.rbi +45 -54
- data/rbi/straddle/internal/transport/connection_pool.rbi +44 -0
- data/rbi/straddle/internal/transport/pooled_net_requester.rbi +15 -16
- data/rbi/straddle/internal/type/base_model.rbi +24 -38
- data/rbi/straddle/internal/type/base_page.rbi +5 -0
- data/rbi/straddle/internal/type/converter.rbi +9 -42
- data/rbi/straddle/internal/type/enum.rbi +1 -5
- data/rbi/straddle/internal/type/request_parameters.rbi +1 -3
- data/rbi/straddle/internal/type/union.rbi +2 -11
- data/rbi/straddle/internal/util.rbi +101 -115
- data/rbi/straddle/internal/webhook_verifier.rbi +86 -0
- data/rbi/straddle/internal.rbi +1 -2
- data/rbi/straddle/models/capability_request_create_params.rbi +18 -18
- data/rbi/straddle/models/paykey.rbi +4 -2
- data/rbi/straddle/models/paykey_created_v1_webhook_event.rbi +6 -2
- data/rbi/straddle/models/paykey_event_v1_webhook_event.rbi +6 -2
- data/rbi/straddle/models/webhook_unwrap_params.rbi +2 -0
- data/rbi/straddle/models.rbi +2 -0
- data/rbi/straddle/request_options.rbi +4 -10
- data/rbi/straddle/resources/accounts.rbi +2 -1
- data/rbi/straddle/resources/bridge.rbi +8 -4
- data/rbi/straddle/resources/charges.rbi +4 -2
- data/rbi/straddle/resources/customers.rbi +7 -3
- data/rbi/straddle/resources/funding_events.rbi +5 -2
- data/rbi/straddle/resources/organizations.rbi +2 -1
- data/rbi/straddle/resources/paykeys.rbi +2 -1
- data/rbi/straddle/resources/payments.rbi +3 -1
- data/rbi/straddle/resources/payouts.rbi +4 -2
- data/rbi/straddle/resources/representatives.rbi +3 -1
- data/rbi/straddle/resources/webhooks.rbi +107 -2
- data/sig/straddle/client.rbs +4 -0
- data/sig/straddle/errors.rbs +13 -0
- data/sig/straddle/internal/transport/base_client.rbs +19 -1
- data/sig/straddle/internal/transport/connection_pool.rbs +19 -0
- data/sig/straddle/internal/transport/pooled_net_requester.rbs +11 -1
- data/sig/straddle/internal/type/base_model.rbs +4 -0
- data/sig/straddle/internal/type/base_page.rbs +2 -0
- data/sig/straddle/internal/util.rbs +29 -1
- data/sig/straddle/internal/webhook_verifier.rbs +53 -0
- data/sig/straddle/models/capability_request_create_params.rbs +24 -24
- data/sig/straddle/models/webhook_unwrap_params.rbs +4 -0
- data/sig/straddle/models.rbs +2 -0
- data/sig/straddle/resources/webhooks.rbs +59 -1
- metadata +12 -60
|
@@ -220,7 +220,7 @@ module Straddle
|
|
|
220
220
|
end
|
|
221
221
|
|
|
222
222
|
# Daily charge amount limit in cents.
|
|
223
|
-
sig { returns(
|
|
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(
|
|
231
|
+
sig { returns(Integer) }
|
|
232
232
|
attr_accessor :max_amount
|
|
233
233
|
|
|
234
234
|
# Monthly charge amount limit in cents.
|
|
235
|
-
sig { returns(
|
|
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:
|
|
245
|
+
daily_amount: Integer,
|
|
246
246
|
enable: T::Boolean,
|
|
247
|
-
max_amount:
|
|
248
|
-
monthly_amount:
|
|
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:
|
|
269
|
+
daily_amount: Integer,
|
|
270
270
|
enable: T::Boolean,
|
|
271
|
-
max_amount:
|
|
272
|
-
monthly_amount:
|
|
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(
|
|
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(
|
|
351
|
+
sig { returns(Integer) }
|
|
352
352
|
attr_accessor :max_amount
|
|
353
353
|
|
|
354
354
|
# Monthly payout amount limit in cents.
|
|
355
|
-
sig { returns(
|
|
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:
|
|
365
|
+
daily_amount: Integer,
|
|
366
366
|
enable: T::Boolean,
|
|
367
|
-
max_amount:
|
|
368
|
-
monthly_amount:
|
|
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:
|
|
389
|
+
daily_amount: Integer,
|
|
390
390
|
enable: T::Boolean,
|
|
391
|
-
max_amount:
|
|
392
|
-
monthly_amount:
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
data/rbi/straddle/models.rbi
CHANGED
|
@@ -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
|
|
21
|
-
#
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
#
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
@@ -92,7 +92,8 @@ module Straddle
|
|
|
92
92
|
)
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
# Cancels a paykey so it cannot be used for new payments.
|
|
95
|
+
# Cancels a paykey by `id` so it cannot be used for new payments. Accepts an
|
|
96
|
+
# optional cancellation `reason` and returns the updated paykey.
|
|
96
97
|
sig do
|
|
97
98
|
params(
|
|
98
99
|
id: String,
|
|
@@ -4,7 +4,9 @@ module Straddle
|
|
|
4
4
|
module Resources
|
|
5
5
|
# Payments provide a combined view of charges and payouts.
|
|
6
6
|
class Payments
|
|
7
|
-
# Returns a
|
|
7
|
+
# Returns a paginated list of charges and payouts matching the specified filters.
|
|
8
|
+
# Supports filtering by payment type, status, customer, paykey, amount range, and
|
|
9
|
+
# dates.
|
|
8
10
|
sig do
|
|
9
11
|
params(
|
|
10
12
|
customer_id: String,
|
|
@@ -58,7 +58,8 @@ module Straddle
|
|
|
58
58
|
)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
# Returns a payout by its unique
|
|
61
|
+
# Returns a payout by its unique `id`. Includes payment amount, status history,
|
|
62
|
+
# customer and paykey details, funding IDs, and trace IDs.
|
|
62
63
|
sig do
|
|
63
64
|
params(
|
|
64
65
|
id: String,
|
|
@@ -187,7 +188,8 @@ module Straddle
|
|
|
187
188
|
)
|
|
188
189
|
end
|
|
189
190
|
|
|
190
|
-
#
|
|
191
|
+
# Returns a payout by `id` with sensitive fields unmasked, including the full
|
|
192
|
+
# `paykey` value. Includes payment status history, funding IDs, and trace IDs.
|
|
191
193
|
sig do
|
|
192
194
|
params(
|
|
193
195
|
id: String,
|
|
@@ -58,7 +58,9 @@ module Straddle
|
|
|
58
58
|
)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
# Returns the representative with the specified
|
|
61
|
+
# Returns the representative with the specified `representative_id`. Includes
|
|
62
|
+
# personal details, verification status, and ownership or control relationship
|
|
63
|
+
# flags.
|
|
62
64
|
sig do
|
|
63
65
|
params(
|
|
64
66
|
representative_id: String,
|
|
@@ -6,7 +6,7 @@ module Straddle
|
|
|
6
6
|
sig do
|
|
7
7
|
params(
|
|
8
8
|
payload: String,
|
|
9
|
-
headers: T::Hash[String, String],
|
|
9
|
+
headers: T::Hash[T.any(String, Symbol), T.any(String, T::Array[String])],
|
|
10
10
|
key: T.nilable(String)
|
|
11
11
|
).returns(
|
|
12
12
|
T.any(
|
|
@@ -41,7 +41,112 @@ module Straddle
|
|
|
41
41
|
# The raw HTTP headers that came with the payload
|
|
42
42
|
headers:,
|
|
43
43
|
# The webhook signing key
|
|
44
|
-
key:
|
|
44
|
+
key: nil
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Back-compat alias for `unwrap`, which it calls with the same arguments. SDKs
|
|
49
|
+
# that named this helper `parsed` shipped it under this name.
|
|
50
|
+
#
|
|
51
|
+
# @deprecated Use `unwrap` instead.
|
|
52
|
+
sig do
|
|
53
|
+
params(
|
|
54
|
+
payload: String,
|
|
55
|
+
headers: T::Hash[T.any(String, Symbol), T.any(String, T::Array[String])],
|
|
56
|
+
key: T.nilable(String)
|
|
57
|
+
).returns(
|
|
58
|
+
T.any(
|
|
59
|
+
Straddle::AccountCreatedV1WebhookEvent,
|
|
60
|
+
Straddle::AccountEventV1WebhookEvent,
|
|
61
|
+
Straddle::RepresentativeEventV1WebhookEvent,
|
|
62
|
+
Straddle::RepresentativeCreatedV1WebhookEvent,
|
|
63
|
+
Straddle::LinkedBankAccountEventV1WebhookEvent,
|
|
64
|
+
Straddle::LinkedBankAccountCreatedV1WebhookEvent,
|
|
65
|
+
Straddle::CapabilityRequestEventV1WebhookEvent,
|
|
66
|
+
Straddle::CapabilityRequestCreatedV1WebhookEvent,
|
|
67
|
+
Straddle::CustomerEventV1WebhookEvent,
|
|
68
|
+
Straddle::CustomerCreatedV1WebhookEvent,
|
|
69
|
+
Straddle::PaykeyEventV1WebhookEvent,
|
|
70
|
+
Straddle::PaykeyCreatedV1WebhookEvent,
|
|
71
|
+
Straddle::ChargeCreatedV1WebhookEvent,
|
|
72
|
+
Straddle::ChargeEventV1WebhookEvent,
|
|
73
|
+
Straddle::PayoutCreatedV1WebhookEvent,
|
|
74
|
+
Straddle::PayoutEventV1WebhookEvent,
|
|
75
|
+
Straddle::PlatformEventV1WebhookEvent,
|
|
76
|
+
Straddle::PlatformCreatedV1WebhookEvent,
|
|
77
|
+
Straddle::UserEventV1WebhookEvent,
|
|
78
|
+
Straddle::UserCreatedV1WebhookEvent,
|
|
79
|
+
Straddle::FundingEventCreatedV1WebhookEvent,
|
|
80
|
+
Straddle::FundingEventEventV1WebhookEvent
|
|
81
|
+
)
|
|
82
|
+
)
|
|
83
|
+
end
|
|
84
|
+
def parsed(
|
|
85
|
+
# The raw webhook payload as a string
|
|
86
|
+
payload,
|
|
87
|
+
# The raw HTTP headers that came with the payload
|
|
88
|
+
headers:,
|
|
89
|
+
# The webhook signing key
|
|
90
|
+
key: nil
|
|
91
|
+
)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Verifies that the payload was signed with the webhook key, raising when it was
|
|
95
|
+
# not.
|
|
96
|
+
sig do
|
|
97
|
+
params(
|
|
98
|
+
payload: String,
|
|
99
|
+
headers:
|
|
100
|
+
T::Hash[T.any(String, Symbol), T.any(String, T::Array[String])],
|
|
101
|
+
key: T.nilable(String)
|
|
102
|
+
).returns(T::Hash[Symbol, T.untyped])
|
|
103
|
+
end
|
|
104
|
+
def verify_signature(
|
|
105
|
+
# The raw webhook payload as a string
|
|
106
|
+
payload:,
|
|
107
|
+
# The raw HTTP headers that came with the payload
|
|
108
|
+
headers:,
|
|
109
|
+
# The webhook signing key
|
|
110
|
+
key: nil
|
|
111
|
+
)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Parses the payload into a typed event without verifying its signature.
|
|
115
|
+
#
|
|
116
|
+
# Only use this for a payload whose signature was already verified, or in tests.
|
|
117
|
+
sig do
|
|
118
|
+
params(
|
|
119
|
+
payload: String
|
|
120
|
+
).returns(
|
|
121
|
+
T.any(
|
|
122
|
+
Straddle::AccountCreatedV1WebhookEvent,
|
|
123
|
+
Straddle::AccountEventV1WebhookEvent,
|
|
124
|
+
Straddle::RepresentativeEventV1WebhookEvent,
|
|
125
|
+
Straddle::RepresentativeCreatedV1WebhookEvent,
|
|
126
|
+
Straddle::LinkedBankAccountEventV1WebhookEvent,
|
|
127
|
+
Straddle::LinkedBankAccountCreatedV1WebhookEvent,
|
|
128
|
+
Straddle::CapabilityRequestEventV1WebhookEvent,
|
|
129
|
+
Straddle::CapabilityRequestCreatedV1WebhookEvent,
|
|
130
|
+
Straddle::CustomerEventV1WebhookEvent,
|
|
131
|
+
Straddle::CustomerCreatedV1WebhookEvent,
|
|
132
|
+
Straddle::PaykeyEventV1WebhookEvent,
|
|
133
|
+
Straddle::PaykeyCreatedV1WebhookEvent,
|
|
134
|
+
Straddle::ChargeCreatedV1WebhookEvent,
|
|
135
|
+
Straddle::ChargeEventV1WebhookEvent,
|
|
136
|
+
Straddle::PayoutCreatedV1WebhookEvent,
|
|
137
|
+
Straddle::PayoutEventV1WebhookEvent,
|
|
138
|
+
Straddle::PlatformEventV1WebhookEvent,
|
|
139
|
+
Straddle::PlatformCreatedV1WebhookEvent,
|
|
140
|
+
Straddle::UserEventV1WebhookEvent,
|
|
141
|
+
Straddle::UserCreatedV1WebhookEvent,
|
|
142
|
+
Straddle::FundingEventCreatedV1WebhookEvent,
|
|
143
|
+
Straddle::FundingEventEventV1WebhookEvent
|
|
144
|
+
)
|
|
145
|
+
)
|
|
146
|
+
end
|
|
147
|
+
def parse_unsafe(
|
|
148
|
+
# The raw webhook payload as a string
|
|
149
|
+
payload
|
|
45
150
|
)
|
|
46
151
|
end
|
|
47
152
|
|
data/sig/straddle/client.rbs
CHANGED
|
@@ -12,6 +12,8 @@ module Straddle
|
|
|
12
12
|
|
|
13
13
|
attr_reader webhook_secret: String?
|
|
14
14
|
|
|
15
|
+
attr_reader explicit_webhook_secret: String?
|
|
16
|
+
|
|
15
17
|
attr_reader accounts: Straddle::Resources::Accounts
|
|
16
18
|
|
|
17
19
|
attr_reader capability_requests: Straddle::Resources::CapabilityRequests
|
|
@@ -42,6 +44,8 @@ module Straddle
|
|
|
42
44
|
|
|
43
45
|
private def auth_headers: -> ::Hash[String, String]
|
|
44
46
|
|
|
47
|
+
private def auth_header_keys: -> ::Array[String]
|
|
48
|
+
|
|
45
49
|
def initialize: (
|
|
46
50
|
?bearer: String?,
|
|
47
51
|
?webhook_secret: String?,
|
data/sig/straddle/errors.rbs
CHANGED
|
@@ -25,6 +25,12 @@ module Straddle
|
|
|
25
25
|
|
|
26
26
|
attr_accessor body: top?
|
|
27
27
|
|
|
28
|
+
def request_id: -> String?
|
|
29
|
+
|
|
30
|
+
def problem_details: -> ::Hash[String | Symbol, top]?
|
|
31
|
+
|
|
32
|
+
private def response_header: (String name) -> String?
|
|
33
|
+
|
|
28
34
|
def initialize: (
|
|
29
35
|
url: URI::Generic,
|
|
30
36
|
?status: Integer?,
|
|
@@ -113,5 +119,12 @@ module Straddle
|
|
|
113
119
|
class InternalServerError < Straddle::Errors::APIStatusError
|
|
114
120
|
HTTP_STATUS: Range[Integer]
|
|
115
121
|
end
|
|
122
|
+
|
|
123
|
+
# Raised by SDKs that verify webhook signatures through the `standardwebhooks` gem when that gem
|
|
124
|
+
# is not installed. This SDK verifies them with the standard library and never raises it; the
|
|
125
|
+
# class is declared so code that rescues or names it keeps working.
|
|
126
|
+
class MissingDependencyError < Straddle::Errors::Error
|
|
127
|
+
def initialize: (gem_name: String, feature: String) -> void
|
|
128
|
+
end
|
|
116
129
|
end
|
|
117
130
|
end
|
|
@@ -20,6 +20,7 @@ module Straddle
|
|
|
20
20
|
page: Class?,
|
|
21
21
|
stream: Class?,
|
|
22
22
|
model: Straddle::Internal::Type::Converter::input?,
|
|
23
|
+
security: ::Array[::Array[String]]?,
|
|
23
24
|
options: Straddle::request_opts?
|
|
24
25
|
}
|
|
25
26
|
type request_input =
|
|
@@ -34,6 +35,8 @@ module Straddle
|
|
|
34
35
|
|
|
35
36
|
MAX_REDIRECTS: 20
|
|
36
37
|
|
|
38
|
+
MAX_RETRY_AFTER: 60
|
|
39
|
+
|
|
37
40
|
PLATFORM_HEADERS: ::Hash[String, String]
|
|
38
41
|
|
|
39
42
|
def self.validate!: (
|
|
@@ -45,10 +48,19 @@ module Straddle
|
|
|
45
48
|
headers: ::Hash[String, String]
|
|
46
49
|
) -> bool
|
|
47
50
|
|
|
51
|
+
def self.retry_after: (::Hash[String, String] headers) -> Float?
|
|
52
|
+
|
|
53
|
+
def self.redirect?: (
|
|
54
|
+
Integer status,
|
|
55
|
+
headers: ::Hash[String, String]
|
|
56
|
+
) -> bool
|
|
57
|
+
|
|
48
58
|
def self.follow_redirect: (
|
|
49
59
|
Straddle::Internal::Transport::BaseClient::request_input request,
|
|
50
60
|
status: Integer,
|
|
51
|
-
response_headers: ::Hash[String, String]
|
|
61
|
+
response_headers: ::Hash[String, String],
|
|
62
|
+
base_url: URI::Generic,
|
|
63
|
+
credential_headers: ::Array[String]
|
|
52
64
|
) -> Straddle::Internal::Transport::BaseClient::request_input
|
|
53
65
|
|
|
54
66
|
def self.reap_connection!: (
|
|
@@ -87,6 +99,12 @@ module Straddle
|
|
|
87
99
|
|
|
88
100
|
private def auth_headers: -> ::Hash[String, String]
|
|
89
101
|
|
|
102
|
+
private def auth_headers_for: (
|
|
103
|
+
::Array[::Array[String]]? _security
|
|
104
|
+
) -> ::Hash[String, String]
|
|
105
|
+
|
|
106
|
+
private def auth_header_keys: -> ::Array[String]
|
|
107
|
+
|
|
90
108
|
private def user_agent: -> String
|
|
91
109
|
|
|
92
110
|
private def generate_idempotency_key: -> String
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Straddle
|
|
2
|
+
module Internal
|
|
3
|
+
module Transport
|
|
4
|
+
class ConnectionPool
|
|
5
|
+
def with: (timeout: Float) { (top arg0) -> top } -> top
|
|
6
|
+
|
|
7
|
+
private def checkout: (Float timeout) -> [top, Integer]
|
|
8
|
+
|
|
9
|
+
private def checkin: (top conn, Integer pid) -> void
|
|
10
|
+
|
|
11
|
+
def shutdown: { (top arg0) -> void } -> void
|
|
12
|
+
|
|
13
|
+
private def reset_after_fork: -> void
|
|
14
|
+
|
|
15
|
+
def initialize: (size: Integer) { -> top } -> void
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -17,12 +17,22 @@ module Straddle
|
|
|
17
17
|
|
|
18
18
|
DEFAULT_MAX_CONNECTIONS: Integer
|
|
19
19
|
|
|
20
|
+
MAX_POOLS: 16
|
|
21
|
+
|
|
22
|
+
ELAPSED_SOCKET_TIMEOUT: Float
|
|
23
|
+
|
|
24
|
+
attr_reader cert_store: OpenSSL::X509::Store
|
|
25
|
+
|
|
20
26
|
def self.connect: (
|
|
21
27
|
cert_store: OpenSSL::X509::Store,
|
|
22
28
|
url: URI::Generic
|
|
23
29
|
) -> top
|
|
24
30
|
|
|
25
|
-
def self.calibrate_socket_timeout: (
|
|
31
|
+
def self.calibrate_socket_timeout: (
|
|
32
|
+
top conn,
|
|
33
|
+
Float deadline,
|
|
34
|
+
?finishing: bool
|
|
35
|
+
) -> void
|
|
26
36
|
|
|
27
37
|
def self.build_request: (
|
|
28
38
|
Straddle::Internal::Transport::PooledNetRequester::request request
|