orb-billing 1.0.1 → 1.2.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 (160) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +1 -1
  4. data/lib/orb/errors.rb +22 -0
  5. data/lib/orb/internal/type/array_of.rb +6 -1
  6. data/lib/orb/internal/type/base_model.rb +79 -25
  7. data/lib/orb/internal/type/boolean.rb +7 -1
  8. data/lib/orb/internal/type/converter.rb +42 -34
  9. data/lib/orb/internal/type/enum.rb +10 -2
  10. data/lib/orb/internal/type/file_input.rb +6 -1
  11. data/lib/orb/internal/type/hash_of.rb +6 -1
  12. data/lib/orb/internal/type/union.rb +12 -7
  13. data/lib/orb/internal/type/unknown.rb +7 -1
  14. data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb +4 -4
  15. data/lib/orb/models/customers/credits/ledger_create_entry_params.rb +4 -4
  16. data/lib/orb/models/invoice.rb +4 -1
  17. data/lib/orb/models/invoice_fetch_upcoming_response.rb +4 -1
  18. data/lib/orb/models/invoice_line_item_create_response.rb +4 -1
  19. data/lib/orb/models/monetary_amount_discount_adjustment.rb +10 -1
  20. data/lib/orb/models/monetary_maximum_adjustment.rb +10 -1
  21. data/lib/orb/models/monetary_minimum_adjustment.rb +10 -1
  22. data/lib/orb/models/monetary_percentage_discount_adjustment.rb +10 -1
  23. data/lib/orb/models/monetary_usage_discount_adjustment.rb +10 -1
  24. data/lib/orb/models/new_plan_bps_price.rb +10 -1
  25. data/lib/orb/models/new_plan_bulk_bps_price.rb +10 -1
  26. data/lib/orb/models/new_plan_bulk_price.rb +10 -1
  27. data/lib/orb/models/new_plan_bulk_with_proration_price.rb +10 -1
  28. data/lib/orb/models/new_plan_cumulative_grouped_bulk_price.rb +10 -1
  29. data/lib/orb/models/new_plan_grouped_allocation_price.rb +10 -1
  30. data/lib/orb/models/new_plan_grouped_tiered_package_price.rb +10 -1
  31. data/lib/orb/models/new_plan_grouped_tiered_price.rb +10 -1
  32. data/lib/orb/models/new_plan_grouped_with_metered_minimum_price.rb +10 -1
  33. data/lib/orb/models/new_plan_grouped_with_prorated_minimum_price.rb +10 -1
  34. data/lib/orb/models/new_plan_matrix_price.rb +10 -1
  35. data/lib/orb/models/new_plan_matrix_with_allocation_price.rb +10 -1
  36. data/lib/orb/models/new_plan_matrix_with_display_name_price.rb +10 -1
  37. data/lib/orb/models/new_plan_max_group_tiered_package_price.rb +10 -1
  38. data/lib/orb/models/new_plan_package_price.rb +10 -1
  39. data/lib/orb/models/new_plan_package_with_allocation_price.rb +10 -1
  40. data/lib/orb/models/new_plan_scalable_matrix_with_tiered_pricing_price.rb +10 -1
  41. data/lib/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rb +10 -1
  42. data/lib/orb/models/new_plan_threshold_total_amount_price.rb +10 -1
  43. data/lib/orb/models/new_plan_tier_with_proration_price.rb +10 -1
  44. data/lib/orb/models/new_plan_tiered_bps_price.rb +10 -1
  45. data/lib/orb/models/new_plan_tiered_package_price.rb +10 -1
  46. data/lib/orb/models/new_plan_tiered_package_with_minimum_price.rb +10 -1
  47. data/lib/orb/models/new_plan_tiered_price.rb +10 -1
  48. data/lib/orb/models/new_plan_tiered_with_minimum_price.rb +10 -1
  49. data/lib/orb/models/new_plan_unit_price.rb +10 -1
  50. data/lib/orb/models/new_plan_unit_with_percent_price.rb +10 -1
  51. data/lib/orb/models/new_plan_unit_with_proration_price.rb +10 -1
  52. data/lib/orb/models/plan_create_params.rb +185 -37
  53. data/lib/orb/models/plan_phase_amount_discount_adjustment.rb +10 -1
  54. data/lib/orb/models/plan_phase_maximum_adjustment.rb +10 -1
  55. data/lib/orb/models/plan_phase_minimum_adjustment.rb +10 -1
  56. data/lib/orb/models/plan_phase_percentage_discount_adjustment.rb +10 -1
  57. data/lib/orb/models/plan_phase_usage_discount_adjustment.rb +10 -1
  58. data/lib/orb/models/price.rb +280 -28
  59. data/lib/orb/resources/customers/credits/ledger.rb +6 -6
  60. data/lib/orb/resources/plans.rb +6 -2
  61. data/lib/orb/version.rb +1 -1
  62. data/rbi/orb/errors.rbi +16 -0
  63. data/rbi/orb/internal/type/boolean.rbi +2 -0
  64. data/rbi/orb/internal/type/converter.rbi +15 -15
  65. data/rbi/orb/internal/type/union.rbi +5 -0
  66. data/rbi/orb/internal/type/unknown.rbi +2 -0
  67. data/rbi/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi +3 -3
  68. data/rbi/orb/models/customers/credits/ledger_create_entry_params.rbi +3 -3
  69. data/rbi/orb/models/invoice.rbi +2 -0
  70. data/rbi/orb/models/invoice_fetch_upcoming_response.rbi +2 -0
  71. data/rbi/orb/models/invoice_line_item_create_response.rbi +2 -0
  72. data/rbi/orb/models/monetary_amount_discount_adjustment.rbi +13 -3
  73. data/rbi/orb/models/monetary_maximum_adjustment.rbi +13 -3
  74. data/rbi/orb/models/monetary_minimum_adjustment.rbi +13 -3
  75. data/rbi/orb/models/monetary_percentage_discount_adjustment.rbi +13 -3
  76. data/rbi/orb/models/monetary_usage_discount_adjustment.rbi +10 -0
  77. data/rbi/orb/models/new_plan_bps_price.rbi +13 -3
  78. data/rbi/orb/models/new_plan_bulk_bps_price.rbi +13 -3
  79. data/rbi/orb/models/new_plan_bulk_price.rbi +13 -3
  80. data/rbi/orb/models/new_plan_bulk_with_proration_price.rbi +13 -3
  81. data/rbi/orb/models/new_plan_cumulative_grouped_bulk_price.rbi +13 -3
  82. data/rbi/orb/models/new_plan_grouped_allocation_price.rbi +13 -3
  83. data/rbi/orb/models/new_plan_grouped_tiered_package_price.rbi +13 -3
  84. data/rbi/orb/models/new_plan_grouped_tiered_price.rbi +13 -3
  85. data/rbi/orb/models/new_plan_grouped_with_metered_minimum_price.rbi +13 -3
  86. data/rbi/orb/models/new_plan_grouped_with_prorated_minimum_price.rbi +13 -3
  87. data/rbi/orb/models/new_plan_matrix_price.rbi +13 -3
  88. data/rbi/orb/models/new_plan_matrix_with_allocation_price.rbi +13 -3
  89. data/rbi/orb/models/new_plan_matrix_with_display_name_price.rbi +13 -3
  90. data/rbi/orb/models/new_plan_max_group_tiered_package_price.rbi +13 -3
  91. data/rbi/orb/models/new_plan_package_price.rbi +13 -3
  92. data/rbi/orb/models/new_plan_package_with_allocation_price.rbi +13 -3
  93. data/rbi/orb/models/new_plan_scalable_matrix_with_tiered_pricing_price.rbi +13 -3
  94. data/rbi/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbi +13 -3
  95. data/rbi/orb/models/new_plan_threshold_total_amount_price.rbi +13 -3
  96. data/rbi/orb/models/new_plan_tier_with_proration_price.rbi +13 -3
  97. data/rbi/orb/models/new_plan_tiered_bps_price.rbi +13 -3
  98. data/rbi/orb/models/new_plan_tiered_package_price.rbi +13 -3
  99. data/rbi/orb/models/new_plan_tiered_package_with_minimum_price.rbi +13 -3
  100. data/rbi/orb/models/new_plan_tiered_price.rbi +13 -3
  101. data/rbi/orb/models/new_plan_tiered_with_minimum_price.rbi +13 -3
  102. data/rbi/orb/models/new_plan_unit_price.rbi +13 -3
  103. data/rbi/orb/models/new_plan_unit_with_percent_price.rbi +13 -3
  104. data/rbi/orb/models/new_plan_unit_with_proration_price.rbi +13 -3
  105. data/rbi/orb/models/plan_create_params.rbi +415 -135
  106. data/rbi/orb/models/plan_phase_amount_discount_adjustment.rbi +13 -3
  107. data/rbi/orb/models/plan_phase_maximum_adjustment.rbi +13 -3
  108. data/rbi/orb/models/plan_phase_minimum_adjustment.rbi +13 -3
  109. data/rbi/orb/models/plan_phase_percentage_discount_adjustment.rbi +13 -3
  110. data/rbi/orb/models/plan_phase_usage_discount_adjustment.rbi +10 -0
  111. data/rbi/orb/models/price.rbi +280 -0
  112. data/rbi/orb/resources/customers/credits/ledger.rbi +6 -6
  113. data/rbi/orb/resources/plans.rbi +11 -33
  114. data/sig/orb/errors.rbs +9 -0
  115. data/sig/orb/internal/type/converter.rbs +7 -1
  116. data/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbs +1 -1
  117. data/sig/orb/models/customers/credits/ledger_create_entry_params.rbs +1 -1
  118. data/sig/orb/models/monetary_amount_discount_adjustment.rbs +8 -3
  119. data/sig/orb/models/monetary_maximum_adjustment.rbs +8 -3
  120. data/sig/orb/models/monetary_minimum_adjustment.rbs +8 -3
  121. data/sig/orb/models/monetary_percentage_discount_adjustment.rbs +8 -3
  122. data/sig/orb/models/monetary_usage_discount_adjustment.rbs +5 -0
  123. data/sig/orb/models/new_plan_bps_price.rbs +8 -3
  124. data/sig/orb/models/new_plan_bulk_bps_price.rbs +8 -3
  125. data/sig/orb/models/new_plan_bulk_price.rbs +8 -3
  126. data/sig/orb/models/new_plan_bulk_with_proration_price.rbs +8 -3
  127. data/sig/orb/models/new_plan_cumulative_grouped_bulk_price.rbs +8 -3
  128. data/sig/orb/models/new_plan_grouped_allocation_price.rbs +8 -3
  129. data/sig/orb/models/new_plan_grouped_tiered_package_price.rbs +8 -3
  130. data/sig/orb/models/new_plan_grouped_tiered_price.rbs +8 -3
  131. data/sig/orb/models/new_plan_grouped_with_metered_minimum_price.rbs +8 -3
  132. data/sig/orb/models/new_plan_grouped_with_prorated_minimum_price.rbs +8 -3
  133. data/sig/orb/models/new_plan_matrix_price.rbs +8 -3
  134. data/sig/orb/models/new_plan_matrix_with_allocation_price.rbs +8 -3
  135. data/sig/orb/models/new_plan_matrix_with_display_name_price.rbs +8 -3
  136. data/sig/orb/models/new_plan_max_group_tiered_package_price.rbs +8 -3
  137. data/sig/orb/models/new_plan_package_price.rbs +8 -3
  138. data/sig/orb/models/new_plan_package_with_allocation_price.rbs +8 -3
  139. data/sig/orb/models/new_plan_scalable_matrix_with_tiered_pricing_price.rbs +8 -3
  140. data/sig/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbs +8 -3
  141. data/sig/orb/models/new_plan_threshold_total_amount_price.rbs +8 -3
  142. data/sig/orb/models/new_plan_tier_with_proration_price.rbs +8 -3
  143. data/sig/orb/models/new_plan_tiered_bps_price.rbs +8 -3
  144. data/sig/orb/models/new_plan_tiered_package_price.rbs +8 -3
  145. data/sig/orb/models/new_plan_tiered_package_with_minimum_price.rbs +8 -3
  146. data/sig/orb/models/new_plan_tiered_price.rbs +8 -3
  147. data/sig/orb/models/new_plan_tiered_with_minimum_price.rbs +8 -3
  148. data/sig/orb/models/new_plan_unit_price.rbs +8 -3
  149. data/sig/orb/models/new_plan_unit_with_percent_price.rbs +8 -3
  150. data/sig/orb/models/new_plan_unit_with_proration_price.rbs +8 -3
  151. data/sig/orb/models/plan_create_params.rbs +156 -37
  152. data/sig/orb/models/plan_phase_amount_discount_adjustment.rbs +8 -3
  153. data/sig/orb/models/plan_phase_maximum_adjustment.rbs +8 -3
  154. data/sig/orb/models/plan_phase_minimum_adjustment.rbs +8 -3
  155. data/sig/orb/models/plan_phase_percentage_discount_adjustment.rbs +8 -3
  156. data/sig/orb/models/plan_phase_usage_discount_adjustment.rbs +5 -0
  157. data/sig/orb/models/price.rbs +140 -0
  158. data/sig/orb/resources/customers/credits/ledger.rbs +2 -2
  159. data/sig/orb/resources/plans.rbs +3 -1
  160. metadata +2 -2
