orb-billing 0.5.5 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/README.md +1 -1
  4. data/lib/orb/client.rb +4 -0
  5. data/lib/orb/internal/type/base_model.rb +2 -2
  6. data/lib/orb/internal/type/union.rb +6 -6
  7. data/lib/orb/models/alert.rb +33 -1
  8. data/lib/orb/models/amount_discount.rb +10 -10
  9. data/lib/orb/models/beta/external_plan_id_create_plan_version_params.rb +17940 -0
  10. data/lib/orb/models/beta/external_plan_id_fetch_plan_version_params.rb +22 -0
  11. data/lib/orb/models/beta/external_plan_id_set_default_plan_version_params.rb +24 -0
  12. data/lib/orb/models/beta_create_plan_version_params.rb +17758 -0
  13. data/lib/orb/models/beta_fetch_plan_version_params.rb +20 -0
  14. data/lib/orb/models/beta_set_default_plan_version_params.rb +22 -0
  15. data/lib/orb/models/credit_note_create_params.rb +9 -9
  16. data/lib/orb/models/customer_create_params.rb +21 -3
  17. data/lib/orb/models/customer_update_by_external_id_params.rb +21 -3
  18. data/lib/orb/models/customer_update_params.rb +21 -3
  19. data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rb +9 -1
  20. data/lib/orb/models/customers/credits/ledger_create_entry_response.rb +9 -1
  21. data/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rb +9 -1
  22. data/lib/orb/models/customers/credits/ledger_list_response.rb +9 -1
  23. data/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rb +1 -1
  24. data/lib/orb/models/customers/credits/top_up_create_params.rb +1 -1
  25. data/lib/orb/models/invoice.rb +626 -9
  26. data/lib/orb/models/invoice_fetch_upcoming_response.rb +624 -9
  27. data/lib/orb/models/invoice_line_item_create_response.rb +486 -7
  28. data/lib/orb/models/item.rb +18 -1
  29. data/lib/orb/models/item_archive_params.rb +14 -0
  30. data/lib/orb/models/item_create_params.rb +14 -1
  31. data/lib/orb/models/item_update_params.rb +16 -1
  32. data/lib/orb/models/percentage_discount.rb +10 -10
  33. data/lib/orb/models/plan.rb +618 -9
  34. data/lib/orb/models/plan_create_params.rb +2066 -30
  35. data/lib/orb/models/plan_version.rb +735 -0
  36. data/lib/orb/models/plan_version_phase.rb +70 -0
  37. data/lib/orb/models/price.rb +4124 -70
  38. data/lib/orb/models/price_create_params.rb +45 -1
  39. data/lib/orb/models/price_evaluate_multiple_params.rb +8620 -0
  40. data/lib/orb/models/price_evaluate_multiple_response.rb +51 -0
  41. data/lib/orb/models/subscription.rb +730 -54
  42. data/lib/orb/models/subscription_cancel_response.rb +706 -54
  43. data/lib/orb/models/subscription_change_apply_response.rb +728 -54
  44. data/lib/orb/models/subscription_change_cancel_response.rb +728 -54
  45. data/lib/orb/models/subscription_change_retrieve_response.rb +728 -54
  46. data/lib/orb/models/subscription_create_params.rb +5992 -1698
  47. data/lib/orb/models/subscription_create_response.rb +706 -54
  48. data/lib/orb/models/subscription_fetch_schedule_response.rb +3 -3
  49. data/lib/orb/models/subscription_price_intervals_params.rb +1392 -76
  50. data/lib/orb/models/subscription_price_intervals_response.rb +712 -54
  51. data/lib/orb/models/subscription_schedule_plan_change_params.rb +6005 -1723
  52. data/lib/orb/models/subscription_schedule_plan_change_response.rb +716 -54
  53. data/lib/orb/models/subscription_trigger_phase_response.rb +708 -54
  54. data/lib/orb/models/subscription_unschedule_cancellation_response.rb +720 -54
  55. data/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rb +728 -54
  56. data/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rb +728 -54
  57. data/lib/orb/models/subscription_update_fixed_fee_quantity_params.rb +1 -1
  58. data/lib/orb/models/subscription_update_fixed_fee_quantity_response.rb +720 -54
  59. data/lib/orb/models/subscription_update_trial_response.rb +706 -54
  60. data/lib/orb/models/trial_discount.rb +10 -10
  61. data/lib/orb/models/usage_discount.rb +10 -10
  62. data/lib/orb/models.rb +16 -0
  63. data/lib/orb/resources/beta/external_plan_id.rb +113 -0
  64. data/lib/orb/resources/beta.rb +115 -0
  65. data/lib/orb/resources/credit_notes.rb +3 -3
  66. data/lib/orb/resources/customers/balance_transactions.rb +0 -7
  67. data/lib/orb/resources/customers.rb +4 -7
  68. data/lib/orb/resources/dimensional_price_groups.rb +1 -1
  69. data/lib/orb/resources/items.rb +34 -2
  70. data/lib/orb/resources/plans/external_plan_id.rb +1 -1
  71. data/lib/orb/resources/plans.rb +2 -2
  72. data/lib/orb/resources/prices.rb +69 -2
  73. data/lib/orb/resources/subscriptions.rb +5 -1
  74. data/lib/orb/version.rb +1 -1
  75. data/lib/orb.rb +13 -0
  76. data/rbi/orb/client.rbi +3 -0
  77. data/rbi/orb/models/alert.rbi +50 -3
  78. data/rbi/orb/models/amount_discount.rbi +8 -8
  79. data/rbi/orb/models/beta/external_plan_id_create_plan_version_params.rbi +32652 -0
  80. data/rbi/orb/models/beta/external_plan_id_fetch_plan_version_params.rbi +40 -0
  81. data/rbi/orb/models/beta/external_plan_id_set_default_plan_version_params.rbi +45 -0
  82. data/rbi/orb/models/beta_create_plan_version_params.rbi +32595 -0
  83. data/rbi/orb/models/beta_fetch_plan_version_params.rbi +35 -0
  84. data/rbi/orb/models/beta_set_default_plan_version_params.rbi +40 -0
  85. data/rbi/orb/models/credit_note_create_params.rbi +8 -8
  86. data/rbi/orb/models/customer_create_params.rbi +38 -4
  87. data/rbi/orb/models/customer_update_by_external_id_params.rbi +38 -4
  88. data/rbi/orb/models/customer_update_params.rbi +38 -4
  89. data/rbi/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbi +9 -1
  90. data/rbi/orb/models/customers/credits/ledger_create_entry_response.rbi +9 -1
  91. data/rbi/orb/models/customers/credits/ledger_list_by_external_id_response.rbi +9 -1
  92. data/rbi/orb/models/customers/credits/ledger_list_response.rbi +9 -1
  93. data/rbi/orb/models/customers/credits/top_up_create_by_external_id_params.rbi +2 -2
  94. data/rbi/orb/models/customers/credits/top_up_create_params.rbi +2 -2
  95. data/rbi/orb/models/invoice.rbi +1451 -35
  96. data/rbi/orb/models/invoice_fetch_upcoming_response.rbi +1524 -4
  97. data/rbi/orb/models/invoice_line_item_create_response.rbi +1184 -2
  98. data/rbi/orb/models/item.rbi +20 -1
  99. data/rbi/orb/models/item_archive_params.rbi +25 -0
  100. data/rbi/orb/models/item_create_params.rbi +18 -1
  101. data/rbi/orb/models/item_update_params.rbi +17 -1
  102. data/rbi/orb/models/percentage_discount.rbi +10 -10
  103. data/rbi/orb/models/plan.rbi +1339 -4
  104. data/rbi/orb/models/plan_create_params.rbi +3833 -29
  105. data/rbi/orb/models/plan_version.rbi +1367 -0
  106. data/rbi/orb/models/plan_version_phase.rbi +99 -0
  107. data/rbi/orb/models/price.rbi +9447 -441
  108. data/rbi/orb/models/price_create_params.rbi +80 -0
  109. data/rbi/orb/models/price_evaluate_multiple_params.rbi +15764 -0
  110. data/rbi/orb/models/price_evaluate_multiple_response.rbi +96 -0
  111. data/rbi/orb/models/subscription.rbi +1654 -44
  112. data/rbi/orb/models/subscription_cancel_response.rbi +1692 -44
  113. data/rbi/orb/models/subscription_change_apply_response.rbi +1692 -44
  114. data/rbi/orb/models/subscription_change_cancel_response.rbi +1692 -44
  115. data/rbi/orb/models/subscription_change_retrieve_response.rbi +1692 -44
  116. data/rbi/orb/models/subscription_create_params.rbi +10400 -2710
  117. data/rbi/orb/models/subscription_create_response.rbi +1692 -44
  118. data/rbi/orb/models/subscription_fetch_schedule_response.rbi +13 -4
  119. data/rbi/orb/models/subscription_price_intervals_params.rbi +2401 -49
  120. data/rbi/orb/models/subscription_price_intervals_response.rbi +1692 -44
  121. data/rbi/orb/models/subscription_schedule_plan_change_params.rbi +10423 -2753
  122. data/rbi/orb/models/subscription_schedule_plan_change_response.rbi +1692 -44
  123. data/rbi/orb/models/subscription_trigger_phase_response.rbi +1692 -44
  124. data/rbi/orb/models/subscription_unschedule_cancellation_response.rbi +1692 -44
  125. data/rbi/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbi +1692 -44
  126. data/rbi/orb/models/subscription_unschedule_pending_plan_changes_response.rbi +1692 -44
  127. data/rbi/orb/models/subscription_update_fixed_fee_quantity_params.rbi +2 -2
  128. data/rbi/orb/models/subscription_update_fixed_fee_quantity_response.rbi +1692 -44
  129. data/rbi/orb/models/subscription_update_trial_response.rbi +1692 -44
  130. data/rbi/orb/models/trial_discount.rbi +8 -8
  131. data/rbi/orb/models/usage_discount.rbi +10 -10
  132. data/rbi/orb/models.rbi +16 -0
  133. data/rbi/orb/resources/beta/external_plan_id.rbi +118 -0
  134. data/rbi/orb/resources/beta.rbi +111 -0
  135. data/rbi/orb/resources/credit_notes.rbi +3 -3
  136. data/rbi/orb/resources/customers/balance_transactions.rbi +0 -7
  137. data/rbi/orb/resources/customers/credits/top_ups.rbi +2 -2
  138. data/rbi/orb/resources/customers.rbi +7 -7
  139. data/rbi/orb/resources/dimensional_price_groups.rbi +1 -1
  140. data/rbi/orb/resources/items.rbi +20 -0
  141. data/rbi/orb/resources/plans/external_plan_id.rbi +1 -1
  142. data/rbi/orb/resources/plans.rbi +5 -2
  143. data/rbi/orb/resources/prices.rbi +73 -1
  144. data/rbi/orb/resources/subscriptions.rbi +9 -1
  145. data/sig/orb/client.rbs +2 -0
  146. data/sig/orb/models/alert.rbs +20 -3
  147. data/sig/orb/models/amount_discount.rbs +5 -5
  148. data/sig/orb/models/beta/external_plan_id_create_plan_version_params.rbs +12898 -0
  149. data/sig/orb/models/beta/external_plan_id_fetch_plan_version_params.rbs +25 -0
  150. data/sig/orb/models/beta/external_plan_id_set_default_plan_version_params.rbs +25 -0
  151. data/sig/orb/models/beta_create_plan_version_params.rbs +12877 -0
  152. data/sig/orb/models/beta_fetch_plan_version_params.rbs +20 -0
  153. data/sig/orb/models/beta_set_default_plan_version_params.rbs +20 -0
  154. data/sig/orb/models/credit_note_create_params.rbs +6 -6
  155. data/sig/orb/models/customer_create_params.rbs +13 -0
  156. data/sig/orb/models/customer_update_by_external_id_params.rbs +13 -0
  157. data/sig/orb/models/customer_update_params.rbs +13 -0
  158. data/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbs +7 -2
  159. data/sig/orb/models/customers/credits/ledger_create_entry_response.rbs +7 -2
  160. data/sig/orb/models/customers/credits/ledger_list_by_external_id_response.rbs +7 -2
  161. data/sig/orb/models/customers/credits/ledger_list_response.rbs +7 -2
  162. data/sig/orb/models/invoice.rbs +558 -4
  163. data/sig/orb/models/invoice_fetch_upcoming_response.rbs +558 -4
  164. data/sig/orb/models/invoice_line_item_create_response.rbs +414 -2
  165. data/sig/orb/models/item.rbs +5 -0
  166. data/sig/orb/models/item_archive_params.rbs +14 -0
  167. data/sig/orb/models/item_create_params.rbs +10 -2
  168. data/sig/orb/models/item_update_params.rbs +5 -0
  169. data/sig/orb/models/percentage_discount.rbs +5 -5
  170. data/sig/orb/models/plan.rbs +538 -4
  171. data/sig/orb/models/plan_create_params.rbs +1460 -3
  172. data/sig/orb/models/plan_version.rbs +583 -0
  173. data/sig/orb/models/plan_version_phase.rbs +60 -0
  174. data/sig/orb/models/price.rbs +3512 -96
  175. data/sig/orb/models/price_create_params.rbs +32 -0
  176. data/sig/orb/models/price_evaluate_multiple_params.rbs +6230 -0
  177. data/sig/orb/models/price_evaluate_multiple_response.rbs +50 -0
  178. data/sig/orb/models/subscription.rbs +609 -29
  179. data/sig/orb/models/subscription_cancel_response.rbs +609 -29
  180. data/sig/orb/models/subscription_change_apply_response.rbs +621 -29
  181. data/sig/orb/models/subscription_change_cancel_response.rbs +621 -29
  182. data/sig/orb/models/subscription_change_retrieve_response.rbs +621 -29
  183. data/sig/orb/models/subscription_create_params.rbs +4450 -1466
  184. data/sig/orb/models/subscription_create_response.rbs +609 -29
  185. data/sig/orb/models/subscription_fetch_schedule_response.rbs +4 -4
  186. data/sig/orb/models/subscription_price_intervals_params.rbs +920 -24
  187. data/sig/orb/models/subscription_price_intervals_response.rbs +609 -29
  188. data/sig/orb/models/subscription_schedule_plan_change_params.rbs +4440 -1466
  189. data/sig/orb/models/subscription_schedule_plan_change_response.rbs +609 -29
  190. data/sig/orb/models/subscription_trigger_phase_response.rbs +609 -29
  191. data/sig/orb/models/subscription_unschedule_cancellation_response.rbs +609 -29
  192. data/sig/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbs +609 -29
  193. data/sig/orb/models/subscription_unschedule_pending_plan_changes_response.rbs +609 -29
  194. data/sig/orb/models/subscription_update_fixed_fee_quantity_response.rbs +609 -29
  195. data/sig/orb/models/subscription_update_trial_response.rbs +609 -29
  196. data/sig/orb/models/trial_discount.rbs +5 -5
  197. data/sig/orb/models/usage_discount.rbs +5 -5
  198. data/sig/orb/models.rbs +16 -0
  199. data/sig/orb/resources/beta/external_plan_id.rbs +34 -0
  200. data/sig/orb/resources/beta.rbs +34 -0
  201. data/sig/orb/resources/credit_notes.rbs +1 -1
  202. data/sig/orb/resources/items.rbs +7 -0
  203. data/sig/orb/resources/prices.rbs +11 -0
  204. data/sig/orb/resources/subscriptions.rbs +2 -0
  205. metadata +40 -1
