orb-billing 0.5.4 → 0.6.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 (211) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/README.md +1 -1
  4. data/lib/orb/internal/type/base_model.rb +2 -2
  5. data/lib/orb/internal/type/union.rb +6 -6
  6. data/lib/orb/internal/util.rb +5 -1
  7. data/lib/orb/models/alert.rb +33 -1
  8. data/lib/orb/models/amount_discount.rb +10 -10
  9. data/lib/orb/models/credit_note_create_params.rb +9 -9
  10. data/lib/orb/models/customer_create_params.rb +21 -3
  11. data/lib/orb/models/customer_update_by_external_id_params.rb +21 -3
  12. data/lib/orb/models/customer_update_params.rb +21 -3
  13. data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rb +9 -1
  14. data/lib/orb/models/customers/credits/ledger_create_entry_response.rb +9 -1
  15. data/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rb +9 -1
  16. data/lib/orb/models/customers/credits/ledger_list_response.rb +9 -1
  17. data/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rb +1 -1
  18. data/lib/orb/models/customers/credits/top_up_create_params.rb +1 -1
  19. data/lib/orb/models/invoice.rb +626 -9
  20. data/lib/orb/models/invoice_fetch_upcoming_response.rb +624 -9
  21. data/lib/orb/models/invoice_line_item_create_response.rb +486 -7
  22. data/lib/orb/models/item.rb +18 -1
  23. data/lib/orb/models/item_archive_params.rb +14 -0
  24. data/lib/orb/models/item_create_params.rb +14 -1
  25. data/lib/orb/models/item_update_params.rb +16 -1
  26. data/lib/orb/models/percentage_discount.rb +10 -10
  27. data/lib/orb/models/plan.rb +618 -9
  28. data/lib/orb/models/plan_create_params.rb +2066 -30
  29. data/lib/orb/models/plan_set_default_version_params.rb +22 -0
  30. data/lib/orb/models/plans/external_plan_id/version_create_params.rb +17948 -0
  31. data/lib/orb/models/plans/external_plan_id/version_create_response.rb +819 -0
  32. data/lib/orb/models/plans/external_plan_id/version_retrieve_params.rb +24 -0
  33. data/lib/orb/models/plans/external_plan_id/version_retrieve_response.rb +819 -0
  34. data/lib/orb/models/plans/external_plan_id_set_default_version_params.rb +24 -0
  35. data/lib/orb/models/plans/version_create_params.rb +17794 -0
  36. data/lib/orb/models/plans/version_create_response.rb +814 -0
  37. data/lib/orb/models/plans/version_retrieve_params.rb +22 -0
  38. data/lib/orb/models/plans/version_retrieve_response.rb +814 -0
  39. data/lib/orb/models/price.rb +4124 -70
  40. data/lib/orb/models/price_create_params.rb +45 -1
  41. data/lib/orb/models/price_evaluate_params.rb +8529 -21
  42. data/lib/orb/models/price_evaluate_response.rb +38 -3
  43. data/lib/orb/models/subscription.rb +730 -54
  44. data/lib/orb/models/subscription_cancel_response.rb +706 -54
  45. data/lib/orb/models/subscription_change_apply_response.rb +728 -54
  46. data/lib/orb/models/subscription_change_cancel_response.rb +728 -54
  47. data/lib/orb/models/subscription_change_retrieve_response.rb +728 -54
  48. data/lib/orb/models/subscription_create_params.rb +5992 -1698
  49. data/lib/orb/models/subscription_create_response.rb +706 -54
  50. data/lib/orb/models/subscription_fetch_schedule_response.rb +3 -3
  51. data/lib/orb/models/subscription_price_intervals_params.rb +1392 -76
  52. data/lib/orb/models/subscription_price_intervals_response.rb +712 -54
  53. data/lib/orb/models/subscription_schedule_plan_change_params.rb +6005 -1723
  54. data/lib/orb/models/subscription_schedule_plan_change_response.rb +716 -54
  55. data/lib/orb/models/subscription_trigger_phase_response.rb +708 -54
  56. data/lib/orb/models/subscription_unschedule_cancellation_response.rb +720 -54
  57. data/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rb +728 -54
  58. data/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rb +728 -54
  59. data/lib/orb/models/subscription_update_fixed_fee_quantity_params.rb +1 -1
  60. data/lib/orb/models/subscription_update_fixed_fee_quantity_response.rb +720 -54
  61. data/lib/orb/models/subscription_update_trial_response.rb +706 -54
  62. data/lib/orb/models/trial_discount.rb +10 -10
  63. data/lib/orb/models/usage_discount.rb +10 -10
  64. data/lib/orb/models.rb +4 -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/versions.rb +88 -0
  71. data/lib/orb/resources/plans/external_plan_id.rb +32 -1
  72. data/lib/orb/resources/plans/versions.rb +86 -0
  73. data/lib/orb/resources/plans.rb +33 -2
  74. data/lib/orb/resources/prices.rb +23 -17
  75. data/lib/orb/resources/subscriptions.rb +5 -1
  76. data/lib/orb/version.rb +1 -1
  77. data/lib/orb.rb +16 -1
  78. data/rbi/orb/models/alert.rbi +50 -3
  79. data/rbi/orb/models/amount_discount.rbi +8 -8
  80. data/rbi/orb/models/credit_note_create_params.rbi +8 -8
  81. data/rbi/orb/models/customer_create_params.rbi +38 -4
  82. data/rbi/orb/models/customer_update_by_external_id_params.rbi +38 -4
  83. data/rbi/orb/models/customer_update_params.rbi +38 -4
  84. data/rbi/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbi +9 -1
  85. data/rbi/orb/models/customers/credits/ledger_create_entry_response.rbi +9 -1
  86. data/rbi/orb/models/customers/credits/ledger_list_by_external_id_response.rbi +9 -1
  87. data/rbi/orb/models/customers/credits/ledger_list_response.rbi +9 -1
  88. data/rbi/orb/models/customers/credits/top_up_create_by_external_id_params.rbi +2 -2
  89. data/rbi/orb/models/customers/credits/top_up_create_params.rbi +2 -2
  90. data/rbi/orb/models/invoice.rbi +1451 -35
  91. data/rbi/orb/models/invoice_fetch_upcoming_response.rbi +1524 -4
  92. data/rbi/orb/models/invoice_line_item_create_response.rbi +1184 -2
  93. data/rbi/orb/models/item.rbi +20 -1
  94. data/rbi/orb/models/item_archive_params.rbi +25 -0
  95. data/rbi/orb/models/item_create_params.rbi +18 -1
  96. data/rbi/orb/models/item_update_params.rbi +17 -1
  97. data/rbi/orb/models/percentage_discount.rbi +10 -10
  98. data/rbi/orb/models/plan.rbi +1339 -4
  99. data/rbi/orb/models/plan_create_params.rbi +3833 -29
  100. data/rbi/orb/models/plan_set_default_version_params.rbi +40 -0
  101. data/rbi/orb/models/plans/external_plan_id/version_create_params.rbi +32668 -0
  102. data/rbi/orb/models/plans/external_plan_id/version_create_response.rbi +1562 -0
  103. data/rbi/orb/models/plans/external_plan_id/version_retrieve_params.rbi +42 -0
  104. data/rbi/orb/models/plans/external_plan_id/version_retrieve_response.rbi +1562 -0
  105. data/rbi/orb/models/plans/external_plan_id_set_default_version_params.rbi +45 -0
  106. data/rbi/orb/models/plans/version_create_params.rbi +32607 -0
  107. data/rbi/orb/models/plans/version_create_response.rbi +1556 -0
  108. data/rbi/orb/models/plans/version_retrieve_params.rbi +37 -0
  109. data/rbi/orb/models/plans/version_retrieve_response.rbi +1558 -0
  110. data/rbi/orb/models/price.rbi +9447 -441
  111. data/rbi/orb/models/price_create_params.rbi +80 -0
  112. data/rbi/orb/models/price_evaluate_params.rbi +15684 -25
  113. data/rbi/orb/models/price_evaluate_response.rbi +68 -5
  114. data/rbi/orb/models/subscription.rbi +1654 -44
  115. data/rbi/orb/models/subscription_cancel_response.rbi +1692 -44
  116. data/rbi/orb/models/subscription_change_apply_response.rbi +1692 -44
  117. data/rbi/orb/models/subscription_change_cancel_response.rbi +1692 -44
  118. data/rbi/orb/models/subscription_change_retrieve_response.rbi +1692 -44
  119. data/rbi/orb/models/subscription_create_params.rbi +10400 -2710
  120. data/rbi/orb/models/subscription_create_response.rbi +1692 -44
  121. data/rbi/orb/models/subscription_fetch_schedule_response.rbi +13 -4
  122. data/rbi/orb/models/subscription_price_intervals_params.rbi +2401 -49
  123. data/rbi/orb/models/subscription_price_intervals_response.rbi +1692 -44
  124. data/rbi/orb/models/subscription_schedule_plan_change_params.rbi +10423 -2753
  125. data/rbi/orb/models/subscription_schedule_plan_change_response.rbi +1692 -44
  126. data/rbi/orb/models/subscription_trigger_phase_response.rbi +1692 -44
  127. data/rbi/orb/models/subscription_unschedule_cancellation_response.rbi +1692 -44
  128. data/rbi/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbi +1692 -44
  129. data/rbi/orb/models/subscription_unschedule_pending_plan_changes_response.rbi +1692 -44
  130. data/rbi/orb/models/subscription_update_fixed_fee_quantity_params.rbi +2 -2
  131. data/rbi/orb/models/subscription_update_fixed_fee_quantity_response.rbi +1692 -44
  132. data/rbi/orb/models/subscription_update_trial_response.rbi +1692 -44
  133. data/rbi/orb/models/trial_discount.rbi +8 -8
  134. data/rbi/orb/models/usage_discount.rbi +10 -10
  135. data/rbi/orb/models.rbi +4 -0
  136. data/rbi/orb/resources/credit_notes.rbi +3 -3
  137. data/rbi/orb/resources/customers/balance_transactions.rbi +0 -7
  138. data/rbi/orb/resources/customers/credits/top_ups.rbi +2 -2
  139. data/rbi/orb/resources/customers.rbi +7 -7
  140. data/rbi/orb/resources/dimensional_price_groups.rbi +1 -1
  141. data/rbi/orb/resources/items.rbi +20 -0
  142. data/rbi/orb/resources/plans/external_plan_id/versions.rbi +103 -0
  143. data/rbi/orb/resources/plans/external_plan_id.rbi +23 -1
  144. data/rbi/orb/resources/plans/versions.rbi +91 -0
  145. data/rbi/orb/resources/plans.rbi +27 -2
  146. data/rbi/orb/resources/prices.rbi +27 -17
  147. data/rbi/orb/resources/subscriptions.rbi +9 -1
  148. data/sig/orb/models/alert.rbs +20 -3
  149. data/sig/orb/models/amount_discount.rbs +5 -5
  150. data/sig/orb/models/credit_note_create_params.rbs +6 -6
  151. data/sig/orb/models/customer_create_params.rbs +13 -0
  152. data/sig/orb/models/customer_update_by_external_id_params.rbs +13 -0
  153. data/sig/orb/models/customer_update_params.rbs +13 -0
  154. data/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbs +7 -2
  155. data/sig/orb/models/customers/credits/ledger_create_entry_response.rbs +7 -2
  156. data/sig/orb/models/customers/credits/ledger_list_by_external_id_response.rbs +7 -2
  157. data/sig/orb/models/customers/credits/ledger_list_response.rbs +7 -2
  158. data/sig/orb/models/invoice.rbs +558 -4
  159. data/sig/orb/models/invoice_fetch_upcoming_response.rbs +558 -4
  160. data/sig/orb/models/invoice_line_item_create_response.rbs +414 -2
  161. data/sig/orb/models/item.rbs +5 -0
  162. data/sig/orb/models/item_archive_params.rbs +14 -0
  163. data/sig/orb/models/item_create_params.rbs +10 -2
  164. data/sig/orb/models/item_update_params.rbs +5 -0
  165. data/sig/orb/models/percentage_discount.rbs +5 -5
  166. data/sig/orb/models/plan.rbs +538 -4
  167. data/sig/orb/models/plan_create_params.rbs +1460 -3
  168. data/sig/orb/models/plan_set_default_version_params.rbs +20 -0
  169. data/sig/orb/models/plans/external_plan_id/version_create_params.rbs +12923 -0
  170. data/sig/orb/models/plans/external_plan_id/version_create_response.rbs +664 -0
  171. data/sig/orb/models/plans/external_plan_id/version_retrieve_params.rbs +27 -0
  172. data/sig/orb/models/plans/external_plan_id/version_retrieve_response.rbs +664 -0
  173. data/sig/orb/models/plans/external_plan_id_set_default_version_params.rbs +25 -0
  174. data/sig/orb/models/plans/version_create_params.rbs +12898 -0
  175. data/sig/orb/models/plans/version_create_response.rbs +662 -0
  176. data/sig/orb/models/plans/version_retrieve_params.rbs +25 -0
  177. data/sig/orb/models/plans/version_retrieve_response.rbs +662 -0
  178. data/sig/orb/models/price.rbs +3512 -96
  179. data/sig/orb/models/price_create_params.rbs +32 -0
  180. data/sig/orb/models/price_evaluate_params.rbs +6187 -10
  181. data/sig/orb/models/price_evaluate_response.rbs +41 -4
  182. data/sig/orb/models/subscription.rbs +609 -29
  183. data/sig/orb/models/subscription_cancel_response.rbs +609 -29
  184. data/sig/orb/models/subscription_change_apply_response.rbs +621 -29
  185. data/sig/orb/models/subscription_change_cancel_response.rbs +621 -29
  186. data/sig/orb/models/subscription_change_retrieve_response.rbs +621 -29
  187. data/sig/orb/models/subscription_create_params.rbs +4450 -1466
  188. data/sig/orb/models/subscription_create_response.rbs +609 -29
  189. data/sig/orb/models/subscription_fetch_schedule_response.rbs +4 -4
  190. data/sig/orb/models/subscription_price_intervals_params.rbs +920 -24
  191. data/sig/orb/models/subscription_price_intervals_response.rbs +609 -29
  192. data/sig/orb/models/subscription_schedule_plan_change_params.rbs +4440 -1466
  193. data/sig/orb/models/subscription_schedule_plan_change_response.rbs +609 -29
  194. data/sig/orb/models/subscription_trigger_phase_response.rbs +609 -29
  195. data/sig/orb/models/subscription_unschedule_cancellation_response.rbs +609 -29
  196. data/sig/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbs +609 -29
  197. data/sig/orb/models/subscription_unschedule_pending_plan_changes_response.rbs +609 -29
  198. data/sig/orb/models/subscription_update_fixed_fee_quantity_response.rbs +609 -29
  199. data/sig/orb/models/subscription_update_trial_response.rbs +609 -29
  200. data/sig/orb/models/trial_discount.rbs +5 -5
  201. data/sig/orb/models/usage_discount.rbs +5 -5
  202. data/sig/orb/models.rbs +4 -0
  203. data/sig/orb/resources/credit_notes.rbs +1 -1
  204. data/sig/orb/resources/items.rbs +7 -0
  205. data/sig/orb/resources/plans/external_plan_id/versions.rbs +30 -0
  206. data/sig/orb/resources/plans/external_plan_id.rbs +8 -0
  207. data/sig/orb/resources/plans/versions.rbs +28 -0
  208. data/sig/orb/resources/plans.rbs +8 -0
  209. data/sig/orb/resources/prices.rbs +3 -3
  210. data/sig/orb/resources/subscriptions.rbs +2 -0
  211. metadata +41 -2
