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
@@ -332,6 +332,11 @@ module Dodopayments
332
332
  :do_not_bill,
333
333
  Dodopayments::ProductCollectionUpdateParams::ProrationBillingModeOnDowngrade::TaggedSymbol
334
334
  )
335
+ PRORATED_IMMEDIATELY_KEEP_CYCLE =
336
+ T.let(
337
+ :prorated_immediately_keep_cycle,
338
+ Dodopayments::ProductCollectionUpdateParams::ProrationBillingModeOnDowngrade::TaggedSymbol
339
+ )
335
340
 
336
341
  sig do
337
342
  override.returns(
@@ -378,6 +383,11 @@ module Dodopayments
378
383
  :do_not_bill,
379
384
  Dodopayments::ProductCollectionUpdateParams::ProrationBillingModeOnUpgrade::TaggedSymbol
380
385
  )
386
+ PRORATED_IMMEDIATELY_KEEP_CYCLE =
387
+ T.let(
388
+ :prorated_immediately_keep_cycle,
389
+ Dodopayments::ProductCollectionUpdateParams::ProrationBillingModeOnUpgrade::TaggedSymbol
390
+ )
381
391
 
382
392
  sig do
383
393
  override.returns(
@@ -22,7 +22,8 @@ module Dodopayments
22
22
  attr_accessor :group_id
23
23
 
24
24
  # Optional group name update: Some(Some(name)) = set name, Some(None) = clear
25
- # name, None = no change
25
+ # name, None = no change The API returns 422 if another group in the collection
26
+ # has no name.
26
27
  sig { returns(T.nilable(String)) }
27
28
  attr_accessor :group_name
28
29
 
@@ -49,7 +50,8 @@ module Dodopayments
49
50
  id:,
50
51
  group_id:,
51
52
  # Optional group name update: Some(Some(name)) = set name, Some(None) = clear
52
- # name, None = no change
53
+ # name, None = no change The API returns 422 if another group in the collection
54
+ # has no name.
53
55
  group_name: nil,
54
56
  # Optional new order for products in this group (array of
55
57
  # product_collection_group_pdts UUIDs)
@@ -71,6 +71,12 @@ module Dodopayments
71
71
  end
72
72
  attr_accessor :network_reference_type
73
73
 
74
+ # The time in UTC when `network_reference` became available. It is null when the
75
+ # reference is not available, or when it became available before this field
76
+ # existed.
77
+ sig { returns(T.nilable(Time)) }
78
+ attr_accessor :network_reference_updated_at
79
+
74
80
  # The reason provided for the refund, if any. Optional.
75
81
  sig { returns(T.nilable(String)) }
76
82
  attr_accessor :reason
@@ -91,6 +97,7 @@ module Dodopayments
91
97
  network_reference: T.nilable(String),
92
98
  network_reference_type:
93
99
  T.nilable(Dodopayments::RefundNetworkReferenceType::OrSymbol),
100
+ network_reference_updated_at: T.nilable(Time),
94
101
  reason: T.nilable(String)
95
102
  ).returns(T.attached_class)
96
103
  end
@@ -123,6 +130,10 @@ module Dodopayments
123
130
  network_reference: nil,
124
131
  # The kind of `network_reference`: ARN, STAN or RRN.
125
132
  network_reference_type: nil,
133
+ # The time in UTC when `network_reference` became available. It is null when the
134
+ # reference is not available, or when it became available before this field
135
+ # existed.
136
+ network_reference_updated_at: nil,
126
137
  # The reason provided for the refund, if any. Optional.
127
138
  reason: nil
128
139
  )
@@ -145,6 +156,7 @@ module Dodopayments
145
156
  network_reference: T.nilable(String),
146
157
  network_reference_type:
147
158
  T.nilable(Dodopayments::RefundNetworkReferenceType::TaggedSymbol),
159
+ network_reference_updated_at: T.nilable(Time),
148
160
  reason: T.nilable(String)
149
161
  }
150
162
  )
@@ -54,6 +54,12 @@ module Dodopayments
54
54
  end
55
55
  attr_accessor :network_reference_type
56
56
 
57
+ # The time in UTC when `network_reference` became available. It is null when the
58
+ # reference is not available, or when it became available before this field
59
+ # existed.
60
+ sig { returns(T.nilable(Time)) }
61
+ attr_accessor :network_reference_updated_at
62
+
57
63
  # The reason provided for the refund, if any. Optional.
58
64
  sig { returns(T.nilable(String)) }
