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
@@ -24,12 +24,6 @@ module Dodopayments
24
24
  # @return [Symbol, Dodopayments::Models::Currency]
25
25
  required :currency, enum: -> { Dodopayments::Currency }
26
26
 
27
- # @!attribute discount
28
- # Discount applied to the price, represented as a percentage (0 to 100).
29
- #
30
- # @return [Integer]
31
- required :discount, Integer
32
-
33
27
  # @!attribute price
34
28
  # The payment amount, in the smallest denomination of the currency (e.g., cents
35
29
  # for USD). For example, to charge $1.00, pass `100`.
@@ -45,6 +39,27 @@ module Dodopayments
45
39
  # @return [Symbol, :one_time_price]
46
40
  required :type, const: :one_time_price
47
41
 
42
+ # @!attribute discount
43
+ # @deprecated
44
+ #
45
+ # Deprecated: use `discount_bps` instead.
46
+ #
47
+ # Discount applied to the price, represented as a percentage (0 to 100). A
48
+ # response rounds this value to the nearest whole percent. Defaults to `0`.
49
+ #
50
+ # @return [Integer, nil]
51
+ optional :discount, Integer
52
+
53
+ # @!attribute discount_bps
54
+ # Discount applied to the price, in basis points. 100 basis points make one
55
+ # percent, so `1250` is a discount of 12.5%.
56
+ #
57
+ # Use this field for a discount with a fraction of a percent. A request that sends
58
+ # this field ignores `discount`. A value of `0` gives no discount.
59
+ #
60
+ # @return [Integer, nil]
61
+ optional :discount_bps, Integer, nil?: true
62
+
48
63
  # @!attribute pay_what_you_want
49
64
  # Indicates whether the customer can pay any amount they choose. If set to `true`,
50
65
  # the [`price`](Self::price) field is the minimum amount.
@@ -74,7 +89,7 @@ module Dodopayments
74
89
  # @return [Boolean, nil]
75
90
  optional :tax_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
76
91
 
77
- # @!method initialize(currency:, discount:, price:, pay_what_you_want: nil, purchasing_power_parity: nil, suggested_price: nil, tax_inclusive: nil, type: :one_time_price)
92
+ # @!method initialize(currency:, price:, discount: nil, discount_bps: nil, pay_what_you_want: nil, purchasing_power_parity: nil, suggested_price: nil, tax_inclusive: nil, type: :one_time_price)
78
93
  # Some parameter documentations has been truncated, see
79
94
  # {Dodopayments::Models::Price::OneTimePrice} for more details.
80
95
  #
@@ -82,10 +97,12 @@ module Dodopayments
82
97
  #
83
98
  # @param currency [Symbol, Dodopayments::Models::Currency] The currency in which the payment is made.
84
99
  #
85
- # @param discount [Integer] Discount applied to the price, represented as a percentage (0 to 100).
86
- #
87
100
  # @param price [Integer] The payment amount, in the smallest denomination of the currency (e.g., cents fo
88
101
  #
102
+ # @param discount [Integer] Deprecated: use `discount_bps` instead.
103
+ #
104
+ # @param discount_bps [Integer, nil] Discount applied to the price, in basis points. 100 basis points make
105
+ #
89
106
  # @param pay_what_you_want [Boolean] Indicates whether the customer can pay any amount they choose.
90
107
  #
91
108
  # @param purchasing_power_parity [Boolean] Opts this price in to purchasing power parity. The business must also
@@ -104,12 +121,6 @@ module Dodopayments
104
121
  # @return [Symbol, Dodopayments::Models::Currency]
105
122
  required :currency, enum: -> { Dodopayments::Currency }
106
123
 
107
- # @!attribute discount
108
- # Discount applied to the price, represented as a percentage (0 to 100).
109
- #
110
- # @return [Integer]
111
- required :discount, Integer
112
-
113
124
  # @!attribute payment_frequency_count