@@ -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
@@ -126,6 +126,8 @@ module Orb
126
126
 
127
127
  Item = Orb::Models::Item
128
128
 
129
+ ItemArchiveParams = Orb::Models::ItemArchiveParams
130
+
129
131
  ItemCreateParams = Orb::Models::ItemCreateParams
130
132
 
131
133
  ItemFetchParams = Orb::Models::ItemFetchParams
@@ -156,6 +158,8 @@ module Orb
156
158
 
157
159
  Plans = Orb::Models::Plans
158
160
 
161
+ PlanSetDefaultVersionParams = Orb::Models::PlanSetDefaultVersionParams
162
+
159
163
  PlanUpdateParams = Orb::Models::PlanUpdateParams
160
164
 
161
165
  Price = Orb::Models::Price
@@ -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(
@@ -0,0 +1,103 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Resources
5
+ class Plans
6
+ class ExternalPlanID
7
+ class Versions
8
+ # This API endpoint is in beta and its interface may change. It is recommended for
9
+ # use only in test mode.
10
+ #
11
+ # This endpoint allows the creation of a new plan version for an existing plan.
12
+ sig do
13
+ params(
14
+ external_plan_id: String,
15
+ version: Integer,
16
+ add_adjustments:
17
+ T.nilable(
18
+ T::Array[
19
+ Orb::Plans::ExternalPlanID::VersionCreateParams::AddAdjustment::OrHash
20
+ ]
21
+ ),
22
+ add_prices:
23
+ T.nilable(
24
+ T::Array[
25
+ Orb::Plans::ExternalPlanID::VersionCreateParams::AddPrice::OrHash
26
+ ]
27
+ ),
28
+ remove_adjustments:
29
+ T.nilable(
30
+ T::Array[
31
+ Orb::Plans::ExternalPlanID::VersionCreateParams::RemoveAdjustment::OrHash
32
+ ]
33
+ ),
34
+ remove_prices:
35
+ T.nilable(
36
+ T::Array[
37
+ Orb::Plans::ExternalPlanID::VersionCreateParams::RemovePrice::OrHash
38
+ ]
39
+ ),
40
+ replace_adjustments:
41
+ T.nilable(
42
+ T::Array[
43
+ Orb::Plans::ExternalPlanID::VersionCreateParams::ReplaceAdjustment::OrHash
44
+ ]
45
+ ),
46
+ replace_prices:
47
+ T.nilable(
48
+ T::Array[
49
+ Orb::Plans::ExternalPlanID::VersionCreateParams::ReplacePrice::OrHash
50
+ ]
51
+ ),
52
+ set_as_default: T.nilable(T::Boolean),
53
+ request_options: Orb::RequestOptions::OrHash
54
+ ).returns(Orb::Models::Plans::ExternalPlanID::VersionCreateResponse)
55
+ end
56
+ def create(
57
+ external_plan_id,
58
+ # New version number.
59
+ version:,
60
+ # Additional adjustments to be added to the plan.
61
+ add_adjustments: nil,
62
+ # Additional prices to be added to the plan.
63
+ add_prices: nil,
64
+ # Adjustments to be removed from the plan.
65
+ remove_adjustments: nil,
66
+ # Prices to be removed from the plan.
67
+ remove_prices: nil,
68
+ # Adjustments to be replaced with additional adjustments on the plan.
69
+ replace_adjustments: nil,
70
+ # Prices to be replaced with additional prices on the plan.
71
+ replace_prices: nil,
72
+ # Set this new plan version as the default
73
+ set_as_default: nil,
74
+ request_options: {}
75
+ )
76
+ end
77
+
78
+ # This API endpoint is in beta and its interface may change. It is recommended for
79
+ # use only in test mode.
80
+ #
81
+ # This endpoint is used to fetch a plan version. It returns the phases, prices,
82
+ # and adjustments present on this version of the plan.
83
+ sig do
84
+ params(
85
+ version: String,
86
+ external_plan_id: String,
87
+ request_options: Orb::RequestOptions::OrHash
88
+ ).returns(
89
+ Orb::Models::Plans::ExternalPlanID::VersionRetrieveResponse
90
+ )
91
+ end
92
+ def retrieve(version, external_plan_id:, request_options: {})
93
+ end
94
+
95
+ # @api private
96
+ sig { params(client: Orb::Client).returns(T.attached_class) }
97
+ def self.new(client:)
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
@@ -4,10 +4,13 @@ module Orb
4
4
  module Resources
5
5
  class Plans
6
6
  class ExternalPlanID
7
+ sig { returns(Orb::Resources::Plans::ExternalPlanID::Versions) }
8
+ attr_reader :versions
9
+
7
10
  # This endpoint can be used to update the `external_plan_id`, and `metadata` of an
8
11
  # existing plan.
9
12
  #
10
- # Other fields on a customer are currently immutable.
13
+ # Other fields on a plan are currently immutable.
11
14
  sig do
12
15
  params(
13
16
  other_external_plan_id: String,
@@ -55,6 +58,25 @@ module Orb
55
58
  def fetch(external_plan_id, request_options: {})
56
59
  end
57
60
 
61
+ # This API endpoint is in beta and its interface may change. It is recommended for
62
+ # use only in test mode.
63
+ #
64
+ # This endpoint allows setting the default version of a plan.
65
+ sig do
66
+ params(
67
+ external_plan_id: String,
68
+ version: Integer,
69
+ request_options: Orb::RequestOptions::OrHash
70
+ ).returns(Orb::Plan)
71
+ end
72
+ def set_default_version(
73
+ external_plan_id,
74
+ # Plan version to set as the default.
75
+ version:,
76
+ request_options: {}
77
+ )
78
+ end
79
+
58
80
  # @api private
59
81
  sig { params(client: Orb::Client).returns(T.attached_class) }
60
82
  def self.new(client:)
@@ -0,0 +1,91 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Resources
5
+ class Plans
6
+ class Versions
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
+ plan_id: String,
14
+ version: Integer,
15
+ add_adjustments:
16
+ T.nilable(
17
+ T::Array[Orb::Plans::VersionCreateParams::AddAdjustment::OrHash]
18
+ ),
19
+ add_prices:
20
+ T.nilable(
21
+ T::Array[Orb::Plans::VersionCreateParams::AddPrice::OrHash]
22
+ ),
23
+ remove_adjustments:
24
+ T.nilable(
25
+ T::Array[
26
+ Orb::Plans::VersionCreateParams::RemoveAdjustment::OrHash
27
+ ]
28
+ ),
29
+ remove_prices:
30
+ T.nilable(
31
+ T::Array[Orb::Plans::VersionCreateParams::RemovePrice::OrHash]
32
+ ),
33
+ replace_adjustments:
34
+ T.nilable(
35
+ T::Array[
36
+ Orb::Plans::VersionCreateParams::ReplaceAdjustment::OrHash
37
+ ]
38
+ ),
39
+ replace_prices:
40
+ T.nilable(
41
+ T::Array[Orb::Plans::VersionCreateParams::ReplacePrice::OrHash]
42
+ ),
43
+ set_as_default: T.nilable(T::Boolean),
44
+ request_options: Orb::RequestOptions::OrHash
45
+ ).returns(Orb::Models::Plans::VersionCreateResponse)
46
+ end
47
+ def create(
48
+ plan_id,
49
+ # New version number.
50
+ version:,
51
+ # Additional adjustments to be added to the plan.
52
+ add_adjustments: nil,
53
+ # Additional prices to be added to the plan.
54
+ add_prices: nil,
55
+ # Adjustments to be removed from the plan.
56
+ remove_adjustments: nil,
57
+ # Prices to be removed from the plan.
58
+ remove_prices: nil,
59
+ # Adjustments to be replaced with additional adjustments on the plan.
60
+ replace_adjustments: nil,
61
+ # Prices to be replaced with additional prices on the plan.
62
+ replace_prices: nil,
63
+ # Set this new plan version as the default
64
+ set_as_default: nil,
65
+ request_options: {}
66
+ )
67
+ end
68
+
69
+ # This API endpoint is in beta and its interface may change. It is recommended for
70
+ # use only in test mode.
71
+ #
72
+ # This endpoint is used to fetch a plan version. It returns the phases, prices,
73
+ # and adjustments present on this version of the plan.
74
+ sig do
75
+ params(
76
+ version: String,
77
+ plan_id: String,
78
+ request_options: Orb::RequestOptions::OrHash
79
+ ).returns(Orb::Models::Plans::VersionRetrieveResponse)
80
+ end
81
+ def retrieve(version, plan_id:, request_options: {})
82
+ end
83
+
84
+ # @api private
85
+ sig { params(client: Orb::Client).returns(T.attached_class) }
86
+ def self.new(client:)
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -6,6 +6,9 @@ module Orb
6
6
  sig { returns(Orb::Resources::Plans::ExternalPlanID) }
7
7
  attr_reader :external_plan_id
8
8
 
9
+ sig { returns(Orb::Resources::Plans::Versions) }
10
+ attr_reader :versions
11
+
9
12
  # This endpoint allows creation of plans including their prices.
10
13
  sig do
11
14
  params(
@@ -38,7 +41,10 @@ module Orb
38
41
  Orb::PlanCreateParams::Price::MaxGroupTieredPackage::OrHash,
39
42
  Orb::PlanCreateParams::Price::ScalableMatrixWithUnitPricing::OrHash,
40
43
  Orb::PlanCreateParams::Price::ScalableMatrixWithTieredPricing::OrHash,
41
- Orb::PlanCreateParams::Price::CumulativeGroupedBulk::OrHash
44
+ Orb::PlanCreateParams::Price::CumulativeGroupedBulk::OrHash,
45
+ Orb::PlanCreateParams::Price::TieredPackageWithMinimum::OrHash,
46
+ Orb::PlanCreateParams::Price::MatrixWithAllocation::OrHash,
47
+ Orb::PlanCreateParams::Price::GroupedTiered::OrHash
42
48
  )
43
49
  ],