@@ -19,44 +19,14 @@ module Orb
19
19
 
20
20
  # Prices for this plan. If the plan has phases, this includes prices across all
21
21
  # phases of the plan.
22
- sig do
23
- returns(
24
- T::Array[
25
- T.any(
26
- Orb::NewPlanUnitPrice,
27
- Orb::NewPlanPackagePrice,
28
- Orb::NewPlanMatrixPrice,
29
- Orb::NewPlanTieredPrice,
30
- Orb::NewPlanTieredBPSPrice,
31
- Orb::NewPlanBPSPrice,
32
- Orb::NewPlanBulkBPSPrice,
33
- Orb::NewPlanBulkPrice,
34
- Orb::NewPlanThresholdTotalAmountPrice,
35
- Orb::NewPlanTieredPackagePrice,
36
- Orb::NewPlanTieredWithMinimumPrice,
37
- Orb::NewPlanUnitWithPercentPrice,
38
- Orb::NewPlanPackageWithAllocationPrice,
39
- Orb::NewPlanTierWithProrationPrice,
40
- Orb::NewPlanUnitWithProrationPrice,
41
- Orb::NewPlanGroupedAllocationPrice,
42
- Orb::NewPlanGroupedWithProratedMinimumPrice,
43
- Orb::NewPlanGroupedWithMeteredMinimumPrice,
44
- Orb::NewPlanMatrixWithDisplayNamePrice,
45
- Orb::NewPlanBulkWithProrationPrice,
46
- Orb::NewPlanGroupedTieredPackagePrice,
47
- Orb::NewPlanMaxGroupTieredPackagePrice,
48
- Orb::NewPlanScalableMatrixWithUnitPricingPrice,
49
- Orb::NewPlanScalableMatrixWithTieredPricingPrice,
50
- Orb::NewPlanCumulativeGroupedBulkPrice,
51
- Orb::NewPlanTieredPackageWithMinimumPrice,
52
- Orb::NewPlanMatrixWithAllocationPrice,
53
- Orb::NewPlanGroupedTieredPrice
54
- )
55
- ]
56
- )
57
- end
22
+ sig { returns(T::Array[Orb::PlanCreateParams::Price]) }
58
23
  attr_accessor :prices
