orb-billing 0.5.5 → 0.7.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 (205) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/README.md +1 -1
  4. data/lib/orb/client.rb +4 -0
  5. data/lib/orb/internal/type/base_model.rb +2 -2
  6. data/lib/orb/internal/type/union.rb +6 -6
  7. data/lib/orb/models/alert.rb +33 -1
  8. data/lib/orb/models/amount_discount.rb +10 -10
  9. data/lib/orb/models/beta/external_plan_id_create_plan_version_params.rb +17940 -0
  10. data/lib/orb/models/beta/external_plan_id_fetch_plan_version_params.rb +22 -0
  11. data/lib/orb/models/beta/external_plan_id_set_default_plan_version_params.rb +24 -0
  12. data/lib/orb/models/beta_create_plan_version_params.rb +17758 -0
  13. data/lib/orb/models/beta_fetch_plan_version_params.rb +20 -0
  14. data/lib/orb/models/beta_set_default_plan_version_params.rb +22 -0
  15. data/lib/orb/models/credit_note_create_params.rb +9 -9
  16. data/lib/orb/models/customer_create_params.rb +21 -3
  17. data/lib/orb/models/customer_update_by_external_id_params.rb +21 -3
  18. data/lib/orb/models/customer_update_params.rb +21 -3
  19. data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rb +9 -1
  20. data/lib/orb/models/customers/credits/ledger_create_entry_response.rb +9 -1
  21. data/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rb +9 -1
  22. data/lib/orb/models/customers/credits/ledger_list_response.rb +9 -1
  23. data/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rb +1 -1
  24. data/lib/orb/models/customers/credits/top_up_create_params.rb +1 -1
  25. data/lib/orb/models/invoice.rb +626 -9
  26. data/lib/orb/models/invoice_fetch_upcoming_response.rb +624 -9
  27. data/lib/orb/models/invoice_line_item_create_response.rb +486 -7
  28. data/lib/orb/models/item.rb +18 -1
  29. data/lib/orb/models/item_archive_params.rb +14 -0
  30. data/lib/orb/models/item_create_params.rb +14 -1
  31. data/lib/orb/models/item_update_params.rb +16 -1
  32. data/lib/orb/models/percentage_discount.rb +10 -10
  33. data/lib/orb/models/plan.rb +618 -9
  34. data/lib/orb/models/plan_create_params.rb +2066 -30
  35. data/lib/orb/models/plan_version.rb +735 -0
  36. data/lib/orb/models/plan_version_phase.rb +70 -0
  37. data/lib/orb/models/price.rb +4124 -70
  38. data/lib/orb/models/price_create_params.rb +45 -1
  39. data/lib/orb/models/price_evaluate_multiple_params.rb +8620 -0
  40. data/lib/orb/models/price_evaluate_multiple_response.rb +51 -0
  41. data/lib/orb/models/subscription.rb +730 -54
  42. data/lib/orb/models/subscription_cancel_response.rb +706 -54
  43. data/lib/orb/models/subscription_change_apply_response.rb +728 -54
  44. data/lib/orb/models/subscription_change_cancel_response.rb +728 -54
  45. data/lib/orb/models/subscription_change_retrieve_response.rb +728 -54
  46. data/lib/orb/models/subscription_create_params.rb +5992 -1698
  47. data/lib/orb/models/subscription_create_response.rb +706 -54
  48. data/lib/orb/models/subscription_fetch_schedule_response.rb +3 -3
  49. data/lib/orb/models/subscription_price_intervals_params.rb +1392 -76
  50. data/lib/orb/models/subscription_price_intervals_response.rb +712 -54
  51. data/lib/orb/models/subscription_schedule_plan_change_params.rb +6005 -1723
  52. data/lib/orb/models/subscription_schedule_plan_change_response.rb +716 -54
  53. data/lib/orb/models/subscription_trigger_phase_response.rb +708 -54
  54. data/lib/orb/models/subscription_unschedule_cancellation_response.rb +720 -54
  55. data/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rb +728 -54
  56. data/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rb +728 -54
  57. data/lib/orb/models/subscription_update_fixed_fee_quantity_params.rb +1 -1
  58. data/lib/orb/models/subscription_update_fixed_fee_quantity_response.rb +720 -54
  59. data/lib/orb/models/subscription_update_trial_response.rb +706 -54
  60. data/lib/orb/models/trial_discount.rb +10 -10
  61. data/lib/orb/models/usage_discount.rb +10 -10
  62. data/lib/orb/models.rb +16 -0
  63. data/lib/orb/resources/beta/external_plan_id.rb +113 -0
  64. data/lib/orb/resources/beta.rb +115 -0
  65. data/lib/orb/resources/credit_notes.rb +3 -3
  66. data/lib/orb/resources/customers/balance_transactions.rb +0 -7
  67. data/lib/orb/resources/customers.rb +4 -7
  68. data/lib/orb/resources/dimensional_price_groups.rb +1 -1
  69. data/lib/orb/resources/items.rb +34 -2
  70. data/lib/orb/resources/plans/external_plan_id.rb +1 -1
  71. data/lib/orb/resources/plans.rb +2 -2
  72. data/lib/orb/resources/prices.rb +69 -2
  73. data/lib/orb/resources/subscriptions.rb +5 -1
  74. data/lib/orb/version.rb +1 -1
  75. data/lib/orb.rb +13 -0
  76. data/rbi/orb/client.rbi +3 -0
  77. data/rbi/orb/models/alert.rbi +50 -3
  78. data/rbi/orb/models/amount_discount.rbi +8 -8
  79. data/rbi/orb/models/beta/external_plan_id_create_plan_version_params.rbi +32652 -0
  80. data/rbi/orb/models/beta/external_plan_id_fetch_plan_version_params.rbi +40 -0
  81. data/rbi/orb/models/beta/external_plan_id_set_default_plan_version_params.rbi +45 -0
  82. data/rbi/orb/models/beta_create_plan_version_params.rbi +32595 -0
  83. data/rbi/orb/models/beta_fetch_plan_version_params.rbi +35 -0
  84. data/rbi/orb/models/beta_set_default_plan_version_params.rbi +40 -0
  85. data/rbi/orb/models/credit_note_create_params.rbi +8 -8
  86. data/rbi/orb/models/customer_create_params.rbi +38 -4
  87. data/rbi/orb/models/customer_update_by_external_id_params.rbi +38 -4
  88. data/rbi/orb/models/customer_update_params.rbi +38 -4
  89. data/rbi/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbi +9 -1
  90. data/rbi/orb/models/customers/credits/ledger_create_entry_response.rbi +9 -1
  91. data/rbi/orb/models/customers/credits/ledger_list_by_external_id_response.rbi +9 -1
  92. data/rbi/orb/models/customers/credits/ledger_list_response.rbi +9 -1
  93. data/rbi/orb/models/customers/credits/top_up_create_by_external_id_params.rbi +2 -2
  94. data/rbi/orb/models/customers/credits/top_up_create_params.rbi +2 -2
  95. data/rbi/orb/models/invoice.rbi +1451 -35
  96. data/rbi/orb/models/invoice_fetch_upcoming_response.rbi +1524 -4
  97. data/rbi/orb/models/invoice_line_item_create_response.rbi +1184 -2
  98. data/rbi/orb/models/item.rbi +20 -1
  99. data/rbi/orb/models/item_archive_params.rbi +25 -0
  100. data/rbi/orb/models/item_create_params.rbi +18 -1
  101. data/rbi/orb/models/item_update_params.rbi +17 -1
  102. data/rbi/orb/models/percentage_discount.rbi +10 -10
  103. data/rbi/orb/models/plan.rbi +1339 -4
  104. data/rbi/orb/models/plan_create_params.rbi +3833 -29
  105. data/rbi/orb/models/plan_version.rbi +1367 -0
  106. data/rbi/orb/models/plan_version_phase.rbi +99 -0
  107. data/rbi/orb/models/price.rbi +9447 -441
  108. data/rbi/orb/models/price_create_params.rbi +80 -0
  109. data/rbi/orb/models/price_evaluate_multiple_params.rbi +15764 -0
  110. data/rbi/orb/models/price_evaluate_multiple_response.rbi +96 -0
  111. data/rbi/orb/models/subscription.rbi +1654 -44
  112. data/rbi/orb/models/subscription_cancel_response.rbi +1692 -44
  113. data/rbi/orb/models/subscription_change_apply_response.rbi +1692 -44
  114. data/rbi/orb/models/subscription_change_cancel_response.rbi +1692 -44
  115. data/rbi/orb/models/subscription_change_retrieve_response.rbi +1692 -44
  116. data/rbi/orb/models/subscription_create_params.rbi +10400 -2710
  117. data/rbi/orb/models/subscription_create_response.rbi +1692 -44
  118. data/rbi/orb/models/subscription_fetch_schedule_response.rbi +13 -4
  119. data/rbi/orb/models/subscription_price_intervals_params.rbi +2401 -49
  120. data/rbi/orb/models/subscription_price_intervals_response.rbi +1692 -44
  121. data/rbi/orb/models/subscription_schedule_plan_change_params.rbi +10423 -2753
  122. data/rbi/orb/models/subscription_schedule_plan_change_response.rbi +1692 -44
  123. data/rbi/orb/models/subscription_trigger_phase_response.rbi +1692 -44
  124. data/rbi/orb/models/subscription_unschedule_cancellation_response.rbi +1692 -44
  125. data/rbi/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbi +1692 -44
  126. data/rbi/orb/models/subscription_unschedule_pending_plan_changes_response.rbi +1692 -44
  127. data/rbi/orb/models/subscription_update_fixed_fee_quantity_params.rbi +2 -2
  128. data/rbi/orb/models/subscription_update_fixed_fee_quantity_response.rbi +1692 -44
  129. data/rbi/orb/models/subscription_update_trial_response.rbi +1692 -44
  130. data/rbi/orb/models/trial_discount.rbi +8 -8
  131. data/rbi/orb/models/usage_discount.rbi +10 -10
  132. data/rbi/orb/models.rbi +16 -0
  133. data/rbi/orb/resources/beta/external_plan_id.rbi +118 -0
  134. data/rbi/orb/resources/beta.rbi +111 -0
  135. data/rbi/orb/resources/credit_notes.rbi +3 -3
  136. data/rbi/orb/resources/customers/balance_transactions.rbi +0 -7
  137. data/rbi/orb/resources/customers/credits/top_ups.rbi +2 -2
  138. data/rbi/orb/resources/customers.rbi +7 -7
  139. data/rbi/orb/resources/dimensional_price_groups.rbi +1 -1
  140. data/rbi/orb/resources/items.rbi +20 -0
  141. data/rbi/orb/resources/plans/external_plan_id.rbi +1 -1
  142. data/rbi/orb/resources/plans.rbi +5 -2
  143. data/rbi/orb/resources/prices.rbi +73 -1
  144. data/rbi/orb/resources/subscriptions.rbi +9 -1
  145. data/sig/orb/client.rbs +2 -0
  146. data/sig/orb/models/alert.rbs +20 -3
  147. data/sig/orb/models/amount_discount.rbs +5 -5
  148. data/sig/orb/models/beta/external_plan_id_create_plan_version_params.rbs +12898 -0
  149. data/sig/orb/models/beta/external_plan_id_fetch_plan_version_params.rbs +25 -0
  150. data/sig/orb/models/beta/external_plan_id_set_default_plan_version_params.rbs +25 -0
  151. data/sig/orb/models/beta_create_plan_version_params.rbs +12877 -0
  152. data/sig/orb/models/beta_fetch_plan_version_params.rbs +20 -0
  153. data/sig/orb/models/beta_set_default_plan_version_params.rbs +20 -0
  154. data/sig/orb/models/credit_note_create_params.rbs +6 -6
  155. data/sig/orb/models/customer_create_params.rbs +13 -0
  156. data/sig/orb/models/customer_update_by_external_id_params.rbs +13 -0
  157. data/sig/orb/models/customer_update_params.rbs +13 -0
  158. data/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbs +7 -2
  159. data/sig/orb/models/customers/credits/ledger_create_entry_response.rbs +7 -2
  160. data/sig/orb/models/customers/credits/ledger_list_by_external_id_response.rbs +7 -2
  161. data/sig/orb/models/customers/credits/ledger_list_response.rbs +7 -2
  162. data/sig/orb/models/invoice.rbs +558 -4
  163. data/sig/orb/models/invoice_fetch_upcoming_response.rbs +558 -4
  164. data/sig/orb/models/invoice_line_item_create_response.rbs +414 -2
  165. data/sig/orb/models/item.rbs +5 -0
  166. data/sig/orb/models/item_archive_params.rbs +14 -0
  167. data/sig/orb/models/item_create_params.rbs +10 -2
  168. data/sig/orb/models/item_update_params.rbs +5 -0
  169. data/sig/orb/models/percentage_discount.rbs +5 -5
  170. data/sig/orb/models/plan.rbs +538 -4
  171. data/sig/orb/models/plan_create_params.rbs +1460 -3
  172. data/sig/orb/models/plan_version.rbs +583 -0
  173. data/sig/orb/models/plan_version_phase.rbs +60 -0
  174. data/sig/orb/models/price.rbs +3512 -96
  175. data/sig/orb/models/price_create_params.rbs +32 -0
  176. data/sig/orb/models/price_evaluate_multiple_params.rbs +6230 -0
  177. data/sig/orb/models/price_evaluate_multiple_response.rbs +50 -0
  178. data/sig/orb/models/subscription.rbs +609 -29
  179. data/sig/orb/models/subscription_cancel_response.rbs +609 -29
  180. data/sig/orb/models/subscription_change_apply_response.rbs +621 -29
  181. data/sig/orb/models/subscription_change_cancel_response.rbs +621 -29
  182. data/sig/orb/models/subscription_change_retrieve_response.rbs +621 -29
  183. data/sig/orb/models/subscription_create_params.rbs +4450 -1466
  184. data/sig/orb/models/subscription_create_response.rbs +609 -29
  185. data/sig/orb/models/subscription_fetch_schedule_response.rbs +4 -4
  186. data/sig/orb/models/subscription_price_intervals_params.rbs +920 -24
  187. data/sig/orb/models/subscription_price_intervals_response.rbs +609 -29
  188. data/sig/orb/models/subscription_schedule_plan_change_params.rbs +4440 -1466
  189. data/sig/orb/models/subscription_schedule_plan_change_response.rbs +609 -29
  190. data/sig/orb/models/subscription_trigger_phase_response.rbs +609 -29
  191. data/sig/orb/models/subscription_unschedule_cancellation_response.rbs +609 -29
  192. data/sig/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbs +609 -29
  193. data/sig/orb/models/subscription_unschedule_pending_plan_changes_response.rbs +609 -29
  194. data/sig/orb/models/subscription_update_fixed_fee_quantity_response.rbs +609 -29
  195. data/sig/orb/models/subscription_update_trial_response.rbs +609 -29
  196. data/sig/orb/models/trial_discount.rbs +5 -5
  197. data/sig/orb/models/usage_discount.rbs +5 -5
  198. data/sig/orb/models.rbs +16 -0
  199. data/sig/orb/resources/beta/external_plan_id.rbs +34 -0
  200. data/sig/orb/resources/beta.rbs +34 -0
  201. data/sig/orb/resources/credit_notes.rbs +1 -1
  202. data/sig/orb/resources/items.rbs +7 -0
  203. data/sig/orb/resources/prices.rbs +11 -0
  204. data/sig/orb/resources/subscriptions.rbs +2 -0
  205. metadata +40 -1
