dodopayments 2.20.1 → 2.22.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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/models/checkout_session_preview_response.rb +30 -4
  5. data/lib/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rb +4 -2
  6. data/lib/dodopayments/models/discount.rb +95 -3
  7. data/lib/dodopayments/models/discount_create_params.rb +110 -3
  8. data/lib/dodopayments/models/discount_list_params.rb +7 -2
  9. data/lib/dodopayments/models/discount_type.rb +1 -0
  10. data/lib/dodopayments/models/discount_update_params.rb +108 -3
  11. data/lib/dodopayments/models/payment.rb +4 -2
  12. data/lib/dodopayments/models/payment_list_params.rb +169 -3
  13. data/lib/dodopayments/models/payment_method_types.rb +0 -1
  14. data/lib/dodopayments/models/payout_created_webhook_event.rb +188 -0
  15. data/lib/dodopayments/models/payout_failed_webhook_event.rb +188 -0
  16. data/lib/dodopayments/models/payout_in_progress_webhook_event.rb +188 -0
  17. data/lib/dodopayments/models/payout_on_hold_webhook_event.rb +188 -0
  18. data/lib/dodopayments/models/payout_success_webhook_event.rb +188 -0
  19. data/lib/dodopayments/models/price.rb +19 -1
  20. data/lib/dodopayments/models/subscription.rb +11 -1
  21. data/lib/dodopayments/models/subscription_create_response.rb +10 -1
  22. data/lib/dodopayments/models/subscription_list_response.rb +11 -1
  23. data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +11 -1
  24. data/lib/dodopayments/models/unwrap_webhook_event.rb +11 -1
  25. data/lib/dodopayments/models/webhook_event_type.rb +1 -1
  26. data/lib/dodopayments/models/webhook_payload.rb +160 -3
  27. data/lib/dodopayments/models.rb +10 -0
  28. data/lib/dodopayments/resources/credit_entitlements/balances.rb +1 -1
  29. data/lib/dodopayments/resources/discounts.rb +24 -5
  30. data/lib/dodopayments/resources/payments.rb +7 -2
  31. data/lib/dodopayments/resources/webhooks.rb +2 -2
  32. data/lib/dodopayments/version.rb +1 -1
  33. data/lib/dodopayments.rb +5 -0
  34. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +33 -5
  35. data/rbi/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rbi +6 -2
  36. data/rbi/dodopayments/models/discount.rbi +151 -2
  37. data/rbi/dodopayments/models/discount_create_params.rbi +197 -2
  38. data/rbi/dodopayments/models/discount_list_params.rbi +6 -2
  39. data/rbi/dodopayments/models/discount_type.rbi +1 -0
  40. data/rbi/dodopayments/models/discount_update_params.rbi +193 -2
  41. data/rbi/dodopayments/models/payment.rbi +6 -2
  42. data/rbi/dodopayments/models/payment_list_params.rbi +331 -2
  43. data/rbi/dodopayments/models/payment_method_types.rbi +0 -1
  44. data/rbi/dodopayments/models/payout_created_webhook_event.rbi +270 -0
  45. data/rbi/dodopayments/models/payout_failed_webhook_event.rbi +270 -0
  46. data/rbi/dodopayments/models/payout_in_progress_webhook_event.rbi +272 -0
  47. data/rbi/dodopayments/models/payout_on_hold_webhook_event.rbi +270 -0
  48. data/rbi/dodopayments/models/payout_success_webhook_event.rbi +270 -0
  49. data/rbi/dodopayments/models/price.rbi +20 -0
  50. data/rbi/dodopayments/models/subscription.rbi +15 -3
  51. data/rbi/dodopayments/models/subscription_create_response.rbi +13 -3
  52. data/rbi/dodopayments/models/subscription_list_response.rbi +15 -3
  53. data/rbi/dodopayments/models/unsafe_unwrap_webhook_event.rbi +5 -0
  54. data/rbi/dodopayments/models/unwrap_webhook_event.rbi +5 -0
  55. data/rbi/dodopayments/models/webhook_event_type.rbi +2 -5
  56. data/rbi/dodopayments/models/webhook_payload.rbi +213 -0
  57. data/rbi/dodopayments/models.rbi +11 -0
  58. data/rbi/dodopayments/resources/credit_entitlements/balances.rbi +3 -1
  59. data/rbi/dodopayments/resources/discounts.rbi +57 -3
  60. data/rbi/dodopayments/resources/payments.rbi +5 -1
  61. data/rbi/dodopayments/resources/webhooks.rbi +10 -0
  62. data/sig/dodopayments/models/checkout_session_preview_response.rbs +13 -3
  63. data/sig/dodopayments/models/discount.rbs +69 -0
  64. data/sig/dodopayments/models/discount_create_params.rbs +69 -0
  65. data/sig/dodopayments/models/discount_type.rbs +2 -1
  66. data/sig/dodopayments/models/discount_update_params.rbs +69 -0
  67. data/sig/dodopayments/models/payment_list_params.rbs +308 -0
  68. data/sig/dodopayments/models/payment_method_types.rbs +0 -2
  69. data/sig/dodopayments/models/payout_created_webhook_event.rbs +137 -0
  70. data/sig/dodopayments/models/payout_failed_webhook_event.rbs +137 -0
  71. data/sig/dodopayments/models/payout_in_progress_webhook_event.rbs +137 -0
  72. data/sig/dodopayments/models/payout_on_hold_webhook_event.rbs +137 -0
  73. data/sig/dodopayments/models/payout_success_webhook_event.rbs +137 -0
  74. data/sig/dodopayments/models/price.rbs +10 -0
  75. data/sig/dodopayments/models/subscription.rbs +8 -3
  76. data/sig/dodopayments/models/subscription_create_response.rbs +8 -3
  77. data/sig/dodopayments/models/subscription_list_response.rbs +8 -3
  78. data/sig/dodopayments/models/unsafe_unwrap_webhook_event.rbs +5 -0
  79. data/sig/dodopayments/models/unwrap_webhook_event.rbs +5 -0
  80. data/sig/dodopayments/models/webhook_event_type.rbs +2 -2
  81. data/sig/dodopayments/models/webhook_payload.rbs +108 -0
  82. data/sig/dodopayments/models.rbs +10 -0
  83. data/sig/dodopayments/resources/discounts.rbs +8 -0
  84. data/sig/dodopayments/resources/payments.rbs +1 -0
  85. data/sig/dodopayments/resources/webhooks.rbs +10 -0
  86. metadata +17 -2