114
125
  # Number of units for the payment frequency. For example, a value of `1` with a
115
126
  # `payment_frequency_interval` of `month` represents monthly payments.
@@ -148,6 +159,27 @@ module Dodopayments
148
159
  # @return [Symbol, :recurring_price]
149
160
  required :type, const: :recurring_price
150
161
 
162
+ # @!attribute discount
163
+ # @deprecated
164
+ #
165
+ # Deprecated: use `discount_bps` instead.
166
+ #
167
+ # Discount applied to the price, represented as a percentage (0 to 100). A
168
+ # response rounds this value to the nearest whole percent. Defaults to `0`.
169
+ #
170
+ # @return [Integer, nil]
171
+ optional :discount, Integer
172
+
173
+ # @!attribute discount_bps
174
+ # Discount applied to the price, in basis points. 100 basis points make one
175
+ # percent, so `1250` is a discount of 12.5%.
176
+ #
177
+ # Use this field for a discount with a fraction of a percent. A request that sends
178
+ # this field ignores `discount`. A value of `0` gives no discount.
179
+ #
180
+ # @return [Integer, nil]
181
+ optional :discount_bps, Integer, nil?: true
182
+
151
183
  # @!attribute purchasing_power_parity
152
184
  # Opts this price in to purchasing power parity. The business must also enable
153
185
  # purchasing power parity. The discount percentage per country is always
@@ -176,13 +208,26 @@ module Dodopayments
176
208
  # @return [Boolean, nil]
177
209
  optional :trial_apply_discounts, Dodopayments::Internal::Type::Boolean, nil?: true
178
210
 
211
+ # @!attribute trial_payment_method_optional
212
+ # Let a customer start a free trial with no card. Defaults to false.
213
+ #
214
+ # @return [Boolean, nil]
215
+ optional :trial_payment_method_optional, Dodopayments::Internal::Type::Boolean
216
+
179
217
  # @!attribute trial_period_days
180
218
  # Number of days for the trial period. A value of `0` indicates no trial period.
181
219
  #
182
220
  # @return [Integer, nil]
183
221
  optional :trial_period_days, Integer
184
222
 
185
- # @!method initialize(currency:, discount:, payment_frequency_count:, payment_frequency_interval:, price:, subscription_period_count:, subscription_period_interval:, purchasing_power_parity: nil, tax_inclusive: nil, trial_amount: nil, trial_apply_discounts: nil, trial_period_days: nil, type: :recurring_price)
223
+ # @!attribute zero_amount_payment_method_optional
224
+ # Let a customer start a subscription with no card, when the amount due today is
225
+ # `0` (a native `0` price, or a 100% discount). Defaults to false.
226
+ #
227
+ # @return [Boolean, nil]
228
+ optional :zero_amount_payment_method_optional, Dodopayments::Internal::Type::Boolean
229
+
230
+ # @!method initialize(currency:, payment_frequency_count:, payment_frequency_interval:, price:, subscription_period_count:, subscription_period_interval:, discount: nil, discount_bps: nil, purchasing_power_parity: nil, tax_inclusive: nil, trial_amount: nil, trial_apply_discounts: nil, trial_payment_method_optional: nil, trial_period_days: nil, zero_amount_payment_method_optional: nil, type: :recurring_price)
186
231
  # Some parameter documentations has been truncated, see
187
232
  # {Dodopayments::Models::Price::RecurringPrice} for more details.
188
233
  #
@@ -190,8 +235,6 @@ module Dodopayments
190
235
  #
191
236
  # @param currency [Symbol, Dodopayments::Models::Currency] The currency in which the payment is made.
192
237
  #
193
- # @param discount [Integer] Discount applied to the price, represented as a percentage (0 to 100).
194
- #
195
238
  # @param payment_frequency_count [Integer] Number of units for the payment frequency.
196
239
  #
197
240
  # @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the payment frequency (e.g., day, month, year).