59
65
  attr_accessor :reason
@@ -71,6 +77,7 @@ module Dodopayments
71
77
  network_reference: T.nilable(String),
72
78
  network_reference_type:
73
79
  T.nilable(Dodopayments::RefundNetworkReferenceType::OrSymbol),
80
+ network_reference_updated_at: T.nilable(Time),
74
81
  reason: T.nilable(String)
75
82
  ).returns(T.attached_class)
76
83
  end
@@ -97,6 +104,10 @@ module Dodopayments
97
104
  network_reference: nil,
98
105
  # The kind of `network_reference`: ARN, STAN or RRN.
99
106
  network_reference_type: nil,
107
+ # The time in UTC when `network_reference` became available. It is null when the
108
+ # reference is not available, or when it became available before this field
109
+ # existed.
110
+ network_reference_updated_at: nil,
100
111
  # The reason provided for the refund, if any. Optional.
101
112
  reason: nil
102
113
  )
@@ -116,6 +127,7 @@ module Dodopayments
116
127
  network_reference: T.nilable(String),
117
128
  network_reference_type:
118
129
  T.nilable(Dodopayments::RefundNetworkReferenceType::TaggedSymbol),
130
+ network_reference_updated_at: T.nilable(Time),
119
131
  reason: T.nilable(String)
120
132
  }
121
133
  )
@@ -88,10 +88,18 @@ module Dodopayments
88
88
  sig { returns(T.nilable(Time)) }
89
89
  attr_accessor :past_due_ends_at
90
90
 
91
+ # Identifier of the payment that caused this event. It is set only for
92
+ # `subscription.renewed`. It is null for all other subscription events.
93
+ sig { returns(T.nilable(String)) }
94
+ attr_accessor :payment_id
95
+
91
96
  # Subscription payload sent on a webhook. It carries every field of
92
97
  # `SubscriptionResponse`, plus the grace-period deadline.
93
98
  sig do
94
- params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
99
+ params(
100
+ past_due_ends_at: T.nilable(Time),
101
+ payment_id: T.nilable(String)
102
+ ).returns(T.attached_class)
95
103
  end
96
104
  def self.new(
97
105
  # Time when the grace period ends. The subscription moves to `on_hold` or to
@@ -101,11 +109,18 @@ module Dodopayments
101
109
  # row snapshot that produced `status`. It is set whenever the subscription sits in
102
110
  # a window at that moment. A delayed event of another type therefore carries the
103
111
  # deadline too, next to a `past_due` status.
104
- past_due_ends_at: nil
112
+ past_due_ends_at: nil,
113
+ # Identifier of the payment that caused this event. It is set only for
114
+ # `subscription.renewed`. It is null for all other subscription events.
115
+ payment_id: nil
105
116
  )
106
117
  end
107
118
 
108
- sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
119
+ sig do
120
+ override.returns(
121
+ { past_due_ends_at: T.nilable(Time), payment_id: T.nilable(String) }
122
+ )
123
+ end
109
124
  def to_hash
110
125
  end
111
126
  end
@@ -88,10 +88,18 @@ module Dodopayments
88
88
  sig { returns(T.nilable(Time)) }
89
89
  attr_accessor :past_due_ends_at
90
90
 
91
+ # Identifier of the payment that caused this event. It is set only for
92
+ # `subscription.renewed`. It is null for all other subscription events.
93
+ sig { returns(T.nilable(String)) }
94
+ attr_accessor :payment_id
95
+
91
96
  # Subscription payload sent on a webhook. It carries every field of
92
97
  # `SubscriptionResponse`, plus the grace-period deadline.
93
98
  sig do
94
- params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
99
+ params(
100
+ past_due_ends_at: T.nilable(Time),
101
+ payment_id: T.nilable(String)
102
+ ).returns(T.attached_class)
95
103
  end
96
104
  def self.new(
97
105
  # Time when the grace period ends. The subscription moves to `on_hold` or to
@@ -101,11 +109,18 @@ module Dodopayments
101
109
  # row snapshot that produced `status`. It is set whenever the subscription sits in
102
110
  # a window at that moment. A delayed event of another type therefore carries the
103
111
  # deadline too, next to a `past_due` status.
104
- past_due_ends_at: nil
112
+ past_due_ends_at: nil,
113
+ # Identifier of the payment that caused this event. It is set only for
114
+ # `subscription.renewed`. It is null for all other subscription events.
115
+ payment_id: nil
105
116
  )
106
117
  end