@@ -0,0 +1,272 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class PayoutInProgressWebhookEvent < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::PayoutInProgressWebhookEvent,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # The business identifier
15
+ sig { returns(String) }
16
+ attr_accessor :business_id
17
+
18
+ sig { returns(Dodopayments::PayoutInProgressWebhookEvent::Data) }
19
+ attr_reader :data
20
+
21
+ sig do
22
+ params(
23
+ data: Dodopayments::PayoutInProgressWebhookEvent::Data::OrHash
24
+ ).void
25
+ end
26
+ attr_writer :data
27
+
28
+ # The timestamp of when the event occurred
29
+ sig { returns(Time) }
30
+ attr_accessor :timestamp
31
+
32
+ # The event type
33
+ sig { returns(Symbol) }
34
+ attr_accessor :type
35
+
36
+ sig do
37
+ params(
38
+ business_id: String,
39
+ data: Dodopayments::PayoutInProgressWebhookEvent::Data::OrHash,
40
+ timestamp: Time,
41
+ type: Symbol
42
+ ).returns(T.attached_class)
43
+ end
44
+ def self.new(
45
+ # The business identifier
46
+ business_id:,
47
+ data:,
48
+ # The timestamp of when the event occurred
49
+ timestamp:,
50
+ # The event type
51
+ type: :"payout.in_progress"
52
+ )
53
+ end
54
+
55
+ sig do
56
+ override.returns(
57
+ {
58
+ business_id: String,
59
+ data: Dodopayments::PayoutInProgressWebhookEvent::Data,
60
+ timestamp: Time,
61
+ type: Symbol
62
+ }
63
+ )
64
+ end
65
+ def to_hash
66
+ end
67
+
68
+ class Data < Dodopayments::Internal::Type::BaseModel
69
+ OrHash =
70
+ T.type_alias do
71
+ T.any(
72
+ Dodopayments::PayoutInProgressWebhookEvent::Data,
73
+ Dodopayments::Internal::AnyHash
74
+ )
75
+ end
76
+
77
+ # The total amount of the payout.
78
+ sig { returns(Integer) }
79
+ attr_accessor :amount
80
+
81
+ # The unique identifier of the business associated with the payout.
82
+ sig { returns(String) }
83
+ attr_accessor :business_id
84
+
85
+ # The total value of chargebacks associated with the payout.
86
+ sig { returns(Integer) }
87
+ attr_accessor :chargebacks
88
+
89
+ # The timestamp when the payout was created, in UTC.
90
+ sig { returns(Time) }
91
+ attr_accessor :created_at
92
+
93
+ # The currency of the payout, represented as an ISO 4217 currency code.
94
+ sig { returns(Dodopayments::Currency::TaggedSymbol) }
95
+ attr_accessor :currency
96
+
97
+ # The fee charged for processing the payout.
98
+ sig { returns(Integer) }
99
+ attr_accessor :fee
100
+
101
+ # The payment method used for the payout (e.g., bank transfer, card, etc.).
102
+ sig { returns(String) }
103
+ attr_accessor :payment_method
104
+
105
+ # The unique identifier of the payout.
106
+ sig { returns(String) }
107
+ attr_accessor :payout_id
108
+
109
+ # The total value of refunds associated with the payout.
110
+ sig { returns(Integer) }
111
+ attr_accessor :refunds
112
+
113
+ # The current status of the payout.
114
+ sig do
115
+ returns(
116
+ Dodopayments::PayoutInProgressWebhookEvent::Data::Status::TaggedSymbol
117
+ )
118
+ end
119
+ attr_accessor :status
120
+
121
+ # The tax applied to the payout.
122
+ sig { returns(Integer) }
123
+ attr_accessor :tax
124
+
125
+ # The timestamp when the payout was last updated, in UTC.
126
+ sig { returns(Time) }
127
+ attr_accessor :updated_at
128
+
129
+ # The name of the payout recipient or purpose.
130
+ sig { returns(T.nilable(String)) }
131
+ attr_accessor :name
132
+
133
+ # The URL of the document associated with the payout.
134
+ sig { returns(T.nilable(String)) }
135
+ attr_accessor :payout_document_url
136
+
137
+ # Any additional remarks or notes associated with the payout.
138
+ sig { returns(T.nilable(String)) }
139
+ attr_accessor :remarks
140
+
141
+ sig do
142
+ params(
143
+ amount: Integer,
144
+ business_id: String,
145
+ chargebacks: Integer,
146
+ created_at: Time,
147
+ currency: Dodopayments::Currency::OrSymbol,
148
+ fee: Integer,
149
+ payment_method: String,
150
+ payout_id: String,
151
+ refunds: Integer,
152
+ status:
153
+ Dodopayments::PayoutInProgressWebhookEvent::Data::Status::OrSymbol,
154
+ tax: Integer,
155
+ updated_at: Time,
156
+ name: T.nilable(String),
157
+ payout_document_url: T.nilable(String),
158
+ remarks: T.nilable(String)
159
+ ).returns(T.attached_class)
160
+ end
161
+ def self.new(
162
+ # The total amount of the payout.
163
+ amount:,
164
+ # The unique identifier of the business associated with the payout.
165
+ business_id:,
166
+ # The total value of chargebacks associated with the payout.
167
+ chargebacks:,
168
+ # The timestamp when the payout was created, in UTC.
169
+ created_at:,
170
+ # The currency of the payout, represented as an ISO 4217 currency code.
171
+ currency:,
172
+ # The fee charged for processing the payout.
173
+ fee:,
174
+ # The payment method used for the payout (e.g., bank transfer, card, etc.).
175
+ payment_method:,
176
+ # The unique identifier of the payout.
177
+ payout_id:,
178
+ # The total value of refunds associated with the payout.
179
+ refunds:,
180
+ # The current status of the payout.
181
+ status:,
182
+ # The tax applied to the payout.
183
+ tax:,
184
+ # The timestamp when the payout was last updated, in UTC.
185
+ updated_at:,
186
+ # The name of the payout recipient or purpose.
187
+ name: nil,
188
+ # The URL of the document associated with the payout.
189
+ payout_document_url: nil,
190
+ # Any additional remarks or notes associated with the payout.
191
+ remarks: nil
192
+ )
193
+ end
194
+
195
+ sig do
196
+ override.returns(
197
+ {
198
+ amount: Integer,
199
+ business_id: String,
200
+ chargebacks: Integer,
201
+ created_at: Time,
202
+ currency: Dodopayments::Currency::TaggedSymbol,
203
+ fee: Integer,
204
+ payment_method: String,
205
+ payout_id: String,
206
+ refunds: Integer,
207
+ status:
208
+ Dodopayments::PayoutInProgressWebhookEvent::Data::Status::TaggedSymbol,
209
+ tax: Integer,
210
+ updated_at: Time,
211
+ name: T.nilable(String),
212
+ payout_document_url: T.nilable(String),
213
+ remarks: T.nilable(String)
214
+ }
215
+ )
216
+ end
217
+ def to_hash
218
+ end
219
+
220
+ # The current status of the payout.
221
+ module Status
222
+ extend Dodopayments::Internal::Type::Enum
223
+
224
+ TaggedSymbol =
225
+ T.type_alias do
226
+ T.all(
227
+ Symbol,
228
+ Dodopayments::PayoutInProgressWebhookEvent::Data::Status
229
+ )
230
+ end
231
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
232
+
233
+ NOT_INITIATED =
234
+ T.let(
235
+ :not_initiated,
236
+ Dodopayments::PayoutInProgressWebhookEvent::Data::Status::TaggedSymbol
237
+ )
238
+ IN_PROGRESS =
239
+ T.let(
240
+ :in_progress,
241
+ Dodopayments::PayoutInProgressWebhookEvent::Data::Status::TaggedSymbol
242
+ )
243
+ ON_HOLD =
244
+ T.let(
245
+ :on_hold,
246
+ Dodopayments::PayoutInProgressWebhookEvent::Data::Status::TaggedSymbol
247
+ )
248
+ FAILED =
249
+ T.let(
250
+ :failed,
251
+ Dodopayments::PayoutInProgressWebhookEvent::Data::Status::TaggedSymbol
252
+ )
253
+ SUCCESS =
254
+ T.let(
255
+ :success,
256
+ Dodopayments::PayoutInProgressWebhookEvent::Data::Status::TaggedSymbol
257
+ )
258
+
259
+ sig do
260
+ override.returns(
261
+ T::Array[
262
+ Dodopayments::PayoutInProgressWebhookEvent::Data::Status::TaggedSymbol
263
+ ]
264
+ )
265
+ end
266
+ def self.values
267
+ end
268
+ end
269
+ end
270
+ end
271
+ end
272
+ end
@@ -0,0 +1,270 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class PayoutOnHoldWebhookEvent < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::PayoutOnHoldWebhookEvent,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # The business identifier
15
+ sig { returns(String) }
16
+ attr_accessor :business_id
17
+
18
+ sig { returns(Dodopayments::PayoutOnHoldWebhookEvent::Data) }
19
+ attr_reader :data
20
+
21
+ sig do
22
+ params(data: Dodopayments::PayoutOnHoldWebhookEvent::Data::OrHash).void
23
+ end
24
+ attr_writer :data
25
+
26
+ # The timestamp of when the event occurred
27
+ sig { returns(Time) }
28
+ attr_accessor :timestamp
29
+
30
+ # The event type
31
+ sig { returns(Symbol) }
32
+ attr_accessor :type
33
+
34
+ sig do
35
+ params(
36
+ business_id: String,
37
+ data: Dodopayments::PayoutOnHoldWebhookEvent::Data::OrHash,
38
+ timestamp: Time,
39
+ type: Symbol
40
+ ).returns(T.attached_class)
41
+ end
42
+ def self.new(
43
+ # The business identifier
44
+ business_id:,
45
+ data:,
46
+ # The timestamp of when the event occurred
47
+ timestamp:,
48
+ # The event type
49
+ type: :"payout.on_hold"
50
+ )
51
+ end
52
+
53
+ sig do
54
+ override.returns(
55
+ {
56
+ business_id: String,
57
+ data: Dodopayments::PayoutOnHoldWebhookEvent::Data,
58
+ timestamp: Time,
59
+ type: Symbol
60
+ }
61
+ )
62
+ end
63
+ def to_hash
64
+ end
65
+
66
+ class Data < Dodopayments::Internal::Type::BaseModel
67
+ OrHash =
68
+ T.type_alias do
69
+ T.any(
70
+ Dodopayments::PayoutOnHoldWebhookEvent::Data,
71
+ Dodopayments::Internal::AnyHash
72
+ )
73
+ end
74
+
75
+ # The total amount of the payout.
76
+ sig { returns(Integer) }
77
+ attr_accessor :amount
78
+
79
+ # The unique identifier of the business associated with the payout.
80
+ sig { returns(String) }
81
+ attr_accessor :business_id
82
+
83
+ # The total value of chargebacks associated with the payout.
84
+ sig { returns(Integer) }
85
+ attr_accessor :chargebacks
86
+
87
+ # The timestamp when the payout was created, in UTC.
88
+ sig { returns(Time) }
89
+ attr_accessor :created_at
90
+
91
+ # The currency of the payout, represented as an ISO 4217 currency code.
92
+ sig { returns(Dodopayments::Currency::TaggedSymbol) }
93
+ attr_accessor :currency
94
+
95
+ # The fee charged for processing the payout.
96
+ sig { returns(Integer) }
97
+ attr_accessor :fee
98
+
99
+ # The payment method used for the payout (e.g., bank transfer, card, etc.).
100
+ sig { returns(String) }
101
+ attr_accessor :payment_method
102
+
103
+ # The unique identifier of the payout.
104
+ sig { returns(String) }
105
+ attr_accessor :payout_id
106
+
107
+ # The total value of refunds associated with the payout.
108
+ sig { returns(Integer) }
109
+ attr_accessor :refunds
110
+
111
+ # The current status of the payout.
112
+ sig do
113
+ returns(
114
+ Dodopayments::PayoutOnHoldWebhookEvent::Data::Status::TaggedSymbol
115
+ )
116
+ end
117
+ attr_accessor :status
118
+
119
+ # The tax applied to the payout.
120
+ sig { returns(Integer) }
121
+ attr_accessor :tax
122
+
123
+ # The timestamp when the payout was last updated, in UTC.
124
+ sig { returns(Time) }
125
+ attr_accessor :updated_at
126
+
127
+ # The name of the payout recipient or purpose.
128
+ sig { returns(T.nilable(String)) }
129
+ attr_accessor :name
130
+
131
+ # The URL of the document associated with the payout.
132
+ sig { returns(T.nilable(String)) }
133
+ attr_accessor :payout_document_url
134
+
135
+ # Any additional remarks or notes associated with the payout.
136
+ sig { returns(T.nilable(String)) }
137
+ attr_accessor :remarks
138
+
139
+ sig do
140
+ params(
141
+ amount: Integer,
142
+ business_id: String,
143
+ chargebacks: Integer,
144
+ created_at: Time,
145
+ currency: Dodopayments::Currency::OrSymbol,
146
+ fee: Integer,
147
+ payment_method: String,
148
+ payout_id: String,
149
+ refunds: Integer,
150
+ status:
151
+ Dodopayments::PayoutOnHoldWebhookEvent::Data::Status::OrSymbol,
152
+ tax: Integer,
153
+ updated_at: Time,
154
+ name: T.nilable(String),
155
+ payout_document_url: T.nilable(String),
156
+ remarks: T.nilable(String)
157
+ ).returns(T.attached_class)
158
+ end
159
+ def self.new(
160
+ # The total amount of the payout.
161
+ amount:,
162
+ # The unique identifier of the business associated with the payout.
163
+ business_id:,
164
+ # The total value of chargebacks associated with the payout.
165
+ chargebacks:,
166
+ # The timestamp when the payout was created, in UTC.
167
+ created_at:,
168
+ # The currency of the payout, represented as an ISO 4217 currency code.
169
+ currency:,
170
+ # The fee charged for processing the payout.
171
+ fee:,
172
+ # The payment method used for the payout (e.g., bank transfer, card, etc.).
173
+ payment_method:,
174
+ # The unique identifier of the payout.
175
+ payout_id:,
176
+ # The total value of refunds associated with the payout.
177
+ refunds:,
178
+ # The current status of the payout.
179
+ status:,
180
+ # The tax applied to the payout.
181
+ tax:,
182
+ # The timestamp when the payout was last updated, in UTC.
183
+ updated_at:,
184
+ # The name of the payout recipient or purpose.
185
+ name: nil,
186
+ # The URL of the document associated with the payout.
187
+ payout_document_url: nil,
188
+ # Any additional remarks or notes associated with the payout.
189
+ remarks: nil
190
+ )
191
+ end
192
+
193
+ sig do
194
+ override.returns(
195
+ {
196
+ amount: Integer,
197
+ business_id: String,
198
+ chargebacks: Integer,
199
+ created_at: Time,
200
+ currency: Dodopayments::Currency::TaggedSymbol,
201
+ fee: Integer,
202
+ payment_method: String,
203
+ payout_id: String,
204
+ refunds: Integer,
205
+ status:
206
+ Dodopayments::PayoutOnHoldWebhookEvent::Data::Status::TaggedSymbol,
207
+ tax: Integer,
208
+ updated_at: Time,
209
+ name: T.nilable(String),
210
+ payout_document_url: T.nilable(String),
211
+ remarks: T.nilable(String)
212
+ }
213
+ )
214
+ end
215
+ def to_hash
216
+ end
217
+
218
+ # The current status of the payout.
219
+ module Status
220
+ extend Dodopayments::Internal::Type::Enum
221
+
222
+ TaggedSymbol =
223
+ T.type_alias do
224
+ T.all(
225
+ Symbol,
226
+ Dodopayments::PayoutOnHoldWebhookEvent::Data::Status
227
+ )
228
+ end
229
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
230
+
231
+ NOT_INITIATED =
232
+ T.let(
233
+ :not_initiated,
234
+ Dodopayments::PayoutOnHoldWebhookEvent::Data::Status::TaggedSymbol
235
+ )
236
+ IN_PROGRESS =
237
+ T.let(
238
+ :in_progress,
239
+ Dodopayments::PayoutOnHoldWebhookEvent::Data::Status::TaggedSymbol
240
+ )
241
+ ON_HOLD =
242
+ T.let(
243
+ :on_hold,
244
+ Dodopayments::PayoutOnHoldWebhookEvent::Data::Status::TaggedSymbol
245
+ )
246
+ FAILED =
247
+ T.let(
248
+ :failed,
249
+ Dodopayments::PayoutOnHoldWebhookEvent::Data::Status::TaggedSymbol
250
+ )
251
+ SUCCESS =
252
+ T.let(
253
+ :success,
254
+ Dodopayments::PayoutOnHoldWebhookEvent::Data::Status::TaggedSymbol
255
+ )
256
+
257
+ sig do
258
+ override.returns(
259
+ T::Array[
260
+ Dodopayments::PayoutOnHoldWebhookEvent::Data::Status::TaggedSymbol
261
+ ]
262
+ )
263
+ end
264
+ def self.values
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
270
+ end