@@ -0,0 +1,1367 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Models
5
+ class PlanVersion < Orb::Internal::Type::BaseModel
6
+ OrHash = T.type_alias { T.any(Orb::PlanVersion, Orb::Internal::AnyHash) }
7
+
8
+ # Adjustments for this plan. If the plan has phases, this includes adjustments
9
+ # across all phases of the plan.
10
+ sig { returns(T::Array[Orb::PlanVersion::Adjustment::Variants]) }
11
+ attr_accessor :adjustments
12
+
13
+ sig { returns(Time) }
14
+ attr_accessor :created_at
15
+
16
+ sig { returns(T.nilable(T::Array[Orb::PlanVersionPhase])) }
17
+ attr_accessor :plan_phases
18
+
19
+ # Prices for this plan. If the plan has phases, this includes prices across all
20
+ # phases of the plan.
21
+ sig { returns(T::Array[Orb::Price::Variants]) }
22
+ attr_accessor :prices
23
+
24
+ sig { returns(Integer) }
25
+ attr_accessor :version
26
+
27
+ # The PlanVersion resource represents the prices and adjustments present on a
28
+ # specific version of a plan.
29
+ sig do
30
+ params(
31
+ adjustments:
32
+ T::Array[
33
+ T.any(
34
+ Orb::PlanVersion::Adjustment::UsageDiscount::OrHash,
35
+ Orb::PlanVersion::Adjustment::AmountDiscount::OrHash,
36
+ Orb::PlanVersion::Adjustment::PercentageDiscount::OrHash,
37
+ Orb::PlanVersion::Adjustment::Minimum::OrHash,
38
+ Orb::PlanVersion::Adjustment::Maximum::OrHash
39
+ )
40
+ ],
41
+ created_at: Time,
42
+ plan_phases: T.nilable(T::Array[Orb::PlanVersionPhase::OrHash]),
43
+ prices:
44
+ T::Array[
45
+ T.any(
46
+ Orb::Price::Unit::OrHash,
47
+ Orb::Price::Package::OrHash,
48
+ Orb::Price::Matrix::OrHash,
49
+ Orb::Price::Tiered::OrHash,
50
+ Orb::Price::TieredBps::OrHash,
51
+ Orb::Price::Bps::OrHash,
52
+ Orb::Price::BulkBps::OrHash,
53
+ Orb::Price::Bulk::OrHash,
54
+ Orb::Price::ThresholdTotalAmount::OrHash,
55
+ Orb::Price::TieredPackage::OrHash,
56
+ Orb::Price::GroupedTiered::OrHash,
57
+ Orb::Price::TieredWithMinimum::OrHash,
58
+ Orb::Price::TieredPackageWithMinimum::OrHash,
59
+ Orb::Price::PackageWithAllocation::OrHash,
60
+ Orb::Price::UnitWithPercent::OrHash,
61
+ Orb::Price::MatrixWithAllocation::OrHash,
62
+ Orb::Price::TieredWithProration::OrHash,
63
+ Orb::Price::UnitWithProration::OrHash,
64
+ Orb::Price::GroupedAllocation::OrHash,
65
+ Orb::Price::GroupedWithProratedMinimum::OrHash,
66
+ Orb::Price::GroupedWithMeteredMinimum::OrHash,
67
+ Orb::Price::MatrixWithDisplayName::OrHash,
68
+ Orb::Price::BulkWithProration::OrHash,
69
+ Orb::Price::GroupedTieredPackage::OrHash,
70
+ Orb::Price::MaxGroupTieredPackage::OrHash,
71
+ Orb::Price::ScalableMatrixWithUnitPricing::OrHash,
72
+ Orb::Price::ScalableMatrixWithTieredPricing::OrHash,
73
+ Orb::Price::CumulativeGroupedBulk::OrHash
74
+ )
75
+ ],
76
+ version: Integer
77
+ ).returns(T.attached_class)
78
+ end
79
+ def self.new(
80
+ # Adjustments for this plan. If the plan has phases, this includes adjustments
81
+ # across all phases of the plan.
82
+ adjustments:,
83
+ created_at:,
84
+ plan_phases:,
85
+ # Prices for this plan. If the plan has phases, this includes prices across all
86
+ # phases of the plan.
87
+ prices:,
88
+ version:
89
+ )
90
+ end
91
+
92
+ sig do
93
+ override.returns(
94
+ {
95
+ adjustments: T::Array[Orb::PlanVersion::Adjustment::Variants],
96
+ created_at: Time,
97
+ plan_phases: T.nilable(T::Array[Orb::PlanVersionPhase]),
98
+ prices: T::Array[Orb::Price::Variants],
99
+ version: Integer
100
+ }
101
+ )
102
+ end
103
+ def to_hash
104
+ end
105
+
106
+ module Adjustment
107
+ extend Orb::Internal::Type::Union
108
+
109
+ Variants =
110
+ T.type_alias do
111
+ T.any(
112
+ Orb::PlanVersion::Adjustment::UsageDiscount,
113
+ Orb::PlanVersion::Adjustment::AmountDiscount,
114
+ Orb::PlanVersion::Adjustment::PercentageDiscount,
115
+ Orb::PlanVersion::Adjustment::Minimum,
116
+ Orb::PlanVersion::Adjustment::Maximum
117
+ )
118
+ end
119
+
120
+ class UsageDiscount < Orb::Internal::Type::BaseModel
121
+ OrHash =
122
+ T.type_alias do
123
+ T.any(
124
+ Orb::PlanVersion::Adjustment::UsageDiscount,
125
+ Orb::Internal::AnyHash
126
+ )
127
+ end
128
+
129
+ sig { returns(String) }
130
+ attr_accessor :id
131
+
132
+ sig { returns(Symbol) }
133
+ attr_accessor :adjustment_type
134
+
135
+ # The price IDs that this adjustment applies to.
136
+ sig { returns(T::Array[String]) }
137
+ attr_accessor :applies_to_price_ids
138
+
139
+ # The filters that determine which prices to apply this adjustment to.
140
+ sig do
141
+ returns(
142
+ T::Array[Orb::PlanVersion::Adjustment::UsageDiscount::Filter]
143
+ )
144
+ end
145
+ attr_accessor :filters
146
+
147
+ # True for adjustments that apply to an entire invocice, false for adjustments
148
+ # that apply to only one price.
149
+ sig { returns(T::Boolean) }
150
+ attr_accessor :is_invoice_level
151
+
152
+ # The plan phase in which this adjustment is active.
153
+ sig { returns(T.nilable(Integer)) }
154
+ attr_accessor :plan_phase_order
155
+
156
+ # The reason for the adjustment.
157
+ sig { returns(T.nilable(String)) }
158
+ attr_accessor :reason
159
+
160
+ # The number of usage units by which to discount the price this adjustment applies
161
+ # to in a given billing period.
162
+ sig { returns(Float) }
163
+ attr_accessor :usage_discount
164
+
165
+ sig do
166
+ params(
167
+ id: String,
168
+ applies_to_price_ids: T::Array[String],
169
+ filters:
170
+ T::Array[
171
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::OrHash
172
+ ],
173
+ is_invoice_level: T::Boolean,
174
+ plan_phase_order: T.nilable(Integer),
175
+ reason: T.nilable(String),
176
+ usage_discount: Float,
177
+ adjustment_type: Symbol
178
+ ).returns(T.attached_class)
179
+ end
180
+ def self.new(
181
+ id:,
182
+ # The price IDs that this adjustment applies to.
183
+ applies_to_price_ids:,
184
+ # The filters that determine which prices to apply this adjustment to.
185
+ filters:,
186
+ # True for adjustments that apply to an entire invocice, false for adjustments
187
+ # that apply to only one price.
188
+ is_invoice_level:,
189
+ # The plan phase in which this adjustment is active.
190
+ plan_phase_order:,
191
+ # The reason for the adjustment.
192
+ reason:,
193
+ # The number of usage units by which to discount the price this adjustment applies
194
+ # to in a given billing period.
195
+ usage_discount:,
196
+ adjustment_type: :usage_discount
197
+ )
198
+ end
199
+
200
+ sig do
201
+ override.returns(
202
+ {
203
+ id: String,
204
+ adjustment_type: Symbol,
205
+ applies_to_price_ids: T::Array[String],
206
+ filters:
207
+ T::Array[Orb::PlanVersion::Adjustment::UsageDiscount::Filter],
208
+ is_invoice_level: T::Boolean,
209
+ plan_phase_order: T.nilable(Integer),
210
+ reason: T.nilable(String),
211
+ usage_discount: Float
212
+ }
213
+ )
214
+ end
215
+ def to_hash
216
+ end
217
+
218
+ class Filter < Orb::Internal::Type::BaseModel
219
+ OrHash =
220
+ T.type_alias do
221
+ T.any(
222
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter,
223
+ Orb::Internal::AnyHash
224
+ )
225
+ end
226
+
227
+ # The property of the price to filter on.
228
+ sig do
229
+ returns(
230
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol
231
+ )
232
+ end
233
+ attr_accessor :field
234
+
235
+ # Should prices that match the filter be included or excluded.
236
+ sig do
237
+ returns(
238
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Operator::TaggedSymbol
239
+ )
240
+ end
241
+ attr_accessor :operator
242
+
243
+ # The IDs or values that match this filter.
244
+ sig { returns(T::Array[String]) }
245
+ attr_accessor :values
246
+
247
+ sig do
248
+ params(
249
+ field:
250
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Field::OrSymbol,
251
+ operator:
252
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Operator::OrSymbol,
253
+ values: T::Array[String]
254
+ ).returns(T.attached_class)
255
+ end
256
+ def self.new(
257
+ # The property of the price to filter on.
258
+ field:,
259
+ # Should prices that match the filter be included or excluded.
260
+ operator:,
261
+ # The IDs or values that match this filter.
262
+ values:
263
+ )
264
+ end
265
+
266
+ sig do
267
+ override.returns(
268
+ {
269
+ field:
270
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol,
271
+ operator:
272
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Operator::TaggedSymbol,
273
+ values: T::Array[String]
274
+ }
275
+ )
276
+ end
277
+ def to_hash
278
+ end
279
+
280
+ # The property of the price to filter on.
281
+ module Field
282
+ extend Orb::Internal::Type::Enum
283
+
284
+ TaggedSymbol =
285
+ T.type_alias do
286
+ T.all(
287
+ Symbol,
288
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Field
289
+ )
290
+ end
291
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
292
+
293
+ PRICE_ID =
294
+ T.let(
295
+ :price_id,
296
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol
297
+ )
298
+ ITEM_ID =
299
+ T.let(
300
+ :item_id,
301
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol
302
+ )
303
+ PRICE_TYPE =
304
+ T.let(
305
+ :price_type,
306
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol
307
+ )
308
+ CURRENCY =
309
+ T.let(
310
+ :currency,
311
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol
312
+ )
313
+ PRICING_UNIT_ID =
314
+ T.let(
315
+ :pricing_unit_id,
316
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol
317
+ )
318
+
319
+ sig do
320
+ override.returns(
321
+ T::Array[
322
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol
323
+ ]
324
+ )
325
+ end
326
+ def self.values
327
+ end
328
+ end
329
+
330
+ # Should prices that match the filter be included or excluded.
331
+ module Operator
332
+ extend Orb::Internal::Type::Enum
333
+
334
+ TaggedSymbol =
335
+ T.type_alias do
336
+ T.all(
337
+ Symbol,
338
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Operator
339
+ )
340
+ end
341
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
342
+
343
+ INCLUDES =
344
+ T.let(
345
+ :includes,
346
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Operator::TaggedSymbol
347
+ )
348
+ EXCLUDES =
349
+ T.let(
350
+ :excludes,
351
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Operator::TaggedSymbol
352
+ )
353
+
354
+ sig do
355
+ override.returns(
356
+ T::Array[
357
+ Orb::PlanVersion::Adjustment::UsageDiscount::Filter::Operator::TaggedSymbol
358
+ ]
359
+ )
360
+ end
361
+ def self.values
362
+ end
363
+ end
364
+ end
365
+ end
366
+
367
+ class AmountDiscount < Orb::Internal::Type::BaseModel
368
+ OrHash =
369
+ T.type_alias do
370
+ T.any(
371
+ Orb::PlanVersion::Adjustment::AmountDiscount,
372
+ Orb::Internal::AnyHash
373
+ )
374
+ end
375
+
376
+ sig { returns(String) }
377
+ attr_accessor :id
378
+
379
+ sig { returns(Symbol) }
380
+ attr_accessor :adjustment_type
381
+
382
+ # The amount by which to discount the prices this adjustment applies to in a given
383
+ # billing period.
384
+ sig { returns(String) }
385
+ attr_accessor :amount_discount
386
+
387
+ # The price IDs that this adjustment applies to.
388
+ sig { returns(T::Array[String]) }
389
+ attr_accessor :applies_to_price_ids
390
+
391
+ # The filters that determine which prices to apply this adjustment to.
392
+ sig do
393
+ returns(
394
+ T::Array[Orb::PlanVersion::Adjustment::AmountDiscount::Filter]
395
+ )
396
+ end
397
+ attr_accessor :filters
398
+
399
+ # True for adjustments that apply to an entire invocice, false for adjustments
400
+ # that apply to only one price.
401
+ sig { returns(T::Boolean) }
402
+ attr_accessor :is_invoice_level
403
+
404
+ # The plan phase in which this adjustment is active.
405
+ sig { returns(T.nilable(Integer)) }
406
+ attr_accessor :plan_phase_order
407
+
408
+ # The reason for the adjustment.
409
+ sig { returns(T.nilable(String)) }
410
+ attr_accessor :reason
411
+
412
+ sig do
413
+ params(
414
+ id: String,
415
+ amount_discount: String,
416
+ applies_to_price_ids: T::Array[String],
417
+ filters:
418
+ T::Array[
419
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::OrHash
420
+ ],
421
+ is_invoice_level: T::Boolean,
422
+ plan_phase_order: T.nilable(Integer),
423
+ reason: T.nilable(String),
424
+ adjustment_type: Symbol
425
+ ).returns(T.attached_class)
426
+ end
427
+ def self.new(
428
+ id:,
429
+ # The amount by which to discount the prices this adjustment applies to in a given
430
+ # billing period.
431
+ amount_discount:,
432
+ # The price IDs that this adjustment applies to.
433
+ applies_to_price_ids:,
434
+ # The filters that determine which prices to apply this adjustment to.
435
+ filters:,
436
+ # True for adjustments that apply to an entire invocice, false for adjustments
437
+ # that apply to only one price.
438
+ is_invoice_level:,
439
+ # The plan phase in which this adjustment is active.
440
+ plan_phase_order:,
441
+ # The reason for the adjustment.
442
+ reason:,
443
+ adjustment_type: :amount_discount
444
+ )
445
+ end
446
+
447
+ sig do
448
+ override.returns(
449
+ {
450
+ id: String,
451
+ adjustment_type: Symbol,
452
+ amount_discount: String,
453
+ applies_to_price_ids: T::Array[String],
454
+ filters:
455
+ T::Array[
456
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter
457
+ ],
458
+ is_invoice_level: T::Boolean,
459
+ plan_phase_order: T.nilable(Integer),
460
+ reason: T.nilable(String)
461
+ }
462
+ )
463
+ end
464
+ def to_hash
465
+ end
466
+
467
+ class Filter < Orb::Internal::Type::BaseModel
468
+ OrHash =
469
+ T.type_alias do
470
+ T.any(
471
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter,
472
+ Orb::Internal::AnyHash
473
+ )
474
+ end
475
+
476
+ # The property of the price to filter on.
477
+ sig do
478
+ returns(
479
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol
480
+ )
481
+ end
482
+ attr_accessor :field
483
+
484
+ # Should prices that match the filter be included or excluded.
485
+ sig do
486
+ returns(
487
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Operator::TaggedSymbol
488
+ )
489
+ end
490
+ attr_accessor :operator
491
+
492
+ # The IDs or values that match this filter.
493
+ sig { returns(T::Array[String]) }
494
+ attr_accessor :values
495
+
496
+ sig do
497
+ params(
498
+ field:
499
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Field::OrSymbol,
500
+ operator:
501
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Operator::OrSymbol,
502
+ values: T::Array[String]
503
+ ).returns(T.attached_class)
504
+ end
505
+ def self.new(
506
+ # The property of the price to filter on.
507
+ field:,
508
+ # Should prices that match the filter be included or excluded.
509
+ operator:,
510
+ # The IDs or values that match this filter.
511
+ values:
512
+ )
513
+ end
514
+
515
+ sig do
516
+ override.returns(
517
+ {
518
+ field:
519
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol,
520
+ operator:
521
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Operator::TaggedSymbol,
522
+ values: T::Array[String]
523
+ }
524
+ )
525
+ end
526
+ def to_hash
527
+ end
528
+
529
+ # The property of the price to filter on.
530
+ module Field
531
+ extend Orb::Internal::Type::Enum
532
+
533
+ TaggedSymbol =
534
+ T.type_alias do
535
+ T.all(
536
+ Symbol,
537
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Field
538
+ )
539
+ end
540
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
541
+
542
+ PRICE_ID =
543
+ T.let(
544
+ :price_id,
545
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol
546
+ )
547
+ ITEM_ID =
548
+ T.let(
549
+ :item_id,
550
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol
551
+ )
552
+ PRICE_TYPE =
553
+ T.let(
554
+ :price_type,
555
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol
556
+ )
557
+ CURRENCY =
558
+ T.let(
559
+ :currency,
560
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol
561
+ )
562
+ PRICING_UNIT_ID =
563
+ T.let(
564
+ :pricing_unit_id,
565
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol
566
+ )
567
+
568
+ sig do
569
+ override.returns(
570
+ T::Array[
571
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol
572
+ ]
573
+ )
574
+ end
575
+ def self.values
576
+ end
577
+ end
578
+
579
+ # Should prices that match the filter be included or excluded.
580
+ module Operator
581
+ extend Orb::Internal::Type::Enum
582
+
583
+ TaggedSymbol =
584
+ T.type_alias do
585
+ T.all(
586
+ Symbol,
587
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Operator
588
+ )
589
+ end
590
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
591
+
592
+ INCLUDES =
593
+ T.let(
594
+ :includes,
595
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Operator::TaggedSymbol
596
+ )
597
+ EXCLUDES =
598
+ T.let(
599
+ :excludes,
600
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Operator::TaggedSymbol
601
+ )
602
+
603
+ sig do
604
+ override.returns(
605
+ T::Array[
606
+ Orb::PlanVersion::Adjustment::AmountDiscount::Filter::Operator::TaggedSymbol
607
+ ]
608
+ )
609
+ end
610
+ def self.values
611
+ end
612
+ end
613
+ end
614
+ end
615
+
616
+ class PercentageDiscount < Orb::Internal::Type::BaseModel
617
+ OrHash =
618
+ T.type_alias do
619
+ T.any(
620
+ Orb::PlanVersion::Adjustment::PercentageDiscount,
621
+ Orb::Internal::AnyHash
622
+ )
623
+ end
624
+
625
+ sig { returns(String) }
626
+ attr_accessor :id
627
+
628
+ sig { returns(Symbol) }
629
+ attr_accessor :adjustment_type
630
+
631
+ # The price IDs that this adjustment applies to.
632
+ sig { returns(T::Array[String]) }
633
+ attr_accessor :applies_to_price_ids
634
+
635
+ # The filters that determine which prices to apply this adjustment to.
636
+ sig do
637
+ returns(
638
+ T::Array[Orb::PlanVersion::Adjustment::PercentageDiscount::Filter]
639
+ )
640
+ end
641
+ attr_accessor :filters
642
+
643
+ # True for adjustments that apply to an entire invocice, false for adjustments
644
+ # that apply to only one price.
645
+ sig { returns(T::Boolean) }
646
+ attr_accessor :is_invoice_level
647
+
648
+ # The percentage (as a value between 0 and 1) by which to discount the price
649
+ # intervals this adjustment applies to in a given billing period.
650
+ sig { returns(Float) }
651
+ attr_accessor :percentage_discount
652
+
653
+ # The plan phase in which this adjustment is active.
654
+ sig { returns(T.nilable(Integer)) }
655
+ attr_accessor :plan_phase_order
656
+
657
+ # The reason for the adjustment.
658
+ sig { returns(T.nilable(String)) }
659
+ attr_accessor :reason
660
+
661
+ sig do
662
+ params(
663
+ id: String,
664
+ applies_to_price_ids: T::Array[String],
665
+ filters:
666
+ T::Array[
667
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::OrHash
668
+ ],
669
+ is_invoice_level: T::Boolean,
670
+ percentage_discount: Float,
671
+ plan_phase_order: T.nilable(Integer),
672
+ reason: T.nilable(String),
673
+ adjustment_type: Symbol
674
+ ).returns(T.attached_class)
675
+ end
676
+ def self.new(
677
+ id:,
678
+ # The price IDs that this adjustment applies to.
679
+ applies_to_price_ids:,
680
+ # The filters that determine which prices to apply this adjustment to.
681
+ filters:,
682
+ # True for adjustments that apply to an entire invocice, false for adjustments
683
+ # that apply to only one price.
684
+ is_invoice_level:,
685
+ # The percentage (as a value between 0 and 1) by which to discount the price
686
+ # intervals this adjustment applies to in a given billing period.
687
+ percentage_discount:,
688
+ # The plan phase in which this adjustment is active.
689
+ plan_phase_order:,
690
+ # The reason for the adjustment.
691
+ reason:,
692
+ adjustment_type: :percentage_discount
693
+ )
694
+ end
695
+
696
+ sig do
697
+ override.returns(
698
+ {
699
+ id: String,
700
+ adjustment_type: Symbol,
701
+ applies_to_price_ids: T::Array[String],
702
+ filters:
703
+ T::Array[
704
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter
705
+ ],
706
+ is_invoice_level: T::Boolean,
707
+ percentage_discount: Float,
708
+ plan_phase_order: T.nilable(Integer),
709
+ reason: T.nilable(String)
710
+ }
711
+ )
712
+ end
713
+ def to_hash
714
+ end
715
+
716
+ class Filter < Orb::Internal::Type::BaseModel
717
+ OrHash =
718
+ T.type_alias do
719
+ T.any(
720
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter,
721
+ Orb::Internal::AnyHash
722
+ )
723
+ end
724
+
725
+ # The property of the price to filter on.
726
+ sig do
727
+ returns(
728
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol
729
+ )
730
+ end
731
+ attr_accessor :field
732
+
733
+ # Should prices that match the filter be included or excluded.
734
+ sig do
735
+ returns(
736
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Operator::TaggedSymbol
737
+ )
738
+ end
739
+ attr_accessor :operator
740
+
741
+ # The IDs or values that match this filter.
742
+ sig { returns(T::Array[String]) }
743
+ attr_accessor :values
744
+
745
+ sig do
746
+ params(
747
+ field:
748
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Field::OrSymbol,
749
+ operator:
750
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Operator::OrSymbol,
751
+ values: T::Array[String]
752
+ ).returns(T.attached_class)
753
+ end
754
+ def self.new(
755
+ # The property of the price to filter on.
756
+ field:,
757
+ # Should prices that match the filter be included or excluded.
758
+ operator:,
759
+ # The IDs or values that match this filter.
760
+ values:
761
+ )
762
+ end
763
+
764
+ sig do
765
+ override.returns(
766
+ {
767
+ field:
768
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol,
769
+ operator:
770
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Operator::TaggedSymbol,
771
+ values: T::Array[String]
772
+ }
773
+ )
774
+ end
775
+ def to_hash
776
+ end
777
+
778
+ # The property of the price to filter on.
779
+ module Field
780
+ extend Orb::Internal::Type::Enum
781
+
782
+ TaggedSymbol =
783
+ T.type_alias do
784
+ T.all(
785
+ Symbol,
786
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Field
787
+ )
788
+ end
789
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
790
+
791
+ PRICE_ID =
792
+ T.let(
793
+ :price_id,
794
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol
795
+ )
796
+ ITEM_ID =
797
+ T.let(
798
+ :item_id,
799
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol
800
+ )
801
+ PRICE_TYPE =
802
+ T.let(
803
+ :price_type,
804
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol
805
+ )
806
+ CURRENCY =
807
+ T.let(
808
+ :currency,
809
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol
810
+ )
811
+ PRICING_UNIT_ID =
812
+ T.let(
813
+ :pricing_unit_id,
814
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol
815
+ )
816
+
817
+ sig do
818
+ override.returns(
819
+ T::Array[
820
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol
821
+ ]
822
+ )
823
+ end
824
+ def self.values
825
+ end
826
+ end
827
+
828
+ # Should prices that match the filter be included or excluded.
829
+ module Operator
830
+ extend Orb::Internal::Type::Enum
831
+
832
+ TaggedSymbol =
833
+ T.type_alias do
834
+ T.all(
835
+ Symbol,
836
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Operator
837
+ )
838
+ end
839
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
840
+
841
+ INCLUDES =
842
+ T.let(
843
+ :includes,
844
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Operator::TaggedSymbol
845
+ )
846
+ EXCLUDES =
847
+ T.let(
848
+ :excludes,
849
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Operator::TaggedSymbol
850
+ )
851
+
852
+ sig do
853
+ override.returns(
854
+ T::Array[
855
+ Orb::PlanVersion::Adjustment::PercentageDiscount::Filter::Operator::TaggedSymbol
856
+ ]
857
+ )
858
+ end
859
+ def self.values
860
+ end
861
+ end
862
+ end
863
+ end
864
+
865
+ class Minimum < Orb::Internal::Type::BaseModel
866
+ OrHash =
867
+ T.type_alias do
868
+ T.any(
869
+ Orb::PlanVersion::Adjustment::Minimum,
870
+ Orb::Internal::AnyHash
871
+ )
872
+ end
873
+
874
+ sig { returns(String) }
875
+ attr_accessor :id
876
+
877
+ sig { returns(Symbol) }
878
+ attr_accessor :adjustment_type
879
+
880
+ # The price IDs that this adjustment applies to.
881
+ sig { returns(T::Array[String]) }
882
+ attr_accessor :applies_to_price_ids
883
+
884
+ # The filters that determine which prices to apply this adjustment to.
885
+ sig do
886
+ returns(T::Array[Orb::PlanVersion::Adjustment::Minimum::Filter])
887
+ end
888
+ attr_accessor :filters
889
+
890
+ # True for adjustments that apply to an entire invocice, false for adjustments
891
+ # that apply to only one price.
892
+ sig { returns(T::Boolean) }
893
+ attr_accessor :is_invoice_level
894
+
895
+ # The item ID that revenue from this minimum will be attributed to.
896
+ sig { returns(String) }
897
+ attr_accessor :item_id
898
+
899
+ # The minimum amount to charge in a given billing period for the prices this
900
+ # adjustment applies to.
901
+ sig { returns(String) }
902
+ attr_accessor :minimum_amount
903
+
904
+ # The plan phase in which this adjustment is active.
905
+ sig { returns(T.nilable(Integer)) }
906
+ attr_accessor :plan_phase_order
907
+
908
+ # The reason for the adjustment.
909
+ sig { returns(T.nilable(String)) }
910
+ attr_accessor :reason
911
+
912
+ sig do
913
+ params(
914
+ id: String,
915
+ applies_to_price_ids: T::Array[String],
916
+ filters:
917
+ T::Array[Orb::PlanVersion::Adjustment::Minimum::Filter::OrHash],
918
+ is_invoice_level: T::Boolean,
919
+ item_id: String,
920
+ minimum_amount: String,
921
+ plan_phase_order: T.nilable(Integer),
922
+ reason: T.nilable(String),
923
+ adjustment_type: Symbol
924
+ ).returns(T.attached_class)
925
+ end
926
+ def self.new(
927
+ id:,
928
+ # The price IDs that this adjustment applies to.
929
+ applies_to_price_ids:,
930
+ # The filters that determine which prices to apply this adjustment to.
931
+ filters:,
932
+ # True for adjustments that apply to an entire invocice, false for adjustments
933
+ # that apply to only one price.
934
+ is_invoice_level:,
935
+ # The item ID that revenue from this minimum will be attributed to.
936
+ item_id:,
937
+ # The minimum amount to charge in a given billing period for the prices this
938
+ # adjustment applies to.
939
+ minimum_amount:,
940
+ # The plan phase in which this adjustment is active.
941
+ plan_phase_order:,
942
+ # The reason for the adjustment.
943
+ reason:,
944
+ adjustment_type: :minimum
945
+ )
946
+ end
947
+
948
+ sig do
949
+ override.returns(
950
+ {
951
+ id: String,
952
+ adjustment_type: Symbol,
953
+ applies_to_price_ids: T::Array[String],
954
+ filters:
955
+ T::Array[Orb::PlanVersion::Adjustment::Minimum::Filter],
956
+ is_invoice_level: T::Boolean,
957
+ item_id: String,
958
+ minimum_amount: String,
959
+ plan_phase_order: T.nilable(Integer),
960
+ reason: T.nilable(String)
961
+ }
962
+ )
963
+ end
964
+ def to_hash
965
+ end
966
+
967
+ class Filter < Orb::Internal::Type::BaseModel
968
+ OrHash =
969
+ T.type_alias do
970
+ T.any(
971
+ Orb::PlanVersion::Adjustment::Minimum::Filter,
972
+ Orb::Internal::AnyHash
973
+ )
974
+ end
975
+
976
+ # The property of the price to filter on.
977
+ sig do
978
+ returns(
979
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Field::TaggedSymbol
980
+ )
981
+ end
982
+ attr_accessor :field
983
+
984
+ # Should prices that match the filter be included or excluded.
985
+ sig do
986
+ returns(
987
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Operator::TaggedSymbol
988
+ )
989
+ end
990
+ attr_accessor :operator
991
+
992
+ # The IDs or values that match this filter.
993
+ sig { returns(T::Array[String]) }
994
+ attr_accessor :values
995
+
996
+ sig do
997
+ params(
998
+ field:
999
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Field::OrSymbol,
1000
+ operator:
1001
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Operator::OrSymbol,
1002
+ values: T::Array[String]
1003
+ ).returns(T.attached_class)
1004
+ end
1005
+ def self.new(
1006
+ # The property of the price to filter on.
1007
+ field:,
1008
+ # Should prices that match the filter be included or excluded.
1009
+ operator:,
1010
+ # The IDs or values that match this filter.
1011
+ values:
1012
+ )
1013
+ end
1014
+
1015
+ sig do
1016
+ override.returns(
1017
+ {
1018
+ field:
1019
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Field::TaggedSymbol,
1020
+ operator:
1021
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Operator::TaggedSymbol,
1022
+ values: T::Array[String]
1023
+ }
1024
+ )
1025
+ end
1026
+ def to_hash
1027
+ end
1028
+
1029
+ # The property of the price to filter on.
1030
+ module Field
1031
+ extend Orb::Internal::Type::Enum
1032
+
1033
+ TaggedSymbol =
1034
+ T.type_alias do
1035
+ T.all(
1036
+ Symbol,
1037
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Field
1038
+ )
1039
+ end
1040
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1041
+
1042
+ PRICE_ID =
1043
+ T.let(
1044
+ :price_id,
1045
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Field::TaggedSymbol
1046
+ )
1047
+ ITEM_ID =
1048
+ T.let(
1049
+ :item_id,
1050
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Field::TaggedSymbol
1051
+ )
1052
+ PRICE_TYPE =
1053
+ T.let(
1054
+ :price_type,
1055
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Field::TaggedSymbol
1056
+ )
1057
+ CURRENCY =
1058
+ T.let(
1059
+ :currency,
1060
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Field::TaggedSymbol
1061
+ )
1062
+ PRICING_UNIT_ID =
1063
+ T.let(
1064
+ :pricing_unit_id,
1065
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Field::TaggedSymbol
1066
+ )
1067
+
1068
+ sig do
1069
+ override.returns(
1070
+ T::Array[
1071
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Field::TaggedSymbol
1072
+ ]
1073
+ )
1074
+ end
1075
+ def self.values
1076
+ end
1077
+ end
1078
+
1079
+ # Should prices that match the filter be included or excluded.
1080
+ module Operator
1081
+ extend Orb::Internal::Type::Enum
1082
+
1083
+ TaggedSymbol =
1084
+ T.type_alias do
1085
+ T.all(
1086
+ Symbol,
1087
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Operator
1088
+ )
1089
+ end
1090
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1091
+
1092
+ INCLUDES =
1093
+ T.let(
1094
+ :includes,
1095
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Operator::TaggedSymbol
1096
+ )
1097
+ EXCLUDES =
1098
+ T.let(
1099
+ :excludes,
1100
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Operator::TaggedSymbol
1101
+ )
1102
+
1103
+ sig do
1104
+ override.returns(
1105
+ T::Array[
1106
+ Orb::PlanVersion::Adjustment::Minimum::Filter::Operator::TaggedSymbol
1107
+ ]
1108
+ )
1109
+ end
1110
+ def self.values
1111
+ end
1112
+ end
1113
+ end
1114
+ end
1115
+
1116
+ class Maximum < Orb::Internal::Type::BaseModel
1117
+ OrHash =
1118
+ T.type_alias do
1119
+ T.any(
1120
+ Orb::PlanVersion::Adjustment::Maximum,
1121
+ Orb::Internal::AnyHash
1122
+ )
1123
+ end
1124
+
1125
+ sig { returns(String) }
1126
+ attr_accessor :id
1127
+
1128
+ sig { returns(Symbol) }
1129
+ attr_accessor :adjustment_type
1130
+
1131
+ # The price IDs that this adjustment applies to.
1132
+ sig { returns(T::Array[String]) }
1133
+ attr_accessor :applies_to_price_ids
1134
+
1135
+ # The filters that determine which prices to apply this adjustment to.
1136
+ sig do
1137
+ returns(T::Array[Orb::PlanVersion::Adjustment::Maximum::Filter])
1138
+ end
1139
+ attr_accessor :filters
1140
+
1141
+ # True for adjustments that apply to an entire invocice, false for adjustments
1142
+ # that apply to only one price.
1143
+ sig { returns(T::Boolean) }
1144
+ attr_accessor :is_invoice_level
1145
+
1146
+ # The maximum amount to charge in a given billing period for the prices this
1147
+ # adjustment applies to.
1148
+ sig { returns(String) }
1149
+ attr_accessor :maximum_amount
1150
+
1151
+ # The plan phase in which this adjustment is active.
1152
+ sig { returns(T.nilable(Integer)) }
1153
+ attr_accessor :plan_phase_order
1154
+
1155
+ # The reason for the adjustment.
1156
+ sig { returns(T.nilable(String)) }
1157
+ attr_accessor :reason
1158
+
1159
+ sig do
1160
+ params(
1161
+ id: String,
1162
+ applies_to_price_ids: T::Array[String],
1163
+ filters:
1164
+ T::Array[Orb::PlanVersion::Adjustment::Maximum::Filter::OrHash],
1165
+ is_invoice_level: T::Boolean,
1166
+ maximum_amount: String,
1167
+ plan_phase_order: T.nilable(Integer),
1168
+ reason: T.nilable(String),
1169
+ adjustment_type: Symbol
1170
+ ).returns(T.attached_class)
1171
+ end
1172
+ def self.new(
1173
+ id:,
1174
+ # The price IDs that this adjustment applies to.
1175
+ applies_to_price_ids:,
1176
+ # The filters that determine which prices to apply this adjustment to.
1177
+ filters:,
1178
+ # True for adjustments that apply to an entire invocice, false for adjustments
1179
+ # that apply to only one price.
1180
+ is_invoice_level:,
1181
+ # The maximum amount to charge in a given billing period for the prices this
1182
+ # adjustment applies to.
1183
+ maximum_amount:,
1184
+ # The plan phase in which this adjustment is active.
1185
+ plan_phase_order:,
1186
+ # The reason for the adjustment.
1187
+ reason:,
1188
+ adjustment_type: :maximum
1189
+ )
1190
+ end
1191
+
1192
+ sig do
1193
+ override.returns(
1194
+ {
1195
+ id: String,
1196
+ adjustment_type: Symbol,
1197
+ applies_to_price_ids: T::Array[String],
1198
+ filters:
1199
+ T::Array[Orb::PlanVersion::Adjustment::Maximum::Filter],
1200
+ is_invoice_level: T::Boolean,
1201
+ maximum_amount: String,
1202
+ plan_phase_order: T.nilable(Integer),
1203
+ reason: T.nilable(String)
1204
+ }
1205
+ )
1206
+ end
1207
+ def to_hash
1208
+ end
1209
+
1210
+ class Filter < Orb::Internal::Type::BaseModel
1211
+ OrHash =
1212
+ T.type_alias do
1213
+ T.any(
1214
+ Orb::PlanVersion::Adjustment::Maximum::Filter,
1215
+ Orb::Internal::AnyHash
1216
+ )
1217
+ end
1218
+
1219
+ # The property of the price to filter on.
1220
+ sig do
1221
+ returns(
1222
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Field::TaggedSymbol
1223
+ )
1224
+ end
1225
+ attr_accessor :field
1226
+
1227
+ # Should prices that match the filter be included or excluded.
1228
+ sig do
1229
+ returns(
1230
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Operator::TaggedSymbol
1231
+ )
1232
+ end
1233
+ attr_accessor :operator
1234
+
1235
+ # The IDs or values that match this filter.
1236
+ sig { returns(T::Array[String]) }
1237
+ attr_accessor :values
1238
+
1239
+ sig do
1240
+ params(
1241
+ field:
1242
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Field::OrSymbol,
1243
+ operator:
1244
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Operator::OrSymbol,
1245
+ values: T::Array[String]
1246
+ ).returns(T.attached_class)
1247
+ end
1248
+ def self.new(
1249
+ # The property of the price to filter on.
1250
+ field:,
1251
+ # Should prices that match the filter be included or excluded.
1252
+ operator:,
1253
+ # The IDs or values that match this filter.
1254
+ values:
1255
+ )
1256
+ end
1257
+
1258
+ sig do
1259
+ override.returns(
1260
+ {
1261
+ field:
1262
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Field::TaggedSymbol,
1263
+ operator:
1264
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Operator::TaggedSymbol,
1265
+ values: T::Array[String]
1266
+ }
1267
+ )
1268
+ end
1269
+ def to_hash
1270
+ end
1271
+
1272
+ # The property of the price to filter on.
1273
+ module Field
1274
+ extend Orb::Internal::Type::Enum
1275
+
1276
+ TaggedSymbol =
1277
+ T.type_alias do
1278
+ T.all(
1279
+ Symbol,
1280
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Field
1281
+ )
1282
+ end
1283
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1284
+
1285
+ PRICE_ID =
1286
+ T.let(
1287
+ :price_id,
1288
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Field::TaggedSymbol
1289
+ )
1290
+ ITEM_ID =
1291
+ T.let(
1292
+ :item_id,
1293
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Field::TaggedSymbol
1294
+ )
1295
+ PRICE_TYPE =
1296
+ T.let(
1297
+ :price_type,
1298
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Field::TaggedSymbol
1299
+ )
1300
+ CURRENCY =
1301
+ T.let(
1302
+ :currency,
1303
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Field::TaggedSymbol
1304
+ )
1305
+ PRICING_UNIT_ID =
1306
+ T.let(
1307
+ :pricing_unit_id,
1308
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Field::TaggedSymbol
1309
+ )
1310
+
1311
+ sig do
1312
+ override.returns(
1313
+ T::Array[
1314
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Field::TaggedSymbol
1315
+ ]
1316
+ )
1317
+ end
1318
+ def self.values
1319
+ end
1320
+ end
1321
+
1322
+ # Should prices that match the filter be included or excluded.
1323
+ module Operator
1324
+ extend Orb::Internal::Type::Enum
1325
+
1326
+ TaggedSymbol =
1327
+ T.type_alias do
1328
+ T.all(
1329
+ Symbol,
1330
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Operator
1331
+ )
1332
+ end
1333
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1334
+
1335
+ INCLUDES =
1336
+ T.let(
1337
+ :includes,
1338
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Operator::TaggedSymbol
1339
+ )
1340
+ EXCLUDES =
1341
+ T.let(
1342
+ :excludes,
1343
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Operator::TaggedSymbol
1344
+ )
1345
+
1346
+ sig do
1347
+ override.returns(
1348
+ T::Array[
1349
+ Orb::PlanVersion::Adjustment::Maximum::Filter::Operator::TaggedSymbol
1350
+ ]
1351
+ )
1352
+ end
1353
+ def self.values
1354
+ end
1355
+ end
1356
+ end
1357
+ end
1358
+
1359
+ sig do
1360
+ override.returns(T::Array[Orb::PlanVersion::Adjustment::Variants])
1361
+ end
1362
+ def self.variants
1363
+ end
1364
+ end
1365
+ end
1366
+ end
1367
+ end