@@ -202,6 +245,10 @@ module Dodopayments
202
245
  #
203
246
  # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
204
247
  #
248
+ # @param discount [Integer] Deprecated: use `discount_bps` instead.
249
+ #
250
+ # @param discount_bps [Integer, nil] Discount applied to the price, in basis points. 100 basis points make
251
+ #
205
252
  # @param purchasing_power_parity [Boolean] Opts this price in to purchasing power parity. The business must also
206
253
  #
207
254
  # @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive
@@ -210,8 +257,12 @@ module Dodopayments
210
257
  #
211
258
  # @param trial_apply_discounts [Boolean, nil] Whether discount codes reduce the trial charge. Defaults to false. Only meaningf
212
259
  #
260
+ # @param trial_payment_method_optional [Boolean] Let a customer start a free trial with no card. Defaults to false.
261
+ #
213
262
  # @param trial_period_days [Integer] Number of days for the trial period. A value of `0` indicates no trial period.
214
263
  #
264
+ # @param zero_amount_payment_method_optional [Boolean] Let a customer start a subscription with no card, when the amount due
265
+ #
215
266
  # @param type [Symbol, :recurring_price]
216
267
  end
217
268
 
@@ -222,12 +273,6 @@ module Dodopayments
222
273
  # @return [Symbol, Dodopayments::Models::Currency]
223
274
  required :currency, enum: -> { Dodopayments::Currency }
224
275
 
225
- # @!attribute discount
226
- # Discount applied to the price, represented as a percentage (0 to 100).
227
- #
228
- # @return [Integer]
229
- required :discount, Integer
230
-
231
276
  # @!attribute fixed_price
232
277
  # The fixed payment amount. Represented in the lowest denomination of the currency
233
278
  # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
@@ -266,6 +311,27 @@ module Dodopayments
266
311
  # @return [Symbol, :usage_based_price]
267
312
  required :type, const: :usage_based_price
268
313
 
314
+ # @!attribute discount
315
+ # @deprecated
316
+ #
317
+ # Deprecated: use `discount_bps` instead.
318
+ #
319
+ # Discount applied to the price, represented as a percentage (0 to 100). A
320
+ # response rounds this value to the nearest whole percent. Defaults to `0`.
321
+ #
322
+ # @return [Integer, nil]
323
+ optional :discount, Integer
324
+
325
+ # @!attribute discount_bps
326
+ # Discount applied to the price, in basis points. 100 basis points make one
327
+ # percent, so `1250` is a discount of 12.5%.
328
+ #
329
+ # Use this field for a discount with a fraction of a percent. A request that sends
330
+ # this field ignores `discount`. A value of `0` gives no discount.
331
+ #
332
+ # @return [Integer, nil]
333
+ optional :discount_bps, Integer, nil?: true
334
+
269
335
  # @!attribute meters
270
336
  #
271
337
  # @return [Array<Dodopayments::Models::AddMeterToPrice>, nil]
@@ -290,7 +356,7 @@ module Dodopayments
290
356
  # @return [Boolean, nil]
291
357
  optional :tax_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
292
358
 
293
- # @!method initialize(currency:, discount:, fixed_price:, payment_frequency_count:, payment_frequency_interval:, subscription_period_count:, subscription_period_interval:, meters: nil, purchasing_power_parity: nil, tax_inclusive: nil, type: :usage_based_price)
359
+ # @!method initialize(currency:, fixed_price:, payment_frequency_count:, payment_frequency_interval:, subscription_period_count:, subscription_period_interval:, discount: nil, discount_bps: nil, meters: nil, purchasing_power_parity: nil, tax_inclusive: nil, type: :usage_based_price)
294
360
  # Some parameter documentations has been truncated, see
295
361
  # {Dodopayments::Models::Price::UsageBasedPrice} for more details.
296
362
  #
@@ -298,8 +364,6 @@ module Dodopayments
298
364
  #