@@ -6,14 +6,14 @@ module Orb
6
6
  OrHash =
7
7
  T.type_alias { T.any(Orb::TrialDiscount, Orb::Internal::AnyHash) }
8
8
 
9
+ sig { returns(Orb::TrialDiscount::DiscountType::OrSymbol) }
10
+ attr_accessor :discount_type
11
+
9
12
  # List of price_ids that this discount applies to. For plan/plan phase discounts,
10
13
  # this can be a subset of prices.
11
- sig { returns(T::Array[String]) }
14
+ sig { returns(T.nilable(T::Array[String])) }
12
15
  attr_accessor :applies_to_price_ids
13
16
 
14
- sig { returns(Orb::TrialDiscount::DiscountType::OrSymbol) }
15
- attr_accessor :discount_type
16
-
17
17
  sig { returns(T.nilable(String)) }
18
18
  attr_accessor :reason
19
19
 
@@ -27,18 +27,18 @@ module Orb
27
27
 
28
28
  sig do
29
29
  params(
30
- applies_to_price_ids: T::Array[String],
31
30
  discount_type: Orb::TrialDiscount::DiscountType::OrSymbol,
31
+ applies_to_price_ids: T.nilable(T::Array[String]),
32
32
  reason: T.nilable(String),
33
33
  trial_amount_discount: T.nilable(String),
34
34
  trial_percentage_discount: T.nilable(Float)
35
35
  ).returns(T.attached_class)
