dodopayments 2.32.2 → 2.34.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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/internal/type/enum.rb +11 -11
  5. data/lib/dodopayments/models/balance_ledger_entry.rb +3 -0
  6. data/lib/dodopayments/models/balance_retrieve_ledger_params.rb +3 -0
  7. data/lib/dodopayments/models/charge_type.rb +33 -0
  8. data/lib/dodopayments/models/checkout_session_flags.rb +3 -0
  9. data/lib/dodopayments/models/checkout_session_preview_response.rb +12 -1
  10. data/lib/dodopayments/models/invoices/payment_retrieve_params.rb +14 -1
  11. data/lib/dodopayments/models/invoices/payment_retrieve_payout_params.rb +14 -1
  12. data/lib/dodopayments/models/invoices/payment_retrieve_refund_params.rb +14 -1
  13. data/lib/dodopayments/models/manual_retry_state.rb +27 -1
  14. data/lib/dodopayments/models/payment.rb +69 -7
  15. data/lib/dodopayments/models/payment_list_response.rb +94 -5
  16. data/lib/dodopayments/models/price.rb +56 -20
  17. data/lib/dodopayments/models/product_collection.rb +2 -0
  18. data/lib/dodopayments/models/product_collection_create_params.rb +2 -0
  19. data/lib/dodopayments/models/product_collection_update_params.rb +2 -0
  20. data/lib/dodopayments/models/product_collections/group_update_params.rb +2 -1
  21. data/lib/dodopayments/models/refund.rb +11 -1
  22. data/lib/dodopayments/models/refund_list_item.rb +11 -1
  23. data/lib/dodopayments/models/subscription_active_webhook_event.rb +10 -1
  24. data/lib/dodopayments/models/subscription_cancelled_webhook_event.rb +10 -1
  25. data/lib/dodopayments/models/subscription_expired_webhook_event.rb +10 -1
  26. data/lib/dodopayments/models/subscription_failed_webhook_event.rb +10 -1
  27. data/lib/dodopayments/models/subscription_on_hold_webhook_event.rb +10 -1
  28. data/lib/dodopayments/models/subscription_past_due_webhook_event.rb +10 -1
  29. data/lib/dodopayments/models/subscription_paused_webhook_event.rb +10 -1
  30. data/lib/dodopayments/models/subscription_plan_changed_webhook_event.rb +10 -1
  31. data/lib/dodopayments/models/subscription_renewed_webhook_event.rb +10 -1
  32. data/lib/dodopayments/models/subscription_service_period.rb +50 -0
  33. data/lib/dodopayments/models/subscription_unpaused_webhook_event.rb +10 -1
  34. data/lib/dodopayments/models/subscription_update_payment_method_webhook_event.rb +10 -1
  35. data/lib/dodopayments/models/subscription_updated_webhook_event.rb +10 -1
  36. data/lib/dodopayments/models/update_subscription_plan_req.rb +1 -0
  37. data/lib/dodopayments/models/webhook_payload.rb +10 -1
  38. data/lib/dodopayments/models.rb +4 -0
  39. data/lib/dodopayments/resources/invoices/payments.rb +30 -6
  40. data/lib/dodopayments/version.rb +1 -1
  41. data/lib/dodopayments.rb +2 -0
  42. data/rbi/dodopayments/models/balance_ledger_entry.rbi +15 -0
  43. data/rbi/dodopayments/models/balance_retrieve_ledger_params.rbi +15 -0
  44. data/rbi/dodopayments/models/charge_type.rbi +37 -0
  45. data/rbi/dodopayments/models/checkout_session_flags.rbi +6 -0
  46. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +14 -0
  47. data/rbi/dodopayments/models/invoices/payment_retrieve_params.rbi +17 -1
  48. data/rbi/dodopayments/models/invoices/payment_retrieve_payout_params.rbi +21 -2
  49. data/rbi/dodopayments/models/invoices/payment_retrieve_refund_params.rbi +21 -2
  50. data/rbi/dodopayments/models/manual_retry_state.rbi +28 -0
  51. data/rbi/dodopayments/models/payment.rbi +85 -6
  52. data/rbi/dodopayments/models/payment_list_response.rbi +113 -4
  53. data/rbi/dodopayments/models/price.rbi +96 -24
  54. data/rbi/dodopayments/models/product_collection.rbi +10 -0
  55. data/rbi/dodopayments/models/product_collection_create_params.rbi +10 -0
  56. data/rbi/dodopayments/models/product_collection_update_params.rbi +10 -0
  57. data/rbi/dodopayments/models/product_collections/group_update_params.rbi +4 -2
  58. data/rbi/dodopayments/models/refund.rbi +12 -0
  59. data/rbi/dodopayments/models/refund_list_item.rbi +12 -0
  60. data/rbi/dodopayments/models/subscription_active_webhook_event.rbi +18 -3
  61. data/rbi/dodopayments/models/subscription_cancelled_webhook_event.rbi +18 -3
  62. data/rbi/dodopayments/models/subscription_expired_webhook_event.rbi +18 -3
  63. data/rbi/dodopayments/models/subscription_failed_webhook_event.rbi +18 -3
  64. data/rbi/dodopayments/models/subscription_on_hold_webhook_event.rbi +18 -3
  65. data/rbi/dodopayments/models/subscription_past_due_webhook_event.rbi +18 -3
  66. data/rbi/dodopayments/models/subscription_paused_webhook_event.rbi +18 -3
  67. data/rbi/dodopayments/models/subscription_plan_changed_webhook_event.rbi +18 -3
  68. data/rbi/dodopayments/models/subscription_renewed_webhook_event.rbi +18 -3
  69. data/rbi/dodopayments/models/subscription_service_period.rbi +75 -0
  70. data/rbi/dodopayments/models/subscription_unpaused_webhook_event.rbi +18 -3
  71. data/rbi/dodopayments/models/subscription_update_payment_method_webhook_event.rbi +18 -3
  72. data/rbi/dodopayments/models/subscription_updated_webhook_event.rbi +18 -3
  73. data/rbi/dodopayments/models/update_subscription_plan_req.rbi +5 -0
  74. data/rbi/dodopayments/models/webhook_payload.rbi +14 -1
  75. data/rbi/dodopayments/models.rbi +4 -0
  76. data/rbi/dodopayments/resources/invoices/payments.rbi +12 -0
  77. data/rbi/dodopayments/resources/product_collections/groups.rbi +2 -1
  78. data/sig/dodopayments/models/balance_ledger_entry.rbs +6 -0
  79. data/sig/dodopayments/models/balance_retrieve_ledger_params.rbs +6 -0
  80. data/sig/dodopayments/models/charge_type.rbs +16 -0
  81. data/sig/dodopayments/models/checkout_session_preview_response.rbs +5 -0
  82. data/sig/dodopayments/models/invoices/payment_retrieve_params.rbs +7 -1
  83. data/sig/dodopayments/models/invoices/payment_retrieve_payout_params.rbs +8 -1
  84. data/sig/dodopayments/models/invoices/payment_retrieve_refund_params.rbs +8 -1
  85. data/sig/dodopayments/models/manual_retry_state.rbs +15 -0
  86. data/sig/dodopayments/models/payment.rbs +25 -0
  87. data/sig/dodopayments/models/payment_list_response.rbs +40 -0
  88. data/sig/dodopayments/models/product_collection.rbs +4 -0
  89. data/sig/dodopayments/models/product_collection_create_params.rbs +4 -0
  90. data/sig/dodopayments/models/product_collection_update_params.rbs +4 -0
  91. data/sig/dodopayments/models/refund.rbs +5 -0
  92. data/sig/dodopayments/models/refund_list_item.rbs +5 -0
  93. data/sig/dodopayments/models/subscription_active_webhook_event.rbs +7 -3
  94. data/sig/dodopayments/models/subscription_cancelled_webhook_event.rbs +7 -3
  95. data/sig/dodopayments/models/subscription_expired_webhook_event.rbs +7 -3
  96. data/sig/dodopayments/models/subscription_failed_webhook_event.rbs +7 -3
  97. data/sig/dodopayments/models/subscription_on_hold_webhook_event.rbs +7 -3
  98. data/sig/dodopayments/models/subscription_past_due_webhook_event.rbs +7 -3
  99. data/sig/dodopayments/models/subscription_paused_webhook_event.rbs +7 -3
  100. data/sig/dodopayments/models/subscription_plan_changed_webhook_event.rbs +7 -3
  101. data/sig/dodopayments/models/subscription_renewed_webhook_event.rbs +7 -3
  102. data/sig/dodopayments/models/subscription_service_period.rbs +35 -0
  103. data/sig/dodopayments/models/subscription_unpaused_webhook_event.rbs +7 -3
  104. data/sig/dodopayments/models/subscription_update_payment_method_webhook_event.rbs +7 -3
  105. data/sig/dodopayments/models/subscription_updated_webhook_event.rbs +7 -3
  106. data/sig/dodopayments/models/update_subscription_plan_req.rbs +2 -0
  107. data/sig/dodopayments/models/webhook_payload.rbs +12 -2
  108. data/sig/dodopayments/models.rbs +4 -0
  109. data/sig/dodopayments/resources/invoices/payments.rbs +3 -0
  110. metadata +8 -2