59
24
 
25
+ # Adjustments for this plan. If the plan has phases, this includes adjustments
26
+ # across all phases of the plan.
27
+ sig { returns(T.nilable(T::Array[Orb::PlanCreateParams::Adjustment])) }
28
+ attr_accessor :adjustments
29
+
60
30
  # Free-form text which is available on the invoice PDF and the Orb invoice portal.
61
31
  sig { returns(T.nilable(String)) }
62
32
  attr_accessor :default_invoice_memo
@@ -76,6 +46,11 @@ module Orb
76
46
  sig { returns(T.nilable(Integer)) }
77
47
  attr_accessor :net_terms
78
48
 
49
+ # Configuration of pre-defined phases, each with their own prices and adjustments.
50
+ # Leave unspecified for plans with a single phase.
51
+ sig { returns(T.nilable(T::Array[Orb::PlanCreateParams::PlanPhase])) }
52
+ attr_accessor :plan_phases
53
+
79
54
  # The status of the plan to create (either active or draft). If not specified,
80
55
  # this defaults to active.
81
56
  sig { returns(T.nilable(Orb::PlanCreateParams::Status::OrSymbol)) }
@@ -88,43 +63,15 @@ module Orb
88
63
  params(
89
64
  currency: String,
90
65
  name: String,
91
- prices:
92
- T::Array[
93
- T.any(
94
- Orb::NewPlanUnitPrice::OrHash,
95
- Orb::NewPlanPackagePrice::OrHash,
96
- Orb::NewPlanMatrixPrice::OrHash,
97
- Orb::NewPlanTieredPrice::OrHash,
98
- Orb::NewPlanTieredBPSPrice::OrHash,
99
- Orb::NewPlanBPSPrice::OrHash,
100
- Orb::NewPlanBulkBPSPrice::OrHash,
101
- Orb::NewPlanBulkPrice::OrHash,
102
- Orb::NewPlanThresholdTotalAmountPrice::OrHash,
103
- Orb::NewPlanTieredPackagePrice::OrHash,
104
- Orb::NewPlanTieredWithMinimumPrice::OrHash,
105
- Orb::NewPlanUnitWithPercentPrice::OrHash,
106
- Orb::NewPlanPackageWithAllocationPrice::OrHash,
107
- Orb::NewPlanTierWithProrationPrice::OrHash,
108
- Orb::NewPlanUnitWithProrationPrice::OrHash,
109
- Orb::NewPlanGroupedAllocationPrice::OrHash,
110
- Orb::NewPlanGroupedWithProratedMinimumPrice::OrHash,
111
- Orb::NewPlanGroupedWithMeteredMinimumPrice::OrHash,
112
- Orb::NewPlanMatrixWithDisplayNamePrice::OrHash,
113
- Orb::NewPlanBulkWithProrationPrice::OrHash,
114
- Orb::NewPlanGroupedTieredPackagePrice::OrHash,
115
- Orb::NewPlanMaxGroupTieredPackagePrice::OrHash,
116
- Orb::NewPlanScalableMatrixWithUnitPricingPrice::OrHash,
117
- Orb::NewPlanScalableMatrixWithTieredPricingPrice::OrHash,
118
- Orb::NewPlanCumulativeGroupedBulkPrice::OrHash,
119
- Orb::NewPlanTieredPackageWithMinimumPrice::OrHash,
120
- Orb::NewPlanMatrixWithAllocationPrice::OrHash,
121
- Orb::NewPlanGroupedTieredPrice::OrHash
122
- )
123
- ],
66
+ prices: T::Array[Orb::PlanCreateParams::Price::OrHash],
67
+ adjustments:
68
+ T.nilable(T::Array[Orb::PlanCreateParams::Adjustment::OrHash]),
124
69
  default_invoice_memo: T.nilable(String),
125
70
  external_plan_id: T.nilable(String),
126
71
  metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
127
72
  net_terms: T.nilable(Integer),
73
+ plan_phases:
74
+ T.nilable(T::Array[Orb::PlanCreateParams::PlanPhase::OrHash]),
128
75
  status: Orb::PlanCreateParams::Status::OrSymbol,
129
76
  request_options: Orb::RequestOptions::OrHash
130
77
  ).returns(T.attached_class)