299
365
  # @param currency [Symbol, Dodopayments::Models::Currency] The currency in which the payment is made.
300
366
  #
301
- # @param discount [Integer] Discount applied to the price, represented as a percentage (0 to 100).
302
- #
303
367
  # @param fixed_price [Integer] The fixed payment amount. Represented in the lowest denomination of the currency
304
368
  #
305
369
  # @param payment_frequency_count [Integer] Number of units for the payment frequency.
@@ -310,6 +374,10 @@ module Dodopayments
310
374
  #
311
375
  # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
312
376
  #
377
+ # @param discount [Integer] Deprecated: use `discount_bps` instead.
378
+ #
379
+ # @param discount_bps [Integer, nil] Discount applied to the price, in basis points. 100 basis points make
380
+ #
313
381
  # @param meters [Array<Dodopayments::Models::AddMeterToPrice>, nil]
314
382
  #
315
383
  # @param purchasing_power_parity [Boolean] Opts this price in to purchasing power parity. The business must also
@@ -53,6 +53,13 @@ module Dodopayments
53
53
  # @return [Dodopayments::Models::CustomerLimitedDetails]
54
54
  required :customer, -> { Dodopayments::CustomerLimitedDetails }
55
55
 
56
+ # @!attribute has_payment_method
57
+ # Whether a payment method is on file. False while a card-optional subscription
58
+ # waits for the customer to add one.
59
+ #
60
+ # @return [Boolean]
61
+ required :has_payment_method, Dodopayments::Internal::Type::Boolean
62
+
56
63
  # @!attribute metadata
57
64
  # Additional custom data associated with the subscription
58
65
  #
@@ -250,7 +257,7 @@ module Dodopayments
250
257
  # @return [Integer, nil]
251
258
  optional :trial_amount, Integer, nil?: true
252
259
 
253
- # @!method initialize(addons:, billing:, brand_id:, cancel_at_next_billing_date:, created_at:, credit_entitlement_cart:, currency:, customer:, metadata:, meter_credit_entitlement_cart:, meters:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancellation_comment: nil, cancellation_feedback: nil, cancelled_at: nil, custom_field_responses: nil, customer_business_name: nil, discount_cycles_remaining: nil, discount_id: nil, discounts: nil, expires_at: nil, paused_at: nil, payment_method_id: nil, scheduled_change: nil, tax_id: nil, trial_amount: nil)
260
+ # @!method initialize(addons:, billing:, brand_id:, cancel_at_next_billing_date:, created_at:, credit_entitlement_cart:, currency:, customer:, has_payment_method:, metadata:, meter_credit_entitlement_cart:, meters:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancellation_comment: nil, cancellation_feedback: nil, cancelled_at: nil, custom_field_responses: nil, customer_business_name: nil, discount_cycles_remaining: nil, discount_id: nil, discounts: nil, expires_at: nil, paused_at: nil, payment_method_id: nil, scheduled_change: nil, tax_id: nil, trial_amount: nil)
254
261
  # Some parameter documentations has been truncated, see
255
262
  # {Dodopayments::Models::Subscription} for more details.
256
263
  #
@@ -272,6 +279,8 @@ module Dodopayments
272
279
  #
273
280
  # @param customer [Dodopayments::Models::CustomerLimitedDetails] Customer details associated with the subscription
274
281
  #
282
+ # @param has_payment_method [Boolean] Whether a payment method is on file. False while a card-optional
283
+ #
275
284
  # @param metadata [Hash{Symbol=>String, Float, Boolean}] Additional custom data associated with the subscription
276
285
  #
277
286
  # @param meter_credit_entitlement_cart [Array<Dodopayments::Models::MeterCreditEntitlementCartResponse>] Meter credit entitlement cart settings for this subscription
@@ -28,6 +28,13 @@ module Dodopayments
28
28
  # @return [String]
29
29
  required :payment_id, String
30
30
 