@@ -122,14 +122,16 @@ module Dodopayments
122
122
  required :currency, enum: -> { Dodopayments::Currency }
123
123
 
124
124
  # @!attribute payment_frequency_count
125
- # Number of units for the payment frequency. For example, a value of `1` with a
126
- # `payment_frequency_interval` of `month` represents monthly payments.
125
+ # Number of `payment_frequency_interval` units between two charges. This field
126
+ # sets the billing cycle. For example, `1` with a `payment_frequency_interval` of
127
+ # `month` charges the customer every month.
127
128
  #
128
129
  # @return [Integer]
129
130
  required :payment_frequency_count, Integer
130
131
 
131
132
  # @!attribute payment_frequency_interval
132
- # The time interval for the payment frequency (e.g., day, month, year).
133
+ # The time unit of the billing cycle (e.g., day, month, year). Use it with
134
+ # `payment_frequency_count`.
133
135
  #
134
136
  # @return [Symbol, Dodopayments::Models::TimeInterval]
135
137
  required :payment_frequency_interval, enum: -> { Dodopayments::TimeInterval }
@@ -142,14 +144,30 @@ module Dodopayments
142
144
  required :price, Integer
143
145
 
144
146
  # @!attribute subscription_period_count
145
- # Number of units for the subscription period. For example, a value of `12` with a
146
- # `subscription_period_interval` of `month` represents a one-year subscription.
147
+ # Number of `subscription_period_interval` units for the total duration of the
148
+ # subscription. This field does not set the billing cycle. Use
149
+ # `payment_frequency_count` for the billing cycle. When this period ends, the
150
+ # subscription expires. Dodo Payments does not start a new billing cycle after the
151
+ # subscription expires. Dodo Payments can still retry a failed payment for an
152
+ # earlier billing cycle.
153
+ #
154
+ # For a subscription that renews until the customer cancels it, set this to `20`
155
+ # with a `subscription_period_interval` of `year`. This is the recommended value
156
+ # and also the maximum. The subscription expires after 20 years if the customer
157
+ # does not cancel it before then.
158
+ #
159
+ # For example, a monthly plan uses a `payment_frequency_count` of `1`, a
160
+ # `payment_frequency_interval` of `month`, and a subscription period of `20`
161
+ # `year`. Do not set the subscription period to `1` `month` for a monthly plan:
162
+ # the subscription then expires after one month.
147
163
  #