@@ -137,6 +84,9 @@ module Orb
137
84
  # Prices for this plan. If the plan has phases, this includes prices across all
138
85
  # phases of the plan.
139
86
  prices:,
87
+ # Adjustments for this plan. If the plan has phases, this includes adjustments
88
+ # across all phases of the plan.
89
+ adjustments: nil,
140
90
  # Free-form text which is available on the invoice PDF and the Orb invoice portal.
141
91
  default_invoice_memo: nil,
142
92
  external_plan_id: nil,
@@ -148,6 +98,9 @@ module Orb
148
98
  # date for the invoice. If you intend the invoice to be due on issue, set this
149
99
  # to 0.
150
100
  net_terms: nil,
101
+ # Configuration of pre-defined phases, each with their own prices and adjustments.
102
+ # Leave unspecified for plans with a single phase.
103
+ plan_phases: nil,
151
104
  # The status of the plan to create (either active or draft). If not specified,
152
105
  # this defaults to active.
153
106
  status: nil,
@@ -160,43 +113,13 @@ module Orb
160
113
  {
161
114
  currency: String,
162
115
  name: String,
163
- prices:
164
- T::Array[
165
- T.any(
166
- Orb::NewPlanUnitPrice,
167
- Orb::NewPlanPackagePrice,
168
- Orb::NewPlanMatrixPrice,
169
- Orb::NewPlanTieredPrice,
170
- Orb::NewPlanTieredBPSPrice,
171
- Orb::NewPlanBPSPrice,
172
- Orb::NewPlanBulkBPSPrice,
173
- Orb::NewPlanBulkPrice,
174
- Orb::NewPlanThresholdTotalAmountPrice,
175
- Orb::NewPlanTieredPackagePrice,
176
- Orb::NewPlanTieredWithMinimumPrice,
177
- Orb::NewPlanUnitWithPercentPrice,
178
- Orb::NewPlanPackageWithAllocationPrice,
179
- Orb::NewPlanTierWithProrationPrice,
180
- Orb::NewPlanUnitWithProrationPrice,
181
- Orb::NewPlanGroupedAllocationPrice,
182
- Orb::NewPlanGroupedWithProratedMinimumPrice,
183
- Orb::NewPlanGroupedWithMeteredMinimumPrice,
184
- Orb::NewPlanMatrixWithDisplayNamePrice,
185
- Orb::NewPlanBulkWithProrationPrice,
186
- Orb::NewPlanGroupedTieredPackagePrice,
187
- Orb::NewPlanMaxGroupTieredPackagePrice,
188
- Orb::NewPlanScalableMatrixWithUnitPricingPrice,
189
- Orb::NewPlanScalableMatrixWithTieredPricingPrice,
190
- Orb::NewPlanCumulativeGroupedBulkPrice,
191
- Orb::NewPlanTieredPackageWithMinimumPrice,
192
- Orb::NewPlanMatrixWithAllocationPrice,
193
- Orb::NewPlanGroupedTieredPrice
194
- )
195
- ],
116
+ prices: T::Array[Orb::PlanCreateParams::Price],
117
+ adjustments: T.nilable(T::Array[Orb::PlanCreateParams::Adjustment]),
196
118
  default_invoice_memo: T.nilable(String),
197
119
  external_plan_id: T.nilable(String),
198
120
  metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
199
121
  net_terms: T.nilable(Integer),
122
+ plan_phases: T.nilable(T::Array[Orb::PlanCreateParams::PlanPhase]),
200
123
  status: Orb::PlanCreateParams::Status::OrSymbol,
201
124
  request_options: Orb::RequestOptions
202
125
  }