107
118
 
108
- sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
119
+ sig do
120
+ override.returns(
121
+ { past_due_ends_at: T.nilable(Time), payment_id: T.nilable(String) }
122
+ )
123
+ end
109
124
  def to_hash
110
125
  end
111
126
  end
@@ -88,10 +88,18 @@ module Dodopayments
88
88
  sig { returns(T.nilable(Time)) }
89
89
  attr_accessor :past_due_ends_at
90
90
 
91
+ # Identifier of the payment that caused this event. It is set only for
92
+ # `subscription.renewed`. It is null for all other subscription events.
93
+ sig { returns(T.nilable(String)) }
94
+ attr_accessor :payment_id
95
+
91
96
  # Subscription payload sent on a webhook. It carries every field of
92
97
  # `SubscriptionResponse`, plus the grace-period deadline.
93
98
  sig do
94
- params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
99
+ params(
100
+ past_due_ends_at: T.nilable(Time),
101
+ payment_id: T.nilable(String)
102
+ ).returns(T.attached_class)
95
103
  end
96
104
  def self.new(
97
105
  # Time when the grace period ends. The subscription moves to `on_hold` or to
@@ -101,11 +109,18 @@ module Dodopayments
101
109
  # row snapshot that produced `status`. It is set whenever the subscription sits in
102
110
  # a window at that moment. A delayed event of another type therefore carries the
103
111
  # deadline too, next to a `past_due` status.
104
- past_due_ends_at: nil
112
+ past_due_ends_at: nil,
113
+ # Identifier of the payment that caused this event. It is set only for
114
+ # `subscription.renewed`. It is null for all other subscription events.
115
+ payment_id: nil
105
116
  )
106
117
  end
107
118
 
108
- sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
119
+ sig do
120
+ override.returns(
121
+ { past_due_ends_at: T.nilable(Time), payment_id: T.nilable(String) }
122
+ )
123
+ end
109
124
  def to_hash
110
125
  end
111
126
  end
@@ -88,10 +88,18 @@ module Dodopayments
88
88
  sig { returns(T.nilable(Time)) }
89
89
  attr_accessor :past_due_ends_at
90
90
 
91
+ # Identifier of the payment that caused this event. It is set only for
92
+ # `subscription.renewed`. It is null for all other subscription events.
93
+ sig { returns(T.nilable(String)) }
94
+ attr_accessor :payment_id
95
+
91
96
  # Subscription payload sent on a webhook. It carries every field of
92
97
  # `SubscriptionResponse`, plus the grace-period deadline.
93
98
  sig do
94
- params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
99
+ params(
100
+ past_due_ends_at: T.nilable(Time),
101
+ payment_id: T.nilable(String)
102
+ ).returns(T.attached_class)
95
103
  end
96
104
  def self.new(
97
105
  # Time when the grace period ends. The subscription moves to `on_hold` or to
@@ -101,11 +109,18 @@ module Dodopayments
101
109
  # row snapshot that produced `status`. It is set whenever the subscription sits in
102
110
  # a window at that moment. A delayed event of another type therefore carries the
103
111
  # deadline too, next to a `past_due` status.
104
- past_due_ends_at: nil
112
+ past_due_ends_at: nil,
113
+ # Identifier of the payment that caused this event. It is set only for
114
+ # `subscription.renewed`. It is null for all other subscription events.
115
+ payment_id: nil
105
116
  )
106
117
  end
107
118
 
108
- sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
119
+ sig do
120
+ override.returns(
121
+ { past_due_ends_at: T.nilable(Time), payment_id: T.nilable(String) }
122
+ )
123
+ end
109
124
  def to_hash
110
125
  end
111
126
  end
@@ -88,10 +88,18 @@ module Dodopayments
88
88
  sig { returns(T.nilable(Time)) }
89
89
  attr_accessor :past_due_ends_at
90
90
 
91
+ # Identifier of the payment that caused this event. It is set only for
92
+ # `subscription.renewed`. It is null for all other subscription events.
93
+ sig { returns(T.nilable(String)) }
94
+ attr_accessor :payment_id
95
+
91
96
  # Subscription payload sent on a webhook. It carries every field of
92
97
  # `SubscriptionResponse`, plus the grace-period deadline.
93
98
  sig do
94
- params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
99
+ params(
100
+ past_due_ends_at: T.nilable(Time),
101
+ payment_id: T.nilable(String)
102
+ ).returns(T.attached_class)
95
103
  end