148
164
  # @return [Integer]
149
165
  required :subscription_period_count, Integer
150
166
 
151
167
  # @!attribute subscription_period_interval
152
- # The time interval for the subscription period (e.g., day, month, year).
168
+ # The time unit of the total subscription duration (e.g., day, month, year). Use
169
+ # it with `subscription_period_count`. The recommended value is `year`, with a
170
+ # `subscription_period_count` of `20`.
153
171
  #
154
172
  # @return [Symbol, Dodopayments::Models::TimeInterval]
155
173
  required :subscription_period_interval, enum: -> { Dodopayments::TimeInterval }
@@ -235,15 +253,15 @@ module Dodopayments
235
253
  #
236
254
  # @param currency [Symbol, Dodopayments::Models::Currency] The currency in which the payment is made.
237
255
  #
238
- # @param payment_frequency_count [Integer] Number of units for the payment frequency.
256
+ # @param payment_frequency_count [Integer] Number of `payment_frequency_interval` units between two charges.
239
257
  #
240
- # @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the payment frequency (e.g., day, month, year).
258
+ # @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval] The time unit of the billing cycle (e.g., day, month, year).
241
259
  #
242
260
  # @param price [Integer] The payment amount. Represented in the lowest denomination of the currency (e.g.
243
261
  #
244
- # @param subscription_period_count [Integer] Number of units for the subscription period.
262
+ # @param subscription_period_count [Integer] Number of `subscription_period_interval` units for the total duration of the sub
245
263
  #
246
- # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
264
+ # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time unit of the total subscription duration (e.g., day, month, year).
247
265
  #
248
266
  # @param discount [Integer] Deprecated: use `discount_bps` instead.
249
267
  #
@@ -281,27 +299,45 @@ module Dodopayments
281
299
  required :fixed_price, Integer
282
300
 
283
301
  # @!attribute payment_frequency_count
284
- # Number of units for the payment frequency. For example, a value of `1` with a
285
- # `payment_frequency_interval` of `month` represents monthly payments.
302
+ # Number of `payment_frequency_interval` units between two charges. This field
303
+ # sets the billing cycle. For example, `1` with a `payment_frequency_interval` of
304
+ # `month` charges the customer every month.
286
305
  #
287
306
  # @return [Integer]
288
307
  required :payment_frequency_count, Integer
289
308
 
290
309
  # @!attribute payment_frequency_interval
291
- # The time interval for the payment frequency (e.g., day, month, year).
310
+ # The time unit of the billing cycle (e.g., day, month, year). Use it with
311
+ # `payment_frequency_count`.
292
312
  #
293
313
  # @return [Symbol, Dodopayments::Models::TimeInterval]
294
314
  required :payment_frequency_interval, enum: -> { Dodopayments::TimeInterval }
295
315
 
296
316
  # @!attribute subscription_period_count
