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,270 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class PayoutCreatedWebhookEvent < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::PayoutCreatedWebhookEvent,
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::PayoutCreatedWebhookEvent::Data) }
19
+ attr_reader :data
20
+
21
+ sig do
22
+ params(data: Dodopayments::PayoutCreatedWebhookEvent::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::PayoutCreatedWebhookEvent::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.created"
50
+ )
51
+ end
52
+
53
+ sig do
54
+ override.returns(
55
+ {
56
+ business_id: String,
57
+ data: Dodopayments::PayoutCreatedWebhookEvent::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::PayoutCreatedWebhookEvent::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::PayoutCreatedWebhookEvent::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::PayoutCreatedWebhookEvent::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::PayoutCreatedWebhookEvent::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::PayoutCreatedWebhookEvent::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::PayoutCreatedWebhookEvent::Data::Status::TaggedSymbol
235
+ )
236
+ IN_PROGRESS =
237
+ T.let(
238
+ :in_progress,
239
+ Dodopayments::PayoutCreatedWebhookEvent::Data::Status::TaggedSymbol
240
+ )
241
+ ON_HOLD =
242
+ T.let(
243
+ :on_hold,
244
+ Dodopayments::PayoutCreatedWebhookEvent::Data::Status::TaggedSymbol
245
+ )
246
+ FAILED =
247
+ T.let(
248
+ :failed,
249
+ Dodopayments::PayoutCreatedWebhookEvent::Data::Status::TaggedSymbol
250
+ )
251
+ SUCCESS =
252
+ T.let(
253
+ :success,
254
+ Dodopayments::PayoutCreatedWebhookEvent::Data::Status::TaggedSymbol
255
+ )
256
+
257
+ sig do
258
+ override.returns(
259
+ T::Array[
260
+ Dodopayments::PayoutCreatedWebhookEvent::Data::Status::TaggedSymbol
261
+ ]
262
+ )
263
+ end
264
+ def self.values
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
270
+ end
@@ -0,0 +1,270 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class PayoutFailedWebhookEvent < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::PayoutFailedWebhookEvent,
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::PayoutFailedWebhookEvent::Data) }
19
+ attr_reader :data
20
+
21
+ sig do
22
+ params(data: Dodopayments::PayoutFailedWebhookEvent::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::PayoutFailedWebhookEvent::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.failed"
50
+ )
51
+ end
52
+
53
+ sig do
54
+ override.returns(
55
+ {
56
+ business_id: String,
57
+ data: Dodopayments::PayoutFailedWebhookEvent::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::PayoutFailedWebhookEvent::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::PayoutFailedWebhookEvent::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::PayoutFailedWebhookEvent::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::PayoutFailedWebhookEvent::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::PayoutFailedWebhookEvent::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::PayoutFailedWebhookEvent::Data::Status::TaggedSymbol
235
+ )
236
+ IN_PROGRESS =
237
+ T.let(
238
+ :in_progress,
239
+ Dodopayments::PayoutFailedWebhookEvent::Data::Status::TaggedSymbol
240
+ )
241
+ ON_HOLD =
242
+ T.let(
243
+ :on_hold,
244
+ Dodopayments::PayoutFailedWebhookEvent::Data::Status::TaggedSymbol
245
+ )
246
+ FAILED =
247
+ T.let(
248
+ :failed,
249
+ Dodopayments::PayoutFailedWebhookEvent::Data::Status::TaggedSymbol
250
+ )
251
+ SUCCESS =
252
+ T.let(
253
+ :success,
254
+ Dodopayments::PayoutFailedWebhookEvent::Data::Status::TaggedSymbol
255
+ )
256
+
257
+ sig do
258
+ override.returns(
259
+ T::Array[
260
+ Dodopayments::PayoutFailedWebhookEvent::Data::Status::TaggedSymbol
261
+ ]
262
+ )
263
+ end
264
+ def self.values
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
270
+ end