44
50
  default_invoice_memo: T.nilable(String),
@@ -78,7 +84,7 @@ module Orb
78
84
  # This endpoint can be used to update the `external_plan_id`, and `metadata` of an
79
85
  # existing plan.
80
86
  #
81
- # Other fields on a customer are currently immutable.
87
+ # Other fields on a plan are currently immutable.
82
88
  sig do
83
89
  params(
84
90
  plan_id: String,
@@ -160,6 +166,25 @@ module Orb
160
166
  def fetch(plan_id, request_options: {})
161
167
  end
162
168
 
169
+ # This API endpoint is in beta and its interface may change. It is recommended for
170
+ # use only in test mode.
171
+ #
172
+ # This endpoint allows setting the default version of a plan.
173
+ sig do
174
+ params(
175
+ plan_id: String,
176
+ version: Integer,
177
+ request_options: Orb::RequestOptions::OrHash
178
+ ).returns(Orb::Plan)
179
+ end
180
+ def set_default_version(
181
+ plan_id,
182
+ # Plan version to set as the default.
183
+ version:,
184
+ request_options: {}
185
+ )
186
+ end
187
+
163
188
  # @api private
164
189
  sig { params(client: Orb::Client).returns(T.attached_class) }
165
190
  def self.new(client:)
@@ -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,14 +183,24 @@ module Orb
177
183
  )
