dodopayments 2.27.0 → 2.28.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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/internal/type/union.rb +15 -5
  5. data/lib/dodopayments/models/balance_ledger_entry.rb +2 -0
  6. data/lib/dodopayments/models/balance_retrieve_ledger_params.rb +2 -0
  7. data/lib/dodopayments/models/checkout_session_preview_response.rb +10 -1
  8. data/lib/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rb +1 -1
  9. data/lib/dodopayments/models/credit_entitlements/balance_create_ledger_entry_response.rb +21 -1
  10. data/lib/dodopayments/models/credit_entitlements/credit_ledger_entry.rb +2 -7
  11. data/lib/dodopayments/models/customers/email_body.rb +57 -0
  12. data/lib/dodopayments/models/customers/email_failure_code.rb +27 -0
  13. data/lib/dodopayments/models/customers/email_list_params.rb +39 -0
  14. data/lib/dodopayments/models/customers/email_log_item.rb +121 -0
  15. data/lib/dodopayments/models/customers/email_log_status.rb +24 -0
  16. data/lib/dodopayments/models/customers/email_policies.rb +45 -0
  17. data/lib/dodopayments/models/customers/email_retrieve_body_params.rb +28 -0
  18. data/lib/dodopayments/models/price.rb +95 -27
  19. data/lib/dodopayments/models/subscription.rb +10 -1
  20. data/lib/dodopayments/models/subscription_create_response.rb +10 -1
  21. data/lib/dodopayments/models/subscription_list_response.rb +10 -1
  22. data/lib/dodopayments/resources/credit_entitlements/balances.rb +1 -0
  23. data/lib/dodopayments/resources/customers/emails.rb +76 -0
  24. data/lib/dodopayments/resources/customers.rb +4 -0
  25. data/lib/dodopayments/version.rb +1 -1
  26. data/lib/dodopayments.rb +8 -0
  27. data/rbi/dodopayments/models/balance_ledger_entry.rbi +10 -0
  28. data/rbi/dodopayments/models/balance_retrieve_ledger_params.rbi +10 -0
  29. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +10 -0
  30. data/rbi/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rbi +2 -2
  31. data/rbi/dodopayments/models/credit_entitlements/balance_create_ledger_entry_response.rbi +8 -0
  32. data/rbi/dodopayments/models/credit_entitlements/credit_ledger_entry.rbi +2 -6
  33. data/rbi/dodopayments/models/customers/email_body.rbi +88 -0
  34. data/rbi/dodopayments/models/customers/email_failure_code.rbi +70 -0
  35. data/rbi/dodopayments/models/customers/email_list_params.rbi +68 -0
  36. data/rbi/dodopayments/models/customers/email_log_item.rbi +157 -0
  37. data/rbi/dodopayments/models/customers/email_log_status.rbi +46 -0
  38. data/rbi/dodopayments/models/customers/email_policies.rbi +68 -0
  39. data/rbi/dodopayments/models/customers/email_retrieve_body_params.rbi +48 -0
  40. data/rbi/dodopayments/models/price.rbi +124 -25
  41. data/rbi/dodopayments/models/subscription.rbi +10 -0
  42. data/rbi/dodopayments/models/subscription_create_response.rbi +10 -0
  43. data/rbi/dodopayments/models/subscription_list_response.rbi +10 -0
  44. data/rbi/dodopayments/resources/credit_entitlements/balances.rbi +2 -1
  45. data/rbi/dodopayments/resources/customers/emails.rbi +60 -0
  46. data/rbi/dodopayments/resources/customers.rbi +3 -0
  47. data/sig/dodopayments/models/balance_ledger_entry.rbs +4 -0
  48. data/sig/dodopayments/models/balance_retrieve_ledger_params.rbs +4 -0
  49. data/sig/dodopayments/models/checkout_session_preview_response.rbs +5 -0
  50. data/sig/dodopayments/models/credit_entitlements/balance_create_ledger_entry_response.rbs +5 -0
  51. data/sig/dodopayments/models/customers/email_body.rbs +42 -0
  52. data/sig/dodopayments/models/customers/email_failure_code.rbs +30 -0
  53. data/sig/dodopayments/models/customers/email_list_params.rbs +38 -0
  54. data/sig/dodopayments/models/customers/email_log_item.rbs +82 -0
  55. data/sig/dodopayments/models/customers/email_log_status.rbs +20 -0
  56. data/sig/dodopayments/models/customers/email_policies.rbs +37 -0
  57. data/sig/dodopayments/models/customers/email_retrieve_body_params.rbs +30 -0
  58. data/sig/dodopayments/models/price.rbs +52 -17
  59. data/sig/dodopayments/models/subscription.rbs +5 -0
  60. data/sig/dodopayments/models/subscription_create_response.rbs +5 -0
  61. data/sig/dodopayments/models/subscription_list_response.rbs +5 -0
  62. data/sig/dodopayments/resources/customers/emails.rbs +22 -0
  63. data/sig/dodopayments/resources/customers.rbs +2 -0
  64. metadata +26 -2