297
- # Number of units for the subscription period. For example, a value of `12` with a
298
- # `subscription_period_interval` of `month` represents a one-year subscription.
317
+ # Number of `subscription_period_interval` units for the total duration of the
318
+ # subscription. This field does not set the billing cycle. Use
319
+ # `payment_frequency_count` for the billing cycle. When this period ends, the
320
+ # subscription expires. Dodo Payments does not start a new billing cycle after the
321
+ # subscription expires. Dodo Payments can still retry a failed payment for an
322
+ # earlier billing cycle.
323
+ #
324
+ # For a subscription that renews until the customer cancels it, set this to `20`
325
+ # with a `subscription_period_interval` of `year`. This is the recommended value
326
+ # and also the maximum. The subscription expires after 20 years if the customer
327
+ # does not cancel it before then.
328
+ #
329
+ # For example, a monthly plan uses a `payment_frequency_count` of `1`, a
330
+ # `payment_frequency_interval` of `month`, and a subscription period of `20`
331
+ # `year`. Do not set the subscription period to `1` `month` for a monthly plan:
332
+ # the subscription then expires after one month.
299
333
  #
300
334
  # @return [Integer]
301
335
  required :subscription_period_count, Integer
302
336
 
303
337
  # @!attribute subscription_period_interval
304
- # The time interval for the subscription period (e.g., day, month, year).
338
+ # The time unit of the total subscription duration (e.g., day, month, year). Use
339
+ # it with `subscription_period_count`. The recommended value is `year`, with a
340
+ # `subscription_period_count` of `20`.
305
341
  #
306
342
  # @return [Symbol, Dodopayments::Models::TimeInterval]
307
343
  required :subscription_period_interval, enum: -> { Dodopayments::TimeInterval }
@@ -366,13 +402,13 @@ module Dodopayments
366
402
  #
367
403
  # @param fixed_price [Integer] The fixed payment amount. Represented in the lowest denomination of the currency
368
404
  #
369
- # @param payment_frequency_count [Integer] Number of units for the payment frequency.
405
+ # @param payment_frequency_count [Integer] Number of `payment_frequency_interval` units between two charges.
370
406
  #
371
- # @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the payment frequency (e.g., day, month, year).
407
+ # @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval] The time unit of the billing cycle (e.g., day, month, year).
372
408
  #
373
- # @param subscription_period_count [Integer] Number of units for the subscription period.
409
+ # @param subscription_period_count [Integer] Number of `subscription_period_interval` units for the total duration of the sub
374
410
  #
375
- # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
411
+ # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time unit of the total subscription duration (e.g., day, month, year).
376
412
  #
377
413
  # @param discount [Integer] Deprecated: use `discount_bps` instead.
378
414
  #
@@ -179,6 +179,7 @@ module Dodopayments
179
179
  FULL_IMMEDIATELY = :full_immediately
180
180
  DIFFERENCE_IMMEDIATELY = :difference_immediately
181
181
  DO_NOT_BILL = :do_not_bill
182
+ PRORATED_IMMEDIATELY_KEEP_CYCLE = :prorated_immediately_keep_cycle
182
183
 
183
184
  # @!method self.values
184
185
  # @return [Array<Symbol>]
@@ -195,6 +196,7 @@ module Dodopayments
195
196
  FULL_IMMEDIATELY = :full_immediately
196
197
  DIFFERENCE_IMMEDIATELY = :difference_immediately
197
198
  DO_NOT_BILL = :do_not_bill
199
+ PRORATED_IMMEDIATELY_KEEP_CYCLE = :prorated_immediately_keep_cycle
198
200
 
199
201
  # @!method self.values
200
202
  # @return [Array<Symbol>]
@@ -146,6 +146,7 @@ module Dodopayments
146
146
  FULL_IMMEDIATELY = :full_immediately
147
147
  DIFFERENCE_IMMEDIATELY = :difference_immediately
148
148
  DO_NOT_BILL = :do_not_bill
149
+ PRORATED_IMMEDIATELY_KEEP_CYCLE = :prorated_immediately_keep_cycle
149
150
 
150
151
  # @!method self.values
151
152
  # @return [Array<Symbol>]
@@ -160,6 +161,7 @@ module Dodopayments
160
161
  FULL_IMMEDIATELY = :full_immediately
161
162
  DIFFERENCE_IMMEDIATELY = :difference_immediately
162
163
  DO_NOT_BILL = :do_not_bill
164
+ PRORATED_IMMEDIATELY_KEEP_CYCLE = :prorated_immediately_keep_cycle
163
165
 
164
166
  # @!method self.values
165
167
  # @return [Array<Symbol>]
@@ -160,6 +160,7 @@ module Dodopayments
160
160
  FULL_IMMEDIATELY = :full_immediately
161
161
  DIFFERENCE_IMMEDIATELY = :difference_immediately
162
162
  DO_NOT_BILL = :do_not_bill
163
+ PRORATED_IMMEDIATELY_KEEP_CYCLE = :prorated_immediately_keep_cycle
163
164
 
164
165
  # @!method self.values
165
166
  # @return [Array<Symbol>]
@@ -174,6 +175,7 @@ module Dodopayments
174
175
  FULL_IMMEDIATELY = :full_immediately
175
176
  DIFFERENCE_IMMEDIATELY = :difference_immediately
176
177
  DO_NOT_BILL = :do_not_bill
178
+ PRORATED_IMMEDIATELY_KEEP_CYCLE = :prorated_immediately_keep_cycle
177
179
 