96
104
  def self.new(
97
105
  # Time when the grace period ends. The subscription moves to `on_hold` or to
@@ -101,11 +109,18 @@ module Dodopayments
101
109
  # row snapshot that produced `status`. It is set whenever the subscription sits in
102
110
  # a window at that moment. A delayed event of another type therefore carries the
103
111
  # deadline too, next to a `past_due` status.
104
- past_due_ends_at: nil
112
+ past_due_ends_at: nil,
113
+ # Identifier of the payment that caused this event. It is set only for
114
+ # `subscription.renewed`. It is null for all other subscription events.
115
+ payment_id: nil
105
116
  )
106
117
  end
107
118
 
108
- sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
119
+ sig do
120
+ override.returns(
121
+ { past_due_ends_at: T.nilable(Time), payment_id: T.nilable(String) }
122
+ )
123
+ end
109
124
  def to_hash
110
125
  end
111
126
  end
@@ -88,10 +88,18 @@ module Dodopayments
88
88
  sig { returns(T.nilable(Time)) }
89
89
  attr_accessor :past_due_ends_at
90
90
 
91
+ # Identifier of the payment that caused this event. It is set only for
92
+ # `subscription.renewed`. It is null for all other subscription events.
93
+ sig { returns(T.nilable(String)) }
94
+ attr_accessor :payment_id
95
+
91
96
  # Subscription payload sent on a webhook. It carries every field of
92
97
  # `SubscriptionResponse`, plus the grace-period deadline.
93
98
  sig do
94
- params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
99
+ params(
100
+ past_due_ends_at: T.nilable(Time),
101
+ payment_id: T.nilable(String)
102
+ ).returns(T.attached_class)
95
103
  end
96
104
  def self.new(
97
105
  # Time when the grace period ends. The subscription moves to `on_hold` or to
@@ -101,11 +109,18 @@ module Dodopayments
101
109
  # row snapshot that produced `status`. It is set whenever the subscription sits in
102
110
  # a window at that moment. A delayed event of another type therefore carries the
103
111
  # deadline too, next to a `past_due` status.
104
- past_due_ends_at: nil
112
+ past_due_ends_at: nil,
113
+ # Identifier of the payment that caused this event. It is set only for
114
+ # `subscription.renewed`. It is null for all other subscription events.
115
+ payment_id: nil
105
116
  )
106
117
  end
107
118
 
108
- sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
119
+ sig do
120
+ override.returns(
121
+ { past_due_ends_at: T.nilable(Time), payment_id: T.nilable(String) }
122
+ )
123
+ end
109
124
  def to_hash
110
125
  end
111
126
  end
@@ -88,10 +88,18 @@ module Dodopayments
88
88
  sig { returns(T.nilable(Time)) }
89
89
  attr_accessor :past_due_ends_at
90
90
 
91
+ # Identifier of the payment that caused this event. It is set only for
92
+ # `subscription.renewed`. It is null for all other subscription events.
93
+ sig { returns(T.nilable(String)) }
94
+ attr_accessor :payment_id
95
+
91
96
  # Subscription payload sent on a webhook. It carries every field of
92
97
  # `SubscriptionResponse`, plus the grace-period deadline.
93
98
  sig do
94
- params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
99
+ params(
100
+ past_due_ends_at: T.nilable(Time),
101
+ payment_id: T.nilable(String)
102
+ ).returns(T.attached_class)
95
103
  end
96
104
  def self.new(
97
105
  # Time when the grace period ends. The subscription moves to `on_hold` or to
@@ -101,11 +109,18 @@ module Dodopayments
101
109
  # row snapshot that produced `status`. It is set whenever the subscription sits in
102
110
  # a window at that moment. A delayed event of another type therefore carries the
103
111
  # deadline too, next to a `past_due` status.
104
- past_due_ends_at: nil
112
+ past_due_ends_at: nil,
113
+ # Identifier of the payment that caused this event. It is set only for
114
+ # `subscription.renewed`. It is null for all other subscription events.
115
+ payment_id: nil
105
116
  )
106
117
  end
107
118
 
108
- sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
119
+ sig do
120
+ override.returns(
121
+ { past_due_ends_at: T.nilable(Time), payment_id: T.nilable(String) }
122
+ )
123
+ end
109
124
  def to_hash
110
125
  end
111
126
  end
@@ -88,10 +88,18 @@ module Dodopayments
88
88
  sig { returns(T.nilable(Time)) }
89
89
  attr_accessor :past_due_ends_at
90
90
 