@@ -28,10 +28,6 @@ module Dodopayments
28
28
  sig { returns(Dodopayments::Currency::OrSymbol) }
29
29
  attr_accessor :currency
30
30
 
31
- # Discount applied to the price, represented as a percentage (0 to 100).
32
- sig { returns(Integer) }
33
- attr_accessor :discount
34
-
35
31
  # The payment amount, in the smallest denomination of the currency (e.g., cents
36
32
  # for USD). For example, to charge $1.00, pass `100`.
37
33
  #
@@ -43,6 +39,24 @@ module Dodopayments
43
39
  sig { returns(Symbol) }
44
40
  attr_accessor :type
45
41
 
42
+ # Deprecated: use `discount_bps` instead.
43
+ #
44
+ # Discount applied to the price, represented as a percentage (0 to 100). A
45
+ # response rounds this value to the nearest whole percent. Defaults to `0`.
46
+ sig { returns(T.nilable(Integer)) }
47
+ attr_reader :discount
48
+
49
+ sig { params(discount: Integer).void }
50
+ attr_writer :discount
51
+
52
+ # Discount applied to the price, in basis points. 100 basis points make one
53
+ # percent, so `1250` is a discount of 12.5%.
54
+ #
55
+ # Use this field for a discount with a fraction of a percent. A request that sends
56
+ # this field ignores `discount`. A value of `0` gives no discount.
57
+ sig { returns(T.nilable(Integer)) }
58
+ attr_accessor :discount_bps
59
+
46
60
  # Indicates whether the customer can pay any amount they choose. If set to `true`,
47
61
  # the [`price`](Self::price) field is the minimum amount.
48
62
  sig { returns(T.nilable(T::Boolean)) }
@@ -74,8 +88,9 @@ module Dodopayments
74
88
  sig do
