straddle 0.4.0 → 0.5.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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +53 -0
  3. data/README.md +23 -1
  4. data/lib/straddle/client.rb +15 -1
  5. data/lib/straddle/internal/transport/base_client.rb +5 -0
  6. data/lib/straddle/internal/util.rb +22 -7
  7. data/lib/straddle/models/charge_create_params.rb +2 -0
  8. data/lib/straddle/models/charge_unmask_response.rb +142 -11
  9. data/lib/straddle/models/charge_v1.rb +140 -11
  10. data/lib/straddle/models/embed/account_list_params.rb +8 -1
  11. data/lib/straddle/models/embed/representative.rb +2 -2
  12. data/lib/straddle/models/embed/representative_create_params.rb +2 -2
  13. data/lib/straddle/models/embed/representative_paged.rb +2 -2
  14. data/lib/straddle/models/embed/representative_update_params.rb +2 -2
  15. data/lib/straddle/models/paykey_list_params.rb +17 -1
  16. data/lib/straddle/models/payment_list_params.rb +55 -1
  17. data/lib/straddle/models/payment_summary_paged_v1.rb +98 -1
  18. data/lib/straddle/models/payout_create_params.rb +2 -0
  19. data/lib/straddle/models/payout_unmask_response.rb +145 -11
  20. data/lib/straddle/models/payout_upload_authorization_document_params.rb +57 -0
  21. data/lib/straddle/models/payout_v1.rb +140 -11
  22. data/lib/straddle/models.rb +2 -0
  23. data/lib/straddle/resources/embed/accounts.rb +5 -2
  24. data/lib/straddle/resources/paykeys.rb +7 -1
  25. data/lib/straddle/resources/payments.rb +19 -1
  26. data/lib/straddle/resources/payouts.rb +49 -0
  27. data/lib/straddle/version.rb +1 -1
  28. data/lib/straddle.rb +1 -0
  29. data/rbi/straddle/internal/util.rbi +8 -0
  30. data/rbi/straddle/models/charge_create_params.rbi +10 -0
  31. data/rbi/straddle/models/charge_unmask_response.rbi +287 -34
  32. data/rbi/straddle/models/charge_v1.rbi +268 -39
  33. data/rbi/straddle/models/embed/account_list_params.rbi +9 -0
  34. data/rbi/straddle/models/embed/representative.rbi +2 -2
  35. data/rbi/straddle/models/embed/representative_create_params.rbi +2 -2
  36. data/rbi/straddle/models/embed/representative_paged.rbi +2 -2
  37. data/rbi/straddle/models/embed/representative_update_params.rbi +2 -2
  38. data/rbi/straddle/models/paykey_list_params.rbi +22 -0
  39. data/rbi/straddle/models/payment_list_params.rbi +75 -0
  40. data/rbi/straddle/models/payment_summary_paged_v1.rbi +198 -3
  41. data/rbi/straddle/models/payout_create_params.rbi +10 -0
  42. data/rbi/straddle/models/payout_unmask_response.rbi +287 -34
  43. data/rbi/straddle/models/payout_upload_authorization_document_params.rbi +88 -0
  44. data/rbi/straddle/models/payout_v1.rbi +268 -39
  45. data/rbi/straddle/models.rbi +3 -0
  46. data/rbi/straddle/resources/embed/accounts.rbi +3 -0
  47. data/rbi/straddle/resources/paykeys.rbi +6 -0
  48. data/rbi/straddle/resources/payments.rbi +20 -0
  49. data/rbi/straddle/resources/payouts.rbi +33 -0
  50. data/sig/straddle/internal/util.rbs +4 -0
  51. data/sig/straddle/models/charge_create_params.rbs +4 -0
  52. data/sig/straddle/models/charge_unmask_response.rbs +120 -11
  53. data/sig/straddle/models/charge_v1.rbs +120 -11
  54. data/sig/straddle/models/embed/account_list_params.rbs +7 -0
  55. data/sig/straddle/models/paykey_list_params.rbs +14 -0
  56. data/sig/straddle/models/payment_list_params.rbs +57 -2
  57. data/sig/straddle/models/payment_summary_paged_v1.rbs +78 -3
  58. data/sig/straddle/models/payout_create_params.rbs +4 -0
  59. data/sig/straddle/models/payout_unmask_response.rbs +120 -11
  60. data/sig/straddle/models/payout_upload_authorization_document_params.rbs +59 -0
  61. data/sig/straddle/models/payout_v1.rbs +120 -11
  62. data/sig/straddle/models.rbs +2 -0
  63. data/sig/straddle/resources/embed/accounts.rbs +1 -0
  64. data/sig/straddle/resources/paykeys.rbs +2 -0
  65. data/sig/straddle/resources/payments.rbs +6 -0
  66. data/sig/straddle/resources/payouts.rbs +10 -0
  67. metadata +5 -2
