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
@@ -23,8 +23,19 @@ module Orb
23
23
  # Prices for this plan. If the plan has phases, this includes prices across all
24
24
  # phases of the plan.
25
25
  #
26
- # @return [Array<Orb::Models::NewPlanUnitPrice, Orb::Models::NewPlanPackagePrice, Orb::Models::NewPlanMatrixPrice, Orb::Models::NewPlanTieredPrice, Orb::Models::NewPlanTieredBPSPrice, Orb::Models::NewPlanBPSPrice, Orb::Models::NewPlanBulkBPSPrice, Orb::Models::NewPlanBulkPrice, Orb::Models::NewPlanThresholdTotalAmountPrice, Orb::Models::NewPlanTieredPackagePrice, Orb::Models::NewPlanTieredWithMinimumPrice, Orb::Models::NewPlanUnitWithPercentPrice, Orb::Models::NewPlanPackageWithAllocationPrice, Orb::Models::NewPlanTierWithProrationPrice, Orb::Models::NewPlanUnitWithProrationPrice, Orb::Models::NewPlanGroupedAllocationPrice, Orb::Models::NewPlanGroupedWithProratedMinimumPrice, Orb::Models::NewPlanGroupedWithMeteredMinimumPrice, Orb::Models::NewPlanMatrixWithDisplayNamePrice, Orb::Models::NewPlanBulkWithProrationPrice, Orb::Models::NewPlanGroupedTieredPackagePrice, Orb::Models::NewPlanMaxGroupTieredPackagePrice, Orb::Models::NewPlanScalableMatrixWithUnitPricingPrice, Orb::Models::NewPlanScalableMatrixWithTieredPricingPrice, Orb::Models::NewPlanCumulativeGroupedBulkPrice, Orb::Models::NewPlanTieredPackageWithMinimumPrice, Orb::Models::NewPlanMatrixWithAllocationPrice, Orb::Models::NewPlanGroupedTieredPrice>]
27
- required :prices, -> { Orb::Internal::Type::ArrayOf[union: Orb::PlanCreateParams::Price] }
26
+ # @return [Array<Orb::Models::PlanCreateParams::Price>]
27
+ required :prices, -> { Orb::Internal::Type::ArrayOf[Orb::PlanCreateParams::Price] }
28
+
29
+ # @!attribute adjustments
30
+ # Adjustments for this plan. If the plan has phases, this includes adjustments
31
+ # across all phases of the plan.
32
+ #
33
+ # @return [Array<Orb::Models::PlanCreateParams::Adjustment>, nil]
34
+ optional :adjustments,
35
+ -> {
36
+ Orb::Internal::Type::ArrayOf[Orb::PlanCreateParams::Adjustment]
37
+ },
38
+ nil?: true
28
39
 
29
40
  # @!attribute default_invoice_memo
30
41
  # Free-form text which is available on the invoice PDF and the Orb invoice portal.
@@ -53,6 +64,13 @@ module Orb
53
64
  # @return [Integer, nil]
54
65
  optional :net_terms, Integer, nil?: true
55
66
 
67
+ # @!attribute plan_phases
68
+ # Configuration of pre-defined phases, each with their own prices and adjustments.
69
+ # Leave unspecified for plans with a single phase.
70
+ #
71
+ # @return [Array<Orb::Models::PlanCreateParams::PlanPhase>, nil]
72
+ optional :plan_phases, -> { Orb::Internal::Type::ArrayOf[Orb::PlanCreateParams::PlanPhase] }, nil?: true
73
+
56
74
  # @!attribute status
57
75
  # The status of the plan to create (either active or draft). If not specified,
58
76
  # this defaults to active.
@@ -60,7 +78,7 @@ module Orb
60
78
  # @return [Symbol, Orb::Models::PlanCreateParams::Status, nil]
61
79
  optional :status, enum: -> { Orb::PlanCreateParams::Status }
62
80
 
63
- # @!method initialize(currency:, name:, prices:, default_invoice_memo: nil, external_plan_id: nil, metadata: nil, net_terms: nil, status: nil, request_options: {})
81
+ # @!method initialize(currency:, name:, prices:, adjustments: nil, default_invoice_memo: nil, external_plan_id: nil, metadata: nil, net_terms: nil, plan_phases: nil, status: nil, request_options: {})
64
82
  # Some parameter documentations has been truncated, see
