dodopayments 1.71.1 → 1.73.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 +13 -0
- data/README.md +1 -1
- data/lib/dodopayments/models/checkout_session_preview_params.rb +14 -0
- data/lib/dodopayments/models/checkout_session_preview_response.rb +426 -0
- data/lib/dodopayments/models/checkout_session_request.rb +9 -1
- data/lib/dodopayments/models/discount_retrieve_by_code_params.rb +14 -0
- data/lib/dodopayments/models/payment.rb +9 -1
- data/lib/dodopayments/models/payment_method_types.rb +13 -98
- data/lib/dodopayments/models/product.rb +9 -1
- data/lib/dodopayments/models/subscription_change_plan_params.rb +10 -1
- data/lib/dodopayments/models/subscription_preview_change_plan_params.rb +10 -1
- data/lib/dodopayments/models.rb +4 -0
- data/lib/dodopayments/resources/checkout_sessions.rb +60 -1
- data/lib/dodopayments/resources/discounts.rb +22 -0
- data/lib/dodopayments/resources/subscriptions.rb +6 -2
- data/lib/dodopayments/version.rb +1 -1
- data/lib/dodopayments.rb +3 -0
- data/rbi/dodopayments/models/checkout_session_preview_params.rbi +32 -0
- data/rbi/dodopayments/models/checkout_session_preview_response.rbi +616 -0
- data/rbi/dodopayments/models/checkout_session_request.rbi +8 -0
- data/rbi/dodopayments/models/discount_retrieve_by_code_params.rbi +32 -0
- data/rbi/dodopayments/models/payment.rbi +8 -0
- data/rbi/dodopayments/models/payment_method_types.rbi +18 -186
- data/rbi/dodopayments/models/product.rbi +11 -3
- data/rbi/dodopayments/models/subscription_change_plan_params.rbi +10 -0
- data/rbi/dodopayments/models/subscription_preview_change_plan_params.rbi +10 -0
- data/rbi/dodopayments/models.rbi +6 -0
- data/rbi/dodopayments/resources/checkout_sessions.rbi +88 -0
- data/rbi/dodopayments/resources/discounts.rbi +16 -0
- data/rbi/dodopayments/resources/subscriptions.rbi +8 -0
- data/sig/dodopayments/models/checkout_session_preview_params.rbs +15 -0
- data/sig/dodopayments/models/checkout_session_preview_response.rbs +330 -0
- data/sig/dodopayments/models/checkout_session_request.rbs +5 -0
- data/sig/dodopayments/models/discount_retrieve_by_code_params.rbs +15 -0
- data/sig/dodopayments/models/payment.rbs +5 -0
- data/sig/dodopayments/models/payment_method_types.rbs +26 -196
- data/sig/dodopayments/models/product.rbs +8 -3
- data/sig/dodopayments/models/subscription_change_plan_params.rbs +6 -1
- data/sig/dodopayments/models/subscription_preview_change_plan_params.rbs +6 -1
- data/sig/dodopayments/models.rbs +4 -0
- data/sig/dodopayments/resources/checkout_sessions.rbs +23 -0
- data/sig/dodopayments/resources/discounts.rbs +5 -0
- data/sig/dodopayments/resources/subscriptions.rbs +2 -0
- metadata +11 -2
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Dodopayments
|
|
4
|
+
module Models
|
|
5
|
+
class CheckoutSessionPreviewResponse < Dodopayments::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(
|
|
9
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse,
|
|
10
|
+
Dodopayments::Internal::AnyHash
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Billing country
|
|
15
|
+
sig { returns(Dodopayments::CountryCode::TaggedSymbol) }
|
|
16
|
+
attr_accessor :billing_country
|
|
17
|
+
|
|
18
|
+
# Currency in which the calculations were made
|
|
19
|
+
sig { returns(Dodopayments::Currency::TaggedSymbol) }
|
|
20
|
+
attr_accessor :currency
|
|
21
|
+
|
|
22
|
+
# Breakup of the current payment
|
|
23
|
+
sig do
|
|
24
|
+
returns(
|
|
25
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::CurrentBreakup
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
attr_reader :current_breakup
|
|
29
|
+
|
|
30
|
+
sig do
|
|
31
|
+
params(
|
|
32
|
+
current_breakup:
|
|
33
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::CurrentBreakup::OrHash
|
|
34
|
+
).void
|
|
35
|
+
end
|
|
36
|
+
attr_writer :current_breakup
|
|
37
|
+
|
|
38
|
+
# The total product cart
|
|
39
|
+
sig do
|
|
40
|
+
returns(
|
|
41
|
+
T::Array[
|
|
42
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart
|
|
43
|
+
]
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
attr_accessor :product_cart
|
|
47
|
+
|
|
48
|
+
# Total calculate price of the product cart
|
|
49
|
+
sig { returns(Integer) }
|
|
50
|
+
attr_accessor :total_price
|
|
51
|
+
|
|
52
|
+
# Breakup of recurring payments (None for one-time only)
|
|
53
|
+
sig do
|
|
54
|
+
returns(
|
|
55
|
+
T.nilable(
|
|
56
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::RecurringBreakup
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
attr_reader :recurring_breakup
|
|
61
|
+
|
|
62
|
+
sig do
|
|
63
|
+
params(
|
|
64
|
+
recurring_breakup:
|
|
65
|
+
T.nilable(
|
|
66
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::RecurringBreakup::OrHash
|
|
67
|
+
)
|
|
68
|
+
).void
|
|
69
|
+
end
|
|
70
|
+
attr_writer :recurring_breakup
|
|
71
|
+
|
|
72
|
+
# Total tax
|
|
73
|
+
sig { returns(T.nilable(Integer)) }
|
|
74
|
+
attr_accessor :total_tax
|
|
75
|
+
|
|
76
|
+
# Data returned by the calculate checkout session API
|
|
77
|
+
sig do
|
|
78
|
+
params(
|
|
79
|
+
billing_country: Dodopayments::CountryCode::OrSymbol,
|
|
80
|
+
currency: Dodopayments::Currency::OrSymbol,
|
|
81
|
+
current_breakup:
|
|
82
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::CurrentBreakup::OrHash,
|
|
83
|
+
product_cart:
|
|
84
|
+
T::Array[
|
|
85
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart::OrHash
|
|
86
|
+
],
|
|
87
|
+
total_price: Integer,
|
|
88
|
+
recurring_breakup:
|
|
89
|
+
T.nilable(
|
|
90
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::RecurringBreakup::OrHash
|
|
91
|
+
),
|
|
92
|
+
total_tax: T.nilable(Integer)
|
|
93
|
+
).returns(T.attached_class)
|
|
94
|
+
end
|
|
95
|
+
def self.new(
|
|
96
|
+
# Billing country
|
|
97
|
+
billing_country:,
|
|
98
|
+
# Currency in which the calculations were made
|
|
99
|
+
currency:,
|
|
100
|
+
# Breakup of the current payment
|
|
101
|
+
current_breakup:,
|
|
102
|
+
# The total product cart
|
|
103
|
+
product_cart:,
|
|
104
|
+
# Total calculate price of the product cart
|
|
105
|
+
total_price:,
|
|
106
|
+
# Breakup of recurring payments (None for one-time only)
|
|
107
|
+
recurring_breakup: nil,
|
|
108
|
+
# Total tax
|
|
109
|
+
total_tax: nil
|
|
110
|
+
)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
sig do
|
|
114
|
+
override.returns(
|
|
115
|
+
{
|
|
116
|
+
billing_country: Dodopayments::CountryCode::TaggedSymbol,
|
|
117
|
+
currency: Dodopayments::Currency::TaggedSymbol,
|
|
118
|
+
current_breakup:
|
|
119
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::CurrentBreakup,
|
|
120
|
+
product_cart:
|
|
121
|
+
T::Array[
|
|
122
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart
|
|
123
|
+
],
|
|
124
|
+
total_price: Integer,
|
|
125
|
+
recurring_breakup:
|
|
126
|
+
T.nilable(
|
|
127
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::RecurringBreakup
|
|
128
|
+
),
|
|
129
|
+
total_tax: T.nilable(Integer)
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
end
|
|
133
|
+
def to_hash
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
class CurrentBreakup < Dodopayments::Internal::Type::BaseModel
|
|
137
|
+
OrHash =
|
|
138
|
+
T.type_alias do
|
|
139
|
+
T.any(
|
|
140
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::CurrentBreakup,
|
|
141
|
+
Dodopayments::Internal::AnyHash
|
|
142
|
+
)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Total discount amount
|
|
146
|
+
sig { returns(Integer) }
|
|
147
|
+
attr_accessor :discount
|
|
148
|
+
|
|
149
|
+
# Subtotal before discount (pre-tax original prices)
|
|
150
|
+
sig { returns(Integer) }
|
|
151
|
+
attr_accessor :subtotal
|
|
152
|
+
|
|
153
|
+
# Total amount to be charged (final amount after all calculations)
|
|
154
|
+
sig { returns(Integer) }
|
|
155
|
+
attr_accessor :total_amount
|
|
156
|
+
|
|
157
|
+
# Total tax amount
|
|
158
|
+
sig { returns(T.nilable(Integer)) }
|
|
159
|
+
attr_accessor :tax
|
|
160
|
+
|
|
161
|
+
# Breakup of the current payment
|
|
162
|
+
sig do
|
|
163
|
+
params(
|
|
164
|
+
discount: Integer,
|
|
165
|
+
subtotal: Integer,
|
|
166
|
+
total_amount: Integer,
|
|
167
|
+
tax: T.nilable(Integer)
|
|
168
|
+
).returns(T.attached_class)
|
|
169
|
+
end
|
|
170
|
+
def self.new(
|
|
171
|
+
# Total discount amount
|
|
172
|
+
discount:,
|
|
173
|
+
# Subtotal before discount (pre-tax original prices)
|
|
174
|
+
subtotal:,
|
|
175
|
+
# Total amount to be charged (final amount after all calculations)
|
|
176
|
+
total_amount:,
|
|
177
|
+
# Total tax amount
|
|
178
|
+
tax: nil
|
|
179
|
+
)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
sig do
|
|
183
|
+
override.returns(
|
|
184
|
+
{
|
|
185
|
+
discount: Integer,
|
|
186
|
+
subtotal: Integer,
|
|
187
|
+
total_amount: Integer,
|
|
188
|
+
tax: T.nilable(Integer)
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
end
|
|
192
|
+
def to_hash
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
class ProductCart < Dodopayments::Internal::Type::BaseModel
|
|
197
|
+
OrHash =
|
|
198
|
+
T.type_alias do
|
|
199
|
+
T.any(
|
|
200
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart,
|
|
201
|
+
Dodopayments::Internal::AnyHash
|
|
202
|
+
)
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# the currency in which the calculatiosn were made
|
|
206
|
+
sig { returns(Dodopayments::Currency::TaggedSymbol) }
|
|
207
|
+
attr_accessor :currency
|
|
208
|
+
|
|
209
|
+
# discounted price
|
|
210
|
+
sig { returns(Integer) }
|
|
211
|
+
attr_accessor :discounted_price
|
|
212
|
+
|
|
213
|
+
# Whether this is a subscription product (affects tax calculation in breakup)
|
|
214
|
+
sig { returns(T::Boolean) }
|
|
215
|
+
attr_accessor :is_subscription
|
|
216
|
+
|
|
217
|
+
sig { returns(T::Boolean) }
|
|
218
|
+
attr_accessor :is_usage_based
|
|
219
|
+
|
|
220
|
+
sig do
|
|
221
|
+
returns(
|
|
222
|
+
T::Array[
|
|
223
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart::Meter
|
|
224
|
+
]
|
|
225
|
+
)
|
|
226
|
+
end
|
|
227
|
+
attr_accessor :meters
|
|
228
|
+
|
|
229
|
+
# the product currency
|
|
230
|
+
sig { returns(Dodopayments::Currency::TaggedSymbol) }
|
|
231
|
+
attr_accessor :og_currency
|
|
232
|
+
|
|
233
|
+
# original price of the product
|
|
234
|
+
sig { returns(Integer) }
|
|
235
|
+
attr_accessor :og_price
|
|
236
|
+
|
|
237
|
+
# unique id of the product
|
|
238
|
+
sig { returns(String) }
|
|
239
|
+
attr_accessor :product_id
|
|
240
|
+
|
|
241
|
+
# Quanitity
|
|
242
|
+
sig { returns(Integer) }
|
|
243
|
+
attr_accessor :quantity
|
|
244
|
+
|
|
245
|
+
# tax category
|
|
246
|
+
sig { returns(Dodopayments::TaxCategory::TaggedSymbol) }
|
|
247
|
+
attr_accessor :tax_category
|
|
248
|
+
|
|
249
|
+
# Whether tax is included in the price
|
|
250
|
+
sig { returns(T::Boolean) }
|
|
251
|
+
attr_accessor :tax_inclusive
|
|
252
|
+
|
|
253
|
+
# tax rate
|
|
254
|
+
sig { returns(Integer) }
|
|
255
|
+
attr_accessor :tax_rate
|
|
256
|
+
|
|
257
|
+
sig do
|
|
258
|
+
returns(
|
|
259
|
+
T.nilable(
|
|
260
|
+
T::Array[
|
|
261
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart::Addon
|
|
262
|
+
]
|
|
263
|
+
)
|
|
264
|
+
)
|
|
265
|
+
end
|
|
266
|
+
attr_accessor :addons
|
|
267
|
+
|
|
268
|
+
sig { returns(T.nilable(String)) }
|
|
269
|
+
attr_accessor :description
|
|
270
|
+
|
|
271
|
+
# discount percentage
|
|
272
|
+
sig { returns(T.nilable(Integer)) }
|
|
273
|
+
attr_accessor :discount_amount
|
|
274
|
+
|
|
275
|
+
# number of cycles the discount will apply
|
|
276
|
+
sig { returns(T.nilable(Integer)) }
|
|
277
|
+
attr_accessor :discount_cycle
|
|
278
|
+
|
|
279
|
+
# name of the product
|
|
280
|
+
sig { returns(T.nilable(String)) }
|
|
281
|
+
attr_accessor :name
|
|
282
|
+
|
|
283
|
+
# total tax
|
|
284
|
+
sig { returns(T.nilable(Integer)) }
|
|
285
|
+
attr_accessor :tax
|
|
286
|
+
|
|
287
|
+
sig do
|
|
288
|
+
params(
|
|
289
|
+
currency: Dodopayments::Currency::OrSymbol,
|
|
290
|
+
discounted_price: Integer,
|
|
291
|
+
is_subscription: T::Boolean,
|
|
292
|
+
is_usage_based: T::Boolean,
|
|
293
|
+
meters:
|
|
294
|
+
T::Array[
|
|
295
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart::Meter::OrHash
|
|
296
|
+
],
|
|
297
|
+
og_currency: Dodopayments::Currency::OrSymbol,
|
|
298
|
+
og_price: Integer,
|
|
299
|
+
product_id: String,
|
|
300
|
+
quantity: Integer,
|
|
301
|
+
tax_category: Dodopayments::TaxCategory::OrSymbol,
|
|
302
|
+
tax_inclusive: T::Boolean,
|
|
303
|
+
tax_rate: Integer,
|
|
304
|
+
addons:
|
|
305
|
+
T.nilable(
|
|
306
|
+
T::Array[
|
|
307
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart::Addon::OrHash
|
|
308
|
+
]
|
|
309
|
+
),
|
|
310
|
+
description: T.nilable(String),
|
|
311
|
+
discount_amount: T.nilable(Integer),
|
|
312
|
+
discount_cycle: T.nilable(Integer),
|
|
313
|
+
name: T.nilable(String),
|
|
314
|
+
tax: T.nilable(Integer)
|
|
315
|
+
).returns(T.attached_class)
|
|
316
|
+
end
|
|
317
|
+
def self.new(
|
|
318
|
+
# the currency in which the calculatiosn were made
|
|
319
|
+
currency:,
|
|
320
|
+
# discounted price
|
|
321
|
+
discounted_price:,
|
|
322
|
+
# Whether this is a subscription product (affects tax calculation in breakup)
|
|
323
|
+
is_subscription:,
|
|
324
|
+
is_usage_based:,
|
|
325
|
+
meters:,
|
|
326
|
+
# the product currency
|
|
327
|
+
og_currency:,
|
|
328
|
+
# original price of the product
|
|
329
|
+
og_price:,
|
|
330
|
+
# unique id of the product
|
|
331
|
+
product_id:,
|
|
332
|
+
# Quanitity
|
|
333
|
+
quantity:,
|
|
334
|
+
# tax category
|
|
335
|
+
tax_category:,
|
|
336
|
+
# Whether tax is included in the price
|
|
337
|
+
tax_inclusive:,
|
|
338
|
+
# tax rate
|
|
339
|
+
tax_rate:,
|
|
340
|
+
addons: nil,
|
|
341
|
+
description: nil,
|
|
342
|
+
# discount percentage
|
|
343
|
+
discount_amount: nil,
|
|
344
|
+
# number of cycles the discount will apply
|
|
345
|
+
discount_cycle: nil,
|
|
346
|
+
# name of the product
|
|
347
|
+
name: nil,
|
|
348
|
+
# total tax
|
|
349
|
+
tax: nil
|
|
350
|
+
)
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
sig do
|
|
354
|
+
override.returns(
|
|
355
|
+
{
|
|
356
|
+
currency: Dodopayments::Currency::TaggedSymbol,
|
|
357
|
+
discounted_price: Integer,
|
|
358
|
+
is_subscription: T::Boolean,
|
|
359
|
+
is_usage_based: T::Boolean,
|
|
360
|
+
meters:
|
|
361
|
+
T::Array[
|
|
362
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart::Meter
|
|
363
|
+
],
|
|
364
|
+
og_currency: Dodopayments::Currency::TaggedSymbol,
|
|
365
|
+
og_price: Integer,
|
|
366
|
+
product_id: String,
|
|
367
|
+
quantity: Integer,
|
|
368
|
+
tax_category: Dodopayments::TaxCategory::TaggedSymbol,
|
|
369
|
+
tax_inclusive: T::Boolean,
|
|
370
|
+
tax_rate: Integer,
|
|
371
|
+
addons:
|
|
372
|
+
T.nilable(
|
|
373
|
+
T::Array[
|
|
374
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart::Addon
|
|
375
|
+
]
|
|
376
|
+
),
|
|
377
|
+
description: T.nilable(String),
|
|
378
|
+
discount_amount: T.nilable(Integer),
|
|
379
|
+
discount_cycle: T.nilable(Integer),
|
|
380
|
+
name: T.nilable(String),
|
|
381
|
+
tax: T.nilable(Integer)
|
|
382
|
+
}
|
|
383
|
+
)
|
|
384
|
+
end
|
|
385
|
+
def to_hash
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
class Meter < Dodopayments::Internal::Type::BaseModel
|
|
389
|
+
OrHash =
|
|
390
|
+
T.type_alias do
|
|
391
|
+
T.any(
|
|
392
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart::Meter,
|
|
393
|
+
Dodopayments::Internal::AnyHash
|
|
394
|
+
)
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
sig { returns(String) }
|
|
398
|
+
attr_accessor :measurement_unit
|
|
399
|
+
|
|
400
|
+
sig { returns(String) }
|
|
401
|
+
attr_accessor :name
|
|
402
|
+
|
|
403
|
+
sig { returns(String) }
|
|
404
|
+
attr_accessor :price_per_unit
|
|
405
|
+
|
|
406
|
+
sig { returns(T.nilable(String)) }
|
|
407
|
+
attr_accessor :description
|
|
408
|
+
|
|
409
|
+
sig { returns(T.nilable(Integer)) }
|
|
410
|
+
attr_accessor :free_threshold
|
|
411
|
+
|
|
412
|
+
sig do
|
|
413
|
+
params(
|
|
414
|
+
measurement_unit: String,
|
|
415
|
+
name: String,
|
|
416
|
+
price_per_unit: String,
|
|
417
|
+
description: T.nilable(String),
|
|
418
|
+
free_threshold: T.nilable(Integer)
|
|
419
|
+
).returns(T.attached_class)
|
|
420
|
+
end
|
|
421
|
+
def self.new(
|
|
422
|
+
measurement_unit:,
|
|
423
|
+
name:,
|
|
424
|
+
price_per_unit:,
|
|
425
|
+
description: nil,
|
|
426
|
+
free_threshold: nil
|
|
427
|
+
)
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
sig do
|
|
431
|
+
override.returns(
|
|
432
|
+
{
|
|
433
|
+
measurement_unit: String,
|
|
434
|
+
name: String,
|
|
435
|
+
price_per_unit: String,
|
|
436
|
+
description: T.nilable(String),
|
|
437
|
+
free_threshold: T.nilable(Integer)
|
|
438
|
+
}
|
|
439
|
+
)
|
|
440
|
+
end
|
|
441
|
+
def to_hash
|
|
442
|
+
end
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
class Addon < Dodopayments::Internal::Type::BaseModel
|
|
446
|
+
OrHash =
|
|
447
|
+
T.type_alias do
|
|
448
|
+
T.any(
|
|
449
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart::Addon,
|
|
450
|
+
Dodopayments::Internal::AnyHash
|
|
451
|
+
)
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
sig { returns(String) }
|
|
455
|
+
attr_accessor :addon_id
|
|
456
|
+
|
|
457
|
+
sig { returns(Dodopayments::Currency::TaggedSymbol) }
|
|
458
|
+
attr_accessor :currency
|
|
459
|
+
|
|
460
|
+
sig { returns(Integer) }
|
|
461
|
+
attr_accessor :discounted_price
|
|
462
|
+
|
|
463
|
+
sig { returns(String) }
|
|
464
|
+
attr_accessor :name
|
|
465
|
+
|
|
466
|
+
sig { returns(Dodopayments::Currency::TaggedSymbol) }
|
|
467
|
+
attr_accessor :og_currency
|
|
468
|
+
|
|
469
|
+
sig { returns(Integer) }
|
|
470
|
+
attr_accessor :og_price
|
|
471
|
+
|
|
472
|
+
sig { returns(Integer) }
|
|
473
|
+
attr_accessor :quantity
|
|
474
|
+
|
|
475
|
+
# Represents the different categories of taxation applicable to various products
|
|
476
|
+
# and services.
|
|
477
|
+
sig { returns(Dodopayments::TaxCategory::TaggedSymbol) }
|
|
478
|
+
attr_accessor :tax_category
|
|
479
|
+
|
|
480
|
+
sig { returns(T::Boolean) }
|
|
481
|
+
attr_accessor :tax_inclusive
|
|
482
|
+
|
|
483
|
+
sig { returns(Integer) }
|
|
484
|
+
attr_accessor :tax_rate
|
|
485
|
+
|
|
486
|
+
sig { returns(T.nilable(String)) }
|
|
487
|
+
attr_accessor :description
|
|
488
|
+
|
|
489
|
+
sig { returns(T.nilable(Integer)) }
|
|
490
|
+
attr_accessor :discount_amount
|
|
491
|
+
|
|
492
|
+
sig { returns(T.nilable(Integer)) }
|
|
493
|
+
attr_accessor :tax
|
|
494
|
+
|
|
495
|
+
sig do
|
|
496
|
+
params(
|
|
497
|
+
addon_id: String,
|
|
498
|
+
currency: Dodopayments::Currency::OrSymbol,
|
|
499
|
+
discounted_price: Integer,
|
|
500
|
+
name: String,
|
|
501
|
+
og_currency: Dodopayments::Currency::OrSymbol,
|
|
502
|
+
og_price: Integer,
|
|
503
|
+
quantity: Integer,
|
|
504
|
+
tax_category: Dodopayments::TaxCategory::OrSymbol,
|
|
505
|
+
tax_inclusive: T::Boolean,
|
|
506
|
+
tax_rate: Integer,
|
|
507
|
+
description: T.nilable(String),
|
|
508
|
+
discount_amount: T.nilable(Integer),
|
|
509
|
+
tax: T.nilable(Integer)
|
|
510
|
+
).returns(T.attached_class)
|
|
511
|
+
end
|
|
512
|
+
def self.new(
|
|
513
|
+
addon_id:,
|
|
514
|
+
currency:,
|
|
515
|
+
discounted_price:,
|
|
516
|
+
name:,
|
|
517
|
+
og_currency:,
|
|
518
|
+
og_price:,
|
|
519
|
+
quantity:,
|
|
520
|
+
# Represents the different categories of taxation applicable to various products
|
|
521
|
+
# and services.
|
|
522
|
+
tax_category:,
|
|
523
|
+
tax_inclusive:,
|
|
524
|
+
tax_rate:,
|
|
525
|
+
description: nil,
|
|
526
|
+
discount_amount: nil,
|
|
527
|
+
tax: nil
|
|
528
|
+
)
|
|
529
|
+
end
|
|
530
|
+
|
|
531
|
+
sig do
|
|
532
|
+
override.returns(
|
|
533
|
+
{
|
|
534
|
+
addon_id: String,
|
|
535
|
+
currency: Dodopayments::Currency::TaggedSymbol,
|
|
536
|
+
discounted_price: Integer,
|
|
537
|
+
name: String,
|
|
538
|
+
og_currency: Dodopayments::Currency::TaggedSymbol,
|
|
539
|
+
og_price: Integer,
|
|
540
|
+
quantity: Integer,
|
|
541
|
+
tax_category: Dodopayments::TaxCategory::TaggedSymbol,
|
|
542
|
+
tax_inclusive: T::Boolean,
|
|
543
|
+
tax_rate: Integer,
|
|
544
|
+
description: T.nilable(String),
|
|
545
|
+
discount_amount: T.nilable(Integer),
|
|
546
|
+
tax: T.nilable(Integer)
|
|
547
|
+
}
|
|
548
|
+
)
|
|
549
|
+
end
|
|
550
|
+
def to_hash
|
|
551
|
+
end
|
|
552
|
+
end
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
class RecurringBreakup < Dodopayments::Internal::Type::BaseModel
|
|
556
|
+
OrHash =
|
|
557
|
+
T.type_alias do
|
|
558
|
+
T.any(
|
|
559
|
+
Dodopayments::Models::CheckoutSessionPreviewResponse::RecurringBreakup,
|
|
560
|
+
Dodopayments::Internal::AnyHash
|
|
561
|
+
)
|
|
562
|
+
end
|
|
563
|
+
|
|
564
|
+
# Total discount amount
|
|
565
|
+
sig { returns(Integer) }
|
|
566
|
+
attr_accessor :discount
|
|
567
|
+
|
|
568
|
+
# Subtotal before discount (pre-tax original prices)
|
|
569
|
+
sig { returns(Integer) }
|
|
570
|
+
attr_accessor :subtotal
|
|
571
|
+
|
|
572
|
+
# Total recurring amount including tax
|
|
573
|
+
sig { returns(Integer) }
|
|
574
|
+
attr_accessor :total_amount
|
|
575
|
+
|
|
576
|
+
# Total tax on recurring payments
|
|
577
|
+
sig { returns(T.nilable(Integer)) }
|
|
578
|
+
attr_accessor :tax
|
|
579
|
+
|
|
580
|
+
# Breakup of recurring payments (None for one-time only)
|
|
581
|
+
sig do
|
|
582
|
+
params(
|
|
583
|
+
discount: Integer,
|
|
584
|
+
subtotal: Integer,
|
|
585
|
+
total_amount: Integer,
|
|
586
|
+
tax: T.nilable(Integer)
|
|
587
|
+
).returns(T.attached_class)
|
|
588
|
+
end
|
|
589
|
+
def self.new(
|
|
590
|
+
# Total discount amount
|
|
591
|
+
discount:,
|
|
592
|
+
# Subtotal before discount (pre-tax original prices)
|
|
593
|
+
subtotal:,
|
|
594
|
+
# Total recurring amount including tax
|
|
595
|
+
total_amount:,
|
|
596
|
+
# Total tax on recurring payments
|
|
597
|
+
tax: nil
|
|
598
|
+
)
|
|
599
|
+
end
|
|
600
|
+
|
|
601
|
+
sig do
|
|
602
|
+
override.returns(
|
|
603
|
+
{
|
|
604
|
+
discount: Integer,
|
|
605
|
+
subtotal: Integer,
|
|
606
|
+
total_amount: Integer,
|
|
607
|
+
tax: T.nilable(Integer)
|
|
608
|
+
}
|
|
609
|
+
)
|
|
610
|
+
end
|
|
611
|
+
def to_hash
|
|
612
|
+
end
|
|
613
|
+
end
|
|
614
|
+
end
|
|
615
|
+
end
|
|
616
|
+
end
|
|
@@ -120,6 +120,10 @@ module Dodopayments
|
|
|
120
120
|
sig { returns(T.nilable(String)) }
|
|
121
121
|
attr_accessor :payment_method_id
|
|
122
122
|
|
|
123
|
+
# Product collection ID for collection-based checkout flow
|
|
124
|
+
sig { returns(T.nilable(String)) }
|
|
125
|
+
attr_accessor :product_collection_id
|
|
126
|
+
|
|
123
127
|
# The url to redirect after payment failure or success.
|
|
124
128
|
sig { returns(T.nilable(String)) }
|
|
125
129
|
attr_accessor :return_url
|
|
@@ -183,6 +187,7 @@ module Dodopayments
|
|
|
183
187
|
metadata: T.nilable(T::Hash[Symbol, String]),
|
|
184
188
|
minimal_address: T::Boolean,
|
|
185
189
|
payment_method_id: T.nilable(String),
|
|
190
|
+
product_collection_id: T.nilable(String),
|
|
186
191
|
return_url: T.nilable(String),
|
|
187
192
|
short_link: T::Boolean,
|
|
188
193
|
show_saved_payment_methods: T::Boolean,
|
|
@@ -225,6 +230,8 @@ module Dodopayments
|
|
|
225
230
|
# Optional payment method ID to use for this checkout session. Only allowed when
|
|
226
231
|
# `confirm` is true. If provided, existing customer id must also be provided.
|
|
227
232
|
payment_method_id: nil,
|
|
233
|
+
# Product collection ID for collection-based checkout flow
|
|
234
|
+
product_collection_id: nil,
|
|
228
235
|
# The url to redirect after payment failure or success.
|
|
229
236
|
return_url: nil,
|
|
230
237
|
# If true, returns a shortened checkout URL. Defaults to false if not specified.
|
|
@@ -260,6 +267,7 @@ module Dodopayments
|
|
|
260
267
|
metadata: T.nilable(T::Hash[Symbol, String]),
|
|
261
268
|
minimal_address: T::Boolean,
|
|
262
269
|
payment_method_id: T.nilable(String),
|
|
270
|
+
product_collection_id: T.nilable(String),
|
|
263
271
|
return_url: T.nilable(String),
|
|
264
272
|
short_link: T::Boolean,
|
|
265
273
|
show_saved_payment_methods: T::Boolean,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Dodopayments
|
|
4
|
+
module Models
|
|
5
|
+
class DiscountRetrieveByCodeParams < Dodopayments::Internal::Type::BaseModel
|
|
6
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include Dodopayments::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Dodopayments::DiscountRetrieveByCodeParams,
|
|
13
|
+
Dodopayments::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
sig do
|
|
18
|
+
params(request_options: Dodopayments::RequestOptions::OrHash).returns(
|
|
19
|
+
T.attached_class
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
def self.new(request_options: {})
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
sig do
|
|
26
|
+
override.returns({ request_options: Dodopayments::RequestOptions })
|
|
27
|
+
end
|
|
28
|
+
def to_hash
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -118,6 +118,10 @@ module Dodopayments
|
|
|
118
118
|
sig { returns(T.nilable(String)) }
|
|
119
119
|
attr_accessor :invoice_id
|
|
120
120
|
|
|
121
|
+
# URL to download the invoice PDF for this payment.
|
|
122
|
+
sig { returns(T.nilable(String)) }
|
|
123
|
+
attr_accessor :invoice_url
|
|
124
|
+
|
|
121
125
|
# Checkout URL
|
|
122
126
|
sig { returns(T.nilable(String)) }
|
|
123
127
|
attr_accessor :payment_link
|
|
@@ -182,6 +186,7 @@ module Dodopayments
|
|
|
182
186
|
error_code: T.nilable(String),
|
|
183
187
|
error_message: T.nilable(String),
|
|
184
188
|
invoice_id: T.nilable(String),
|
|
189
|
+
invoice_url: T.nilable(String),
|
|
185
190
|
payment_link: T.nilable(String),
|
|
186
191
|
payment_method: T.nilable(String),
|
|
187
192
|
payment_method_type: T.nilable(String),
|
|
@@ -249,6 +254,8 @@ module Dodopayments
|
|
|
249
254
|
error_message: nil,
|
|
250
255
|
# Invoice ID for this payment. Uses India-specific invoice ID if available.
|
|
251
256
|
invoice_id: nil,
|
|
257
|
+
# URL to download the invoice PDF for this payment.
|
|
258
|
+
invoice_url: nil,
|
|
252
259
|
# Checkout URL
|
|
253
260
|
payment_link: nil,
|
|
254
261
|
# Payment method used by customer (e.g. "card", "bank_transfer")
|
|
@@ -300,6 +307,7 @@ module Dodopayments
|
|
|
300
307
|
error_code: T.nilable(String),
|
|
301
308
|
error_message: T.nilable(String),
|
|
302
309
|
invoice_id: T.nilable(String),
|
|
310
|
+
invoice_url: T.nilable(String),
|
|
303
311
|
payment_link: T.nilable(String),
|
|
304
312
|
payment_method: T.nilable(String),
|
|
305
313
|
payment_method_type: T.nilable(String),
|