178
180
  # @!method self.values
179
181
  # @return [Array<Symbol>]
@@ -20,7 +20,8 @@ module Dodopayments
20
20
 
21
21
  # @!attribute group_name
22
22
  # Optional group name update: Some(Some(name)) = set name, Some(None) = clear
23
- # name, None = no change
23
+ # name, None = no change The API returns 422 if another group in the collection
24
+ # has no name.
24
25
  #
25
26
  # @return [String, nil]
26
27
  optional :group_name, String, nil?: true
@@ -84,13 +84,21 @@ module Dodopayments
84
84
  # @return [Symbol, Dodopayments::Models::RefundNetworkReferenceType, nil]
85
85
  optional :network_reference_type, enum: -> { Dodopayments::RefundNetworkReferenceType }, nil?: true
86
86
 
87
+ # @!attribute network_reference_updated_at
88
+ # The time in UTC when `network_reference` became available. It is null when the
89
+ # reference is not available, or when it became available before this field
90
+ # existed.
91
+ #
92
+ # @return [Time, nil]
93
+ optional :network_reference_updated_at, Time, nil?: true
94
+
87
95
  # @!attribute reason
88
96
  # The reason provided for the refund, if any. Optional.
89
97
  #
90
98
  # @return [String, nil]
91
99
  optional :reason, String, nil?: true
92
100
 
93
- # @!method initialize(brand_id:, business_id:, created_at:, customer:, is_partial:, metadata:, payment_id:, refund_id:, status:, amount: nil, currency: nil, network_reference: nil, network_reference_type: nil, reason: nil)
101
+ # @!method initialize(brand_id:, business_id:, created_at:, customer:, is_partial:, metadata:, payment_id:, refund_id:, status:, amount: nil, currency: nil, network_reference: nil, network_reference_type: nil, network_reference_updated_at: nil, reason: nil)
94
102
  # Some parameter documentations has been truncated, see
95
103
  # {Dodopayments::Models::Refund} for more details.
96
104
  #
@@ -120,6 +128,8 @@ module Dodopayments
120
128
  #
121
129
  # @param network_reference_type [Symbol, Dodopayments::Models::RefundNetworkReferenceType, nil] The kind of `network_reference`: ARN, STAN or RRN.
122
130
  #
131
+ # @param network_reference_updated_at [Time, nil] The time in UTC when `network_reference` became available. It is null when the
132
+ #
123
133
  # @param reason [String, nil] The reason provided for the refund, if any. Optional.
124
134
  end
125
135
  end
@@ -65,13 +65,21 @@ module Dodopayments
65
65
  # @return [Symbol, Dodopayments::Models::RefundNetworkReferenceType, nil]
66
66
  optional :network_reference_type, enum: -> { Dodopayments::RefundNetworkReferenceType }, nil?: true
67
67
 
68
+ # @!attribute network_reference_updated_at
69
+ # The time in UTC when `network_reference` became available. It is null when the
70
+ # reference is not available, or when it became available before this field
71
+ # existed.
72
+ #
73
+ # @return [Time, nil]
74
+ optional :network_reference_updated_at, Time, nil?: true
75
+
68
76
  # @!attribute reason
69
77
  # The reason provided for the refund, if any. Optional.
70
78
  #
71
79
  # @return [String, nil]
72
80
  optional :reason, String, nil?: true
73
81
 
74
- # @!method initialize(business_id:, created_at:, is_partial:, payment_id:, refund_id:, status:, amount: nil, currency: nil, network_reference: nil, network_reference_type: nil, reason: nil)
82
+ # @!method initialize(business_id:, created_at:, is_partial:, payment_id:, refund_id:, status:, amount: nil, currency: nil, network_reference: nil, network_reference_type: nil, network_reference_updated_at: nil, reason: nil)
75
83
  # Some parameter documentations has been truncated, see
76
84
  # {Dodopayments::Models::RefundListItem} for more details.
77
85
  #
@@ -95,6 +103,8 @@ module Dodopayments
95
103
  #
96
104
  # @param network_reference_type [Symbol, Dodopayments::Models::RefundNetworkReferenceType, nil] The kind of `network_reference`: ARN, STAN or RRN.
97
105
  #
106
+ # @param network_reference_updated_at [Time, nil] The time in UTC when `network_reference` became available. It is null when the
107
+ #
98
108
  # @param reason [String, nil] The reason provided for the refund, if any. Optional.
99
109
  end
100
110
  end
@@ -54,7 +54,14 @@ module Dodopayments
54
54
  # @return [Time, nil]
55
55
  optional :past_due_ends_at, Time, nil?: true
56
56
 
57
- # @!method initialize(past_due_ends_at: nil)
57
+ # @!attribute payment_id
58
+ # Identifier of the payment that caused this event. It is set only for
59
+ # `subscription.renewed`. It is null for all other subscription events.
60
+ #
61
+ # @return [String, nil]
62
+ optional :payment_id, String, nil?: true
63
+
64
+ # @!method initialize(past_due_ends_at: nil, payment_id: nil)
58
65
  # Some parameter documentations has been truncated, see