65
83
  # {Orb::Models::PlanCreateParams} for more details.
66
84
  #
@@ -68,7 +86,9 @@ module Orb
68
86
  #
69
87
  # @param name [String]
70
88
  #
71
- # @param prices [Array<Orb::Models::NewPlanUnitPrice, Orb::Models::NewPlanPackagePrice, Orb::Models::NewPlanMatrixPrice, Orb::Models::NewPlanTieredPrice, Orb::Models::NewPlanTieredBPSPrice, Orb::Models::NewPlanBPSPrice, Orb::Models::NewPlanBulkBPSPrice, Orb::Models::NewPlanBulkPrice, Orb::Models::NewPlanThresholdTotalAmountPrice, Orb::Models::NewPlanTieredPackagePrice, Orb::Models::NewPlanTieredWithMinimumPrice, Orb::Models::NewPlanUnitWithPercentPrice, Orb::Models::NewPlanPackageWithAllocationPrice, Orb::Models::NewPlanTierWithProrationPrice, Orb::Models::NewPlanUnitWithProrationPrice, Orb::Models::NewPlanGroupedAllocationPrice, Orb::Models::NewPlanGroupedWithProratedMinimumPrice, Orb::Models::NewPlanGroupedWithMeteredMinimumPrice, Orb::Models::NewPlanMatrixWithDisplayNamePrice, Orb::Models::NewPlanBulkWithProrationPrice, Orb::Models::NewPlanGroupedTieredPackagePrice, Orb::Models::NewPlanMaxGroupTieredPackagePrice, Orb::Models::NewPlanScalableMatrixWithUnitPricingPrice, Orb::Models::NewPlanScalableMatrixWithTieredPricingPrice, Orb::Models::NewPlanCumulativeGroupedBulkPrice, Orb::Models::NewPlanTieredPackageWithMinimumPrice, Orb::Models::NewPlanMatrixWithAllocationPrice, Orb::Models::NewPlanGroupedTieredPrice>] Prices for this plan. If the plan has phases, this includes prices across all ph
89
+ # @param prices [Array<Orb::Models::PlanCreateParams::Price>] Prices for this plan. If the plan has phases, this includes prices across all ph
90
+ #
91
+ # @param adjustments [Array<Orb::Models::PlanCreateParams::Adjustment>, nil] Adjustments for this plan. If the plan has phases, this includes adjustments acr
72
92
  #
73
93
  # @param default_invoice_memo [String, nil] Free-form text which is available on the invoice PDF and the Orb invoice portal.
74
94
  #
@@ -78,73 +98,201 @@ module Orb
78
98
  #
79
99
  # @param net_terms [Integer, nil] The net terms determines the difference between the invoice date and the issue d
80
100
  #
101
+ # @param plan_phases [Array<Orb::Models::PlanCreateParams::PlanPhase>, nil] Configuration of pre-defined phases, each with their own prices and adjustments.
102
+ #
81
103
  # @param status [Symbol, Orb::Models::PlanCreateParams::Status] The status of the plan to create (either active or draft). If not specified, thi
82
104
  #
83
105
  # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
84
106
 