31
+ # @!attribute payment_method_required
32
+ # False when the customer can start this subscription with no card. True for every
33
+ # other subscription.
34
+ #
35
+ # @return [Boolean]
36
+ required :payment_method_required, Dodopayments::Internal::Type::Boolean
37
+
31
38
  # @!attribute recurring_pre_tax_amount
32
39
  # Tax will be added to the amount and charged to the customer on each billing
33
40
  # cycle
@@ -90,7 +97,7 @@ module Dodopayments
90
97
  # @return [Integer, nil]
91
98
  optional :trial_amount, Integer, nil?: true
92
99
 
93
- # @!method initialize(addons:, customer:, metadata:, payment_id:, recurring_pre_tax_amount:, subscription_id:, client_secret: nil, discount_id: nil, discount_ids: nil, expires_on: nil, one_time_product_cart: nil, payment_link: nil, trial_amount: nil)
100
+ # @!method initialize(addons:, customer:, metadata:, payment_id:, payment_method_required:, recurring_pre_tax_amount:, subscription_id:, client_secret: nil, discount_id: nil, discount_ids: nil, expires_on: nil, one_time_product_cart: nil, payment_link: nil, trial_amount: nil)
94
101
  # Some parameter documentations has been truncated, see
95
102
  # {Dodopayments::Models::SubscriptionCreateResponse} for more details.
96
103
  #
@@ -102,6 +109,8 @@ module Dodopayments
102
109
  #
103
110
  # @param payment_id [String] First payment id for the subscription
104
111
  #
112
+ # @param payment_method_required [Boolean] False when the customer can start this subscription with no card.
113
+ #
105
114
  # @param recurring_pre_tax_amount [Integer] Tax will be added to the amount and charged to the customer on each billing cycl
106
115
  #
107
116
  # @param subscription_id [String] Unique identifier for the subscription
@@ -41,6 +41,13 @@ module Dodopayments
41
41
  required :discounts,
42
42
  -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Models::SubscriptionListResponse::Discount] }
43
43
 
44
+ # @!attribute has_payment_method
45
+ # Whether a payment method is on file. False while a card-optional subscription
46
+ # waits for the customer to add one.
47
+ #
48
+ # @return [Boolean]
49
+ required :has_payment_method, Dodopayments::Internal::Type::Boolean
50
+
44
51
  # @!attribute metadata
45
52
  # Additional custom data associated with the subscription
46
53
  #
@@ -197,7 +204,7 @@ module Dodopayments
197
204
  # @return [Integer, nil]
198
205
  optional :trial_amount, Integer, nil?: true
199
206
 
200
- # @!method initialize(billing:, cancel_at_next_billing_date:, created_at:, currency:, customer:, discounts:, metadata:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancelled_at: nil, customer_business_name: nil, discount_cycles_remaining: nil, discount_id: nil, paused_at: nil, payment_method_id: nil, product_name: nil, scheduled_change: nil, tax_id: nil, trial_amount: nil)
207
+ # @!method initialize(billing:, cancel_at_next_billing_date:, created_at:, currency:, customer:, discounts:, has_payment_method:, metadata:, next_billing_date:, on_demand:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancelled_at: nil, customer_business_name: nil, discount_cycles_remaining: nil, discount_id: nil, paused_at: nil, payment_method_id: nil, product_name: nil, scheduled_change: nil, tax_id: nil, trial_amount: nil)
201
208
  # Some parameter documentations has been truncated, see
202
209
  # {Dodopayments::Models::SubscriptionListResponse} for more details.
203
210
  #
@@ -215,6 +222,8 @@ module Dodopayments
215
222
  #
216
223
  # @param discounts [Array<Dodopayments::Models::SubscriptionListResponse::Discount>] All stacked discounts applied, in order of application
217
224
  #
225
+ # @param has_payment_method [Boolean] Whether a payment method is on file. False while a card-optional
226
+ #
218
227
  # @param metadata [Hash{Symbol=>String, Float, Boolean}] Additional custom data associated with the subscription