75
89
  params(
76
90
  currency: Dodopayments::Currency::OrSymbol,
77
- discount: Integer,
78
91
  price: Integer,
92
+ discount: Integer,
93
+ discount_bps: T.nilable(Integer),
79
94
  pay_what_you_want: T::Boolean,
80
95
  purchasing_power_parity: T::Boolean,
81
96
  suggested_price: T.nilable(Integer),
@@ -86,14 +101,23 @@ module Dodopayments
86
101
  def self.new(
87
102
  # The currency in which the payment is made.
88
103
  currency:,
89
- # Discount applied to the price, represented as a percentage (0 to 100).
90
- discount:,
91
104
  # The payment amount, in the smallest denomination of the currency (e.g., cents
92
105
  # for USD). For example, to charge $1.00, pass `100`.
93
106
  #
94
107
  # If [`pay_what_you_want`](Self::pay_what_you_want) is set to `true`, this field
95
108
  # represents the **minimum** amount the customer must pay.
96
109
  price:,
110
+ # Deprecated: use `discount_bps` instead.
111
+ #
112
+ # Discount applied to the price, represented as a percentage (0 to 100). A
113
+ # response rounds this value to the nearest whole percent. Defaults to `0`.
114
+ discount: nil,
115
+ # Discount applied to the price, in basis points. 100 basis points make one
116
+ # percent, so `1250` is a discount of 12.5%.
117
+ #
118
+ # Use this field for a discount with a fraction of a percent. A request that sends
119
+ # this field ignores `discount`. A value of `0` gives no discount.
120
+ discount_bps: nil,
97
121
  # Indicates whether the customer can pay any amount they choose. If set to `true`,
98
122
  # the [`price`](Self::price) field is the minimum amount.
99
123
  pay_what_you_want: nil,
@@ -115,9 +139,10 @@ module Dodopayments
115
139
  override.returns(
116
140
  {
117
141
  currency: Dodopayments::Currency::OrSymbol,
118
- discount: Integer,
119
142
  price: Integer,
120
143
  type: Symbol,
144
+ discount: Integer,
145
+ discount_bps: T.nilable(Integer),
121
146
  pay_what_you_want: T::Boolean,
122
147
  purchasing_power_parity: T::Boolean,
123
148
  suggested_price: T.nilable(Integer),
@@ -142,10 +167,6 @@ module Dodopayments
142
167
  sig { returns(Dodopayments::Currency::OrSymbol) }
143
168
  attr_accessor :currency
144
169
 
145
- # Discount applied to the price, represented as a percentage (0 to 100).
146
- sig { returns(Integer) }
147
- attr_accessor :discount
148
-
149
170
  # Number of units for the payment frequency. For example, a value of `1` with a
150
171
  # `payment_frequency_interval` of `month` represents monthly payments.
151
172
  sig { returns(Integer) }
@@ -172,6 +193,24 @@ module Dodopayments
172
193
  sig { returns(Symbol) }
173
194
  attr_accessor :type
174
195
 
196
+ # Deprecated: use `discount_bps` instead.
197
+ #
198
+ # Discount applied to the price, represented as a percentage (0 to 100). A
199
+ # response rounds this value to the nearest whole percent. Defaults to `0`.
200
+ sig { returns(T.nilable(Integer)) }
201
+ attr_reader :discount
202
+
203
+ sig { params(discount: Integer).void }
204
+ attr_writer :discount
205
+
206
+ # Discount applied to the price, in basis points. 100 basis points make one
207
+ # percent, so `1250` is a discount of 12.5%.
208
+ #
209
+ # Use this field for a discount with a fraction of a percent. A request that sends
210
+ # this field ignores `discount`. A value of `0` gives no discount.
211
+ sig { returns(T.nilable(Integer)) }
212
+ attr_accessor :discount_bps
213
+
175
214
  # Opts this price in to purchasing power parity. The business must also enable
176
215
  # purchasing power parity. The discount percentage per country is always
177
216
  # business-wide. Defaults to `false`.
@@ -195,6 +234,13 @@ module Dodopayments
195
234
  sig { returns(T.nilable(T::Boolean)) }
196
235
  attr_accessor :trial_apply_discounts
197
236
 
237
+ # Let a customer start a free trial with no card. Defaults to false.
238
+ sig { returns(T.nilable(T::Boolean)) }
239
+ attr_reader :trial_payment_method_optional
240
+
241
+ sig { params(trial_payment_method_optional: T::Boolean).void }
242
+ attr_writer :trial_payment_method_optional
243
+
198
244
  # Number of days for the trial period. A value of `0` indicates no trial period.
199
245
  sig { returns(T.nilable(Integer)) }
200
246
  attr_reader :trial_period_days
@@ -202,29 +248,38 @@ module Dodopayments
202
248
  sig { params(trial_period_days: Integer).void }
203
249
  attr_writer :trial_period_days
204
250
 
251
+ # Let a customer start a subscription with no card, when the amount due today is
252
+ # `0` (a native `0` price, or a 100% discount). Defaults to false.
253
+ sig { returns(T.nilable(T::Boolean)) }
254
+ attr_reader :zero_amount_payment_method_optional
255
+
256
+ sig { params(zero_amount_payment_method_optional: T::Boolean).void }
257
+ attr_writer :zero_amount_payment_method_optional
258
+
205
259
  # Recurring price details.
206
260
  sig do
207
261
  params(
208
262
  currency: Dodopayments::Currency::OrSymbol,
209
- discount: Integer,
210
263
  payment_frequency_count: Integer,
211
264
  payment_frequency_interval: Dodopayments::TimeInterval::OrSymbol,
212
265
  price: Integer,
213
266
  subscription_period_count: Integer,
214
267
  subscription_period_interval: Dodopayments::TimeInterval::OrSymbol,
268
+ discount: Integer,
269
+ discount_bps: T.nilable(Integer),
215
270
  purchasing_power_parity: T::Boolean,
216
271
  tax_inclusive: T.nilable(T::Boolean),
217
272
  trial_amount: T.nilable(Integer),
218
273
  trial_apply_discounts: T.nilable(T::Boolean),
274
+ trial_payment_method_optional: T::Boolean,
219
275
  trial_period_days: Integer,
276
+ zero_amount_payment_method_optional: T::Boolean,
220
277
  type: Symbol
221
278
  ).returns(T.attached_class)
222
279
  end
223
280
  def self.new(
224
281
  # The currency in which the payment is made.
225
282
  currency:,
226
- # Discount applied to the price, represented as a percentage (0 to 100).
227
- discount:,
228
283
  # Number of units for the payment frequency. For example, a value of `1` with a
229
284
  # `payment_frequency_interval` of `month` represents monthly payments.
230
285
  payment_frequency_count:,
@@ -238,6 +293,17 @@ module Dodopayments
238
293
  subscription_period_count:,
239
294
  # The time interval for the subscription period (e.g., day, month, year).
240
295
  subscription_period_interval:,
296
+ # Deprecated: use `discount_bps` instead.
297
+ #
298
+ # Discount applied to the price, represented as a percentage (0 to 100). A
299
+ # response rounds this value to the nearest whole percent. Defaults to `0`.
300
+ discount: nil,
301
+ # Discount applied to the price, in basis points. 100 basis points make one
302
+ # percent, so `1250` is a discount of 12.5%.
303
+ #
304
+ # Use this field for a discount with a fraction of a percent. A request that sends
305
+ # this field ignores `discount`. A value of `0` gives no discount.
306
+ discount_bps: nil,
241
307
  # Opts this price in to purchasing power parity. The business must also enable
242
308
  # purchasing power parity. The discount percentage per country is always
243
309
  # business-wide. Defaults to `false`.
@@ -250,8 +316,13 @@ module Dodopayments
250
316
  # Whether discount codes reduce the trial charge. Defaults to false. Only
251
317
  # meaningful when a paid trial is configured.
252
318
  trial_apply_discounts: nil,
319
+ # Let a customer start a free trial with no card. Defaults to false.
320
+ trial_payment_method_optional: nil,
253
321
  # Number of days for the trial period. A value of `0` indicates no trial period.
254
322
  trial_period_days: nil,
323
+ # Let a customer start a subscription with no card, when the amount due today is
324
+ # `0` (a native `0` price, or a 100% discount). Defaults to false.
325
+ zero_amount_payment_method_optional: nil,
255
326
  type: :recurring_price
256
327
  )
257
328
  end
@@ -260,7 +331,6 @@ module Dodopayments
260
331
  override.returns(
261
332
  {
262
333
  currency: Dodopayments::Currency::OrSymbol,
263
- discount: Integer,
264
334
  payment_frequency_count: Integer,
265
335
  payment_frequency_interval: Dodopayments::TimeInterval::OrSymbol,
266
336
  price: Integer,
@@ -268,11 +338,15 @@ module Dodopayments
268
338
  subscription_period_interval:
269
339
  Dodopayments::TimeInterval::OrSymbol,
270
340
  type: Symbol,
341
+ discount: Integer,
342
+ discount_bps: T.nilable(Integer),
271
343
  purchasing_power_parity: T::Boolean,
272
344
  tax_inclusive: T.nilable(T::Boolean),
273
345
  trial_amount: T.nilable(Integer),
274
346
  trial_apply_discounts: T.nilable(T::Boolean),
275
- trial_period_days: Integer
347
+ trial_payment_method_optional: T::Boolean,
348
+ trial_period_days: Integer,
349
+ zero_amount_payment_method_optional: T::Boolean
276
350
  }
277
351
  )
278
352
  end
@@ -293,10 +367,6 @@ module Dodopayments
293
367
  sig { returns(Dodopayments::Currency::OrSymbol) }
294
368
  attr_accessor :currency
295
369
 
296
- # Discount applied to the price, represented as a percentage (0 to 100).
297
- sig { returns(Integer) }
298
- attr_accessor :discount
299
-
300
370
  # The fixed payment amount. Represented in the lowest denomination of the currency
301
371
  # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
302
372
  sig { returns(Integer) }
@@ -323,6 +393,24 @@ module Dodopayments
323
393
  sig { returns(Symbol) }
324
394
  attr_accessor :type
325
395
 
396
+ # Deprecated: use `discount_bps` instead.
397
+ #
398
+ # Discount applied to the price, represented as a percentage (0 to 100). A
399
+ # response rounds this value to the nearest whole percent. Defaults to `0`.
400
+ sig { returns(T.nilable(Integer)) }
401
+ attr_reader :discount
402
+
403
+ sig { params(discount: Integer).void }
404
+ attr_writer :discount
405
+
406
+ # Discount applied to the price, in basis points. 100 basis points make one
407
+ # percent, so `1250` is a discount of 12.5%.
408
+ #
409
+ # Use this field for a discount with a fraction of a percent. A request that sends
410
+ # this field ignores `discount`. A value of `0` gives no discount.
411
+ sig { returns(T.nilable(Integer)) }
412
+ attr_accessor :discount_bps
413
+
326
414
  sig { returns(T.nilable(T::Array[Dodopayments::AddMeterToPrice])) }
327
415
  attr_accessor :meters
328
416
 
@@ -344,12 +432,13 @@ module Dodopayments
344
432
  sig do
345
433
  params(
346
434
  currency: Dodopayments::Currency::OrSymbol,
347
- discount: Integer,
348
435
  fixed_price: Integer,
349
436
  payment_frequency_count: Integer,
350
437
  payment_frequency_interval: Dodopayments::TimeInterval::OrSymbol,
351
438
  subscription_period_count: Integer,
352
439
  subscription_period_interval: Dodopayments::TimeInterval::OrSymbol,
440
+ discount: Integer,
441
+ discount_bps: T.nilable(Integer),
353
442
  meters: T.nilable(T::Array[Dodopayments::AddMeterToPrice::OrHash]),
354
443
  purchasing_power_parity: T::Boolean,
355
444
  tax_inclusive: T.nilable(T::Boolean),
@@ -359,8 +448,6 @@ module Dodopayments
359
448
  def self.new(
360
449
  # The currency in which the payment is made.
361
450
  currency:,
362
- # Discount applied to the price, represented as a percentage (0 to 100).
363
- discount:,
364
451
  # The fixed payment amount. Represented in the lowest denomination of the currency
365
452
  # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
366
453
  fixed_price:,
@@ -374,6 +461,17 @@ module Dodopayments
374
461
  subscription_period_count:,
375
462
  # The time interval for the subscription period (e.g., day, month, year).
376
463
  subscription_period_interval:,
464
+ # Deprecated: use `discount_bps` instead.
465
+ #
466
+ # Discount applied to the price, represented as a percentage (0 to 100). A
467
+ # response rounds this value to the nearest whole percent. Defaults to `0`.
468
+ discount: nil,
469
+ # Discount applied to the price, in basis points. 100 basis points make one
470
+ # percent, so `1250` is a discount of 12.5%.
471
+ #
472
+ # Use this field for a discount with a fraction of a percent. A request that sends
473
+ # this field ignores `discount`. A value of `0` gives no discount.
474
+ discount_bps: nil,
377
475
  meters: nil,
378
476
  # Opts this price in to purchasing power parity. The business must also enable
379
477
  # purchasing power parity. The discount percentage per country is always
@@ -390,7 +488,6 @@ module Dodopayments
390
488
  override.returns(
391
489
  {
392
490
  currency: Dodopayments::Currency::OrSymbol,
393
- discount: Integer,
394
491
  fixed_price: Integer,
395
492
  payment_frequency_count: Integer,
396
493
  payment_frequency_interval: Dodopayments::TimeInterval::OrSymbol,
@@ -398,6 +495,8 @@ module Dodopayments
398
495
  subscription_period_interval:
399
496
  Dodopayments::TimeInterval::OrSymbol,
400
497
  type: Symbol,
498
+ discount: Integer,
499
+ discount_bps: T.nilable(Integer),
401
500
  meters: T.nilable(T::Array[Dodopayments::AddMeterToPrice]),
402
501
  purchasing_power_parity: T::Boolean,
403
502
  tax_inclusive: T.nilable(T::Boolean)
@@ -48,6 +48,11 @@ module Dodopayments
48
48
  end
49
49
  attr_writer :customer
50
50
 
51
+ # Whether a payment method is on file. False while a card-optional subscription
52
+ # waits for the customer to add one.
53
+ sig { returns(T::Boolean) }
54
+ attr_accessor :has_payment_method
55
+
51
56
  # Additional custom data associated with the subscription
52
57
  sig { returns(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]) }
53
58
  attr_accessor :metadata
@@ -201,6 +206,7 @@ module Dodopayments
201
206
  T::Array[Dodopayments::CreditEntitlementCartResponse::OrHash],
202
207
  currency: Dodopayments::Currency::OrSymbol,
203
208
  customer: Dodopayments::CustomerLimitedDetails::OrHash,
209
+ has_payment_method: T::Boolean,
204
210
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
205
211
  meter_credit_entitlement_cart:
206
212
  T::Array[Dodopayments::MeterCreditEntitlementCartResponse::OrHash],
@@ -255,6 +261,9 @@ module Dodopayments
255
261
  currency:,
256
262
  # Customer details associated with the subscription
257
263
  customer:,
264
+ # Whether a payment method is on file. False while a card-optional subscription
265
+ # waits for the customer to add one.
266
+ has_payment_method:,
258
267
  # Additional custom data associated with the subscription
259
268
  metadata:,
260
269
  # Meter credit entitlement cart settings for this subscription
@@ -338,6 +347,7 @@ module Dodopayments
338
347
  T::Array[Dodopayments::CreditEntitlementCartResponse],
339
348
  currency: Dodopayments::Currency::TaggedSymbol,
340
349
  customer: Dodopayments::CustomerLimitedDetails,
350
+ has_payment_method: T::Boolean,
341
351
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
342
352
  meter_credit_entitlement_cart:
343
353
  T::Array[Dodopayments::MeterCreditEntitlementCartResponse],
@@ -32,6 +32,11 @@ module Dodopayments
32
32
  sig { returns(String) }
33
33
  attr_accessor :payment_id
34
34
 
35
+ # False when the customer can start this subscription with no card. True for every
36
+ # other subscription.
37
+ sig { returns(T::Boolean) }
38
+ attr_accessor :payment_method_required
39
+
35
40
  # Tax will be added to the amount and charged to the customer on each billing
36
41
  # cycle
37
42
  sig { returns(Integer) }
@@ -86,6 +91,7 @@ module Dodopayments
86
91
  customer: Dodopayments::CustomerLimitedDetails::OrHash,
87
92
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
88
93
  payment_id: String,
94
+ payment_method_required: T::Boolean,
89
95
  recurring_pre_tax_amount: Integer,
90
96
  subscription_id: String,
91
97
  client_secret: T.nilable(String),
@@ -111,6 +117,9 @@ module Dodopayments
111
117
  metadata:,
112
118
  # First payment id for the subscription
113
119
  payment_id:,
120
+ # False when the customer can start this subscription with no card. True for every
121
+ # other subscription.
122
+ payment_method_required:,
114
123
  # Tax will be added to the amount and charged to the customer on each billing
115
124
  # cycle
116
125
  recurring_pre_tax_amount:,
@@ -143,6 +152,7 @@ module Dodopayments
143
152
  customer: Dodopayments::CustomerLimitedDetails,
144
153
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
145
154
  payment_id: String,
155
+ payment_method_required: T::Boolean,
146
156
  recurring_pre_tax_amount: Integer,
147
157
  subscription_id: String,
148
158
  client_secret: T.nilable(String),
@@ -47,6 +47,11 @@ module Dodopayments
47
47
  end
48
48
  attr_accessor :discounts
49
49
 
50
+ # Whether a payment method is on file. False while a card-optional subscription
51
+ # waits for the customer to add one.
52
+ sig { returns(T::Boolean) }
53
+ attr_accessor :has_payment_method
54
+
50
55
  # Additional custom data associated with the subscription
51
56
  sig { returns(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]) }
52
57
  attr_accessor :metadata
@@ -172,6 +177,7 @@ module Dodopayments
172
177
  T::Array[
173
178
  Dodopayments::Models::SubscriptionListResponse::Discount::OrHash
174
179
  ],
180
+ has_payment_method: T::Boolean,
175
181
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
176
182
  next_billing_date: Time,
177
183
  on_demand: T::Boolean,
@@ -213,6 +219,9 @@ module Dodopayments
213
219
  customer:,
214
220
  # All stacked discounts applied, in order of application
215
221
  discounts:,
222
+ # Whether a payment method is on file. False while a card-optional subscription
223
+ # waits for the customer to add one.
224
+ has_payment_method:,
216
225
  # Additional custom data associated with the subscription
217
226
  metadata:,
218
227
  # Timestamp of the next scheduled billing. Indicates the end of current billing
@@ -284,6 +293,7 @@ module Dodopayments
284
293
  T::Array[
285
294
  Dodopayments::Models::SubscriptionListResponse::Discount
286
295
  ],
296
+ has_payment_method: T::Boolean,
287
297
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
288
298
  next_billing_date: Time,
289
299
  on_demand: T::Boolean,
@@ -104,6 +104,7 @@ module Dodopayments
104
104
  # - `reason` - Optional human-readable reason
105
105
  # - `expires_at` - Optional expiration for credited amount (only for credit type)
106
106
  # - `idempotency_key` - Optional key to prevent duplicate entries
107
+ # - `metadata` - Optional key-value pairs
107
108
  #
108
109
  # # Responses
109
110
  #
@@ -145,7 +146,7 @@ module Dodopayments
145
146
  # Body param: Idempotency key to prevent duplicate entries
146
147
  idempotency_key: nil,
147
148
  # Body param: Optional metadata (max 50 key-value pairs, key max 40 chars, value
148
- # max 500 chars)
149
+ # max 500 chars).
149
150
  metadata: nil,
150
151
  # Body param: Human-readable reason for the entry
151
152
  reason: nil,
@@ -0,0 +1,60 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Customers
6
+ class Emails
7
+ # Returns every transactional email sent to this customer in the last 180 days,
8
+ # newest first, with its delivery outcome. Delivery status comes from the email
9
+ # provider and is as fresh as replication, typically seconds.
10
+ sig do
11
+ params(
12
+ customer_id: String,
13
+ page_number: Integer,
14
+ page_size: Integer,
15
+ request_options: Dodopayments::RequestOptions::OrHash
16
+ ).returns(
17
+ Dodopayments::Internal::DefaultPageNumberPagination[
18
+ Dodopayments::Customers::EmailLogItem
19
+ ]
20
+ )
21
+ end
22
+ def list(
23
+ # The customer's id
24
+ customer_id,
25
+ # Which page to return. The default is 0.
26
+ page_number: nil,
27
+ # How many emails to return. The default is 10 and the maximum is 100.
28
+ page_size: nil,
29
+ request_options: {}
30
+ )
31
+ end
32
+
33
+ # Returns the email exactly as it was sent, plus the reason it failed when it did.
34
+ # Some emails have no body to show: an authentication email carries a live login
35
+ # token, a blocked email never reached the provider, and the provider clears
36
+ # bodies at 180 days.
37
+ sig do
38
+ params(
39
+ email_log_id: String,
40
+ customer_id: String,
41
+ request_options: Dodopayments::RequestOptions::OrHash
42
+ ).returns(Dodopayments::Customers::EmailBody)
43
+ end
44
+ def retrieve_body(
45
+ # The email log entry's id
46
+ email_log_id,
47
+ # The customer's id
48
+ customer_id:,
49
+ request_options: {}
50
+ )
51
+ end
52
+
53
+ # @api private
54
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
55
+ def self.new(client:)
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -9,6 +9,9 @@ module Dodopayments
9
9
  sig { returns(Dodopayments::Resources::Customers::Wallets) }
10
10
  attr_reader :wallets
11
11
 
12
+ sig { returns(Dodopayments::Resources::Customers::Emails) }
13
+ attr_reader :emails
14
+
12
15
  sig do
13
16
  params(
14
17
  email: String,
@@ -99,6 +99,8 @@ module Dodopayments
99
99
  | :dunning_fees
100
100
  | :payment_retry_fee
101
101
  | :byop_fee
102
+ | :ethoca_fees
103
+ | :ethoca_fees_reversal
102
104
 
103
105
  module EventType
104
106
  extend Dodopayments::Internal::Type::Enum
@@ -125,6 +127,8 @@ module Dodopayments
125
127
  DUNNING_FEES: :dunning_fees
126
128
  PAYMENT_RETRY_FEE: :payment_retry_fee
127
129
  BYOP_FEE: :byop_fee
130
+ ETHOCA_FEES: :ethoca_fees
131
+ ETHOCA_FEES_REVERSAL: :ethoca_fees_reversal
128
132
 
129
133
  def self?.values: -> ::Array[Dodopayments::Models::BalanceLedgerEntry::event_type]
130
134
  end
@@ -399,6 +399,8 @@ module Dodopayments
399
399
  | :dunning_fees
400
400
  | :payment_retry_fee
401
401
  | :byop_fee
402
+ | :ethoca_fees
403
+ | :ethoca_fees_reversal
402
404
 
403
405
  module EventType
404
406
  extend Dodopayments::Internal::Type::Enum
@@ -425,6 +427,8 @@ module Dodopayments
425
427
  DUNNING_FEES: :dunning_fees
426
428
  PAYMENT_RETRY_FEE: :payment_retry_fee
427
429
  BYOP_FEE: :byop_fee
430
+ ETHOCA_FEES: :ethoca_fees
431
+ ETHOCA_FEES_REVERSAL: :ethoca_fees_reversal
428
432
 
429
433
  def self?.values: -> ::Array[Dodopayments::Models::BalanceRetrieveLedgerParams::event_type]
430
434
  end
@@ -6,6 +6,7 @@ module Dodopayments
6
6
  currency: Dodopayments::Models::currency,
7
7
  current_breakup: Dodopayments::Models::CheckoutSessionPreviewResponse::CurrentBreakup,
8
8
  is_byop: bool,
9
+ payment_method_required: bool,
9
10
  product_cart: ::Array[Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart],
10
11
  total_price: Integer,
11
12
  next_billing_date: Time?,
@@ -27,6 +28,8 @@ module Dodopayments
27
28
 
28
29
  attr_accessor is_byop: bool
29
30
 
31
+ attr_accessor payment_method_required: bool
32
+
30
33
  attr_accessor product_cart: ::Array[Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart]
31
34
 
32
35
  attr_accessor total_price: Integer
@@ -52,6 +55,7 @@ module Dodopayments
52
55
  currency: Dodopayments::Models::currency,
53
56
  current_breakup: Dodopayments::Models::CheckoutSessionPreviewResponse::CurrentBreakup,
54
57
  is_byop: bool,
58
+ payment_method_required: bool,
55
59
  product_cart: ::Array[Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart],
56
60
  total_price: Integer,
57
61
  ?next_billing_date: Time?,
@@ -69,6 +73,7 @@ module Dodopayments
69
73
  currency: Dodopayments::Models::currency,
70
74
  current_breakup: Dodopayments::Models::CheckoutSessionPreviewResponse::CurrentBreakup,
71
75
  is_byop: bool,
76
+ payment_method_required: bool,
72
77
  product_cart: ::Array[Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart],
73
78
  total_price: Integer,
74
79
  next_billing_date: Time?,
@@ -12,6 +12,7 @@ module Dodopayments
12
12
  customer_id: String,
13
13
  entry_type: Dodopayments::Models::CreditEntitlements::ledger_entry_type,
14
14
  is_credit: bool,
15
+ metadata: Dodopayments::Models::metadata,
15
16
  overage_after: String,
16
17
  overage_before: String,
17
18
  grant_id: String?,
@@ -37,6 +38,8 @@ module Dodopayments
37
38
 
38
39
  attr_accessor is_credit: bool
39
40
 
41
+ attr_accessor metadata: Dodopayments::Models::metadata
42
+
40
43
  attr_accessor overage_after: String
41
44
 
42
45
  attr_accessor overage_before: String
@@ -55,6 +58,7 @@ module Dodopayments
55
58
  customer_id: String,
56
59
  entry_type: Dodopayments::Models::CreditEntitlements::ledger_entry_type,
57
60
  is_credit: bool,
61
+ metadata: Dodopayments::Models::metadata,
58
62
  overage_after: String,
59
63
  overage_before: String,
60
64
  ?grant_id: String?,
@@ -71,6 +75,7 @@ module Dodopayments
71
75
  customer_id: String,
72
76
  entry_type: Dodopayments::Models::CreditEntitlements::ledger_entry_type,
73
77
  is_credit: bool,
78
+ metadata: Dodopayments::Models::metadata,
74
79
  overage_after: String,
75
80
  overage_before: String,
76
81
  grant_id: String?,
@@ -0,0 +1,42 @@
1
+ module Dodopayments
2
+ module Models
3
+ module Customers
4
+ type email_body =
5
+ {
6
+ merchant_authored: bool,
7
+ failure_code: Dodopayments::Models::Customers::email_failure_code?,
8
+ failure_reason: String?,
9
+ html: String?,
10
+ text: String?
11
+ }
12
+
13
+ class EmailBody < Dodopayments::Internal::Type::BaseModel
14
+ attr_accessor merchant_authored: bool
15
+
16
+ attr_accessor failure_code: Dodopayments::Models::Customers::email_failure_code?
17
+
18
+ attr_accessor failure_reason: String?
19
+
20
+ attr_accessor html: String?
21
+
22
+ attr_accessor text: String?
23
+
24
+ def initialize: (
25
+ merchant_authored: bool,
26
+ ?failure_code: Dodopayments::Models::Customers::email_failure_code?,
27
+ ?failure_reason: String?,
28
+ ?html: String?,
29
+ ?text: String?
30
+ ) -> void
31
+
32
+ def to_hash: -> {
33
+ merchant_authored: bool,
34
+ failure_code: Dodopayments::Models::Customers::email_failure_code?,
35
+ failure_reason: String?,
36
+ html: String?,
37
+ text: String?
38
+ }
39
+ end
40
+ end
41
+ end
42
+ end