@@ -205,47 +128,404 @@ module Orb
205
128
  def to_hash
206
129
  end
207
130
 
208
- module Price
209
- extend Orb::Internal::Type::Union
131
+ class Price < Orb::Internal::Type::BaseModel
132
+ OrHash =
133
+ T.type_alias do
134
+ T.any(Orb::PlanCreateParams::Price, Orb::Internal::AnyHash)
135
+ end
136
+
137
+ # The allocation price to add to the plan.
138
+ sig { returns(T.nilable(Orb::NewAllocationPrice)) }
139
+ attr_reader :allocation_price
140
+
141
+ sig do
142
+ params(
143
+ allocation_price: T.nilable(Orb::NewAllocationPrice::OrHash)
144
+ ).void
145
+ end
146
+ attr_writer :allocation_price
147
+
148
+ # The phase to add this price to.
149
+ sig { returns(T.nilable(Integer)) }
150
+ attr_accessor :plan_phase_order
151
+
152
+ # The price to add to the plan
153
+ sig do
154
+ returns(
155
+ T.nilable(
156
+ T.any(
157
+ Orb::NewPlanUnitPrice,
158
+ Orb::NewPlanPackagePrice,
159
+ Orb::NewPlanMatrixPrice,
160
+ Orb::NewPlanTieredPrice,
161
+ Orb::NewPlanTieredBPSPrice,
162
+ Orb::NewPlanBPSPrice,
163
+ Orb::NewPlanBulkBPSPrice,
164
+ Orb::NewPlanBulkPrice,
165
+ Orb::NewPlanThresholdTotalAmountPrice,
166
+ Orb::NewPlanTieredPackagePrice,
167
+ Orb::NewPlanTieredWithMinimumPrice,
168
+ Orb::NewPlanUnitWithPercentPrice,
169
+ Orb::NewPlanPackageWithAllocationPrice,
170
+ Orb::NewPlanTierWithProrationPrice,
171
+ Orb::NewPlanUnitWithProrationPrice,
172
+ Orb::NewPlanGroupedAllocationPrice,
173
+ Orb::NewPlanGroupedWithProratedMinimumPrice,
174
+ Orb::NewPlanGroupedWithMeteredMinimumPrice,
175
+ Orb::NewPlanMatrixWithDisplayNamePrice,
176
+ Orb::NewPlanBulkWithProrationPrice,
177
+ Orb::NewPlanGroupedTieredPackagePrice,
178
+ Orb::NewPlanMaxGroupTieredPackagePrice,
179
+ Orb::NewPlanScalableMatrixWithUnitPricingPrice,
180
+ Orb::NewPlanScalableMatrixWithTieredPricingPrice,
181
+ Orb::NewPlanCumulativeGroupedBulkPrice,
182
+ Orb::NewPlanTieredPackageWithMinimumPrice,
183
+ Orb::NewPlanMatrixWithAllocationPrice,
184
+ Orb::NewPlanGroupedTieredPrice
185
+ )
186
+ )
187
+ )
188
+ end
189
+ attr_accessor :price
190
+
191
+ sig do
192
+ params(
193
+ allocation_price: T.nilable(Orb::NewAllocationPrice::OrHash),
194
+ plan_phase_order: T.nilable(Integer),
195
+ price:
196
+ T.nilable(
197
+ T.any(
198
+ Orb::NewPlanUnitPrice::OrHash,
199
+ Orb::NewPlanPackagePrice::OrHash,
200
+ Orb::NewPlanMatrixPrice::OrHash,
201
+ Orb::NewPlanTieredPrice::OrHash,
202
+ Orb::NewPlanTieredBPSPrice::OrHash,
203
+ Orb::NewPlanBPSPrice::OrHash,
204
+ Orb::NewPlanBulkBPSPrice::OrHash,
205
+ Orb::NewPlanBulkPrice::OrHash,
206
+ Orb::NewPlanThresholdTotalAmountPrice::OrHash,
207
+ Orb::NewPlanTieredPackagePrice::OrHash,
208
+ Orb::NewPlanTieredWithMinimumPrice::OrHash,
209
+ Orb::NewPlanUnitWithPercentPrice::OrHash,
210
+ Orb::NewPlanPackageWithAllocationPrice::OrHash,
211
+ Orb::NewPlanTierWithProrationPrice::OrHash,
212
+ Orb::NewPlanUnitWithProrationPrice::OrHash,
213
+ Orb::NewPlanGroupedAllocationPrice::OrHash,
214
+ Orb::NewPlanGroupedWithProratedMinimumPrice::OrHash,
215
+ Orb::NewPlanGroupedWithMeteredMinimumPrice::OrHash,
216
+ Orb::NewPlanMatrixWithDisplayNamePrice::OrHash,
217
+ Orb::NewPlanBulkWithProrationPrice::OrHash,
218
+ Orb::NewPlanGroupedTieredPackagePrice::OrHash,
219
+ Orb::NewPlanMaxGroupTieredPackagePrice::OrHash,
220
+ Orb::NewPlanScalableMatrixWithUnitPricingPrice::OrHash,
221
+ Orb::NewPlanScalableMatrixWithTieredPricingPrice::OrHash,
222
+ Orb::NewPlanCumulativeGroupedBulkPrice::OrHash,
223
+ Orb::NewPlanTieredPackageWithMinimumPrice::OrHash,
224
+ Orb::NewPlanMatrixWithAllocationPrice::OrHash,
225
+ Orb::NewPlanGroupedTieredPrice::OrHash
226
+ )
227
+ )
228
+ ).returns(T.attached_class)
229
+ end
230
+ def self.new(
231
+ # The allocation price to add to the plan.
232
+ allocation_price: nil,
233
+ # The phase to add this price to.
234
+ plan_phase_order: nil,
235
+ # The price to add to the plan
236
+ price: nil
237
+ )
238
+ end
239
+
240
+ sig do
241
+ override.returns(
242
+ {
243
+ allocation_price: T.nilable(Orb::NewAllocationPrice),
244
+ plan_phase_order: T.nilable(Integer),
245
+ price:
246
+ T.nilable(
247
+ T.any(
248
+ Orb::NewPlanUnitPrice,
249
+ Orb::NewPlanPackagePrice,
250
+ Orb::NewPlanMatrixPrice,
251
+ Orb::NewPlanTieredPrice,
252
+ Orb::NewPlanTieredBPSPrice,
253
+ Orb::NewPlanBPSPrice,
254
+ Orb::NewPlanBulkBPSPrice,
255
+ Orb::NewPlanBulkPrice,
256
+ Orb::NewPlanThresholdTotalAmountPrice,
257
+ Orb::NewPlanTieredPackagePrice,
258
+ Orb::NewPlanTieredWithMinimumPrice,
259
+ Orb::NewPlanUnitWithPercentPrice,
260
+ Orb::NewPlanPackageWithAllocationPrice,
261
+ Orb::NewPlanTierWithProrationPrice,
262
+ Orb::NewPlanUnitWithProrationPrice,
263
+ Orb::NewPlanGroupedAllocationPrice,
264
+ Orb::NewPlanGroupedWithProratedMinimumPrice,
265
+ Orb::NewPlanGroupedWithMeteredMinimumPrice,
266
+ Orb::NewPlanMatrixWithDisplayNamePrice,
267
+ Orb::NewPlanBulkWithProrationPrice,
268
+ Orb::NewPlanGroupedTieredPackagePrice,
269
+ Orb::NewPlanMaxGroupTieredPackagePrice,
270
+ Orb::NewPlanScalableMatrixWithUnitPricingPrice,
271
+ Orb::NewPlanScalableMatrixWithTieredPricingPrice,
272
+ Orb::NewPlanCumulativeGroupedBulkPrice,
273
+ Orb::NewPlanTieredPackageWithMinimumPrice,
274
+ Orb::NewPlanMatrixWithAllocationPrice,
275
+ Orb::NewPlanGroupedTieredPrice
276
+ )
277
+ )
278
+ }
279
+ )
280
+ end
281
+ def to_hash
282
+ end
283
+
284
+ # The price to add to the plan
285
+ module Price
286
+ extend Orb::Internal::Type::Union
210
287
 