219
228
  #
220
229
  # @param next_billing_date [Time] Timestamp of the next scheduled billing. Indicates the end of current billing pe
@@ -121,6 +121,7 @@ module Dodopayments
121
121
  # - `reason` - Optional human-readable reason
122
122
  # - `expires_at` - Optional expiration for credited amount (only for credit type)
123
123
  # - `idempotency_key` - Optional key to prevent duplicate entries
124
+ # - `metadata` - Optional key-value pairs
124
125
  #
125
126
  # # Responses
126
127
  #
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
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
+ #
11
+ # @overload list(customer_id, page_number: nil, page_size: nil, request_options: {})
12
+ #
13
+ # @param customer_id [String] The customer's id
14
+ #
15
+ # @param page_number [Integer] Which page to return. The default is 0.
16
+ #
17
+ # @param page_size [Integer] How many emails to return. The default is 10 and the maximum is 100.
18
+ #
19
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
20
+ #
21
+ # @return [Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::Customers::EmailLogItem>]
22
+ #
23
+ # @see Dodopayments::Models::Customers::EmailListParams
24
+ def list(customer_id, params = {})
25
+ parsed, options = Dodopayments::Customers::EmailListParams.dump_request(params)
26
+ query = Dodopayments::Internal::Util.encode_query_params(parsed)
27
+ @client.request(
28
+ method: :get,
29
+ path: ["customers/%1$s/emails", customer_id],
30
+ query: query,
31
+ page: Dodopayments::Internal::DefaultPageNumberPagination,
32
+ model: Dodopayments::Customers::EmailLogItem,
33
+ options: options
34
+ )
35
+ end
36
+
37
+ # Returns the email exactly as it was sent, plus the reason it failed when it did.
38
+ # Some emails have no body to show: an authentication email carries a live login
39
+ # token, a blocked email never reached the provider, and the provider clears
40
+ # bodies at 180 days.
41
+ #
42
+ # @overload retrieve_body(email_log_id, customer_id:, request_options: {})
43
+ #
44
+ # @param email_log_id [String] The email log entry's id
45
+ #
46
+ # @param customer_id [String] The customer's id
47
+ #
48
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
49
+ #
50
+ # @return [Dodopayments::Models::Customers::EmailBody]
51
+ #
52
+ # @see Dodopayments::Models::Customers::EmailRetrieveBodyParams
53
+ def retrieve_body(email_log_id, params)
54
+ parsed, options = Dodopayments::Customers::EmailRetrieveBodyParams.dump_request(params)
55
+ customer_id =
56
+ parsed.delete(:customer_id) do
57
+ raise ArgumentError.new("missing required path argument #{_1}")
58
+ end
59
+ @client.request(
60
+ method: :get,
61
+ path: ["customers/%1$s/emails/%2$s/body", customer_id, email_log_id],
62
+ model: Dodopayments::Customers::EmailBody,
63
+ options: options
64
+ )
65
+ end
66
+
67
+ # @api private
68
+ #
69
+ # @param client [Dodopayments::Client]
70
+ def initialize(client:)
71
+ @client = client
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -9,6 +9,9 @@ module Dodopayments
9
9
  # @return [Dodopayments::Resources::Customers::Wallets]
10
10
  attr_reader :wallets
11
11
 
12
+ # @return [Dodopayments::Resources::Customers::Emails]
13
+ attr_reader :emails
14
+
12
15
  # @overload create(email:, name:, metadata: nil, phone_number: nil, request_options: {})
13
16
  #
14
17
  # @param email [String]
@@ -236,6 +239,7 @@ module Dodopayments
236
239
  @client = client
237
240
  @customer_portal = Dodopayments::Resources::Customers::CustomerPortal.new(client: client)
238
241
  @wallets = Dodopayments::Resources::Customers::Wallets.new(client: client)