85
- module Price
86
- extend Orb::Internal::Type::Union
107
+ class Price < Orb::Internal::Type::BaseModel
108
+ # @!attribute allocation_price
109
+ # The allocation price to add to the plan.
110
+ #
111
+ # @return [Orb::Models::NewAllocationPrice, nil]
112
+ optional :allocation_price, -> { Orb::NewAllocationPrice }, nil?: true
113
+
114
+ # @!attribute plan_phase_order
115
+ # The phase to add this price to.
116
+ #
117
+ # @return [Integer, nil]
118
+ optional :plan_phase_order, Integer, nil?: true
119
+
120
+ # @!attribute price
121
+ # The price to add to the plan
122
+ #
123
+ # @return [Orb::Models::NewPlanUnitPrice, Orb::Models::NewPlanPackagePrice, Orb::Models::NewPlanMatrixPrice, Orb::Models::NewPlanTieredPrice, Orb::Models::NewPlanTieredBPSPrice, Orb::Models::NewPlanBPSPrice, Orb::Models::NewPlanBulkBPSPrice, Orb::Models::NewPlanBulkPrice, Orb::Models::NewPlanThresholdTotalAmountPrice, Orb::Models::NewPlanTieredPackagePrice, Orb::Models::NewPlanTieredWithMinimumPrice, Orb::Models::NewPlanUnitWithPercentPrice, Orb::Models::NewPlanPackageWithAllocationPrice, Orb::Models::NewPlanTierWithProrationPrice, Orb::Models::NewPlanUnitWithProrationPrice, Orb::Models::NewPlanGroupedAllocationPrice, Orb::Models::NewPlanGroupedWithProratedMinimumPrice, Orb::Models::NewPlanGroupedWithMeteredMinimumPrice, Orb::Models::NewPlanMatrixWithDisplayNamePrice, Orb::Models::NewPlanBulkWithProrationPrice, Orb::Models::NewPlanGroupedTieredPackagePrice, Orb::Models::NewPlanMaxGroupTieredPackagePrice, Orb::Models::NewPlanScalableMatrixWithUnitPricingPrice, Orb::Models::NewPlanScalableMatrixWithTieredPricingPrice, Orb::Models::NewPlanCumulativeGroupedBulkPrice, Orb::Models::NewPlanTieredPackageWithMinimumPrice, Orb::Models::NewPlanMatrixWithAllocationPrice, Orb::Models::NewPlanGroupedTieredPrice, nil]
124
+ optional :price, union: -> { Orb::PlanCreateParams::Price::Price }, nil?: true
125
+
126
+ # @!method initialize(allocation_price: nil, plan_phase_order: nil, price: nil)
127
+ # @param allocation_price [Orb::Models::NewAllocationPrice, nil] The allocation price to add to the plan.
128
+ #
129
+ # @param plan_phase_order [Integer, nil] The phase to add this price to.
130
+ #
131
+ # @param price [Orb::Models::NewPlanUnitPrice, Orb::Models::NewPlanPackagePrice, Orb::Models::NewPlanMatrixPrice, Orb::Models::NewPlanTieredPrice, Orb::Models::NewPlanTieredBPSPrice, Orb::Models::NewPlanBPSPrice, Orb::Models::NewPlanBulkBPSPrice, Orb::Models::NewPlanBulkPrice, Orb::Models::NewPlanThresholdTotalAmountPrice, Orb::Models::NewPlanTieredPackagePrice, Orb::Models::NewPlanTieredWithMinimumPrice, Orb::Models::NewPlanUnitWithPercentPrice, Orb::Models::NewPlanPackageWithAllocationPrice, Orb::Models::NewPlanTierWithProrationPrice, Orb::Models::NewPlanUnitWithProrationPrice, Orb::Models::NewPlanGroupedAllocationPrice, Orb::Models::NewPlanGroupedWithProratedMinimumPrice, Orb::Models::NewPlanGroupedWithMeteredMinimumPrice, Orb::Models::NewPlanMatrixWithDisplayNamePrice, Orb::Models::NewPlanBulkWithProrationPrice, Orb::Models::NewPlanGroupedTieredPackagePrice, Orb::Models::NewPlanMaxGroupTieredPackagePrice, Orb::Models::NewPlanScalableMatrixWithUnitPricingPrice, Orb::Models::NewPlanScalableMatrixWithTieredPricingPrice, Orb::Models::NewPlanCumulativeGroupedBulkPrice, Orb::Models::NewPlanTieredPackageWithMinimumPrice, Orb::Models::NewPlanMatrixWithAllocationPrice, Orb::Models::NewPlanGroupedTieredPrice, nil] The price to add to the plan
132
+
133
+ # The price to add to the plan
134
+ #
135
+ # @see Orb::Models::PlanCreateParams::Price#price
136
+ module Price
137
+ extend Orb::Internal::Type::Union
138
+
139
+ discriminator :model_type
140
+
141
+ variant :unit, -> { Orb::NewPlanUnitPrice }
87
142
 
88
- discriminator :model_type
143
+ variant :package, -> { Orb::NewPlanPackagePrice }
89
144
 
90
- variant :unit, -> { Orb::NewPlanUnitPrice }
145
+ variant :matrix, -> { Orb::NewPlanMatrixPrice }
91
146
 
92
- variant :package, -> { Orb::NewPlanPackagePrice }
147
+ variant :tiered, -> { Orb::NewPlanTieredPrice }
93
148
 
94
- variant :matrix, -> { Orb::NewPlanMatrixPrice }
149
+ variant :tiered_bps, -> { Orb::NewPlanTieredBPSPrice }
95
150
 