211
- Variants =
288
+ Variants =
289
+ T.type_alias do
290
+ T.any(
291
+ Orb::NewPlanUnitPrice,
292
+ Orb::NewPlanPackagePrice,
293
+ Orb::NewPlanMatrixPrice,
294
+ Orb::NewPlanTieredPrice,
295
+ Orb::NewPlanTieredBPSPrice,
296
+ Orb::NewPlanBPSPrice,
297
+ Orb::NewPlanBulkBPSPrice,
298
+ Orb::NewPlanBulkPrice,
299
+ Orb::NewPlanThresholdTotalAmountPrice,
300
+ Orb::NewPlanTieredPackagePrice,
301
+ Orb::NewPlanTieredWithMinimumPrice,
302
+ Orb::NewPlanUnitWithPercentPrice,
303
+ Orb::NewPlanPackageWithAllocationPrice,
304
+ Orb::NewPlanTierWithProrationPrice,
305
+ Orb::NewPlanUnitWithProrationPrice,
306
+ Orb::NewPlanGroupedAllocationPrice,
307
+ Orb::NewPlanGroupedWithProratedMinimumPrice,
308
+ Orb::NewPlanGroupedWithMeteredMinimumPrice,
309
+ Orb::NewPlanMatrixWithDisplayNamePrice,
310
+ Orb::NewPlanBulkWithProrationPrice,
311
+ Orb::NewPlanGroupedTieredPackagePrice,
312
+ Orb::NewPlanMaxGroupTieredPackagePrice,
313
+ Orb::NewPlanScalableMatrixWithUnitPricingPrice,
314
+ Orb::NewPlanScalableMatrixWithTieredPricingPrice,
315
+ Orb::NewPlanCumulativeGroupedBulkPrice,
316
+ Orb::NewPlanTieredPackageWithMinimumPrice,
317
+ Orb::NewPlanMatrixWithAllocationPrice,
318
+ Orb::NewPlanGroupedTieredPrice
319
+ )
320
+ end
321
+
322
+ sig do
323
+ override.returns(
324
+ T::Array[Orb::PlanCreateParams::Price::Price::Variants]
325
+ )
326
+ end
327
+ def self.variants
328
+ end
329
+ end
330
+ end
331
+
332
+ class Adjustment < Orb::Internal::Type::BaseModel
333
+ OrHash =
212
334
  T.type_alias do