242
+ @emails = Dodopayments::Resources::Customers::Emails.new(client: client)
239
243
  end
240
244
  end
241
245
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "2.27.0"
4
+ VERSION = "2.28.0"
5
5
  end
data/lib/dodopayments.rb CHANGED
@@ -167,6 +167,13 @@ require_relative "dodopayments/models/customer_retrieve_payment_methods_params"
167
167
  require_relative "dodopayments/models/customer_retrieve_payment_methods_response"
168
168
  require_relative "dodopayments/models/customers/customer_portal_create_params"
169
169
  require_relative "dodopayments/models/customers/customer_wallet"
170
+ require_relative "dodopayments/models/customers/email_body"
171
+ require_relative "dodopayments/models/customers/email_failure_code"
172
+ require_relative "dodopayments/models/customers/email_list_params"
173
+ require_relative "dodopayments/models/customers/email_log_item"
174
+ require_relative "dodopayments/models/customers/email_log_status"
175
+ require_relative "dodopayments/models/customers/email_policies"
176
+ require_relative "dodopayments/models/customers/email_retrieve_body_params"
170
177
  require_relative "dodopayments/models/customers/wallet_list_params"
171
178
  require_relative "dodopayments/models/customers/wallet_list_response"
172
179
  require_relative "dodopayments/models/customers/wallets/customer_wallet_transaction"
@@ -419,6 +426,7 @@ require_relative "dodopayments/resources/credit_entitlements"
419
426
  require_relative "dodopayments/resources/credit_entitlements/balances"
420
427
  require_relative "dodopayments/resources/customers"
421
428
  require_relative "dodopayments/resources/customers/customer_portal"
429
+ require_relative "dodopayments/resources/customers/emails"
422
430
  require_relative "dodopayments/resources/customers/wallets"
423
431
  require_relative "dodopayments/resources/customers/wallets/ledger_entries"
424
432
  require_relative "dodopayments/resources/discounts"
@@ -223,6 +223,16 @@ module Dodopayments
223
223
  :byop_fee,
224
224
  Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
225
225
  )
226
+ ETHOCA_FEES =
227
+ T.let(
228
+ :ethoca_fees,
229
+ Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
230
+ )
231
+ ETHOCA_FEES_REVERSAL =
232
+ T.let(
233
+ :ethoca_fees_reversal,
234
+ Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
235
+ )
226
236
 
227
237
  sig do
228
238
  override.returns(
@@ -1015,6 +1015,16 @@ module Dodopayments
1015
1015
  :byop_fee,
1016
1016
  Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
1017
1017
  )
1018
+ ETHOCA_FEES =
1019
+ T.let(
1020
+ :ethoca_fees,
1021
+ Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
1022
+ )
1023
+ ETHOCA_FEES_REVERSAL =
1024
+ T.let(
1025
+ :ethoca_fees_reversal,
1026
+ Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
1027
+ )
1018
1028
 
1019
1029
  sig do