96
- variant :tiered, -> { Orb::NewPlanTieredPrice }
151
+ variant :bps, -> { Orb::NewPlanBPSPrice }
97
152
 
98
- variant :tiered_bps, -> { Orb::NewPlanTieredBPSPrice }
153
+ variant :bulk_bps, -> { Orb::NewPlanBulkBPSPrice }
99
154
 
100
- variant :bps, -> { Orb::NewPlanBPSPrice }
155
+ variant :bulk, -> { Orb::NewPlanBulkPrice }
101
156
 
102
- variant :bulk_bps, -> { Orb::NewPlanBulkBPSPrice }
157
+ variant :threshold_total_amount, -> { Orb::NewPlanThresholdTotalAmountPrice }
103
158
 
104
- variant :bulk, -> { Orb::NewPlanBulkPrice }
159
+ variant :tiered_package, -> { Orb::NewPlanTieredPackagePrice }
105
160
 
106
- variant :threshold_total_amount, -> { Orb::NewPlanThresholdTotalAmountPrice }
161
+ variant :tiered_with_minimum, -> { Orb::NewPlanTieredWithMinimumPrice }
107
162
 
108
- variant :tiered_package, -> { Orb::NewPlanTieredPackagePrice }
163
+ variant :unit_with_percent, -> { Orb::NewPlanUnitWithPercentPrice }
109
164
 
110
- variant :tiered_with_minimum, -> { Orb::NewPlanTieredWithMinimumPrice }
165
+ variant :package_with_allocation, -> { Orb::NewPlanPackageWithAllocationPrice }
111
166
 
112
- variant :unit_with_percent, -> { Orb::NewPlanUnitWithPercentPrice }
167
+ variant :tiered_with_proration, -> { Orb::NewPlanTierWithProrationPrice }
113
168
 
114
- variant :package_with_allocation, -> { Orb::NewPlanPackageWithAllocationPrice }
169
+ variant :unit_with_proration, -> { Orb::NewPlanUnitWithProrationPrice }
115
170
 
116
- variant :tiered_with_proration, -> { Orb::NewPlanTierWithProrationPrice }
171
+ variant :grouped_allocation, -> { Orb::NewPlanGroupedAllocationPrice }
117
172
 
118
- variant :unit_with_proration, -> { Orb::NewPlanUnitWithProrationPrice }
173
+ variant :grouped_with_prorated_minimum, -> { Orb::NewPlanGroupedWithProratedMinimumPrice }
119
174
 
120
- variant :grouped_allocation, -> { Orb::NewPlanGroupedAllocationPrice }
175
+ variant :grouped_with_metered_minimum, -> { Orb::NewPlanGroupedWithMeteredMinimumPrice }
121
176
 
122
- variant :grouped_with_prorated_minimum, -> { Orb::NewPlanGroupedWithProratedMinimumPrice }
177
+ variant :matrix_with_display_name, -> { Orb::NewPlanMatrixWithDisplayNamePrice }
123
178
 
124
- variant :grouped_with_metered_minimum, -> { Orb::NewPlanGroupedWithMeteredMinimumPrice }
179
+ variant :bulk_with_proration, -> { Orb::NewPlanBulkWithProrationPrice }
125
180
 
126
- variant :matrix_with_display_name, -> { Orb::NewPlanMatrixWithDisplayNamePrice }
181
+ variant :grouped_tiered_package, -> { Orb::NewPlanGroupedTieredPackagePrice }
127
182
 
128
- variant :bulk_with_proration, -> { Orb::NewPlanBulkWithProrationPrice }
183
+ variant :max_group_tiered_package, -> { Orb::NewPlanMaxGroupTieredPackagePrice }
129
184
 
130
- variant :grouped_tiered_package, -> { Orb::NewPlanGroupedTieredPackagePrice }
185
+ variant :scalable_matrix_with_unit_pricing, -> { Orb::NewPlanScalableMatrixWithUnitPricingPrice }
131
186
 
132
- variant :max_group_tiered_package, -> { Orb::NewPlanMaxGroupTieredPackagePrice }
187
+ variant :scalable_matrix_with_tiered_pricing,
188
+ -> {
189
+ Orb::NewPlanScalableMatrixWithTieredPricingPrice
190
+ }
133
191
 