91
+ # Identifier of the payment that caused this event. It is set only for
92
+ # `subscription.renewed`. It is null for all other subscription events.
93
+ sig { returns(T.nilable(String)) }
94
+ attr_accessor :payment_id
95
+
91
96
  # Subscription payload sent on a webhook. It carries every field of
92
97
  # `SubscriptionResponse`, plus the grace-period deadline.
93
98
  sig do
94
- params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
99
+ params(
100
+ past_due_ends_at: T.nilable(Time),
101
+ payment_id: T.nilable(String)
102
+ ).returns(T.attached_class)
95
103
  end
96
104
  def self.new(
97
105
  # Time when the grace period ends. The subscription moves to `on_hold` or to
@@ -101,11 +109,18 @@ module Dodopayments
101
109
  # row snapshot that produced `status`. It is set whenever the subscription sits in
102
110
  # a window at that moment. A delayed event of another type therefore carries the
103
111
  # deadline too, next to a `past_due` status.
104
- past_due_ends_at: nil
112
+ past_due_ends_at: nil,
113
+ # Identifier of the payment that caused this event. It is set only for
114
+ # `subscription.renewed`. It is null for all other subscription events.
115
+ payment_id: nil
105
116
  )
106
117
  end
107
118
 
108
- sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
119
+ sig do
120
+ override.returns(
121
+ { past_due_ends_at: T.nilable(Time), payment_id: T.nilable(String) }
122
+ )
123
+ end
109
124
  def to_hash
110
125
  end
111
126
  end
@@ -88,10 +88,18 @@ module Dodopayments
88
88
  sig { returns(T.nilable(Time)) }
89
89
  attr_accessor :past_due_ends_at
90
90
 
91
+ # Identifier of the payment that caused this event. It is set only for
92
+ # `subscription.renewed`. It is null for all other subscription events.
93
+ sig { returns(T.nilable(String)) }
94
+ attr_accessor :payment_id
95
+
91
96
  # Subscription payload sent on a webhook. It carries every field of
92
97
  # `SubscriptionResponse`, plus the grace-period deadline.
93
98
  sig do
94
- params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
99
+ params(
100
+ past_due_ends_at: T.nilable(Time),
101
+ payment_id: T.nilable(String)
102
+ ).returns(T.attached_class)
95
103
  end
96
104
  def self.new(
97
105
  # Time when the grace period ends. The subscription moves to `on_hold` or to
@@ -101,11 +109,18 @@ module Dodopayments
101
109
  # row snapshot that produced `status`. It is set whenever the subscription sits in
102
110
  # a window at that moment. A delayed event of another type therefore carries the
103
111
  # deadline too, next to a `past_due` status.
104
- past_due_ends_at: nil
112
+ past_due_ends_at: nil,
113
+ # Identifier of the payment that caused this event. It is set only for
114
+ # `subscription.renewed`. It is null for all other subscription events.
115
+ payment_id: nil
105
116
  )
106
117
  end
107
118
 
108
- sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
119
+ sig do
120
+ override.returns(
121
+ { past_due_ends_at: T.nilable(Time), payment_id: T.nilable(String) }
122
+ )
123
+ end
109
124
  def to_hash
110
125
  end
111
126
  end
@@ -0,0 +1,75 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class SubscriptionServicePeriod < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::SubscriptionServicePeriod,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # End of the service period.
15
+ sig { returns(Time) }
16
+ attr_accessor :ends_at
17
+
18
+ # The part of one full billing period that the plan charge pays for. The value
19
+ # `"1"` is a full period. A value less than 1 is a partial period, for example
20
+ # after a plan change that keeps the billing cycle. For a plan change, this is the
21
+ # value of the new plan. The credit for the old plan is not in this value.
22
+ sig { returns(String) }
23
+ attr_accessor :proration_factor
24
+
25
+ # Start of the service period. For a renewal, this is the billing date. For a plan
26
+ # change that applies at the next billing date, this is the time when the change
27
+ # applied. This time can be some minutes after the billing date.
28
+ sig { returns(Time) }
29
+ attr_accessor :starts_at
30
+
31
+ # Identifier of the subscription.
32
+ sig { returns(String) }
33
+ attr_accessor :subscription_id
34
+
35
+ # The service period that a payment pays for, for one subscription.
36
+ sig do
37
+ params(
38
+ ends_at: Time,
39
+ proration_factor: String,
40
+ starts_at: Time,
41
+ subscription_id: String
42
+ ).returns(T.attached_class)
43
+ end
44
+ def self.new(
45
+ # End of the service period.
46
+ ends_at:,
47
+ # The part of one full billing period that the plan charge pays for. The value
48
+ # `"1"` is a full period. A value less than 1 is a partial period, for example
49
+ # after a plan change that keeps the billing cycle. For a plan change, this is the
50
+ # value of the new plan. The credit for the old plan is not in this value.
51
+ proration_factor:,
52
+ # Start of the service period. For a renewal, this is the billing date. For a plan
53
+ # change that applies at the next billing date, this is the time when the change
54
+ # applied. This time can be some minutes after the billing date.
55
+ starts_at:,
56
+ # Identifier of the subscription.
57
+ subscription_id:
58
+ )
59
+ end
60
+
61
+ sig do
62
+ override.returns(
63
+ {
64
+ ends_at: Time,
65
+ proration_factor: String,
66
+ starts_at: Time,
67
+ subscription_id: String
68
+ }
69
+ )
70
+ end
71
+ def to_hash
72
+ end
73
+ end
74
+ end
75
+ end
@@ -88,10 +88,18 @@ module Dodopayments
88
88
  sig { returns(T.nilable(Time)) }