@@ -129,6 +129,18 @@ module Straddle
129
129
  sig { returns(T::Array[String]) }
130
130
  attr_accessor :funding_ids
131
131
 
132
+ # Has the payout been resubmitted.
133
+ sig { returns(T::Boolean) }
134
+ attr_accessor :has_resubmit
135
+
136
+ # Is the payout a refund of an original charge.
137
+ sig { returns(T::Boolean) }
138
+ attr_accessor :is_refund
139
+
140
+ # Is the payout a resubmit of an original payout.
141
+ sig { returns(T::Boolean) }
142
+ attr_accessor :is_resubmit
143
+
132
144
  # Paykey.
133
145
  sig { returns(String) }
134
146
  attr_accessor :paykey
@@ -178,6 +190,17 @@ module Straddle
178
190
  end
179
191
  attr_writer :customer_details
180
192
 
193
+ # Documents uploaded for this payout (e.g. proof of authorization), in the order
194
+ # they were uploaded.
195
+ sig do
196
+ returns(
197
+ T.nilable(
198
+ T::Array[Straddle::Models::PayoutUnmaskResponse::Data::Document]
199
+ )
200
+ )
201
+ end
202
+ attr_accessor :documents
203
+
181
204
  # Effective at.
182
205
  sig { returns(T.nilable(Time)) }
183
206
  attr_accessor :effective_at
@@ -218,9 +241,8 @@ module Straddle
218
241
  sig do