134
- variant :scalable_matrix_with_unit_pricing, -> { Orb::NewPlanScalableMatrixWithUnitPricingPrice }
192
+ variant :cumulative_grouped_bulk, -> { Orb::NewPlanCumulativeGroupedBulkPrice }
135
193
 
136
- variant :scalable_matrix_with_tiered_pricing, -> { Orb::NewPlanScalableMatrixWithTieredPricingPrice }
194
+ variant :tiered_package_with_minimum, -> { Orb::NewPlanTieredPackageWithMinimumPrice }
137
195
 
138
- variant :cumulative_grouped_bulk, -> { Orb::NewPlanCumulativeGroupedBulkPrice }
196
+ variant :matrix_with_allocation, -> { Orb::NewPlanMatrixWithAllocationPrice }
139
197
 
140
- variant :tiered_package_with_minimum, -> { Orb::NewPlanTieredPackageWithMinimumPrice }
198
+ variant :grouped_tiered, -> { Orb::NewPlanGroupedTieredPrice }
141
199
 
142
- variant :matrix_with_allocation, -> { Orb::NewPlanMatrixWithAllocationPrice }
200
+ # @!method self.variants
201
+ # @return [Array(Orb::Models::NewPlanUnitPrice, Orb::Models::NewPlanPackagePrice, Orb::Models::NewPlanMatrixPrice, Orb::Models::NewPlanTieredPrice, Orb::Models::NewPlanTieredBPSPrice, Orb::Models::NewPlanBPSPrice, Orb::Models::NewPlanBulkBPSPrice, Orb::Models::NewPlanBulkPrice, Orb::Models::NewPlanThresholdTotalAmountPrice, Orb::Models::NewPlanTieredPackagePrice, Orb::Models::NewPlanTieredWithMinimumPrice, Orb::Models::NewPlanUnitWithPercentPrice, Orb::Models::NewPlanPackageWithAllocationPrice, Orb::Models::NewPlanTierWithProrationPrice, Orb::Models::NewPlanUnitWithProrationPrice, Orb::Models::NewPlanGroupedAllocationPrice, Orb::Models::NewPlanGroupedWithProratedMinimumPrice, Orb::Models::NewPlanGroupedWithMeteredMinimumPrice, Orb::Models::NewPlanMatrixWithDisplayNamePrice, Orb::Models::NewPlanBulkWithProrationPrice, Orb::Models::NewPlanGroupedTieredPackagePrice, Orb::Models::NewPlanMaxGroupTieredPackagePrice, Orb::Models::NewPlanScalableMatrixWithUnitPricingPrice, Orb::Models::NewPlanScalableMatrixWithTieredPricingPrice, Orb::Models::NewPlanCumulativeGroupedBulkPrice, Orb::Models::NewPlanTieredPackageWithMinimumPrice, Orb::Models::NewPlanMatrixWithAllocationPrice, Orb::Models::NewPlanGroupedTieredPrice)]
202
+ end
203
+ end
204
+
205
+ class Adjustment < Orb::Internal::Type::BaseModel
206
+ # @!attribute adjustment
207
+ # The definition of a new adjustment to create and add to the plan.
208
+ #
209
+ # @return [Orb::Models::NewPercentageDiscount, Orb::Models::NewUsageDiscount, Orb::Models::NewAmountDiscount, Orb::Models::NewMinimum, Orb::Models::NewMaximum]
210
+ required :adjustment, union: -> { Orb::PlanCreateParams::Adjustment::Adjustment }
211
+
212
+ # @!attribute plan_phase_order
213
+ # The phase to add this adjustment to.
214
+ #
215
+ # @return [Integer, nil]
216
+ optional :plan_phase_order, Integer, nil?: true
217
+
218
+ # @!method initialize(adjustment:, plan_phase_order: nil)
219
+ # @param adjustment [Orb::Models::NewPercentageDiscount, Orb::Models::NewUsageDiscount, Orb::Models::NewAmountDiscount, Orb::Models::NewMinimum, Orb::Models::NewMaximum] The definition of a new adjustment to create and add to the plan.
220
+ #
221
+ # @param plan_phase_order [Integer, nil] The phase to add this adjustment to.
222
+
223
+ # The definition of a new adjustment to create and add to the plan.
224
+ #
225
+ # @see Orb::Models::PlanCreateParams::Adjustment#adjustment
226
+ module Adjustment
227
+ extend Orb::Internal::Type::Union
228
+
229
+ discriminator :adjustment_type
143
230
 