1020
1030
  override.returns(
@@ -42,6 +42,11 @@ module Dodopayments
42
42
  sig { returns(T::Boolean) }
43
43
  attr_accessor :is_byop
44
44
 
45
+ # False when the customer can confirm this session with no card. True for every
46
+ # other cart, including a one-time cart.
47
+ sig { returns(T::Boolean) }
48
+ attr_accessor :payment_method_required
49
+
45
50
  # The total product cart
46
51
  sig do
47
52
  returns(
@@ -118,6 +123,7 @@ module Dodopayments
118
123
  current_breakup:
119
124
  Dodopayments::Models::CheckoutSessionPreviewResponse::CurrentBreakup::OrHash,
120
125
  is_byop: T::Boolean,
126
+ payment_method_required: T::Boolean,
121
127
  product_cart:
122
128
  T::Array[
123
129
  Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart::OrHash
@@ -148,6 +154,9 @@ module Dodopayments
148
154
  # country; in that case the quoted amounts exclude Dodo-computed tax because the
149
155
  # merchant is MoR and owns tax.
150
156
  is_byop:,
157
+ # False when the customer can confirm this session with no card. True for every
158
+ # other cart, including a one-time cart.
159
+ payment_method_required:,
151
160
  # The total product cart
152
161
  product_cart:,
153
162
  # Total calculate price of the product cart
@@ -185,6 +194,7 @@ module Dodopayments
185
194
  current_breakup:
186
195
  Dodopayments::Models::CheckoutSessionPreviewResponse::CurrentBreakup,
187
196
  is_byop: T::Boolean,
197
+ payment_method_required: T::Boolean,
188
198
  product_cart:
189
199
  T::Array[
190
200
  Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart
@@ -42,7 +42,7 @@ module Dodopayments
42
42
  attr_accessor :idempotency_key
43
43
 
44
44
  # Optional metadata (max 50 key-value pairs, key max 40 chars, value max 500
45
- # chars)
45
+ # chars).
46
46
  sig do
47
47
  returns(
48
48
  T.nilable(T::Hash[Symbol, Dodopayments::MetadataItem::Variants])
@@ -83,7 +83,7 @@ module Dodopayments
83
83
  # Idempotency key to prevent duplicate entries
84
84
  idempotency_key: nil,
85
85
  # Optional metadata (max 50 key-value pairs, key max 40 chars, value max 500
86
- # chars)
86
+ # chars).
87
87
  metadata: nil,
88
88
  # Human-readable reason for the entry
89
89
  reason: nil,
@@ -43,6 +43,10 @@ module Dodopayments
43
43
  sig { returns(T::Boolean) }
44
44
  attr_accessor :is_credit
45
45
 
46
+ # Metadata stored on this entry.
47
+ sig { returns(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]) }
48
+ attr_accessor :metadata
49
+
46
50
  sig { returns(String) }
47
51
  attr_accessor :overage_after
48
52
 
@@ -68,6 +72,7 @@ module Dodopayments
68
72
  entry_type:
69
73
  Dodopayments::CreditEntitlements::LedgerEntryType::OrSymbol,
70
74
  is_credit: T::Boolean,
75
+ metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
71
76
  overage_after: String,
72
77
  overage_before: String,
73
78
  grant_id: T.nilable(String),
@@ -84,6 +89,8 @@ module Dodopayments
84
89
  customer_id:,
85
90
  entry_type:,
86
91
  is_credit:,
92
+ # Metadata stored on this entry.
93
+ metadata:,
87
94
  overage_after:,
88
95
  overage_before:,
89
96
  grant_id: nil,
@@ -104,6 +111,7 @@ module Dodopayments
104
111
  entry_type:
105
112
  Dodopayments::CreditEntitlements::LedgerEntryType::TaggedSymbol,
106
113
  is_credit: T::Boolean,
114
+ metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
107
115
  overage_after: String,
108
116
  overage_before: String,
109
117
  grant_id: T.nilable(String),
@@ -43,9 +43,7 @@ module Dodopayments
43
43
  sig { returns(T::Boolean) }
44
44
  attr_accessor :is_credit
45
45
 
46
- # Metadata associated with the credit grant's source (the subscription or payment
47
- # created at checkout). Empty when the grant has no resolvable source (e.g.
48
- # credits granted directly via the API).
46
+ # Metadata associated with this entry.
49
47
  sig { returns(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]) }
50
48
  attr_accessor :metadata
51
49
 
@@ -110,9 +108,7 @@ module Dodopayments
110
108
  credit_entitlement_id:,
111
109
  customer_id:,
112
110
  is_credit:,
113
- # Metadata associated with the credit grant's source (the subscription or payment
114
- # created at checkout). Empty when the grant has no resolvable source (e.g.
115
- # credits granted directly via the API).
111
+ # Metadata associated with this entry.
116
112
  metadata:,
117
113
  overage_after:,
118
114
  overage_before:,