219
242
  returns(
220
243
  T.nilable(
221
- T::Hash[
222
- Symbol,
223
- Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::TaggedSymbol
244
+ T::Array[
245
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment
224
246
  ]
225
247
  )
226
248
  )
@@ -243,6 +265,9 @@ module Straddle
243
265
  Straddle::Models::PayoutUnmaskResponse::Data::Device::OrHash,
244
266
  external_id: String,
245
267
  funding_ids: T::Array[String],
268
+ has_resubmit: T::Boolean,
269
+ is_refund: T::Boolean,
270
+ is_resubmit: T::Boolean,
246
271
  paykey: String,
247
272
  payment_date: Date,
248
273
  status:
@@ -255,6 +280,12 @@ module Straddle
255
280
  trace_ids: T::Hash[Symbol, String],
256
281
  created_at: T.nilable(Time),
257
282
  customer_details: Straddle::CustomerDetailsV1::OrHash,
283
+ documents:
284
+ T.nilable(
285
+ T::Array[
286
+ Straddle::Models::PayoutUnmaskResponse::Data::Document::OrHash
287
+ ]
288
+ ),
258
289
  effective_at: T.nilable(Time),
259
290
  metadata: T.nilable(T::Hash[Symbol, String]),
260
291
  paykey_details: Straddle::PaykeyDetailsV1::OrHash,
@@ -263,9 +294,8 @@ module Straddle
263
294
  processed_at: T.nilable(Time),
264
295
  related_payments:
265
296
  T.nilable(
266
- T::Hash[
267
- Symbol,
268
- Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::OrSymbol
297
+ T::Array[
298
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::OrHash
269
299
  ]
270
300
  ),
271
301
  updated_at: T.nilable(Time)
@@ -286,6 +316,12 @@ module Straddle
286
316
  external_id:,
287
317
  # Funding Ids
288
318
  funding_ids:,
319
+ # Has the payout been resubmitted.
320
+ has_resubmit:,
321
+ # Is the payout a refund of an original charge.
322
+ is_refund:,
323
+ # Is the payout a resubmit of an original payout.
324
+ is_resubmit:,
289
325
  # Paykey.
290
326
  paykey:,
291
327
  # Payment date.
@@ -301,6 +337,9 @@ module Straddle
301
337
  created_at: nil,
302
338
  # Information about the customer associated with the charge or payout.
303
339
  customer_details: nil,
340
+ # Documents uploaded for this payout (e.g. proof of authorization), in the order
341
+ # they were uploaded.
342
+ documents: nil,
304
343
  # Effective at.
305
344
  effective_at: nil,
306
345
  # Metadata.
@@ -328,6 +367,9 @@ module Straddle
328
367
  device: Straddle::Models::PayoutUnmaskResponse::Data::Device,
329
368
  external_id: String,
330
369
  funding_ids: T::Array[String],
370
+ has_resubmit: T::Boolean,
371
+ is_refund: T::Boolean,
372
+ is_resubmit: T::Boolean,
331
373
  paykey: String,
332
374
  payment_date: Date,
333
375
  status:
@@ -340,6 +382,12 @@ module Straddle
340
382
  trace_ids: T::Hash[Symbol, String],
341
383
  created_at: T.nilable(Time),
342
384
  customer_details: Straddle::CustomerDetailsV1,
385
+ documents:
386
+ T.nilable(
387
+ T::Array[
388
+ Straddle::Models::PayoutUnmaskResponse::Data::Document
389
+ ]
390
+ ),
343
391
  effective_at: T.nilable(Time),
344
392
  metadata: T.nilable(T::Hash[Symbol, String]),
345
393
  paykey_details: Straddle::PaykeyDetailsV1,
@@ -348,9 +396,8 @@ module Straddle
348
396
  processed_at: T.nilable(Time),
349
397
  related_payments:
350
398
  T.nilable(
351
- T::Hash[
352
- Symbol,
353
- Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::TaggedSymbol
399
+ T::Array[
400
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment
354
401
  ]
355
402
  ),
356
403
  updated_at: T.nilable(Time)
@@ -494,6 +541,16 @@ module Straddle
494
541
  :reversed_closed_bank_account,
495
542
  Straddle::Models::PayoutUnmaskResponse::Data::Config::SandboxOutcome::TaggedSymbol
496
543
  )
544
+ FAILED_NOT_AUTHORIZED =
545
+ T.let(
546
+ :failed_not_authorized,
547
+ Straddle::Models::PayoutUnmaskResponse::Data::Config::SandboxOutcome::TaggedSymbol
548
+ )
549
+ REVERSED_NOT_AUTHORIZED =
550
+ T.let(
551
+ :reversed_not_authorized,
552
+ Straddle::Models::PayoutUnmaskResponse::Data::Config::SandboxOutcome::TaggedSymbol
553
+ )
497
554
 
498
555
  sig do
499
556
  override.returns(
@@ -981,6 +1038,106 @@ module Straddle
981
1038
  end
982
1039
  end
983
1040
 
1041
+ class Document < Straddle::Internal::Type::BaseModel
1042
+ OrHash =
1043
+ T.type_alias do
1044
+ T.any(
1045
+ Straddle::Models::PayoutUnmaskResponse::Data::Document,
1046
+ Straddle::Internal::AnyHash
1047
+ )
1048
+ end
1049
+
1050
+ # Unique identifier for this document.
1051
+ sig { returns(String) }
1052
+ attr_accessor :document_id
1053
+
1054
+ # The file name of this document as uploaded.
1055
+ sig { returns(String) }
1056
+ attr_accessor :document_name
1057
+
1058
+ # The size of this document in bytes.
1059
+ sig { returns(Integer) }
1060
+ attr_accessor :document_size
1061
+
1062
+ sig do
1063
+ returns(
1064
+ Straddle::Models::PayoutUnmaskResponse::Data::Document::DocumentType::TaggedSymbol
1065
+ )
1066
+ end
1067
+ attr_accessor :document_type
1068
+
1069
+ # The UTC timestamp when this document was uploaded.
1070
+ sig { returns(Time) }
1071
+ attr_accessor :uploaded_at
1072
+
1073
+ sig do
1074
+ params(
1075
+ document_id: String,
1076
+ document_name: String,
1077
+ document_size: Integer,
1078
+ document_type:
1079
+ Straddle::Models::PayoutUnmaskResponse::Data::Document::DocumentType::OrSymbol,
1080
+ uploaded_at: Time
1081
+ ).returns(T.attached_class)
1082
+ end
1083
+ def self.new(
1084
+ # Unique identifier for this document.
1085
+ document_id:,
1086
+ # The file name of this document as uploaded.
1087
+ document_name:,
1088
+ # The size of this document in bytes.
1089
+ document_size:,
1090
+ document_type:,
1091
+ # The UTC timestamp when this document was uploaded.
1092
+ uploaded_at:
1093
+ )
1094
+ end
1095
+
1096
+ sig do
1097
+ override.returns(
1098
+ {
1099
+ document_id: String,
1100
+ document_name: String,
1101
+ document_size: Integer,
1102
+ document_type:
1103
+ Straddle::Models::PayoutUnmaskResponse::Data::Document::DocumentType::TaggedSymbol,
1104
+ uploaded_at: Time
1105
+ }
1106
+ )
1107
+ end
1108
+ def to_hash
1109
+ end
1110
+
1111
+ module DocumentType
1112
+ extend Straddle::Internal::Type::Enum
1113
+
1114
+ TaggedSymbol =
1115
+ T.type_alias do
1116
+ T.all(
1117
+ Symbol,
1118
+ Straddle::Models::PayoutUnmaskResponse::Data::Document::DocumentType
1119
+ )
1120
+ end
1121
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1122
+
1123
+ PAYMENT_AUTHORIZATION =
1124
+ T.let(
1125
+ :payment_authorization,
1126
+ Straddle::Models::PayoutUnmaskResponse::Data::Document::DocumentType::TaggedSymbol
1127
+ )
1128
+
1129
+ sig do
1130
+ override.returns(
1131
+ T::Array[
1132
+ Straddle::Models::PayoutUnmaskResponse::Data::Document::DocumentType::TaggedSymbol
1133
+ ]
1134
+ )
1135
+ end
1136
+ def self.values
1137
+ end
1138
+ end
1139
+ end
1140
+
984
1141
  # The payment rail used for the charge or payout.
985
1142
  module PaymentRail
986
1143
  extend Straddle::Internal::Type::Enum
@@ -1011,42 +1168,138 @@ module Straddle
1011
1168
  end
1012
1169
  end
1013
1170
 
1014
- module RelatedPayment
1015
- extend Straddle::Internal::Type::Enum
1016
-
1017
- TaggedSymbol =
1171
+ class RelatedPayment < Straddle::Internal::Type::BaseModel
1172
+ OrHash =
1018
1173
  T.type_alias do
1019
- T.all(
1020
- Symbol,
1021
- Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment
1174
+ T.any(
1175
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment,
1176
+ Straddle::Internal::AnyHash
1022
1177
  )
1023
1178
  end
1024
- OrSymbol = T.type_alias { T.any(Symbol, String) }
1025
1179
 
1026
- ORIGINAL =
1027
- T.let(
1028
- :original,
1029
- Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::TaggedSymbol
1030
- )
1031
- RESUBMIT =
1032
- T.let(
1033
- :resubmit,
1034
- Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::TaggedSymbol
1180
+ # The ID of the related payment.
1181
+ sig { returns(String) }
1182
+ attr_accessor :id
1183
+
1184
+ # The type of payment.
1185
+ sig do
1186
+ returns(
1187
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::PaymentType::TaggedSymbol
1035
1188
  )
1036
- REFUND =
1037
- T.let(
1038
- :refund,
1039
- Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::TaggedSymbol
1189
+ end
1190
+ attr_accessor :payment_type
1191
+
1192
+ sig do
1193
+ returns(
1194
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::Relationship::TaggedSymbol
1040
1195
  )
1196
+ end
1197
+ attr_accessor :relationship
1198
+
1199
+ sig do
1200
+ params(
1201
+ id: String,
1202
+ payment_type:
1203
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::PaymentType::OrSymbol,
1204
+ relationship:
1205
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::Relationship::OrSymbol
1206
+ ).returns(T.attached_class)
1207
+ end
1208
+ def self.new(
1209
+ # The ID of the related payment.
1210
+ id:,
1211
+ # The type of payment.
1212
+ payment_type:,
1213
+ relationship:
1214
+ )
1215
+ end
1041
1216
 
1042
1217
  sig do
1043
1218
  override.returns(
1044
- T::Array[
1045
- Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::TaggedSymbol
1046
- ]
1219
+ {
1220
+ id: String,
1221
+ payment_type:
1222
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::PaymentType::TaggedSymbol,
1223
+ relationship:
1224
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::Relationship::TaggedSymbol
1225
+ }
1047
1226
  )
1048
1227
  end
1049
- def self.values
1228
+ def to_hash
1229
+ end
1230
+
1231
+ # The type of payment.
1232
+ module PaymentType
1233
+ extend Straddle::Internal::Type::Enum
1234
+
1235
+ TaggedSymbol =
1236
+ T.type_alias do
1237
+ T.all(
1238
+ Symbol,
1239
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::PaymentType
1240
+ )
1241
+ end
1242
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1243
+
1244
+ CHARGE =
1245
+ T.let(
1246
+ :charge,
1247
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::PaymentType::TaggedSymbol
1248
+ )
1249
+ PAYOUT =
1250
+ T.let(
1251
+ :payout,
1252
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::PaymentType::TaggedSymbol
1253
+ )
1254
+
1255
+ sig do
1256
+ override.returns(
1257
+ T::Array[
1258
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::PaymentType::TaggedSymbol
1259
+ ]
1260
+ )
1261
+ end
1262
+ def self.values
1263
+ end
1264
+ end
1265
+
1266
+ module Relationship
1267
+ extend Straddle::Internal::Type::Enum
1268
+
1269
+ TaggedSymbol =
1270
+ T.type_alias do
1271
+ T.all(
1272
+ Symbol,
1273
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::Relationship
1274
+ )
1275
+ end
1276
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1277
+
1278
+ ORIGINAL =
1279
+ T.let(
1280
+ :original,
1281
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::Relationship::TaggedSymbol
1282
+ )
1283
+ RESUBMIT =
1284
+ T.let(
1285
+ :resubmit,
1286
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::Relationship::TaggedSymbol
1287
+ )
1288
+ REFUND =
1289
+ T.let(
1290
+ :refund,
1291
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::Relationship::TaggedSymbol
1292
+ )
1293
+
1294
+ sig do
1295
+ override.returns(
1296
+ T::Array[
1297
+ Straddle::Models::PayoutUnmaskResponse::Data::RelatedPayment::Relationship::TaggedSymbol
1298
+ ]
1299
+ )
1300
+ end
1301
+ def self.values
1302
+ end
1050
1303
  end
1051
1304
  end
1052
1305
  end
@@ -0,0 +1,88 @@
1
+ # typed: strong
2
+
3
+ module Straddle
4
+ module Models
5
+ class PayoutUploadAuthorizationDocumentParams < Straddle::Internal::Type::BaseModel
6
+ extend Straddle::Internal::Type::RequestParameters::Converter
7
+ include Straddle::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Straddle::PayoutUploadAuthorizationDocumentParams,
13
+ Straddle::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :id
19
+
20
+ # The document file to upload as proof of authorization for this payout.
21
+ sig { returns(Straddle::Internal::FileInput) }
22
+ attr_accessor :file
23
+
24
+ sig { returns(T.nilable(String)) }
25
+ attr_reader :correlation_id
26
+
27
+ sig { params(correlation_id: String).void }
28
+ attr_writer :correlation_id
29
+
30
+ sig { returns(T.nilable(String)) }
31
+ attr_reader :idempotency_key
32
+
33
+ sig { params(idempotency_key: String).void }
34
+ attr_writer :idempotency_key
35
+
36
+ sig { returns(T.nilable(String)) }
37
+ attr_reader :request_id
38
+
39
+ sig { params(request_id: String).void }
40
+ attr_writer :request_id
41
+
42
+ sig { returns(T.nilable(String)) }
43
+ attr_reader :straddle_account_id
44
+
45
+ sig { params(straddle_account_id: String).void }
46
+ attr_writer :straddle_account_id
47
+
48
+ sig do
49
+ params(
50
+ id: String,
51
+ file: Straddle::Internal::FileInput,
52
+ correlation_id: String,
53
+ idempotency_key: String,
54
+ request_id: String,
55
+ straddle_account_id: String,
56
+ request_options: Straddle::RequestOptions::OrHash
57
+ ).returns(T.attached_class)
58
+ end
59
+ def self.new(
60
+ id:,
61
+ # The document file to upload as proof of authorization for this payout.
62
+ file:,
63
+ correlation_id: nil,
64
+ idempotency_key: nil,
65
+ request_id: nil,
66
+ straddle_account_id: nil,
67
+ request_options: {}
68
+ )
69
+ end
70
+
71
+ sig do
72
+ override.returns(
73
+ {
74
+ id: String,
75
+ file: Straddle::Internal::FileInput,
76
+ correlation_id: String,
77
+ idempotency_key: String,
78
+ request_id: String,
79
+ straddle_account_id: String,
80
+ request_options: Straddle::RequestOptions
81
+ }
82
+ )
83
+ end
84
+ def to_hash
85
+ end
86
+ end
87
+ end
88
+ end