144
- variant :grouped_tiered, -> { Orb::NewPlanGroupedTieredPrice }
231
+ variant :percentage_discount, -> { Orb::NewPercentageDiscount }
232
+
233
+ variant :usage_discount, -> { Orb::NewUsageDiscount }
234
+
235
+ variant :amount_discount, -> { Orb::NewAmountDiscount }
236
+
237
+ variant :minimum, -> { Orb::NewMinimum }
238
+
239
+ variant :maximum, -> { Orb::NewMaximum }
240
+
241
+ # @!method self.variants
242
+ # @return [Array(Orb::Models::NewPercentageDiscount, Orb::Models::NewUsageDiscount, Orb::Models::NewAmountDiscount, Orb::Models::NewMinimum, Orb::Models::NewMaximum)]
243
+ end
244
+ end
145
245
 
146
- # @!method self.variants
147
- # @return [Array(Orb::Models::NewPlanUnitPrice, Orb::Models::NewPlanPackagePrice, Orb::Models::NewPlanMatrixPrice, Orb::Models::NewPlanTieredPrice, Orb::Models::NewPlanTieredBPSPrice, Orb::Models::NewPlanBPSPrice, Orb::Models::NewPlanBulkBPSPrice, Orb::Models::NewPlanBulkPrice, Orb::Models::NewPlanThresholdTotalAmountPrice, Orb::Models::NewPlanTieredPackagePrice, Orb::Models::NewPlanTieredWithMinimumPrice, Orb::Models::NewPlanUnitWithPercentPrice, Orb::Models::NewPlanPackageWithAllocationPrice, Orb::Models::NewPlanTierWithProrationPrice, Orb::Models::NewPlanUnitWithProrationPrice, Orb::Models::NewPlanGroupedAllocationPrice, Orb::Models::NewPlanGroupedWithProratedMinimumPrice, Orb::Models::NewPlanGroupedWithMeteredMinimumPrice, Orb::Models::NewPlanMatrixWithDisplayNamePrice, Orb::Models::NewPlanBulkWithProrationPrice, Orb::Models::NewPlanGroupedTieredPackagePrice, Orb::Models::NewPlanMaxGroupTieredPackagePrice, Orb::Models::NewPlanScalableMatrixWithUnitPricingPrice, Orb::Models::NewPlanScalableMatrixWithTieredPricingPrice, Orb::Models::NewPlanCumulativeGroupedBulkPrice, Orb::Models::NewPlanTieredPackageWithMinimumPrice, Orb::Models::NewPlanMatrixWithAllocationPrice, Orb::Models::NewPlanGroupedTieredPrice)]
246
+ class PlanPhase < Orb::Internal::Type::BaseModel
247
+ # @!attribute order
248
+ # Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
249
+ #
250
+ # @return [Integer]
251
+ required :order, Integer
252
+
253
+ # @!attribute align_billing_with_phase_start_date
254
+ # Align billing cycle day with phase start date.
255
+ #
256
+ # @return [Boolean, nil]
257
+ optional :align_billing_with_phase_start_date, Orb::Internal::Type::Boolean, nil?: true
258
+
259
+ # @!attribute duration
260
+ # How many terms of length `duration_unit` this phase is active for. If null, this
261
+ # phase is evergreen and active indefinitely
262
+ #
263
+ # @return [Integer, nil]
264
+ optional :duration, Integer, nil?: true
265
+
266
+ # @!attribute duration_unit
267
+ #
268
+ # @return [Symbol, Orb::Models::PlanCreateParams::PlanPhase::DurationUnit, nil]
269
+ optional :duration_unit, enum: -> { Orb::PlanCreateParams::PlanPhase::DurationUnit }, nil?: true
270
+
271
+ # @!method initialize(order:, align_billing_with_phase_start_date: nil, duration: nil, duration_unit: nil)
272
+ # Some parameter documentations has been truncated, see
273
+ # {Orb::Models::PlanCreateParams::PlanPhase} for more details.
274
+ #
275
+ # @param order [Integer] Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
276
+ #
277
+ # @param align_billing_with_phase_start_date [Boolean, nil] Align billing cycle day with phase start date.
278
+ #
279
+ # @param duration [Integer, nil] How many terms of length `duration_unit` this phase is active for. If null, this
280
+ #
281
+ # @param duration_unit [Symbol, Orb::Models::PlanCreateParams::PlanPhase::DurationUnit, nil]
282
+
283
+ # @see Orb::Models::PlanCreateParams::PlanPhase#duration_unit
284
+ module DurationUnit
285
+ extend Orb::Internal::Type::Enum
286
+
287
+ DAILY = :daily
288
+ MONTHLY = :monthly
289
+ QUARTERLY = :quarterly
290
+ SEMI_ANNUAL = :semi_annual
291
+ ANNUAL = :annual
292
+
293
+ # @!method self.values
294
+ # @return [Array<Symbol>]
295
+ end
148
296
  end