59
66
  # {Dodopayments::Models::SubscriptionActiveWebhookEvent::Data} for more details.
60
67
  #
@@ -62,6 +69,8 @@ module Dodopayments
62
69
  # `SubscriptionResponse`, plus the grace-period deadline.
63
70
  #
64
71
  # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
72
+ #
73
+ # @param payment_id [String, nil] Identifier of the payment that caused this event.
65
74
  end
66
75
  end
67
76
  end
@@ -54,7 +54,14 @@ module Dodopayments
54
54
  # @return [Time, nil]
55
55
  optional :past_due_ends_at, Time, nil?: true
56
56
 
57
- # @!method initialize(past_due_ends_at: nil)
57
+ # @!attribute payment_id
58
+ # Identifier of the payment that caused this event. It is set only for
59
+ # `subscription.renewed`. It is null for all other subscription events.
60
+ #
61
+ # @return [String, nil]
62
+ optional :payment_id, String, nil?: true
63
+
64
+ # @!method initialize(past_due_ends_at: nil, payment_id: nil)
58
65
  # Some parameter documentations has been truncated, see
59
66
  # {Dodopayments::Models::SubscriptionCancelledWebhookEvent::Data} for more
60
67
  # details.
@@ -63,6 +70,8 @@ module Dodopayments
63
70
  # `SubscriptionResponse`, plus the grace-period deadline.
64
71
  #
65
72
  # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
73
+ #
74
+ # @param payment_id [String, nil] Identifier of the payment that caused this event.
66
75
  end
67
76
  end
68
77
  end
@@ -54,7 +54,14 @@ module Dodopayments
54
54
  # @return [Time, nil]
55
55
  optional :past_due_ends_at, Time, nil?: true
56
56
 
57
- # @!method initialize(past_due_ends_at: nil)
57
+ # @!attribute payment_id
58
+ # Identifier of the payment that caused this event. It is set only for
59
+ # `subscription.renewed`. It is null for all other subscription events.
60
+ #
61
+ # @return [String, nil]
62
+ optional :payment_id, String, nil?: true
63
+
64
+ # @!method initialize(past_due_ends_at: nil, payment_id: nil)
58
65
  # Some parameter documentations has been truncated, see
59
66
  # {Dodopayments::Models::SubscriptionExpiredWebhookEvent::Data} for more details.
60
67
  #
@@ -62,6 +69,8 @@ module Dodopayments
62
69
  # `SubscriptionResponse`, plus the grace-period deadline.
63
70
  #
64
71
  # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
72
+ #
73
+ # @param payment_id [String, nil] Identifier of the payment that caused this event.
65
74
  end
66
75
  end
67
76
  end
@@ -54,7 +54,14 @@ module Dodopayments
54
54
  # @return [Time, nil]
55
55
  optional :past_due_ends_at, Time, nil?: true
56
56
 
57
- # @!method initialize(past_due_ends_at: nil)
57
+ # @!attribute payment_id
58
+ # Identifier of the payment that caused this event. It is set only for
59
+ # `subscription.renewed`. It is null for all other subscription events.
60
+ #
61
+ # @return [String, nil]
62
+ optional :payment_id, String, nil?: true
63
+
64
+ # @!method initialize(past_due_ends_at: nil, payment_id: nil)
58
65
  # Some parameter documentations has been truncated, see
59
66
  # {Dodopayments::Models::SubscriptionFailedWebhookEvent::Data} for more details.
60
67
  #
@@ -62,6 +69,8 @@ module Dodopayments
62
69
  # `SubscriptionResponse`, plus the grace-period deadline.
63
70
  #
64
71
  # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
72
+ #
73
+ # @param payment_id [String, nil] Identifier of the payment that caused this event.
65
74
  end
66
75
  end
67
76
  end
@@ -54,7 +54,14 @@ module Dodopayments
54
54
  # @return [Time, nil]
55
55
  optional :past_due_ends_at, Time, nil?: true
56
56
 
57
- # @!method initialize(past_due_ends_at: nil)
57
+ # @!attribute payment_id
58
+ # Identifier of the payment that caused this event. It is set only for
59
+ # `subscription.renewed`. It is null for all other subscription events.
60
+ #
61
+ # @return [String, nil]
62
+ optional :payment_id, String, nil?: true
63
+
64
+ # @!method initialize(past_due_ends_at: nil, payment_id: nil)
58
65
  # Some parameter documentations has been truncated, see
59
66
  # {Dodopayments::Models::SubscriptionOnHoldWebhookEvent::Data} for more details.
60
67
  #
@@ -62,6 +69,8 @@ module Dodopayments
62
69
  # `SubscriptionResponse`, plus the grace-period deadline.
63
70
  #
64
71
  # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
72
+ #
73
+ # @param payment_id [String, nil] Identifier of the payment that caused this event.
65
74
  end
66
75
  end
67
76
  end
@@ -54,7 +54,14 @@ module Dodopayments
54
54
  # @return [Time, nil]