178
184
  end
179
185
 
180
- # This endpoint is used to evaluate the output of a price for a given customer and
181
- # time range. It enables filtering and grouping the output using
186
+ # This endpoint is used to evaluate the output of price(s) for a given customer
187
+ # and time range over either ingested events or preview events. It enables
188
+ # filtering and grouping the output using
182
189
  # [computed properties](/extensibility/advanced-metrics#computed-properties),
183
190
  # supporting the following workflows:
184
191
  #
185
192
  # 1. Showing detailed usage and costs to the end customer.
186
193
  # 2. Auditing subtotals on invoice line items.
187
194
  #
195
+ # Prices may either reference existing prices in your Orb account or be defined
196
+ # inline in the request body. Up to 100 prices can be evaluated in a single
197
+ # request.
198
+ #
199
+ # Price evaluation by default uses ingested events, but you can also provide a
200
+ # list of preview events to use instead. Up to 500 preview events can be provided
201
+ # in a single request. When using ingested events, the start of the time range
202
+ # must be no more than 100 days ago.
203
+ #
188
204
  # For these workflows, the expressiveness of computed properties in both the
189
205
  # filters and grouping is critical. For example, if you'd like to show your
190
206
  # customer their usage grouped by hour and another property, you can do so with
@@ -194,40 +210,34 @@ module Orb
194
210
  # with the following `filter`:
