orb-billing 1.0.1 → 1.1.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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -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/new_plan_bps_price.rb +10 -1
  20. data/lib/orb/models/new_plan_bulk_bps_price.rb +10 -1
  21. data/lib/orb/models/new_plan_bulk_price.rb +10 -1
  22. data/lib/orb/models/new_plan_bulk_with_proration_price.rb +10 -1
  23. data/lib/orb/models/new_plan_cumulative_grouped_bulk_price.rb +10 -1
  24. data/lib/orb/models/new_plan_grouped_allocation_price.rb +10 -1
  25. data/lib/orb/models/new_plan_grouped_tiered_package_price.rb +10 -1
  26. data/lib/orb/models/new_plan_grouped_tiered_price.rb +10 -1
  27. data/lib/orb/models/new_plan_grouped_with_metered_minimum_price.rb +10 -1
  28. data/lib/orb/models/new_plan_grouped_with_prorated_minimum_price.rb +10 -1
  29. data/lib/orb/models/new_plan_matrix_price.rb +10 -1
  30. data/lib/orb/models/new_plan_matrix_with_allocation_price.rb +10 -1
  31. data/lib/orb/models/new_plan_matrix_with_display_name_price.rb +10 -1
  32. data/lib/orb/models/new_plan_max_group_tiered_package_price.rb +10 -1
  33. data/lib/orb/models/new_plan_package_price.rb +10 -1
  34. data/lib/orb/models/new_plan_package_with_allocation_price.rb +10 -1
  35. data/lib/orb/models/new_plan_scalable_matrix_with_tiered_pricing_price.rb +10 -1
  36. data/lib/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rb +10 -1
  37. data/lib/orb/models/new_plan_threshold_total_amount_price.rb +10 -1
  38. data/lib/orb/models/new_plan_tier_with_proration_price.rb +10 -1
  39. data/lib/orb/models/new_plan_tiered_bps_price.rb +10 -1
  40. data/lib/orb/models/new_plan_tiered_package_price.rb +10 -1
  41. data/lib/orb/models/new_plan_tiered_package_with_minimum_price.rb +10 -1
  42. data/lib/orb/models/new_plan_tiered_price.rb +10 -1
  43. data/lib/orb/models/new_plan_tiered_with_minimum_price.rb +10 -1
  44. data/lib/orb/models/new_plan_unit_price.rb +10 -1
  45. data/lib/orb/models/new_plan_unit_with_percent_price.rb +10 -1
  46. data/lib/orb/models/new_plan_unit_with_proration_price.rb +10 -1
  47. data/lib/orb/models/plan_create_params.rb +185 -37
  48. data/lib/orb/resources/customers/credits/ledger.rb +6 -6
  49. data/lib/orb/resources/plans.rb +6 -2
  50. data/lib/orb/version.rb +1 -1
  51. data/rbi/orb/errors.rbi +16 -0
  52. data/rbi/orb/internal/type/boolean.rbi +2 -0
  53. data/rbi/orb/internal/type/converter.rbi +15 -15
  54. data/rbi/orb/internal/type/union.rbi +5 -0
  55. data/rbi/orb/internal/type/unknown.rbi +2 -0
  56. data/rbi/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi +3 -3
  57. data/rbi/orb/models/customers/credits/ledger_create_entry_params.rbi +3 -3
  58. data/rbi/orb/models/invoice.rbi +2 -0
  59. data/rbi/orb/models/invoice_fetch_upcoming_response.rbi +2 -0
  60. data/rbi/orb/models/invoice_line_item_create_response.rbi +2 -0
  61. data/rbi/orb/models/new_plan_bps_price.rbi +13 -3
  62. data/rbi/orb/models/new_plan_bulk_bps_price.rbi +13 -3
  63. data/rbi/orb/models/new_plan_bulk_price.rbi +13 -3
  64. data/rbi/orb/models/new_plan_bulk_with_proration_price.rbi +13 -3
  65. data/rbi/orb/models/new_plan_cumulative_grouped_bulk_price.rbi +13 -3
  66. data/rbi/orb/models/new_plan_grouped_allocation_price.rbi +13 -3
  67. data/rbi/orb/models/new_plan_grouped_tiered_package_price.rbi +13 -3
  68. data/rbi/orb/models/new_plan_grouped_tiered_price.rbi +13 -3
  69. data/rbi/orb/models/new_plan_grouped_with_metered_minimum_price.rbi +13 -3
  70. data/rbi/orb/models/new_plan_grouped_with_prorated_minimum_price.rbi +13 -3
  71. data/rbi/orb/models/new_plan_matrix_price.rbi +13 -3
  72. data/rbi/orb/models/new_plan_matrix_with_allocation_price.rbi +13 -3
  73. data/rbi/orb/models/new_plan_matrix_with_display_name_price.rbi +13 -3
  74. data/rbi/orb/models/new_plan_max_group_tiered_package_price.rbi +13 -3
  75. data/rbi/orb/models/new_plan_package_price.rbi +13 -3
  76. data/rbi/orb/models/new_plan_package_with_allocation_price.rbi +13 -3
  77. data/rbi/orb/models/new_plan_scalable_matrix_with_tiered_pricing_price.rbi +13 -3
  78. data/rbi/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbi +13 -3
  79. data/rbi/orb/models/new_plan_threshold_total_amount_price.rbi +13 -3
  80. data/rbi/orb/models/new_plan_tier_with_proration_price.rbi +13 -3
  81. data/rbi/orb/models/new_plan_tiered_bps_price.rbi +13 -3
  82. data/rbi/orb/models/new_plan_tiered_package_price.rbi +13 -3
  83. data/rbi/orb/models/new_plan_tiered_package_with_minimum_price.rbi +13 -3
  84. data/rbi/orb/models/new_plan_tiered_price.rbi +13 -3
  85. data/rbi/orb/models/new_plan_tiered_with_minimum_price.rbi +13 -3
  86. data/rbi/orb/models/new_plan_unit_price.rbi +13 -3
  87. data/rbi/orb/models/new_plan_unit_with_percent_price.rbi +13 -3
  88. data/rbi/orb/models/new_plan_unit_with_proration_price.rbi +13 -3
  89. data/rbi/orb/models/plan_create_params.rbi +415 -135
  90. data/rbi/orb/resources/customers/credits/ledger.rbi +6 -6
  91. data/rbi/orb/resources/plans.rbi +11 -33
  92. data/sig/orb/errors.rbs +9 -0
  93. data/sig/orb/internal/type/converter.rbs +7 -1
  94. data/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbs +1 -1
  95. data/sig/orb/models/customers/credits/ledger_create_entry_params.rbs +1 -1
  96. data/sig/orb/models/new_plan_bps_price.rbs +8 -3
  97. data/sig/orb/models/new_plan_bulk_bps_price.rbs +8 -3
  98. data/sig/orb/models/new_plan_bulk_price.rbs +8 -3
  99. data/sig/orb/models/new_plan_bulk_with_proration_price.rbs +8 -3
  100. data/sig/orb/models/new_plan_cumulative_grouped_bulk_price.rbs +8 -3
  101. data/sig/orb/models/new_plan_grouped_allocation_price.rbs +8 -3
  102. data/sig/orb/models/new_plan_grouped_tiered_package_price.rbs +8 -3
  103. data/sig/orb/models/new_plan_grouped_tiered_price.rbs +8 -3
  104. data/sig/orb/models/new_plan_grouped_with_metered_minimum_price.rbs +8 -3
  105. data/sig/orb/models/new_plan_grouped_with_prorated_minimum_price.rbs +8 -3
  106. data/sig/orb/models/new_plan_matrix_price.rbs +8 -3
  107. data/sig/orb/models/new_plan_matrix_with_allocation_price.rbs +8 -3
  108. data/sig/orb/models/new_plan_matrix_with_display_name_price.rbs +8 -3
  109. data/sig/orb/models/new_plan_max_group_tiered_package_price.rbs +8 -3
  110. data/sig/orb/models/new_plan_package_price.rbs +8 -3
  111. data/sig/orb/models/new_plan_package_with_allocation_price.rbs +8 -3
  112. data/sig/orb/models/new_plan_scalable_matrix_with_tiered_pricing_price.rbs +8 -3
  113. data/sig/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbs +8 -3
  114. data/sig/orb/models/new_plan_threshold_total_amount_price.rbs +8 -3
  115. data/sig/orb/models/new_plan_tier_with_proration_price.rbs +8 -3
  116. data/sig/orb/models/new_plan_tiered_bps_price.rbs +8 -3
  117. data/sig/orb/models/new_plan_tiered_package_price.rbs +8 -3
  118. data/sig/orb/models/new_plan_tiered_package_with_minimum_price.rbs +8 -3
  119. data/sig/orb/models/new_plan_tiered_price.rbs +8 -3
  120. data/sig/orb/models/new_plan_tiered_with_minimum_price.rbs +8 -3
  121. data/sig/orb/models/new_plan_unit_price.rbs +8 -3
  122. data/sig/orb/models/new_plan_unit_with_percent_price.rbs +8 -3
  123. data/sig/orb/models/new_plan_unit_with_proration_price.rbs +8 -3
  124. data/sig/orb/models/plan_create_params.rbs +156 -37
  125. data/sig/orb/resources/customers/credits/ledger.rbs +2 -2
  126. data/sig/orb/resources/plans.rbs +3 -1
  127. 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
 
