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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +65 -0
- data/README.md +84 -89
- data/SKILL.md +4 -2
- data/api.md +26 -26
- 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/payout.rb +14 -14
- data/lib/straddle/models/unmasked_payout.rb +14 -14
- 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/payout.rbi +18 -18
- data/rbi/straddle/models/unmasked_payout.rbi +18 -18
- 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/payout.rbs +12 -12
- data/sig/straddle/models/unmasked_payout.rbs +12 -12
- 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
|
@@ -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
|
|
@@ -13,6 +13,8 @@ module Straddle
|
|
|
13
13
|
def self.known_fields: -> ::Hash[Symbol, (Straddle::Internal::Type::BaseModel::known_field
|
|
14
14
|
& { type_fn: (^-> Straddle::Internal::Type::Converter::input) })]
|
|
15
15
|
|
|
16
|
+
def self.dropped_keys: -> ::Hash[Symbol, true]
|
|
17
|
+
|
|
16
18
|
def self.fields: -> ::Hash[Symbol, (Straddle::Internal::Type::BaseModel::known_field
|
|
17
19
|
& { type: Straddle::Internal::Type::Converter::input })]
|
|
18
20
|
|
|
@@ -50,6 +52,8 @@ module Straddle
|
|
|
50
52
|
|
|
51
53
|
private def self.response_only: { -> void } -> void
|
|
52
54
|
|
|
55
|
+
private def self.drop_on_dump: (*Symbol names) -> void
|
|
56
|
+
|
|
53
57
|
def self.==: (top other) -> bool
|
|
54
58
|
|
|
55
59
|
def self.hash: -> Integer
|
|
@@ -55,6 +55,8 @@ module Straddle
|
|
|
55
55
|
|
|
56
56
|
def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
|
|
57
57
|
|
|
58
|
+
def self?.unescape_query_component: (String component) -> String
|
|
59
|
+
|
|
58
60
|
def self?.encode_query: (
|
|
59
61
|
::Hash[String, (::Array[String] | String)?]? query
|
|
60
62
|
) -> String?
|
|
@@ -87,6 +89,10 @@ module Straddle
|
|
|
87
89
|
| ::Array[(String | Integer)?])?] headers
|
|
88
90
|
) -> ::Hash[String, String]
|
|
89
91
|
|
|
92
|
+
def self?.encode_cookie_value: (top value) -> String
|
|
93
|
+
|
|
94
|
+
def self?.merge_cookies: (*String? values) -> String?
|
|
95
|
+
|
|
90
96
|
class ReadIOAdapter
|
|
91
97
|
def close?: -> bool?
|
|
92
98
|
|
|
@@ -110,6 +116,12 @@ module Straddle
|
|
|
110
116
|
JSON_CONTENT: Regexp
|
|
111
117
|
JSONL_CONTENT: Regexp
|
|
112
118
|
|
|
119
|
+
MAX_BUFFERED_BODY_BYTES: Integer
|
|
120
|
+
|
|
121
|
+
MAX_ERROR_BODY_BYTES: Integer
|
|
122
|
+
|
|
123
|
+
MAX_PENDING_STREAM_BYTES: Integer
|
|
124
|
+
|
|
113
125
|
def encode_query_params: (
|
|
114
126
|
::Hash[Symbol, top] query
|
|
115
127
|
) -> ::Hash[Symbol, top]
|
|
@@ -120,6 +132,8 @@ module Straddle
|
|
|
120
132
|
top element
|
|
121
133
|
) -> nil
|
|
122
134
|
|
|
135
|
+
def self?.encode_form_name: (Symbol | String name) -> String
|
|
136
|
+
|
|
123
137
|
def self?.write_multipart_content: (
|
|
124
138
|
Enumerator::Yielder y,
|
|
125
139
|
val: top,
|
|
@@ -139,6 +153,10 @@ module Straddle
|
|
|
139
153
|
top body
|
|
140
154
|
) -> [String, Enumerable[String]]
|
|
141
155
|
|
|
156
|
+
def self?.encode_form: (::Hash[Symbol, top] body) -> String
|
|
157
|
+
|
|
158
|
+
def self?.form_field_value: (top value) -> top
|
|
159
|
+
|
|
142
160
|
def self?.encode_content: (
|
|
143
161
|
::Hash[String, String] headers,
|
|
144
162
|
top body
|
|
@@ -146,10 +164,18 @@ module Straddle
|
|
|
146
164
|
|
|
147
165
|
def self?.force_charset!: (String content_type, text: String) -> void
|
|
148
166
|
|
|
167
|
+
def self?.read_body: (
|
|
168
|
+
Enumerable[String] stream,
|
|
169
|
+
limit: Integer,
|
|
170
|
+
?truncate: bool
|
|
171
|
+
) -> String
|
|
172
|
+
|
|
149
173
|
def self?.decode_content: (
|
|
150
174
|
::Hash[String, String] headers,
|
|
151
175
|
stream: Enumerable[String],
|
|
152
|
-
?suppress_error: bool
|
|
176
|
+
?suppress_error: bool,
|
|
177
|
+
?truncate_at: Integer?,
|
|
178
|
+
?download: bool
|
|
153
179
|
) -> top
|
|
154
180
|
|
|
155
181
|
def self?.fused_enum: (
|
|
@@ -172,6 +198,8 @@ module Straddle
|
|
|
172
198
|
|
|
173
199
|
def self?.decode_lines: (Enumerable[String] enum) -> Enumerable[String]
|
|
174
200
|
|
|
201
|
+
def self?.check_pending_stream!: (Integer bytesize) -> void
|
|
202
|
+
|
|
175
203
|
def self?.decode_sse: (
|
|
176
204
|
Enumerable[String] lines
|
|
177
205
|
) -> Enumerable[Straddle::Internal::Util::server_sent_event]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module StandardWebhooks
|
|
2
|
+
class StandardWebhooksError < StandardError
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
class WebhookVerificationError < StandardWebhooksError
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
module Straddle
|
|
10
|
+
module Errors
|
|
11
|
+
class WebhookVerificationError < ::StandardWebhooks::WebhookVerificationError
|
|
12
|
+
def initialize: (?String? message) -> void
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module Internal
|
|
17
|
+
module WebhookVerifier
|
|
18
|
+
SECRET_PREFIX: String
|
|
19
|
+
|
|
20
|
+
TOLERANCE_SECONDS: Integer
|
|
21
|
+
|
|
22
|
+
DEFAULT_ALGORITHM: String
|
|
23
|
+
|
|
24
|
+
HMAC_DIGESTS: ::Hash[String, String]
|
|
25
|
+
|
|
26
|
+
def self.verify!: (
|
|
27
|
+
String payload,
|
|
28
|
+
::Hash[String | Symbol, String | ::Array[String]] headers,
|
|
29
|
+
String secret,
|
|
30
|
+
?algorithm: String,
|
|
31
|
+
?id_header: String,
|
|
32
|
+
?timestamp_header: String,
|
|
33
|
+
?signature_header: String,
|
|
34
|
+
?tolerance: Integer,
|
|
35
|
+
?decoder: String?
|
|
36
|
+
) -> void
|
|
37
|
+
|
|
38
|
+
def self.header_value: (
|
|
39
|
+
::Hash[String | Symbol, String | ::Array[String]] headers,
|
|
40
|
+
String name
|
|
41
|
+
) -> String?
|
|
42
|
+
|
|
43
|
+
def self.decode_secret: (String secret) -> String
|
|
44
|
+
|
|
45
|
+
def self.verify_timestamp!: (String msg_timestamp, ?Integer tolerance) -> void
|
|
46
|
+
|
|
47
|
+
def self.secure_compare: (
|
|
48
|
+
String expected,
|
|
49
|
+
String? signature
|
|
50
|
+
) -> bool
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -109,37 +109,37 @@ module Straddle
|
|
|
109
109
|
|
|
110
110
|
type charges =
|
|
111
111
|
{
|
|
112
|
-
daily_amount:
|
|
112
|
+
daily_amount: Integer,
|
|
113
113
|
enable: bool,
|
|
114
|
-
max_amount:
|
|
115
|
-
monthly_amount:
|
|
114
|
+
max_amount: Integer,
|
|
115
|
+
monthly_amount: Integer,
|
|
116
116
|
monthly_count: Integer
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
class Charges < Straddle::Internal::Type::BaseModel
|
|
120
|
-
attr_accessor daily_amount:
|
|
120
|
+
attr_accessor daily_amount: Integer
|
|
121
121
|
|
|
122
122
|
attr_accessor enable: bool
|
|
123
123
|
|
|
124
|
-
attr_accessor max_amount:
|
|
124
|
+
attr_accessor max_amount: Integer
|
|
125
125
|
|
|
126
|
-
attr_accessor monthly_amount:
|
|
126
|
+
attr_accessor monthly_amount: Integer
|
|
127
127
|
|
|
128
128
|
attr_accessor monthly_count: Integer
|
|
129
129
|
|
|
130
130
|
def initialize: (
|
|
131
|
-
daily_amount:
|
|
131
|
+
daily_amount: Integer,
|
|
132
132
|
enable: bool,
|
|
133
|
-
max_amount:
|
|
134
|
-
monthly_amount:
|
|
133
|
+
max_amount: Integer,
|
|
134
|
+
monthly_amount: Integer,
|
|
135
135
|
monthly_count: Integer
|
|
136
136
|
) -> void
|
|
137
137
|
|
|
138
138
|
def to_hash: -> {
|
|
139
|
-
daily_amount:
|
|
139
|
+
daily_amount: Integer,
|
|
140
140
|
enable: bool,
|
|
141
|
-
max_amount:
|
|
142
|
-
monthly_amount:
|
|
141
|
+
max_amount: Integer,
|
|
142
|
+
monthly_amount: Integer,
|
|
143
143
|
monthly_count: Integer
|
|
144
144
|
}
|
|
145
145
|
end
|
|
@@ -166,37 +166,37 @@ module Straddle
|
|
|
166
166
|
|
|
167
167
|
type payouts =
|
|
168
168
|
{
|
|
169
|
-
daily_amount:
|
|
169
|
+
daily_amount: Integer,
|
|
170
170
|
enable: bool,
|
|
171
|
-
max_amount:
|
|
172
|
-
monthly_amount:
|
|
171
|
+
max_amount: Integer,
|
|
172
|
+
monthly_amount: Integer,
|
|
173
173
|
monthly_count: Integer
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
class Payouts < Straddle::Internal::Type::BaseModel
|
|
177
|
-
attr_accessor daily_amount:
|
|
177
|
+
attr_accessor daily_amount: Integer
|
|
178
178
|
|
|
179
179
|
attr_accessor enable: bool
|
|
180
180
|
|
|
181
|
-
attr_accessor max_amount:
|
|
181
|
+
attr_accessor max_amount: Integer
|
|
182
182
|
|
|
183
|
-
attr_accessor monthly_amount:
|
|
183
|
+
attr_accessor monthly_amount: Integer
|
|
184
184
|
|
|
185
185
|
attr_accessor monthly_count: Integer
|
|
186
186
|
|
|
187
187
|
def initialize: (
|
|
188
|
-
daily_amount:
|
|
188
|
+
daily_amount: Integer,
|
|
189
189
|
enable: bool,
|
|
190
|
-
max_amount:
|
|
191
|
-
monthly_amount:
|
|
190
|
+
max_amount: Integer,
|
|
191
|
+
monthly_amount: Integer,
|
|
192
192
|
monthly_count: Integer
|
|
193
193
|
) -> void
|
|
194
194
|
|
|
195
195
|
def to_hash: -> {
|
|
196
|
-
daily_amount:
|
|
196
|
+
daily_amount: Integer,
|
|
197
197
|
enable: bool,
|
|
198
|
-
max_amount:
|
|
199
|
-
monthly_amount:
|
|
198
|
+
max_amount: Integer,
|
|
199
|
+
monthly_amount: Integer,
|
|
200
200
|
monthly_count: Integer
|
|
201
201
|
}
|
|
202
202
|
end
|
|
@@ -5,6 +5,7 @@ module Straddle
|
|
|
5
5
|
id: String,
|
|
6
6
|
amount: Integer,
|
|
7
7
|
config: Straddle::PayoutConfiguration,
|
|
8
|
+
created_at: Time,
|
|
8
9
|
currency: String,
|
|
9
10
|
description: String?,
|
|
10
11
|
device: Straddle::MaskedPaymentDevice,
|
|
@@ -19,7 +20,7 @@ module Straddle
|
|
|
19
20
|
status_details: Straddle::PaymentStatusDetails,
|
|
20
21
|
status_history: ::Array[Straddle::PaymentStatusHistory],
|
|
21
22
|
trace_ids: ::Hash[Symbol, String],
|
|
22
|
-
|
|
23
|
+
updated_at: Time,
|
|
23
24
|
customer_details: Straddle::CustomerDetails,
|
|
24
25
|
documents: ::Array[Straddle::PaymentAuthorizationProof]?,
|
|
25
26
|
effective_at: Time?,
|
|
@@ -27,8 +28,7 @@ module Straddle
|
|
|
27
28
|
paykey_details: Straddle::PaykeyDetails,
|
|
28
29
|
payment_rail: Straddle::Models::payment_rail,
|
|
29
30
|
processed_at: Time?,
|
|
30
|
-
related_payments: ::Array[Straddle::RelatedPayment]
|
|
31
|
-
updated_at: Time?
|
|
31
|
+
related_payments: ::Array[Straddle::RelatedPayment]?
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
class Payout < Straddle::Internal::Type::BaseModel
|
|
@@ -38,6 +38,8 @@ module Straddle
|
|
|
38
38
|
|
|
39
39
|
attr_accessor config: Straddle::PayoutConfiguration
|
|
40
40
|
|
|
41
|
+
attr_accessor created_at: Time
|
|
42
|
+
|
|
41
43
|
attr_accessor currency: String
|
|
42
44
|
|
|
43
45
|
attr_accessor description: String?
|
|
@@ -66,7 +68,7 @@ module Straddle
|
|
|
66
68
|
|
|
67
69
|
attr_accessor trace_ids: ::Hash[Symbol, String]
|
|
68
70
|
|
|
69
|
-
attr_accessor
|
|
71
|
+
attr_accessor updated_at: Time
|
|
70
72
|
|
|
71
73
|
attr_reader customer_details: Straddle::CustomerDetails?
|
|
72
74
|
|
|
@@ -94,12 +96,11 @@ module Straddle
|
|
|
94
96
|
|
|
95
97
|
attr_accessor related_payments: ::Array[Straddle::RelatedPayment]?
|
|
96
98
|
|
|
97
|
-
attr_accessor updated_at: Time?
|
|
98
|
-
|
|
99
99
|
def initialize: (
|
|
100
100
|
id: String,
|
|
101
101
|
amount: Integer,
|
|
102
102
|
config: Straddle::PayoutConfiguration,
|
|
103
|
+
created_at: Time,
|
|
103
104
|
currency: String,
|
|
104
105
|
description: String?,
|
|
105
106
|
device: Straddle::MaskedPaymentDevice,
|
|
@@ -114,7 +115,7 @@ module Straddle
|
|
|
114
115
|
status_details: Straddle::PaymentStatusDetails,
|
|
115
116
|
status_history: ::Array[Straddle::PaymentStatusHistory],
|
|
116
117
|
trace_ids: ::Hash[Symbol, String],
|
|
117
|
-
|
|
118
|
+
updated_at: Time,
|
|
118
119
|
?customer_details: Straddle::CustomerDetails,
|
|
119
120
|
?documents: ::Array[Straddle::PaymentAuthorizationProof]?,
|
|
120
121
|
?effective_at: Time?,
|
|
@@ -122,14 +123,14 @@ module Straddle
|
|
|
122
123
|
?paykey_details: Straddle::PaykeyDetails,
|
|
123
124
|
?payment_rail: Straddle::Models::payment_rail,
|
|
124
125
|
?processed_at: Time?,
|
|
125
|
-
?related_payments: ::Array[Straddle::RelatedPayment]
|
|
126
|
-
?updated_at: Time?
|
|
126
|
+
?related_payments: ::Array[Straddle::RelatedPayment]?
|
|
127
127
|
) -> void
|
|
128
128
|
|
|
129
129
|
def to_hash: -> {
|
|
130
130
|
id: String,
|
|
131
131
|
amount: Integer,
|
|
132
132
|
config: Straddle::PayoutConfiguration,
|
|
133
|
+
created_at: Time,
|
|
133
134
|
currency: String,
|
|
134
135
|
description: String?,
|
|
135
136
|
device: Straddle::MaskedPaymentDevice,
|
|
@@ -144,7 +145,7 @@ module Straddle
|
|
|
144
145
|
status_details: Straddle::PaymentStatusDetails,
|
|
145
146
|
status_history: ::Array[Straddle::PaymentStatusHistory],
|
|
146
147
|
trace_ids: ::Hash[Symbol, String],
|
|
147
|
-
|
|
148
|
+
updated_at: Time,
|
|
148
149
|
customer_details: Straddle::CustomerDetails,
|
|
149
150
|
documents: ::Array[Straddle::PaymentAuthorizationProof]?,
|
|
150
151
|
effective_at: Time?,
|
|
@@ -152,8 +153,7 @@ module Straddle
|
|
|
152
153
|
paykey_details: Straddle::PaykeyDetails,
|
|
153
154
|
payment_rail: Straddle::Models::payment_rail,
|
|
154
155
|
processed_at: Time?,
|
|
155
|
-
related_payments: ::Array[Straddle::RelatedPayment]
|
|
156
|
-
updated_at: Time?
|
|
156
|
+
related_payments: ::Array[Straddle::RelatedPayment]?
|
|
157
157
|
}
|
|
158
158
|
end
|
|
159
159
|
end
|