149
297
 
150
298
  # The status of the plan to create (either active or draft). If not specified,
@@ -53,7 +53,14 @@ module Orb
53
53
  # @return [String, nil]
54
54
  required :reason, String, nil?: true
55
55
 
56
- # @!method initialize(id:, adjustment_type:, amount_discount:, applies_to_price_ids:, filters:, is_invoice_level:, plan_phase_order:, reason:)
56
+ # @!attribute replaces_adjustment_id
57
+ # The adjustment id this adjustment replaces. This adjustment will take the place
58
+ # of the replaced adjustment in plan version migrations.
59
+ #
60
+ # @return [String, nil]
61
+ required :replaces_adjustment_id, String, nil?: true
62
+
63
+ # @!method initialize(id:, adjustment_type:, amount_discount:, applies_to_price_ids:, filters:, is_invoice_level:, plan_phase_order:, reason:, replaces_adjustment_id:)
57
64
  # Some parameter documentations has been truncated, see
58
65
  # {Orb::Models::PlanPhaseAmountDiscountAdjustment} for more details.
59
66
  #
@@ -72,6 +79,8 @@ module Orb
72
79
  # @param plan_phase_order [Integer, nil] The plan phase in which this adjustment is active.
73
80
  #
74
81
  # @param reason [String, nil] The reason for the adjustment.
82
+ #
83
+ # @param replaces_adjustment_id [String, nil] The adjustment id this adjustment replaces. This adjustment will take the place
75
84
 
76
85
  # @see Orb::Models::PlanPhaseAmountDiscountAdjustment#adjustment_type
77
86
  module AdjustmentType
@@ -53,7 +53,14 @@ module Orb
53
53
  # @return [String, nil]
54
54
  required :reason, String, nil?: true
55
55
 
56
- # @!method initialize(id:, adjustment_type:, applies_to_price_ids:, filters:, is_invoice_level:, maximum_amount:, plan_phase_order:, reason:)
56
+ # @!attribute replaces_adjustment_id
57
+ # The adjustment id this adjustment replaces. This adjustment will take the place
58
+ # of the replaced adjustment in plan version migrations.
59
+ #
60
+ # @return [String, nil]
61
+ required :replaces_adjustment_id, String, nil?: true
62
+
63
+ # @!method initialize(id:, adjustment_type:, applies_to_price_ids:, filters:, is_invoice_level:, maximum_amount:, plan_phase_order:, reason:, replaces_adjustment_id:)
57
64
  # Some parameter documentations has been truncated, see
58
65
  # {Orb::Models::PlanPhaseMaximumAdjustment} for more details.
59
66
  #
@@ -72,6 +79,8 @@ module Orb
72
79
  # @param plan_phase_order [Integer, nil] The plan phase in which this adjustment is active.
73
80
  #
74
81
  # @param reason [String, nil] The reason for the adjustment.
82
+ #
83
+ # @param replaces_adjustment_id [String, nil] The adjustment id this adjustment replaces. This adjustment will take the place
75
84
 
76
85
  # @see Orb::Models::PlanPhaseMaximumAdjustment#adjustment_type
77
86
  module AdjustmentType
@@ -59,7 +59,14 @@ module Orb
59
59
  # @return [String, nil]
60
60
  required :reason, String, nil?: true
61
61
 