@@ -248,12 +248,12 @@ module Orb
248
248
  amount: Float,
249
249
  entry_type:
250
250
  Orb::Customers::Credits::LedgerCreateEntryParams::EntryType::OrSymbol,
251
- expiry_date: T.nilable(Time),
252
251
  target_expiry_date: Date,
253
252
  block_id: String,
254
253
  currency: T.nilable(String),
255
254
  description: T.nilable(String),
256
255
  effective_date: T.nilable(Time),
256
+ expiry_date: T.nilable(Time),
257
257
  invoice_settings:
258
258
  T.nilable(
259
259
  Orb::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings::OrHash
@@ -275,8 +275,6 @@ module Orb
275
275
  # decrement or void operations.
276
276
  amount:,
277
277
  entry_type:,
278
- # An ISO 8601 format date that identifies the origination credit block to expire
279
- expiry_date:,
280
278
  # A future date (specified in YYYY-MM-DD format) used for expiration change,
281
279
  # denoting when credits transferred (as part of a partial block expiration) should
282
280
  # expire.
@@ -293,6 +291,8 @@ module Orb
293
291
  # An ISO 8601 format date that denotes when this credit balance should become
294
292
  # available for use.
295
293
  effective_date: nil,
294
+ # An ISO 8601 format date that identifies the origination credit block to expire
295
+ expiry_date: nil,
296
296
  # Passing `invoice_settings` automatically generates an invoice for the newly
297
297
  # added credits. If `invoice_settings` is passed, you must specify
298
298
  # per_unit_cost_basis, as the calculation of the invoice total is done on that
@@ -427,12 +427,12 @@ module Orb
427
427
  amount: Float,
428
428
  entry_type:
429
429
  Orb::Customers::Credits::LedgerCreateEntryByExternalIDParams::EntryType::OrSymbol,
430
- expiry_date: T.nilable(Time),
431
430
  target_expiry_date: Date,
432
431
  block_id: String,
433
432
  currency: T.nilable(String),
434
433
  description: T.nilable(String),
435
434
  effective_date: T.nilable(Time),
435
+ expiry_date: T.nilable(Time),
436
436
  invoice_settings:
437
437
  T.nilable(
438
438
  Orb::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings::OrHash
@@ -454,8 +454,6 @@ module Orb
454
454
  # decrement or void operations.
455
455
  amount:,
456
456
  entry_type:,
457
- # An ISO 8601 format date that identifies the origination credit block to expire
458
- expiry_date:,
459
457
  # A future date (specified in YYYY-MM-DD format) used for expiration change,
460
458
  # denoting when credits transferred (as part of a partial block expiration) should
461
459
  # expire.
@@ -472,6 +470,8 @@ module Orb
472
470
  # An ISO 8601 format date that denotes when this credit balance should become
473
471
  # available for use.
474
472
  effective_date: nil,
473
+ # An ISO 8601 format date that identifies the origination credit block to expire
474
+ expiry_date: nil,
475
475
  # Passing `invoice_settings` automatically generates an invoice for the newly
476
476
  # added credits. If `invoice_settings` is passed, you must specify
477
477
  # per_unit_cost_basis, as the calculation of the invoice total is done on that