89
89
  attr_accessor :past_due_ends_at
90
90
 
91
+ # Identifier of the payment that caused this event. It is set only for
92
+ # `subscription.renewed`. It is null for all other subscription events.
93
+ sig { returns(T.nilable(String)) }
94
+ attr_accessor :payment_id
95
+
91
96
  # Subscription payload sent on a webhook. It carries every field of
92
97
  # `SubscriptionResponse`, plus the grace-period deadline.
93
98
  sig do
94
- params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
99
+ params(
100
+ past_due_ends_at: T.nilable(Time),
101
+ payment_id: T.nilable(String)
102
+ ).returns(T.attached_class)
95
103
  end
96
104
  def self.new(
97
105
  # Time when the grace period ends. The subscription moves to `on_hold` or to
@@ -101,11 +109,18 @@ module Dodopayments
101
109
  # row snapshot that produced `status`. It is set whenever the subscription sits in
102
110
  # a window at that moment. A delayed event of another type therefore carries the
103
111
  # deadline too, next to a `past_due` status.
104
- past_due_ends_at: nil
112
+ past_due_ends_at: nil,
113
+ # Identifier of the payment that caused this event. It is set only for
114
+ # `subscription.renewed`. It is null for all other subscription events.
115
+ payment_id: nil
105
116
  )
106
117
  end
107
118
 
108
- sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
119
+ sig do
120
+ override.returns(
121
+ { past_due_ends_at: T.nilable(Time), payment_id: T.nilable(String) }
122
+ )
123
+ end
109
124
  def to_hash
110
125
  end
111
126
  end
@@ -93,10 +93,18 @@ module Dodopayments
93
93
  sig { returns(T.nilable(Time)) }
94
94
  attr_accessor :past_due_ends_at
95
95
 
96
+ # Identifier of the payment that caused this event. It is set only for
97
+ # `subscription.renewed`. It is null for all other subscription events.
98
+ sig { returns(T.nilable(String)) }
99
+ attr_accessor :payment_id
100
+
96
101
  # Subscription payload sent on a webhook. It carries every field of
97
102
  # `SubscriptionResponse`, plus the grace-period deadline.
98
103
  sig do
99
- params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
104
+ params(
105
+ past_due_ends_at: T.nilable(Time),
106
+ payment_id: T.nilable(String)
107
+ ).returns(T.attached_class)
100
108
  end
101
109
  def self.new(
102
110
  # Time when the grace period ends. The subscription moves to `on_hold` or to
@@ -106,11 +114,18 @@ module Dodopayments
106
114
  # row snapshot that produced `status`. It is set whenever the subscription sits in
107
115
  # a window at that moment. A delayed event of another type therefore carries the
108
116
  # deadline too, next to a `past_due` status.
109
- past_due_ends_at: nil
117
+ past_due_ends_at: nil,
118
+ # Identifier of the payment that caused this event. It is set only for
119
+ # `subscription.renewed`. It is null for all other subscription events.
120
+ payment_id: nil
110
121
  )
111
122
  end
112
123
 
113
- sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
124
+ sig do
125
+ override.returns(
126
+ { past_due_ends_at: T.nilable(Time), payment_id: T.nilable(String) }
127
+ )
128
+ end
114
129
  def to_hash
115
130
  end
116
131
  end