55
55
  optional :past_due_ends_at, Time, nil?: true
56
56
 
57
- # @!method initialize(past_due_ends_at: nil)
57
+ # @!attribute payment_id
58
+ # Identifier of the payment that caused this event. It is set only for
59
+ # `subscription.renewed`. It is null for all other subscription events.
60
+ #
61
+ # @return [String, nil]
62
+ optional :payment_id, String, nil?: true
63
+
64
+ # @!method initialize(past_due_ends_at: nil, payment_id: nil)
58
65
  # Some parameter documentations has been truncated, see
59
66
  # {Dodopayments::Models::SubscriptionPastDueWebhookEvent::Data} for more details.
60
67
  #
@@ -62,6 +69,8 @@ module Dodopayments
62
69
  # `SubscriptionResponse`, plus the grace-period deadline.
63
70
  #
64
71
  # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
72
+ #
73
+ # @param payment_id [String, nil] Identifier of the payment that caused this event.
65
74
  end
66
75
  end
67
76
  end
@@ -54,7 +54,14 @@ module Dodopayments
54
54
  # @return [Time, nil]
55
55
  optional :past_due_ends_at, Time, nil?: true
56
56
 
57
- # @!method initialize(past_due_ends_at: nil)
57
+ # @!attribute payment_id
58
+ # Identifier of the payment that caused this event. It is set only for
59
+ # `subscription.renewed`. It is null for all other subscription events.
60
+ #
61
+ # @return [String, nil]
62
+ optional :payment_id, String, nil?: true
63
+
64
+ # @!method initialize(past_due_ends_at: nil, payment_id: nil)
58
65
  # Some parameter documentations has been truncated, see
59
66
  # {Dodopayments::Models::SubscriptionPausedWebhookEvent::Data} for more details.
60
67
  #
@@ -62,6 +69,8 @@ module Dodopayments
62
69
  # `SubscriptionResponse`, plus the grace-period deadline.
63
70
  #
64
71
  # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
72
+ #
73
+ # @param payment_id [String, nil] Identifier of the payment that caused this event.
65
74
  end
66
75
  end
67
76
  end
@@ -54,7 +54,14 @@ module Dodopayments
54
54
  # @return [Time, nil]
55
55
  optional :past_due_ends_at, Time, nil?: true
56
56
 
57
- # @!method initialize(past_due_ends_at: nil)
57
+ # @!attribute payment_id
58
+ # Identifier of the payment that caused this event. It is set only for
59
+ # `subscription.renewed`. It is null for all other subscription events.
60
+ #
61
+ # @return [String, nil]
62
+ optional :payment_id, String, nil?: true
63
+
64
+ # @!method initialize(past_due_ends_at: nil, payment_id: nil)
58
65
  # Some parameter documentations has been truncated, see
59
66
  # {Dodopayments::Models::SubscriptionPlanChangedWebhookEvent::Data} for more
60
67
  # details.
@@ -63,6 +70,8 @@ module Dodopayments
63
70
  # `SubscriptionResponse`, plus the grace-period deadline.
64
71
  #
65
72
  # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
73
+ #
74
+ # @param payment_id [String, nil] Identifier of the payment that caused this event.
66
75
  end
67
76
  end
68
77
  end
@@ -54,7 +54,14 @@ module Dodopayments
54
54
  # @return [Time, nil]
55
55
  optional :past_due_ends_at, Time, nil?: true
56
56
 
57
- # @!method initialize(past_due_ends_at: nil)
57
+ # @!attribute payment_id
58
+ # Identifier of the payment that caused this event. It is set only for
59
+ # `subscription.renewed`. It is null for all other subscription events.
60
+ #
61
+ # @return [String, nil]
62
+ optional :payment_id, String, nil?: true
63
+
64
+ # @!method initialize(past_due_ends_at: nil, payment_id: nil)
58
65
  # Some parameter documentations has been truncated, see
59
66
  # {Dodopayments::Models::SubscriptionRenewedWebhookEvent::Data} for more details.
60
67
  #
@@ -62,6 +69,8 @@ module Dodopayments
62
69
  # `SubscriptionResponse`, plus the grace-period deadline.
63
70
  #
64
71
  # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
72
+ #
73
+ # @param payment_id [String, nil] Identifier of the payment that caused this event.
65
74
  end
66
75
  end
67
76
  end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class SubscriptionServicePeriod < Dodopayments::Internal::Type::BaseModel