62
- # @!method initialize(id:, adjustment_type:, applies_to_price_ids:, filters:, is_invoice_level:, item_id:, minimum_amount:, plan_phase_order:, reason:)
62
+ # @!attribute replaces_adjustment_id
63
+ # The adjustment id this adjustment replaces. This adjustment will take the place
64
+ # of the replaced adjustment in plan version migrations.
65
+ #
66
+ # @return [String, nil]
67
+ required :replaces_adjustment_id, String, nil?: true
68
+
69
+ # @!method initialize(id:, adjustment_type:, applies_to_price_ids:, filters:, is_invoice_level:, item_id:, minimum_amount:, plan_phase_order:, reason:, replaces_adjustment_id:)
63
70
  # Some parameter documentations has been truncated, see
64
71
  # {Orb::Models::PlanPhaseMinimumAdjustment} for more details.
65
72
  #
@@ -80,6 +87,8 @@ module Orb
80
87
  # @param plan_phase_order [Integer, nil] The plan phase in which this adjustment is active.
81
88
  #
82
89
  # @param reason [String, nil] The reason for the adjustment.
90
+ #
91
+ # @param replaces_adjustment_id [String, nil] The adjustment id this adjustment replaces. This adjustment will take the place
83
92
 
84
93
  # @see Orb::Models::PlanPhaseMinimumAdjustment#adjustment_type
85
94
  module AdjustmentType
@@ -53,7 +53,14 @@ module Orb
53
53
  # @return [String, nil]
54
54
  required :reason, String, nil?: true
55
55
 
56
- # @!method initialize(id:, adjustment_type:, applies_to_price_ids:, filters:, is_invoice_level:, percentage_discount:, plan_phase_order:, reason:)
56
+ # @!attribute replaces_adjustment_id
57
+ # The adjustment id this adjustment replaces. This adjustment will take the place
58
+ # of the replaced adjustment in plan version migrations.
59
+ #
60
+ # @return [String, nil]
61
+ required :replaces_adjustment_id, String, nil?: true
62
+
63
+ # @!method initialize(id:, adjustment_type:, applies_to_price_ids:, filters:, is_invoice_level:, percentage_discount:, plan_phase_order:, reason:, replaces_adjustment_id:)
57
64
  # Some parameter documentations has been truncated, see
58
65
  # {Orb::Models::PlanPhasePercentageDiscountAdjustment} for more details.
59
66
  #
@@ -72,6 +79,8 @@ module Orb
72
79
  # @param plan_phase_order [Integer, nil] The plan phase in which this adjustment is active.
73
80
  #
74
81
  # @param reason [String, nil] The reason for the adjustment.
82
+ #
83
+ # @param replaces_adjustment_id [String, nil] The adjustment id this adjustment replaces. This adjustment will take the place
75
84
 
76
85
  # @see Orb::Models::PlanPhasePercentageDiscountAdjustment#adjustment_type
77
86
  module AdjustmentType
@@ -46,6 +46,13 @@ module Orb
46
46
  # @return [String, nil]
47
47
  required :reason, String, nil?: true
48
48
 
49
+ # @!attribute replaces_adjustment_id
50
+ # The adjustment id this adjustment replaces. This adjustment will take the place
51
+ # of the replaced adjustment in plan version migrations.
52
+ #
53
+ # @return [String, nil]
54
+ required :replaces_adjustment_id, String, nil?: true
55
+
49
56
  # @!attribute usage_discount
50
57
  # The number of usage units by which to discount the price this adjustment applies
51
58
  # to in a given billing period.
@@ -53,7 +60,7 @@ module Orb
53
60
  # @return [Float]
54
61
  required :usage_discount, Float
55
62
 
56
- # @!method initialize(id:, adjustment_type:, applies_to_price_ids:, filters:, is_invoice_level:, plan_phase_order:, reason:, usage_discount:)
63
+ # @!method initialize(id:, adjustment_type:, applies_to_price_ids:, filters:, is_invoice_level:, plan_phase_order:, reason:, replaces_adjustment_id:, usage_discount:)
57
64
  # Some parameter documentations has been truncated, see
58
65
  # {Orb::Models::PlanPhaseUsageDiscountAdjustment} for more details.
59
66
  #
@@ -71,6 +78,8 @@ module Orb
71
78
  #
72
79
  # @param reason [String, nil] The reason for the adjustment.
73
80
  #
81
+ # @param replaces_adjustment_id [String, nil] The adjustment id this adjustment replaces. This adjustment will take the place
82
+ #
74
83
  # @param usage_discount [Float] The number of usage units by which to discount the price this adjustment applies
75
84
 
76
85
  # @see Orb::Models::PlanPhaseUsageDiscountAdjustment#adjustment_type