335
+ T.any(Orb::PlanCreateParams::Adjustment, Orb::Internal::AnyHash)
336
+ end
337
+
338
+ # The definition of a new adjustment to create and add to the plan.
339
+ sig do
340
+ returns(
213
341
  T.any(
214
- Orb::NewPlanUnitPrice,
215
- Orb::NewPlanPackagePrice,
216
- Orb::NewPlanMatrixPrice,
217
- Orb::NewPlanTieredPrice,
218
- Orb::NewPlanTieredBPSPrice,
219
- Orb::NewPlanBPSPrice,
220
- Orb::NewPlanBulkBPSPrice,
221
- Orb::NewPlanBulkPrice,
222
- Orb::NewPlanThresholdTotalAmountPrice,
223
- Orb::NewPlanTieredPackagePrice,
224
- Orb::NewPlanTieredWithMinimumPrice,
225
- Orb::NewPlanUnitWithPercentPrice,
226
- Orb::NewPlanPackageWithAllocationPrice,
227
- Orb::NewPlanTierWithProrationPrice,
228
- Orb::NewPlanUnitWithProrationPrice,
229
- Orb::NewPlanGroupedAllocationPrice,
230
- Orb::NewPlanGroupedWithProratedMinimumPrice,
231
- Orb::NewPlanGroupedWithMeteredMinimumPrice,
232
- Orb::NewPlanMatrixWithDisplayNamePrice,
233
- Orb::NewPlanBulkWithProrationPrice,
234
- Orb::NewPlanGroupedTieredPackagePrice,
235
- Orb::NewPlanMaxGroupTieredPackagePrice,
236
- Orb::NewPlanScalableMatrixWithUnitPricingPrice,
237
- Orb::NewPlanScalableMatrixWithTieredPricingPrice,
238
- Orb::NewPlanCumulativeGroupedBulkPrice,
239
- Orb::NewPlanTieredPackageWithMinimumPrice,
240
- Orb::NewPlanMatrixWithAllocationPrice,
241
- Orb::NewPlanGroupedTieredPrice
342
+ Orb::NewPercentageDiscount,
343
+ Orb::NewUsageDiscount,
344
+ Orb::NewAmountDiscount,
345
+ Orb::NewMinimum,
346
+ Orb::NewMaximum
347
+ )
348
+ )
349
+ end
350
+ attr_accessor :adjustment
351
+
352
+ # The phase to add this adjustment to.
353
+ sig { returns(T.nilable(Integer)) }
354
+ attr_accessor :plan_phase_order
355
+
356
+ sig do
357
+ params(
358
+ adjustment:
359
+ T.any(
360
+ Orb::NewPercentageDiscount::OrHash,
361
+ Orb::NewUsageDiscount::OrHash,
362
+ Orb::NewAmountDiscount::OrHash,
363
+ Orb::NewMinimum::OrHash,
364
+ Orb::NewMaximum::OrHash
365
+ ),
366
+ plan_phase_order: T.nilable(Integer)
367
+ ).returns(T.attached_class)
368
+ end
369
+ def self.new(
370
+ # The definition of a new adjustment to create and add to the plan.
371
+ adjustment:,
372
+ # The phase to add this adjustment to.
373
+ plan_phase_order: nil
374
+ )
375
+ end
376
+
377
+ sig do
378
+ override.returns(
379
+ {
380
+ adjustment:
381
+ T.any(
382
+ Orb::NewPercentageDiscount,
383
+ Orb::NewUsageDiscount,
384
+ Orb::NewAmountDiscount,
385
+ Orb::NewMinimum,
386
+ Orb::NewMaximum
387
+ ),
388
+ plan_phase_order: T.nilable(Integer)
389
+ }
390
+ )
391
+ end
392
+ def to_hash
393
+ end
394
+
395
+ # The definition of a new adjustment to create and add to the plan.
396
+ module Adjustment
397
+ extend Orb::Internal::Type::Union
398
+
399
+ Variants =
400
+ T.type_alias do
401
+ T.any(
402
+ Orb::NewPercentageDiscount,
403
+ Orb::NewUsageDiscount,
404
+ Orb::NewAmountDiscount,
405
+ Orb::NewMinimum,
406
+ Orb::NewMaximum
407
+ )
408
+ end
409
+
410
+ sig do
411
+ override.returns(
412
+ T::Array[Orb::PlanCreateParams::Adjustment::Adjustment::Variants]
242
413
  )
243
414
  end
415
+ def self.variants
416
+ end
417
+ end
418
+ end
419
+
420
+ class PlanPhase < Orb::Internal::Type::BaseModel
421
+ OrHash =
422
+ T.type_alias do
423
+ T.any(Orb::PlanCreateParams::PlanPhase, Orb::Internal::AnyHash)
424
+ end
425
+
426
+ # Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
427
+ sig { returns(Integer) }
428
+ attr_accessor :order
429
+
430
+ # Align billing cycle day with phase start date.
431
+ sig { returns(T.nilable(T::Boolean)) }
432
+ attr_accessor :align_billing_with_phase_start_date
433
+
434
+ # How many terms of length `duration_unit` this phase is active for. If null, this
435
+ # phase is evergreen and active indefinitely
436
+ sig { returns(T.nilable(Integer)) }
437
+ attr_accessor :duration
438
+
439
+ sig do
440
+ returns(
441
+ T.nilable(Orb::PlanCreateParams::PlanPhase::DurationUnit::OrSymbol)
442
+ )
443
+ end
444
+ attr_accessor :duration_unit
445
+
446
+ sig do
447
+ params(
448
+ order: Integer,
449
+ align_billing_with_phase_start_date: T.nilable(T::Boolean),
450
+ duration: T.nilable(Integer),
451
+ duration_unit:
452
+ T.nilable(
453
+ Orb::PlanCreateParams::PlanPhase::DurationUnit::OrSymbol
454
+ )
455
+ ).returns(T.attached_class)
456
+ end
457
+ def self.new(
458
+ # Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
459
+ order:,
460
+ # Align billing cycle day with phase start date.
461
+ align_billing_with_phase_start_date: nil,
462
+ # How many terms of length `duration_unit` this phase is active for. If null, this
463
+ # phase is evergreen and active indefinitely
464
+ duration: nil,
465
+ duration_unit: nil
466
+ )
467
+ end
244
468
 