6
+ # @!attribute ends_at
7
+ # End of the service period.
8
+ #
9
+ # @return [Time]
10
+ required :ends_at, Time
11
+
12
+ # @!attribute proration_factor
13
+ # The part of one full billing period that the plan charge pays for. The value
14
+ # `"1"` is a full period. A value less than 1 is a partial period, for example
15
+ # after a plan change that keeps the billing cycle. For a plan change, this is the
16
+ # value of the new plan. The credit for the old plan is not in this value.
17
+ #
18
+ # @return [String]
19
+ required :proration_factor, String
20
+
21
+ # @!attribute starts_at
22
+ # Start of the service period. For a renewal, this is the billing date. For a plan
23
+ # change that applies at the next billing date, this is the time when the change
24
+ # applied. This time can be some minutes after the billing date.
25
+ #
26
+ # @return [Time]
27
+ required :starts_at, Time
28
+
29
+ # @!attribute subscription_id
30
+ # Identifier of the subscription.
31
+ #
32
+ # @return [String]
33
+ required :subscription_id, String
34
+
35
+ # @!method initialize(ends_at:, proration_factor:, starts_at:, subscription_id:)
36
+ # Some parameter documentations has been truncated, see
37
+ # {Dodopayments::Models::SubscriptionServicePeriod} for more details.
38
+ #
39
+ # The service period that a payment pays for, for one subscription.
40
+ #
41
+ # @param ends_at [Time] End of the service period.
42
+ #
43
+ # @param proration_factor [String] The part of one full billing period that the plan charge pays for. The value
44
+ #
45
+ # @param starts_at [Time] Start of the service period. For a renewal, this is the billing date. For a
46
+ #
47
+ # @param subscription_id [String] Identifier of the subscription.
48
+ end
49
+ end
50
+ end
@@ -54,7 +54,14 @@ module Dodopayments
54
54
  # @return [Time, nil]
55
55
  optional :past_due_ends_at, Time, nil?: true
56
56
 
57
- # @!method initialize(past_due_ends_at: nil)
57
+ # @!attribute payment_id
58
+ # Identifier of the payment that caused this event. It is set only for
59
+ # `subscription.renewed`. It is null for all other subscription events.
60
+ #
61
+ # @return [String, nil]
62
+ optional :payment_id, String, nil?: true
63
+
64
+ # @!method initialize(past_due_ends_at: nil, payment_id: nil)
58
65
  # Some parameter documentations has been truncated, see
59
66
  # {Dodopayments::Models::SubscriptionUnpausedWebhookEvent::Data} for more details.
60
67
  #
@@ -62,6 +69,8 @@ module Dodopayments
62
69
  # `SubscriptionResponse`, plus the grace-period deadline.
63
70
  #
64
71
  # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
72
+ #
73
+ # @param payment_id [String, nil] Identifier of the payment that caused this event.
65
74
  end
66
75
  end
67
76
  end
@@ -55,7 +55,14 @@ module Dodopayments
55
55
  # @return [Time, nil]
56
56
  optional :past_due_ends_at, Time, nil?: true
57
57
 
58
- # @!method initialize(past_due_ends_at: nil)
58
+ # @!attribute payment_id
59
+ # Identifier of the payment that caused this event. It is set only for
60
+ # `subscription.renewed`. It is null for all other subscription events.
61
+ #
62
+ # @return [String, nil]
63
+ optional :payment_id, String, nil?: true
64
+
65
+ # @!method initialize(past_due_ends_at: nil, payment_id: nil)
59
66
  # Some parameter documentations has been truncated, see
60
67
  # {Dodopayments::Models::SubscriptionUpdatePaymentMethodWebhookEvent::Data} for
61
68
  # more details.
@@ -64,6 +71,8 @@ module Dodopayments
64
71
  # `SubscriptionResponse`, plus the grace-period deadline.
65
72
  #
66
73
  # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
74
+ #
75
+ # @param payment_id [String, nil] Identifier of the payment that caused this event.
67
76
  end
68
77
  end
69
78
  end
@@ -54,7 +54,14 @@ module Dodopayments
54
54
  # @return [Time, nil]
55
55
  optional :past_due_ends_at, Time, nil?: true
56
56
 
57
- # @!method initialize(past_due_ends_at: nil)
57
+ # @!attribute payment_id
58
+ # Identifier of the payment that caused this event. It is set only for
59
+ # `subscription.renewed`. It is null for all other subscription events.
60
+ #
61
+ # @return [String, nil]
62
+ optional :payment_id, String, nil?: true
63
+
64
+ # @!method initialize(past_due_ends_at: nil, payment_id: nil)
58
65
  # Some parameter documentations has been truncated, see
59
66
  # {Dodopayments::Models::SubscriptionUpdatedWebhookEvent::Data} for more details.
60
67
  #
@@ -62,6 +69,8 @@ module Dodopayments
62
69
  # `SubscriptionResponse`, plus the grace-period deadline.
63
70
  #
64
71
  # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
72
+ #
73
+ # @param payment_id [String, nil] Identifier of the payment that caused this event.
65
74
  end
66
75
  end
67
76
  end
@@ -190,6 +190,7 @@ module Dodopayments
190
190
  FULL_IMMEDIATELY = :full_immediately
191
191
  DIFFERENCE_IMMEDIATELY = :difference_immediately
192
192
  DO_NOT_BILL = :do_not_bill
193
+ PRORATED_IMMEDIATELY_KEEP_CYCLE = :prorated_immediately_keep_cycle
193
194
 
194
195
  # @!method self.values
195
196
  # @return [Array<Symbol>]