36
36
  end
37
37
  def self.new(
38
+ discount_type:,
38
39
  # List of price_ids that this discount applies to. For plan/plan phase discounts,
39
40
  # this can be a subset of prices.
40
- applies_to_price_ids:,
41
- discount_type:,
41
+ applies_to_price_ids: nil,
42
42
  reason: nil,
43
43
  # Only available if discount_type is `trial`
44
44
  trial_amount_discount: nil,
@@ -50,8 +50,8 @@ module Orb
50
50
  sig do
51
51
  override.returns(
52
52
  {
53
- applies_to_price_ids: T::Array[String],
54
53
  discount_type: Orb::TrialDiscount::DiscountType::OrSymbol,
54
+ applies_to_price_ids: T.nilable(T::Array[String]),
55
55
  reason: T.nilable(String),
56
56
  trial_amount_discount: T.nilable(String),
57
57
  trial_percentage_discount: T.nilable(Float)
@@ -6,11 +6,6 @@ module Orb
6
6
  OrHash =
7
7
  T.type_alias { T.any(Orb::UsageDiscount, Orb::Internal::AnyHash) }
8
8
 
9
- # List of price_ids that this discount applies to. For plan/plan phase discounts,
10
- # this can be a subset of prices.
11
- sig { returns(T::Array[String]) }
12
- attr_accessor :applies_to_price_ids
13
-
14
9
  sig { returns(Orb::UsageDiscount::DiscountType::OrSymbol) }
15
10
  attr_accessor :discount_type
16
11
 
@@ -19,25 +14,30 @@ module Orb
19
14
  sig { returns(Float) }
20
15
  attr_accessor :usage_discount
21
16
 
17
+ # List of price_ids that this discount applies to. For plan/plan phase discounts,
18
+ # this can be a subset of prices.
19
+ sig { returns(T.nilable(T::Array[String])) }
20
+ attr_accessor :applies_to_price_ids
21
+
22
22
  sig { returns(T.nilable(String)) }
23
23
  attr_accessor :reason
24
24
 
25
25
  sig do
26
26
  params(
27
- applies_to_price_ids: T::Array[String],
28
27
  discount_type: Orb::UsageDiscount::DiscountType::OrSymbol,
29
28
  usage_discount: Float,
29
+ applies_to_price_ids: T.nilable(T::Array[String]),
30
30
  reason: T.nilable(String)
31
31
  ).returns(T.attached_class)
32
32
  end
33
33
  def self.new(
34
- # List of price_ids that this discount applies to. For plan/plan phase discounts,
35
- # this can be a subset of prices.
36
- applies_to_price_ids:,
37
34
  discount_type:,
38
35
  # Only available if discount_type is `usage`. Number of usage units that this
39
36
  # discount is for
40
37
  usage_discount:,
38
+ # List of price_ids that this discount applies to. For plan/plan phase discounts,
39
+ # this can be a subset of prices.
40
+ applies_to_price_ids: nil,
41
41
  reason: nil
42
42
  )
43
43
  end
@@ -45,9 +45,9 @@ module Orb
45
45
  sig do
46
46
  override.returns(
47
47
  {
48
- applies_to_price_ids: T::Array[String],
49
48
  discount_type: Orb::UsageDiscount::DiscountType::OrSymbol,
50
49
  usage_discount: Float,
50
+ applies_to_price_ids: T.nilable(T::Array[String]),
51
51
  reason: T.nilable(String)
52
52
  }
53
53
  )
data/rbi/orb/models.rbi CHANGED
@@ -23,6 +23,14 @@ module Orb
23
23
 
24
24
  AmountDiscount = Orb::Models::AmountDiscount
25
25
 
26
+ Beta = Orb::Models::Beta
27
+
28
+ BetaCreatePlanVersionParams = Orb::Models::BetaCreatePlanVersionParams
29
+
30
+ BetaFetchPlanVersionParams = Orb::Models::BetaFetchPlanVersionParams
31
+
32
+ BetaSetDefaultPlanVersionParams = Orb::Models::BetaSetDefaultPlanVersionParams
33
+
26
34
  BillableMetric = Orb::Models::BillableMetric
27
35
 
28
36
  BillingCycleRelativeDate = Orb::Models::BillingCycleRelativeDate
@@ -126,6 +134,8 @@ module Orb
126
134
 
127
135
  Item = Orb::Models::Item
128
136
 
137
+ ItemArchiveParams = Orb::Models::ItemArchiveParams
138
+
129
139
  ItemCreateParams = Orb::Models::ItemCreateParams
130
140
 
131
141
  ItemFetchParams = Orb::Models::ItemFetchParams
@@ -158,10 +168,16 @@ module Orb
158
168
 
159
169
  PlanUpdateParams = Orb::Models::PlanUpdateParams
160
170
 
171
+ PlanVersion = Orb::Models::PlanVersion
172
+
173
+ PlanVersionPhase = Orb::Models::PlanVersionPhase
174
+
161
175
  Price = Orb::Models::Price
162
176
 
163
177
  PriceCreateParams = Orb::Models::PriceCreateParams
164
178
 
179
+ PriceEvaluateMultipleParams = Orb::Models::PriceEvaluateMultipleParams
180
+
165
181
  PriceEvaluateParams = Orb::Models::PriceEvaluateParams
166
182
 
167
183
  PriceFetchParams = Orb::Models::PriceFetchParams
@@ -0,0 +1,118 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Resources
5
+ class Beta
6
+ class ExternalPlanID
7
+ # This API endpoint is in beta and its interface may change. It is recommended for
8
+ # use only in test mode.
9
+ #
10
+ # This endpoint allows the creation of a new plan version for an existing plan.
11
+ sig do
12
+ params(
13
+ external_plan_id: String,
14
+ version: Integer,
15
+ add_adjustments:
16
+ T.nilable(
17
+ T::Array[
18
+ Orb::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::OrHash
19
+ ]
20
+ ),
21
+ add_prices:
22
+ T.nilable(
23
+ T::Array[
24
+ Orb::Beta::ExternalPlanIDCreatePlanVersionParams::AddPrice::OrHash
25
+ ]
26
+ ),
27
+ remove_adjustments:
28
+ T.nilable(
29
+ T::Array[
30
+ Orb::Beta::ExternalPlanIDCreatePlanVersionParams::RemoveAdjustment::OrHash
31
+ ]
32
+ ),
33
+ remove_prices:
34
+ T.nilable(
35
+ T::Array[
36
+ Orb::Beta::ExternalPlanIDCreatePlanVersionParams::RemovePrice::OrHash
37
+ ]
38
+ ),
39
+ replace_adjustments:
40
+ T.nilable(
41
+ T::Array[
42
+ Orb::Beta::ExternalPlanIDCreatePlanVersionParams::ReplaceAdjustment::OrHash
43
+ ]
44
+ ),
45
+ replace_prices:
46
+ T.nilable(
47
+ T::Array[
48
+ Orb::Beta::ExternalPlanIDCreatePlanVersionParams::ReplacePrice::OrHash
49
+ ]
50
+ ),
51
+ set_as_default: T.nilable(T::Boolean),
52
+ request_options: Orb::RequestOptions::OrHash
53
+ ).returns(Orb::PlanVersion)
54
+ end
55
+ def create_plan_version(
56
+ external_plan_id,
57
+ # New version number.
58
+ version:,
59
+ # Additional adjustments to be added to the plan.
60
+ add_adjustments: nil,
61
+ # Additional prices to be added to the plan.
62
+ add_prices: nil,
63
+ # Adjustments to be removed from the plan.
64
+ remove_adjustments: nil,
65
+ # Prices to be removed from the plan.
66
+ remove_prices: nil,
67
+ # Adjustments to be replaced with additional adjustments on the plan.
68
+ replace_adjustments: nil,
69
+ # Prices to be replaced with additional prices on the plan.
70
+ replace_prices: nil,
71
+ # Set this new plan version as the default
72
+ set_as_default: nil,
73
+ request_options: {}
74
+ )
75
+ end
76
+
77
+ # This API endpoint is in beta and its interface may change. It is recommended for
78
+ # use only in test mode.
79
+ #
80
+ # This endpoint is used to fetch a plan version. It returns the phases, prices,
81
+ # and adjustments present on this version of the plan.
82
+ sig do
83
+ params(
84
+ version: String,
85
+ external_plan_id: String,
86
+ request_options: Orb::RequestOptions::OrHash
87
+ ).returns(Orb::PlanVersion)
88
+ end
89
+ def fetch_plan_version(version, external_plan_id:, request_options: {})
90
+ end
91
+
92
+ # This API endpoint is in beta and its interface may change. It is recommended for
93
+ # use only in test mode.
94
+ #
95
+ # This endpoint allows setting the default version of a plan.
96
+ sig do
97
+ params(
98
+ external_plan_id: String,
99
+ version: Integer,
100
+ request_options: Orb::RequestOptions::OrHash
101
+ ).returns(Orb::Plan)
102
+ end
103
+ def set_default_plan_version(
104
+ external_plan_id,
105
+ # Plan version to set as the default.
106
+ version:,
107
+ request_options: {}
108
+ )
109
+ end
110
+
111
+ # @api private
112
+ sig { params(client: Orb::Client).returns(T.attached_class) }
113
+ def self.new(client:)
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,111 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Resources
5
+ class Beta
6
+ sig { returns(Orb::Resources::Beta::ExternalPlanID) }
7
+ attr_reader :external_plan_id
8
+
9
+ # This API endpoint is in beta and its interface may change. It is recommended for
10
+ # use only in test mode.
11
+ #
12
+ # This endpoint allows the creation of a new plan version for an existing plan.
13
+ sig do
14
+ params(
15
+ plan_id: String,
16
+ version: Integer,
17
+ add_adjustments:
18
+ T.nilable(
19
+ T::Array[Orb::BetaCreatePlanVersionParams::AddAdjustment::OrHash]
20
+ ),
21
+ add_prices:
22
+ T.nilable(
23
+ T::Array[Orb::BetaCreatePlanVersionParams::AddPrice::OrHash]
24
+ ),
25
+ remove_adjustments:
26
+ T.nilable(
27
+ T::Array[
28
+ Orb::BetaCreatePlanVersionParams::RemoveAdjustment::OrHash
29
+ ]
30
+ ),
31
+ remove_prices:
32
+ T.nilable(
33
+ T::Array[Orb::BetaCreatePlanVersionParams::RemovePrice::OrHash]
34
+ ),
35
+ replace_adjustments:
36
+ T.nilable(
37
+ T::Array[
38
+ Orb::BetaCreatePlanVersionParams::ReplaceAdjustment::OrHash
39
+ ]
40
+ ),
41
+ replace_prices:
42
+ T.nilable(
43
+ T::Array[Orb::BetaCreatePlanVersionParams::ReplacePrice::OrHash]
44
+ ),
45
+ set_as_default: T.nilable(T::Boolean),
46
+ request_options: Orb::RequestOptions::OrHash
47
+ ).returns(Orb::PlanVersion)
48
+ end
49
+ def create_plan_version(
50
+ plan_id,
51
+ # New version number.
52
+ version:,
53
+ # Additional adjustments to be added to the plan.
54
+ add_adjustments: nil,
55
+ # Additional prices to be added to the plan.
56
+ add_prices: nil,
57
+ # Adjustments to be removed from the plan.
58
+ remove_adjustments: nil,
59
+ # Prices to be removed from the plan.
60
+ remove_prices: nil,
61
+ # Adjustments to be replaced with additional adjustments on the plan.
62
+ replace_adjustments: nil,
63
+ # Prices to be replaced with additional prices on the plan.
64
+ replace_prices: nil,
65
+ # Set this new plan version as the default
66
+ set_as_default: nil,
67
+ request_options: {}
68
+ )
69
+ end
70
+
71
+ # This API endpoint is in beta and its interface may change. It is recommended for
72
+ # use only in test mode.
73
+ #
74
+ # This endpoint is used to fetch a plan version. It returns the phases, prices,
75
+ # and adjustments present on this version of the plan.
76
+ sig do
77
+ params(
78
+ version: String,
79
+ plan_id: String,
80
+ request_options: Orb::RequestOptions::OrHash
81
+ ).returns(Orb::PlanVersion)
82
+ end
83
+ def fetch_plan_version(version, plan_id:, request_options: {})
84
+ end
85
+
86
+ # This API endpoint is in beta and its interface may change. It is recommended for
87
+ # use only in test mode.
88
+ #
89
+ # This endpoint allows setting the default version of a plan.
90
+ sig do
91
+ params(
92
+ plan_id: String,
93
+ version: Integer,
94
+ request_options: Orb::RequestOptions::OrHash
95
+ ).returns(Orb::Plan)
96
+ end
97
+ def set_default_plan_version(
98
+ plan_id,
99
+ # Plan version to set as the default.
100
+ version:,
101
+ request_options: {}
102
+ )
103
+ end
104
+
105
+ # @api private
106
+ sig { params(client: Orb::Client).returns(T.attached_class) }
107
+ def self.new(client:)
108
+ end
109
+ end
110
+ end
111
+ end
@@ -8,17 +8,17 @@ module Orb
8
8
  sig do
9
9
  params(
10
10
  line_items: T::Array[Orb::CreditNoteCreateParams::LineItem::OrHash],
11
+ reason: Orb::CreditNoteCreateParams::Reason::OrSymbol,
11
12
  memo: T.nilable(String),
12
- reason: T.nilable(Orb::CreditNoteCreateParams::Reason::OrSymbol),
13
13
  request_options: Orb::RequestOptions::OrHash
14
14
  ).returns(Orb::CreditNote)
15
15
  end
16
16
  def create(
17
17
  line_items:,
18
+ # An optional reason for the credit note.
19
+ reason:,
18
20
  # An optional memo to attach to the credit note.
19
21
  memo: nil,
20
- # An optional reason for the credit note.
21
- reason: nil,
22
22
  request_options: {}
23
23
  )
24
24
  end
@@ -47,13 +47,6 @@ module Orb
47
47
  # This endpoint retrieves all customer balance transactions in reverse
48
48
  # chronological order for a single customer, providing a complete audit trail of
49
49
  # all adjustments and invoice applications.
50
- #
51
- # ## Eligibility
52
- #
53
- # The customer balance can only be applied to invoices or adjusted manually if
54
- # invoices are not synced to a separate invoicing provider. If a payment gateway
55
- # such as Stripe is used, the balance will be applied to the invoice before
56
- # forwarding payment to the gateway.
57
50
  sig do
58
51
  params(
59
52
  customer_id: String,
@@ -45,7 +45,7 @@ module Orb
45
45
  # threshold, the top-up will be triggered.
46
46
  threshold:,
47
47
  # The date from which the top-up is active. If unspecified, the top-up is active
48
- # immediately.
48
+ # immediately. This should not be more than 10 days in the past.
49
49
  active_from: nil,
50
50
  # The number of days or months after which the top-up expires. If unspecified, it
51
51
  # does not expire.
@@ -134,7 +134,7 @@ module Orb
134
134
  # threshold, the top-up will be triggered.
135
135
  threshold:,
136
136
  # The date from which the top-up is active. If unspecified, the top-up is active
137
- # immediately.
137
+ # immediately. This should not be more than 10 days in the past.
138
138
  active_from: nil,
139
139
  # The number of days or months after which the top-up expires. If unspecified, it
140
140
  # does not expire.
@@ -54,7 +54,8 @@ module Orb
54
54
  T.nilable(
55
55
  T.any(
56
56
  Orb::CustomerCreateParams::TaxConfiguration::Avalara::OrHash,
57
- Orb::CustomerCreateParams::TaxConfiguration::Taxjar::OrHash
57
+ Orb::CustomerCreateParams::TaxConfiguration::Taxjar::OrHash,
58
+ Orb::CustomerCreateParams::TaxConfiguration::Sphere::OrHash
58
59
  )
59
60
  ),
60
61
  tax_id: T.nilable(Orb::CustomerCreateParams::TaxID::OrHash),
@@ -252,7 +253,8 @@ module Orb
252
253
  T.nilable(
253
254
  T.any(
254
255
  Orb::CustomerUpdateParams::TaxConfiguration::Avalara::OrHash,
255
- Orb::CustomerUpdateParams::TaxConfiguration::Taxjar::OrHash
256
+ Orb::CustomerUpdateParams::TaxConfiguration::Taxjar::OrHash,
257
+ Orb::CustomerUpdateParams::TaxConfiguration::Sphere::OrHash
256
258
  )
257
259
  ),
258
260
  tax_id: T.nilable(Orb::CustomerUpdateParams::TaxID::OrHash),
@@ -453,10 +455,7 @@ module Orb
453
455
  # **Note**: This operation happens asynchronously and can be expected to take a
454
456
  # few minutes to propagate to related resources. However, querying for the
455
457
  # customer on subsequent GET requests while deletion is in process will reflect
456
- # its deletion with a `deleted: true` property. Once the customer deletion has
457
- # been fully processed, the customer will not be returned in the API.
458
- #
459
- # On successful processing, this returns an empty dictionary (`{}`) in the API.
458
+ # its deletion.
460
459
  sig do
461
460
  params(
462
461
  customer_id: String,
@@ -570,7 +569,8 @@ module Orb
570
569
  T.nilable(
571
570
  T.any(
572
571
  Orb::CustomerUpdateByExternalIDParams::TaxConfiguration::Avalara::OrHash,
573
- Orb::CustomerUpdateByExternalIDParams::TaxConfiguration::Taxjar::OrHash
572
+ Orb::CustomerUpdateByExternalIDParams::TaxConfiguration::Taxjar::OrHash,
573
+ Orb::CustomerUpdateByExternalIDParams::TaxConfiguration::Sphere::OrHash
574
574
  )
575
575
  ),
576
576
  tax_id:
@@ -17,7 +17,7 @@ module Orb
17
17
  # For example, suppose we have a billable metric that measures the number of
18
18
  # widgets used and we want to charge differently depending on the color of the
19
19
  # widget. We can create a price group with a dimension "color" and two prices: one
20
- # that charges $10 per red widget and one that charges $20 per blue widget.
20
+ # that charges \$10 per red widget and one that charges \$20 per blue widget.
21
21
  sig do
22
22
  params(
23
23
  billable_metric_id: String,
@@ -7,12 +7,17 @@ module Orb
7
7
  sig do
8
8
  params(
9
9
  name: String,
10
+ metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
10
11
  request_options: Orb::RequestOptions::OrHash
11
12
  ).returns(Orb::Item)
12
13
  end
13
14
  def create(
14
15
  # The name of the item.
15
16
  name:,
17
+ # User-specified key/value pairs for the resource. Individual keys can be removed
18
+ # by setting the value to `null`, and the entire metadata mapping can be cleared
19
+ # by setting `metadata` to `null`.
20
+ metadata: nil,
16
21
  request_options: {}
17
22
  )
18
23
  end
@@ -25,6 +30,7 @@ module Orb
25
30
  T.nilable(
26
31
  T::Array[Orb::ItemUpdateParams::ExternalConnection::OrHash]
27
32
  ),
33
+ metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
28
34
  name: T.nilable(String),
29
35
  request_options: Orb::RequestOptions::OrHash
30
36
  ).returns(Orb::Item)
@@ -32,6 +38,10 @@ module Orb
32
38
  def update(
33
39
  item_id,
34
40
  external_connections: nil,
41
+ # User-specified key/value pairs for the resource. Individual keys can be removed
42
+ # by setting the value to `null`, and the entire metadata mapping can be cleared
43
+ # by setting `metadata` to `null`.
44
+ metadata: nil,
35
45
  name: nil,
36
46
  request_options: {}
37
47
  )
@@ -56,6 +66,16 @@ module Orb
56
66
  )
57
67
  end
58
68
 
69
+ # Archive item
70
+ sig do
71
+ params(
72
+ item_id: String,
73
+ request_options: Orb::RequestOptions::OrHash
74
+ ).returns(Orb::Item)
75
+ end
76
+ def archive(item_id, request_options: {})
77
+ end
78
+
59
79
  # This endpoint returns an item identified by its item_id.
60
80
  sig do
61
81
  params(
@@ -7,7 +7,7 @@ module Orb
7
7
  # This endpoint can be used to update the `external_plan_id`, and `metadata` of an
8
8
  # existing plan.
9
9
  #
10
- # Other fields on a customer are currently immutable.
10
+ # Other fields on a plan are currently immutable.
11
11
  sig do
12
12
  params(
13
13
  other_external_plan_id: String,
@@ -38,7 +38,10 @@ module Orb
38
38
  Orb::PlanCreateParams::Price::MaxGroupTieredPackage::OrHash,
39
39
  Orb::PlanCreateParams::Price::ScalableMatrixWithUnitPricing::OrHash,
40
40
  Orb::PlanCreateParams::Price::ScalableMatrixWithTieredPricing::OrHash,
41
- Orb::PlanCreateParams::Price::CumulativeGroupedBulk::OrHash
41
+ Orb::PlanCreateParams::Price::CumulativeGroupedBulk::OrHash,
42
+ Orb::PlanCreateParams::Price::TieredPackageWithMinimum::OrHash,
43
+ Orb::PlanCreateParams::Price::MatrixWithAllocation::OrHash,
44
+ Orb::PlanCreateParams::Price::GroupedTiered::OrHash
42
45
  )
43
46
  ],
44
47
  default_invoice_memo: T.nilable(String),
@@ -78,7 +81,7 @@ module Orb
78
81
  # This endpoint can be used to update the `external_plan_id`, and `metadata` of an
79
82
  # existing plan.
80
83
  #
81
- # Other fields on a customer are currently immutable.
84
+ # Other fields on a plan are currently immutable.
82
85
  sig do
83
86
  params(
84
87
  plan_id: String,
@@ -7,7 +7,7 @@ module Orb
7
7
  attr_reader :external_price_id
8
8
 
9
9
  # This endpoint is used to create a [price](/product-catalog/price-configuration).
10
- # A price created using this endpoint is always an add-on, meaning that its not
10
+ # A price created using this endpoint is always an add-on, meaning that it's not
11
11
  # associated with a specific plan and can instead be individually added to
12
12
  # subscriptions, including subscriptions on different plans.
13
13
  #
@@ -60,6 +60,10 @@ module Orb
60
60
  Orb::PriceCreateParams::BillingCycleConfiguration::OrHash
61
61
  ),
62
62
  conversion_rate: T.nilable(Float),
63
+ dimensional_price_configuration:
64
+ T.nilable(
65
+ Orb::PriceCreateParams::DimensionalPriceConfiguration::OrHash
66
+ ),
63
67
  external_price_id: T.nilable(String),
64
68
  fixed_price_quantity: T.nilable(Float),
65
69
  invoice_grouping_key: T.nilable(String),
@@ -120,6 +124,8 @@ module Orb
120
124
  billing_cycle_configuration: nil,
121
125
  # The per unit conversion rate of the price currency to the invoicing currency.
122
126
  conversion_rate: nil,
127
+ # For dimensional price: specifies a price group and dimension values
128
+ dimensional_price_configuration: nil,
123
129
  # An alias for the price.
124
130
  external_price_id: nil,
125
131
  # If the Price represents a fixed cost, this represents the quantity of units
@@ -177,6 +183,10 @@ module Orb
177
183
  )
178
184
  end
179
185
 
186
+ # [NOTE] It is recommended to use the `/v1/prices/evaluate` which offers further
187
+ # functionality, such as multiple prices, inline price definitions, and querying
188
+ # over preview events.
189
+ #
180
190
  # This endpoint is used to evaluate the output of a price for a given customer and
181
191
  # time range. It enables filtering and grouping the output using
182
192
  # [computed properties](/extensibility/advanced-metrics#computed-properties),
@@ -232,6 +242,68 @@ module Orb
232
242
  )
233
243
  end
234
244
 
245
+ # This endpoint is used to evaluate the output of price(s) for a given customer
246
+ # and time range over either ingested events or preview events. It enables
247
+ # filtering and grouping the output using
248
+ # [computed properties](/extensibility/advanced-metrics#computed-properties),
249
+ # supporting the following workflows:
250
+ #
251
+ # 1. Showing detailed usage and costs to the end customer.
252
+ # 2. Auditing subtotals on invoice line items.
253
+ #
254
+ # Prices may either reference existing prices in your Orb account or be defined
255
+ # inline in the request body. Up to 100 prices can be evaluated in a single
256
+ # request.
257
+ #
258
+ # Price evaluation by default uses ingested events, but you can also provide a
259
+ # list of preview events to use instead. Up to 500 preview events can be provided
260
+ # in a single request. When using ingested events, the start of the time range
261
+ # must be no more than 100 days ago.
262
+ #
263
+ # For these workflows, the expressiveness of computed properties in both the
264
+ # filters and grouping is critical. For example, if you'd like to show your
265
+ # customer their usage grouped by hour and another property, you can do so with
266
+ # the following `grouping_keys`:
267
+ # `["hour_floor_timestamp_millis(timestamp_millis)", "my_property"]`. If you'd
268
+ # like to examine a customer's usage for a specific property value, you can do so
269
+ # with the following `filter`:
270
+ # `my_property = 'foo' AND my_other_property = 'bar'`.
271
+ #
272
+ # The length of the results must be no greater than 1000. Note that this is a POST
273
+ # endpoint rather than a GET endpoint because it employs a JSON body rather than
274
+ # query parameters.
275
+ sig do
276
+ params(
277
+ timeframe_end: Time,
278
+ timeframe_start: Time,
279
+ customer_id: T.nilable(String),
280
+ events:
281
+ T.nilable(
282
+ T::Array[Orb::PriceEvaluateMultipleParams::Event::OrHash]
283
+ ),
284
+ external_customer_id: T.nilable(String),
285
+ price_evaluations:
286
+ T::Array[Orb::PriceEvaluateMultipleParams::PriceEvaluation::OrHash],
287
+ request_options: Orb::RequestOptions::OrHash
288
+ ).returns(Orb::Models::PriceEvaluateMultipleResponse)
289
+ end
290
+ def evaluate_multiple(
291
+ # The exclusive upper bound for event timestamps
292
+ timeframe_end:,
293
+ # The inclusive lower bound for event timestamps
294
+ timeframe_start:,
295
+ # The ID of the customer to which this evaluation is scoped.
296
+ customer_id: nil,
297
+ # Optional list of preview events to use instead of actual usage data (max 500)
298
+ events: nil,
299
+ # The external customer ID of the customer to which this evaluation is scoped.
300
+ external_customer_id: nil,
301
+ # List of prices to evaluate (max 100)
302
+ price_evaluations: nil,
303
+ request_options: {}
304
+ )
305
+ end
306
+
235
307
  # This endpoint returns a price given an identifier.
236
308
  sig do
237
309
  params(