245
469
  sig do
246
- override.returns(T::Array[Orb::PlanCreateParams::Price::Variants])
470
+ override.returns(
471
+ {
472
+ order: Integer,
473
+ align_billing_with_phase_start_date: T.nilable(T::Boolean),
474
+ duration: T.nilable(Integer),
475
+ duration_unit:
476
+ T.nilable(
477
+ Orb::PlanCreateParams::PlanPhase::DurationUnit::OrSymbol
478
+ )
479
+ }
480
+ )
247
481
  end
248
- def self.variants
482
+ def to_hash
483
+ end
484
+
485
+ module DurationUnit
486
+ extend Orb::Internal::Type::Enum
487
+
488
+ TaggedSymbol =
489
+ T.type_alias do
490
+ T.all(Symbol, Orb::PlanCreateParams::PlanPhase::DurationUnit)
491
+ end
492
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
493
+
494
+ DAILY =
495
+ T.let(
496
+ :daily,
497
+ Orb::PlanCreateParams::PlanPhase::DurationUnit::TaggedSymbol
498
+ )
499
+ MONTHLY =
500
+ T.let(
501
+ :monthly,
502
+ Orb::PlanCreateParams::PlanPhase::DurationUnit::TaggedSymbol
503
+ )
504
+ QUARTERLY =
505
+ T.let(
506
+ :quarterly,
507
+ Orb::PlanCreateParams::PlanPhase::DurationUnit::TaggedSymbol
508
+ )
509
+ SEMI_ANNUAL =
510
+ T.let(
511
+ :semi_annual,
512
+ Orb::PlanCreateParams::PlanPhase::DurationUnit::TaggedSymbol
513
+ )
514
+ ANNUAL =
515
+ T.let(
516
+ :annual,
517
+ Orb::PlanCreateParams::PlanPhase::DurationUnit::TaggedSymbol
518
+ )
519
+
520
+ sig do
521
+ override.returns(
522
+ T::Array[
523
+ Orb::PlanCreateParams::PlanPhase::DurationUnit::TaggedSymbol
524
+ ]
525
+ )
526
+ end
527
+ def self.values
528
+ end
249
529
  end
250
530
  end
251
531
 
@@ -44,6 +44,11 @@ module Orb
44
44
  sig { returns(T.nilable(String)) }
45
45
  attr_accessor :reason
46
46
 
47
+ # The adjustment id this adjustment replaces. This adjustment will take the place
48
+ # of the replaced adjustment in plan version migrations.
49
+ sig { returns(T.nilable(String)) }
50
+ attr_accessor :replaces_adjustment_id
51
+
47
52
  sig do
48
53
  params(
49
54
  id: String,
@@ -54,7 +59,8 @@ module Orb
54
59
  filters: T::Array[Orb::TransformPriceFilter::OrHash],
55
60
  is_invoice_level: T::Boolean,
56
61
  plan_phase_order: T.nilable(Integer),
57
- reason: T.nilable(String)
62
+ reason: T.nilable(String),
63
+ replaces_adjustment_id: T.nilable(String)
58
64
  ).returns(T.attached_class)
59
65
  end
60
66
  def self.new(
@@ -73,7 +79,10 @@ module Orb
73
79
  # The plan phase in which this adjustment is active.
74
80
  plan_phase_order:,
75
81
  # The reason for the adjustment.
76
- reason:
82
+ reason:,
83
+ # The adjustment id this adjustment replaces. This adjustment will take the place
84
+ # of the replaced adjustment in plan version migrations.
85
+ replaces_adjustment_id:
77
86
  )
78
87
  end
79
88
 
@@ -88,7 +97,8 @@ module Orb
88
97
  filters: T::Array[Orb::TransformPriceFilter],
89
98
  is_invoice_level: T::Boolean,
90
99
  plan_phase_order: T.nilable(Integer),
91
- reason: T.nilable(String)
100
+ reason: T.nilable(String),
101
+ replaces_adjustment_id: T.nilable(String)
92
102
  }
93
103
  )
94
104
  end
@@ -42,6 +42,11 @@ module Orb
42
42
  sig { returns(T.nilable(String)) }
43
43
  attr_accessor :reason
44
44
 
45
+ # The adjustment id this adjustment replaces. This adjustment will take the place
46
+ # of the replaced adjustment in plan version migrations.
47
+ sig { returns(T.nilable(String)) }
48
+ attr_accessor :replaces_adjustment_id
49
+
45
50
  sig do
46
51
  params(
47
52
  id: String,
@@ -52,7 +57,8 @@ module Orb
52
57
  is_invoice_level: T::Boolean,
53
58
  maximum_amount: String,
54
59
  plan_phase_order: T.nilable(Integer),
55
- reason: T.nilable(String)
60
+ reason: T.nilable(String),
61
+ replaces_adjustment_id: T.nilable(String)
56
62
  ).returns(T.attached_class)
57
63
  end
58
64
  def self.new(
@@ -71,7 +77,10 @@ module Orb
71
77
  # The plan phase in which this adjustment is active.
72
78
  plan_phase_order:,
73
79
  # The reason for the adjustment.
74
- reason:
80
+ reason:,
81
+ # The adjustment id this adjustment replaces. This adjustment will take the place
82
+ # of the replaced adjustment in plan version migrations.
83
+ replaces_adjustment_id:
75
84
  )
76
85
  end
77
86
 
@@ -86,7 +95,8 @@ module Orb
86
95
  is_invoice_level: T::Boolean,
87
96
  maximum_amount: String,
88
97
  plan_phase_order: T.nilable(Integer),
89
- reason: T.nilable(String)
98
+ reason: T.nilable(String),
99
+ replaces_adjustment_id: T.nilable(String)
90
100
  }
91
101
  )
92
102
  end