195
211
  # `my_property = 'foo' AND my_other_property = 'bar'`.
196
212
  #
197
- # By default, the start of the time range must be no more than 100 days ago and
198
- # the length of the results must be no greater than 1000. Note that this is a POST
213
+ # The length of the results must be no greater than 1000. Note that this is a POST
199
214
  # endpoint rather than a GET endpoint because it employs a JSON body rather than
200
215
  # query parameters.
201
216
  sig do
202
217
  params(
203
- price_id: String,
204
218
  timeframe_end: Time,
205
219
  timeframe_start: Time,
206
220
  customer_id: T.nilable(String),
221
+ events: T.nilable(T::Array[Orb::PriceEvaluateParams::Event::OrHash]),
207
222
  external_customer_id: T.nilable(String),
208
- filter: T.nilable(String),
209
- grouping_keys: T::Array[String],
223
+ price_evaluations:
224
+ T::Array[Orb::PriceEvaluateParams::PriceEvaluation::OrHash],
210
225
  request_options: Orb::RequestOptions::OrHash
211
226
  ).returns(Orb::Models::PriceEvaluateResponse)
212
227
  end
213
228
  def evaluate(
214
- price_id,
215
229
  # The exclusive upper bound for event timestamps
216
230
  timeframe_end:,
217
231
  # The inclusive lower bound for event timestamps
218
232
  timeframe_start:,
219
233
  # The ID of the customer to which this evaluation is scoped.
220
234
  customer_id: nil,
235
+ # Optional list of preview events to use instead of actual usage data (max 500)
236
+ events: nil,
221
237
  # The external customer ID of the customer to which this evaluation is scoped.
222
238
  external_customer_id: nil,
223
- # A boolean
224
- # [computed property](/extensibility/advanced-metrics#computed-properties) used to
225
- # filter the underlying billable metric
226
- filter: nil,
227
- # Properties (or
228
- # [computed properties](/extensibility/advanced-metrics#computed-properties)) used
229
- # to group the underlying billable metric
230
- grouping_keys: nil,
239
+ # List of prices to evaluate (max 100)
240
+ price_evaluations: nil,
231
241
  request_options: {}
232
242
  )
233
243
  end