orb-billing 1.57.0 → 1.59.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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/orb/client.rb +0 -8
  5. data/lib/orb/models/invoice_list_params.rb +12 -11
  6. data/lib/orb/models/invoice_list_summary_params.rb +12 -11
  7. data/lib/orb/models/invoice_status_filter.rb +18 -0
  8. data/lib/orb/models/migration_create_params.rb +10 -1
  9. data/lib/orb/models/{beta_create_plan_version_params.rb → plan_create_plan_version_params.rb} +430 -430
  10. data/lib/orb/models/{beta_fetch_plan_version_params.rb → plan_fetch_plan_version_params.rb} +2 -2
  11. data/lib/orb/models/{beta_set_default_plan_version_params.rb → plan_set_default_plan_version_params.rb} +2 -2
  12. data/lib/orb/models/plan_version.rb +1 -1
  13. data/lib/orb/models/plans/draft_discard_params.rb +22 -0
  14. data/lib/orb/models/plans/draft_fetch_params.rb +22 -0
  15. data/lib/orb/models/plans/draft_publish_params.rb +31 -0
  16. data/lib/orb/models/plans/draft_save_params.rb +7522 -0
  17. data/lib/orb/models/plans/external_plan_id/draft_discard_params.rb +24 -0
  18. data/lib/orb/models/plans/external_plan_id/draft_fetch_params.rb +24 -0
  19. data/lib/orb/models/plans/external_plan_id/draft_publish_params.rb +33 -0
  20. data/lib/orb/models/plans/external_plan_id/draft_save_params.rb +7595 -0
  21. data/lib/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rb +430 -430
  22. data/lib/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rb +2 -2
  23. data/lib/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rb +2 -2
  24. data/lib/orb/models/plans/plan_version_draft.rb +279 -0
  25. data/lib/orb/models/subscription_list_params.rb +52 -15
  26. data/lib/orb/models/subscription_list_summary_params.rb +50 -15
  27. data/lib/orb/models/subscription_status_filter.rb +16 -0
  28. data/lib/orb/models.rb +10 -8
  29. data/lib/orb/resources/customers/credits/ledger.rb +56 -0
  30. data/lib/orb/resources/invoices.rb +16 -2
  31. data/lib/orb/resources/migrations.rb +3 -1
  32. data/lib/orb/resources/plans/draft.rb +124 -0
  33. data/lib/orb/resources/plans/external_plan_id/draft.rb +126 -0
  34. data/lib/orb/resources/plans/external_plan_id.rb +96 -0
  35. data/lib/orb/resources/plans.rb +96 -0
  36. data/lib/orb/resources/subscriptions.rb +6 -6
  37. data/lib/orb/version.rb +1 -1
  38. data/lib/orb.rb +19 -8
  39. data/rbi/orb/client.rbi +0 -7
  40. data/rbi/orb/models/invoice_list_params.rbi +37 -17
  41. data/rbi/orb/models/invoice_list_summary_params.rbi +38 -18
  42. data/rbi/orb/models/invoice_status_filter.rbi +22 -0
  43. data/rbi/orb/models/migration_create_params.rbi +13 -0
  44. data/rbi/orb/models/{beta_create_plan_version_params.rbi → plan_create_plan_version_params.rbi} +744 -744
  45. data/rbi/orb/models/{beta_fetch_plan_version_params.rbi → plan_fetch_plan_version_params.rbi} +2 -2
  46. data/rbi/orb/models/{beta_set_default_plan_version_params.rbi → plan_set_default_plan_version_params.rbi} +2 -2
  47. data/rbi/orb/models/plans/draft_discard_params.rbi +37 -0
  48. data/rbi/orb/models/plans/draft_fetch_params.rbi +37 -0
  49. data/rbi/orb/models/plans/draft_publish_params.rbi +54 -0
  50. data/rbi/orb/models/plans/draft_save_params.rbi +13143 -0
  51. data/rbi/orb/models/plans/external_plan_id/draft_discard_params.rbi +42 -0
  52. data/rbi/orb/models/plans/external_plan_id/draft_fetch_params.rbi +42 -0
  53. data/rbi/orb/models/plans/external_plan_id/draft_publish_params.rbi +59 -0
  54. data/rbi/orb/models/plans/external_plan_id/draft_save_params.rbi +13256 -0
  55. data/rbi/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rbi +744 -744
  56. data/rbi/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rbi +2 -2
  57. data/rbi/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rbi +2 -2
  58. data/rbi/orb/models/plans/plan_version_draft.rbi +502 -0
  59. data/rbi/orb/models/subscription_list_params.rbi +100 -21
  60. data/rbi/orb/models/subscription_list_summary_params.rbi +99 -28
  61. data/rbi/orb/models/subscription_status_filter.rbi +23 -0
  62. data/rbi/orb/models.rbi +10 -8
  63. data/rbi/orb/resources/customers/credits/ledger.rbi +56 -0
  64. data/rbi/orb/resources/invoices.rbi +28 -2
  65. data/rbi/orb/resources/migrations.rbi +4 -0
  66. data/rbi/orb/resources/{beta/external_plan_id.rbi → plans/draft.rbi} +58 -59
  67. data/rbi/orb/resources/plans/external_plan_id/draft.rbi +126 -0
  68. data/rbi/orb/resources/plans/external_plan_id.rbi +102 -0
  69. data/rbi/orb/resources/plans.rbi +94 -0
  70. data/rbi/orb/resources/subscriptions.rbi +25 -6
  71. data/sig/orb/client.rbs +0 -2
  72. data/sig/orb/models/invoice_list_params.rbs +10 -12
  73. data/sig/orb/models/invoice_list_summary_params.rbs +6 -8
  74. data/sig/orb/models/invoice_status_filter.rbs +17 -0
  75. data/sig/orb/models/migration_create_params.rbs +7 -0
  76. data/sig/orb/models/{beta_create_plan_version_params.rbs → plan_create_plan_version_params.rbs} +448 -448
  77. data/sig/orb/models/{beta_fetch_plan_version_params.rbs → plan_fetch_plan_version_params.rbs} +2 -2
  78. data/sig/orb/models/{beta_set_default_plan_version_params.rbs → plan_set_default_plan_version_params.rbs} +2 -2
  79. data/sig/orb/models/plans/draft_discard_params.rbs +25 -0
  80. data/sig/orb/models/plans/draft_fetch_params.rbs +25 -0
  81. data/sig/orb/models/plans/draft_publish_params.rbs +32 -0
  82. data/sig/orb/models/plans/draft_save_params.rbs +5210 -0
  83. data/sig/orb/models/plans/external_plan_id/draft_discard_params.rbs +27 -0
  84. data/sig/orb/models/plans/external_plan_id/draft_fetch_params.rbs +27 -0
  85. data/sig/orb/models/plans/external_plan_id/draft_publish_params.rbs +34 -0
  86. data/sig/orb/models/plans/external_plan_id/draft_save_params.rbs +5215 -0
  87. data/sig/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rbs +447 -447
  88. data/sig/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rbs +1 -1
  89. data/sig/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rbs +1 -1
  90. data/sig/orb/models/plans/plan_version_draft.rbs +205 -0
  91. data/sig/orb/models/subscription_list_params.rbs +34 -14
  92. data/sig/orb/models/subscription_list_summary_params.rbs +34 -14
  93. data/sig/orb/models/subscription_status_filter.rbs +15 -0
  94. data/sig/orb/models.rbs +10 -8
  95. data/sig/orb/resources/invoices.rbs +1 -1
  96. data/sig/orb/resources/migrations.rbs +1 -0
  97. data/sig/orb/resources/plans/draft.rbs +37 -0
  98. data/sig/orb/resources/plans/external_plan_id/draft.rbs +39 -0
  99. data/sig/orb/resources/plans/external_plan_id.rbs +27 -0
  100. data/sig/orb/resources/plans.rbs +27 -0
  101. data/sig/orb/resources/subscriptions.rbs +4 -4
  102. metadata +2044 -2005
  103. data/lib/orb/resources/beta/external_plan_id.rb +0 -108
  104. data/lib/orb/resources/beta.rb +0 -114
  105. data/rbi/orb/resources/beta.rbi +0 -110
  106. data/sig/orb/resources/beta/external_plan_id.rbs +0 -34
  107. data/sig/orb/resources/beta.rbs +0 -34
@@ -2,65 +2,94 @@
2
2
 
3
3
  module Orb
4
4
  module Resources
5
- class Beta
5
+ class Plans
6
6
  # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
7
7
  # subscribed to by a customer. Plans define the billing behavior of the
8
8
  # subscription. You can see more about how to configure prices in the
9
9
  # [Price resource](/reference/price).
10
- class ExternalPlanID
11
- # This endpoint allows the creation of a new plan version for an existing plan.
10
+ class Draft
11
+ # This endpoint discards the plan's draft version. Prices and adjustments the
12
+ # draft created stay in the Pricebook.
12
13
  sig do
13
14
  params(
14
- external_plan_id: String,
15
- version: Integer,
15
+ plan_id: String,
16
+ request_options: Orb::RequestOptions::OrHash
17
+ ).void
18
+ end
19
+ def discard(plan_id, request_options: {})
20
+ end
21
+
22
+ # This endpoint returns the plan's unpublished draft version, with its changes
23
+ # applied on top of the latest published version. It returns a 404 if the plan has
24
+ # no draft.
25
+ sig do
26
+ params(
27
+ plan_id: String,
28
+ request_options: Orb::RequestOptions::OrHash
29
+ ).returns(Orb::Plans::PlanVersionDraft)
30
+ end
31
+ def fetch(plan_id, request_options: {})
32
+ end
33
+
34
+ # This endpoint publishes the plan's draft as the next numbered version. A draft
35
+ # that fails plan version validation is a 400 and is left as it was.
36
+ sig do
37
+ params(
38
+ plan_id: String,
39
+ set_as_default: T::Boolean,
40
+ request_options: Orb::RequestOptions::OrHash
41
+ ).returns(Orb::PlanVersion)
42
+ end
43
+ def publish(
44
+ plan_id,
45
+ # Also make the new version the plan's default.
46
+ set_as_default: nil,
47
+ request_options: {}
48
+ )
49
+ end
50
+
51
+ # This endpoint creates the plan's draft version or fully replaces its changes.
52
+ # The changes are always relative to the latest published version. A save replaces
53
+ # the draft; last write wins.
54
+ sig do
55
+ params(
56
+ plan_id: String,
16
57
  add_adjustments:
17
58
  T.nilable(
18
- T::Array[
19
- Orb::Beta::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::OrHash
20
- ]
59
+ T::Array[Orb::Plans::DraftSaveParams::AddAdjustment::OrHash]
21
60
  ),
22
61
  add_prices:
23
62
  T.nilable(
24
- T::Array[
25
- Orb::Beta::ExternalPlanIDCreatePlanVersionParams::AddPrice::OrHash
26
- ]
63
+ T::Array[Orb::Plans::DraftSaveParams::AddPrice::OrHash]
27
64
  ),
65
+ description: T.nilable(String),
28
66
  remove_adjustments:
29
67
  T.nilable(
30
- T::Array[
31
- Orb::Beta::ExternalPlanIDCreatePlanVersionParams::RemoveAdjustment::OrHash
32
- ]
68
+ T::Array[Orb::Plans::DraftSaveParams::RemoveAdjustment::OrHash]
33
69
  ),
34
70
  remove_prices:
35
71
  T.nilable(
36
- T::Array[
37
- Orb::Beta::ExternalPlanIDCreatePlanVersionParams::RemovePrice::OrHash
38
- ]
72
+ T::Array[Orb::Plans::DraftSaveParams::RemovePrice::OrHash]
39
73
  ),
40
74
  replace_adjustments:
41
75
  T.nilable(
42
- T::Array[
43
- Orb::Beta::ExternalPlanIDCreatePlanVersionParams::ReplaceAdjustment::OrHash
44
- ]
76
+ T::Array[Orb::Plans::DraftSaveParams::ReplaceAdjustment::OrHash]
45
77
  ),
46
78
  replace_prices:
47
79
  T.nilable(
48
- T::Array[
49
- Orb::Beta::ExternalPlanIDCreatePlanVersionParams::ReplacePrice::OrHash
50
- ]
80
+ T::Array[Orb::Plans::DraftSaveParams::ReplacePrice::OrHash]
51
81
  ),
52
- set_as_default: T.nilable(T::Boolean),
53
82
  request_options: Orb::RequestOptions::OrHash
54
- ).returns(Orb::PlanVersion)
83
+ ).returns(Orb::Plans::PlanVersionDraft)
55
84
  end
56
- def create_plan_version(
57
- external_plan_id,
58
- # New version number.
59
- version:,
85
+ def save(
86
+ plan_id,
60
87
  # Additional adjustments to be added to the plan.
61
88
  add_adjustments: nil,
62
89
  # Additional prices to be added to the plan.
63
90
  add_prices: nil,
91
+ # Optional description of what changes in this draft
92
+ description: nil,
64
93
  # Adjustments to be removed from the plan.
65
94
  remove_adjustments: nil,
66
95
  # Prices to be removed from the plan.
@@ -69,36 +98,6 @@ module Orb
69
98
  replace_adjustments: nil,
70
99
  # Prices to be replaced with additional prices on the plan.
71
100
  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 endpoint is used to fetch a plan version. It returns the phases, prices,
79
- # and adjustments present on this version of the plan.
80
- sig do
81
- params(
82
- version: String,
83
- external_plan_id: String,
84
- request_options: Orb::RequestOptions::OrHash
85
- ).returns(Orb::PlanVersion)
86
- end
87
- def fetch_plan_version(version, external_plan_id:, request_options: {})
88
- end
89
-
90
- # This endpoint allows setting the default version of a plan.
91
- sig do
92
- params(
93
- external_plan_id: String,
94
- version: Integer,
95
- request_options: Orb::RequestOptions::OrHash
96
- ).returns(Orb::Plan)
97
- end
98
- def set_default_plan_version(
99
- external_plan_id,
100
- # Plan version to set as the default.
101
- version:,
102
101
  request_options: {}
103
102
  )
104
103
  end
@@ -0,0 +1,126 @@
1
+ # typed: strong
2
+
3
+ module Orb
4
+ module Resources
5
+ class Plans
6
+ class ExternalPlanID
7
+ # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
8
+ # subscribed to by a customer. Plans define the billing behavior of the
9
+ # subscription. You can see more about how to configure prices in the
10
+ # [Price resource](/reference/price).
11
+ class Draft
12
+ # This endpoint discards the plan's draft version. Prices and adjustments the
13
+ # draft created stay in the Pricebook.
14
+ sig do
15
+ params(
16
+ external_plan_id: String,
17
+ request_options: Orb::RequestOptions::OrHash
18
+ ).void
19
+ end
20
+ def discard(external_plan_id, request_options: {})
21
+ end
22
+
23
+ # This endpoint returns the plan's unpublished draft version, with its changes
24
+ # applied on top of the latest published version. It returns a 404 if the plan has
25
+ # no draft.
26
+ sig do
27
+ params(
28
+ external_plan_id: String,
29
+ request_options: Orb::RequestOptions::OrHash
30
+ ).returns(Orb::Plans::PlanVersionDraft)
31
+ end
32
+ def fetch(external_plan_id, request_options: {})
33
+ end
34
+
35
+ # This endpoint publishes the plan's draft as the next numbered version. A draft
36
+ # that fails plan version validation is a 400 and is left as it was.
37
+ sig do
38
+ params(
39
+ external_plan_id: String,
40
+ set_as_default: T::Boolean,
41
+ request_options: Orb::RequestOptions::OrHash
42
+ ).returns(Orb::PlanVersion)
43
+ end
44
+ def publish(
45
+ external_plan_id,
46
+ # Also make the new version the plan's default.
47
+ set_as_default: nil,
48
+ request_options: {}
49
+ )
50
+ end
51
+
52
+ # This endpoint creates the plan's draft version or fully replaces its changes.
53
+ # The changes are always relative to the latest published version. A save replaces
54
+ # the draft; last write wins.
55
+ sig do
56
+ params(
57
+ external_plan_id: String,
58
+ add_adjustments:
59
+ T.nilable(
60
+ T::Array[
61
+ Orb::Plans::ExternalPlanID::DraftSaveParams::AddAdjustment::OrHash
62
+ ]
63
+ ),
64
+ add_prices:
65
+ T.nilable(
66
+ T::Array[
67
+ Orb::Plans::ExternalPlanID::DraftSaveParams::AddPrice::OrHash
68
+ ]
69
+ ),
70
+ description: T.nilable(String),
71
+ remove_adjustments:
72
+ T.nilable(
73
+ T::Array[
74
+ Orb::Plans::ExternalPlanID::DraftSaveParams::RemoveAdjustment::OrHash
75
+ ]
76
+ ),
77
+ remove_prices:
78
+ T.nilable(
79
+ T::Array[
80
+ Orb::Plans::ExternalPlanID::DraftSaveParams::RemovePrice::OrHash
81
+ ]
82
+ ),
83
+ replace_adjustments:
84
+ T.nilable(
85
+ T::Array[
86
+ Orb::Plans::ExternalPlanID::DraftSaveParams::ReplaceAdjustment::OrHash
87
+ ]
88
+ ),
89
+ replace_prices:
90
+ T.nilable(
91
+ T::Array[
92
+ Orb::Plans::ExternalPlanID::DraftSaveParams::ReplacePrice::OrHash
93
+ ]
94
+ ),
95
+ request_options: Orb::RequestOptions::OrHash
96
+ ).returns(Orb::Plans::PlanVersionDraft)
97
+ end
98
+ def save(
99
+ external_plan_id,
100
+ # Additional adjustments to be added to the plan.
101
+ add_adjustments: nil,
102
+ # Additional prices to be added to the plan.
103
+ add_prices: nil,
104
+ # Optional description of what changes in this draft
105
+ description: nil,
106
+ # Adjustments to be removed from the plan.
107
+ remove_adjustments: nil,
108
+ # Prices to be removed from the plan.
109
+ remove_prices: nil,
110
+ # Adjustments to be replaced with additional adjustments on the plan.
111
+ replace_adjustments: nil,
112
+ # Prices to be replaced with additional prices on the plan.
113
+ replace_prices: nil,
114
+ request_options: {}
115
+ )
116
+ end
117
+
118
+ # @api private
119
+ sig { params(client: Orb::Client).returns(T.attached_class) }
120
+ def self.new(client:)
121
+ end
122
+ end
123
+ end
124
+ end
125
+ end
126
+ end
@@ -8,6 +8,13 @@ module Orb
8
8
  # subscription. You can see more about how to configure prices in the
9
9
  # [Price resource](/reference/price).
10
10
  class ExternalPlanID
11
+ # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
12
+ # subscribed to by a customer. Plans define the billing behavior of the
13
+ # subscription. You can see more about how to configure prices in the
14
+ # [Price resource](/reference/price).
15
+ sig { returns(Orb::Resources::Plans::ExternalPlanID::Draft) }
16
+ attr_reader :draft
17
+
11
18
  # This endpoint can be used to update the `name`, `external_plan_id`,
12
19
  # `description`, and `metadata` of an existing plan. A plan's `name` cannot be
13
20
  # empty.
@@ -41,6 +48,73 @@ module Orb
41
48
  )
42
49
  end
43
50
 
51
+ # This endpoint allows the creation of a new plan version for an existing plan.
52
+ sig do
53
+ params(
54
+ external_plan_id: String,
55
+ version: Integer,
56
+ add_adjustments:
57
+ T.nilable(
58
+ T::Array[
59
+ Orb::Plans::ExternalPlanIDCreatePlanVersionParams::AddAdjustment::OrHash
60
+ ]
61
+ ),
62
+ add_prices:
63
+ T.nilable(
64
+ T::Array[
65
+ Orb::Plans::ExternalPlanIDCreatePlanVersionParams::AddPrice::OrHash
66
+ ]
67
+ ),
68
+ remove_adjustments:
69
+ T.nilable(
70
+ T::Array[
71
+ Orb::Plans::ExternalPlanIDCreatePlanVersionParams::RemoveAdjustment::OrHash
72
+ ]
73
+ ),
74
+ remove_prices:
75
+ T.nilable(
76
+ T::Array[
77
+ Orb::Plans::ExternalPlanIDCreatePlanVersionParams::RemovePrice::OrHash
78
+ ]
79
+ ),
80
+ replace_adjustments:
81
+ T.nilable(
82
+ T::Array[
83
+ Orb::Plans::ExternalPlanIDCreatePlanVersionParams::ReplaceAdjustment::OrHash
84
+ ]
85
+ ),
86
+ replace_prices:
87
+ T.nilable(
88
+ T::Array[
89
+ Orb::Plans::ExternalPlanIDCreatePlanVersionParams::ReplacePrice::OrHash
90
+ ]
91
+ ),
92
+ set_as_default: T.nilable(T::Boolean),
93
+ request_options: Orb::RequestOptions::OrHash
94
+ ).returns(Orb::PlanVersion)
95
+ end
96
+ def create_plan_version(
97
+ external_plan_id,
98
+ # New version number.
99
+ version:,
100
+ # Additional adjustments to be added to the plan.
101
+ add_adjustments: nil,
102
+ # Additional prices to be added to the plan.
103
+ add_prices: nil,
104
+ # Adjustments to be removed from the plan.
105
+ remove_adjustments: nil,
106
+ # Prices to be removed from the plan.
107
+ remove_prices: nil,
108
+ # Adjustments to be replaced with additional adjustments on the plan.
109
+ replace_adjustments: nil,
110
+ # Prices to be replaced with additional prices on the plan.
111
+ replace_prices: nil,
112
+ # Set this new plan version as the default
113
+ set_as_default: nil,
114
+ request_options: {}
115
+ )
116
+ end
117
+
44
118
  # This endpoint is used to fetch [plan](/core-concepts##plan-and-price) details
45
119
  # given an external_plan_id identifier. It returns information about the prices
46
120
  # included in the plan and their configuration, as well as the product that the
@@ -66,6 +140,34 @@ module Orb
66
140
  def fetch(external_plan_id, request_options: {})
67
141
  end
68
142
 
143
+ # This endpoint is used to fetch a plan version. It returns the phases, prices,
144
+ # and adjustments present on this version of the plan.
145
+ sig do
146
+ params(
147
+ version: String,
148
+ external_plan_id: String,
149
+ request_options: Orb::RequestOptions::OrHash
150
+ ).returns(Orb::PlanVersion)
151
+ end
152
+ def fetch_plan_version(version, external_plan_id:, request_options: {})
153
+ end
154
+
155
+ # This endpoint allows setting the default version of a plan.
156
+ sig do
157
+ params(
158
+ external_plan_id: String,
159
+ version: Integer,
160
+ request_options: Orb::RequestOptions::OrHash
161
+ ).returns(Orb::Plan)
162
+ end
163
+ def set_default_plan_version(
164
+ external_plan_id,
165
+ # Plan version to set as the default.
166
+ version:,
167
+ request_options: {}
168
+ )
169
+ end
170
+
69
171
  # @api private
70
172
  sig { params(client: Orb::Client).returns(T.attached_class) }
71
173
  def self.new(client:)
@@ -14,6 +14,13 @@ module Orb
14
14
  sig { returns(Orb::Resources::Plans::ExternalPlanID) }
15
15
  attr_reader :external_plan_id
16
16
 
17
+ # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
18
+ # subscribed to by a customer. Plans define the billing behavior of the
19
+ # subscription. You can see more about how to configure prices in the
20
+ # [Price resource](/reference/price).
21
+ sig { returns(Orb::Resources::Plans::Draft) }
22
+ attr_reader :draft
23
+
17
24
  # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
18
25
  # subscribed to by a customer. Plans define the billing behavior of the
19
26
  # subscription. You can see more about how to configure prices in the
@@ -140,6 +147,65 @@ module Orb
140
147
  )
141
148
  end
142
149
 
150
+ # This endpoint allows the creation of a new plan version for an existing plan.
151
+ sig do
152
+ params(
153
+ plan_id: String,
154
+ version: Integer,
155
+ add_adjustments:
156
+ T.nilable(
157
+ T::Array[Orb::PlanCreatePlanVersionParams::AddAdjustment::OrHash]
158
+ ),
159
+ add_prices:
160
+ T.nilable(
161
+ T::Array[Orb::PlanCreatePlanVersionParams::AddPrice::OrHash]
162
+ ),
163
+ remove_adjustments:
164
+ T.nilable(
165
+ T::Array[
166
+ Orb::PlanCreatePlanVersionParams::RemoveAdjustment::OrHash
167
+ ]
168
+ ),
169
+ remove_prices:
170
+ T.nilable(
171
+ T::Array[Orb::PlanCreatePlanVersionParams::RemovePrice::OrHash]
172
+ ),
173
+ replace_adjustments:
174
+ T.nilable(
175
+ T::Array[
176
+ Orb::PlanCreatePlanVersionParams::ReplaceAdjustment::OrHash
177
+ ]
178
+ ),
179
+ replace_prices:
180
+ T.nilable(
181
+ T::Array[Orb::PlanCreatePlanVersionParams::ReplacePrice::OrHash]
182
+ ),
183
+ set_as_default: T.nilable(T::Boolean),
184
+ request_options: Orb::RequestOptions::OrHash
185
+ ).returns(Orb::PlanVersion)
186
+ end
187
+ def create_plan_version(
188
+ plan_id,
189
+ # New version number.
190
+ version:,
191
+ # Additional adjustments to be added to the plan.
192
+ add_adjustments: nil,
193
+ # Additional prices to be added to the plan.
194
+ add_prices: nil,
195
+ # Adjustments to be removed from the plan.
196
+ remove_adjustments: nil,
197
+ # Prices to be removed from the plan.
198
+ remove_prices: nil,
199
+ # Adjustments to be replaced with additional adjustments on the plan.
200
+ replace_adjustments: nil,
201
+ # Prices to be replaced with additional prices on the plan.
202
+ replace_prices: nil,
203
+ # Set this new plan version as the default
204
+ set_as_default: nil,
205
+ request_options: {}
206
+ )
207
+ end
208
+
143
209
  # This endpoint is used to fetch [plan](/core-concepts#plan-and-price) details
144
210
  # given a plan identifier. It returns information about the prices included in the
145
211
  # plan and their configuration, as well as the product that the plan is attached
@@ -166,6 +232,34 @@ module Orb
166
232
  def fetch(plan_id, request_options: {})
167
233
  end
168
234
 
235
+ # This endpoint is used to fetch a plan version. It returns the phases, prices,
236
+ # and adjustments present on this version of the plan.
237
+ sig do
238
+ params(
239
+ version: String,
240
+ plan_id: String,
241
+ request_options: Orb::RequestOptions::OrHash
242
+ ).returns(Orb::PlanVersion)
243
+ end
244
+ def fetch_plan_version(version, plan_id:, request_options: {})
245
+ end
246
+
247
+ # This endpoint allows setting the default version of a plan.
248
+ sig do
249
+ params(
250
+ plan_id: String,
251
+ version: Integer,
252
+ request_options: Orb::RequestOptions::OrHash
253
+ ).returns(Orb::Plan)
254
+ end
255
+ def set_default_plan_version(
256
+ plan_id,
257
+ # Plan version to set as the default.
258
+ version:,
259
+ request_options: {}
260
+ )
261
+ end
262
+
169
263
  # @api private
170
264
  sig { params(client: Orb::Client).returns(T.attached_class) }
171
265
  def self.new(client:)
@@ -489,12 +489,22 @@ module Orb
489
489
  created_at_lt: T.nilable(Time),
490
490
  created_at_lte: T.nilable(Time),
491
491
  cursor: T.nilable(String),
492
- customer_id: T.nilable(T::Array[String]),
493
- external_customer_id: T.nilable(T::Array[String]),
492
+ customer_id:
493
+ T.nilable(Orb::SubscriptionListParams::CustomerID::Variants),
494
+ external_customer_id:
495
+ T.nilable(
496
+ Orb::SubscriptionListParams::ExternalCustomerID::Variants
497
+ ),
494
498
  external_plan_id: T.nilable(String),
495
499
  limit: Integer,
496
500
  plan_id: T.nilable(String),
497
- status: T.nilable(Orb::SubscriptionListParams::Status::OrSymbol),
501
+ status:
502
+ T.nilable(
503
+ T.any(
504
+ Orb::SubscriptionStatusFilter::OrSymbol,
505
+ T::Array[Orb::SubscriptionStatusFilter::OrSymbol]
506
+ )
507
+ ),
498
508
  request_options: Orb::RequestOptions::OrHash
499
509
  ).returns(Orb::Internal::Page[Orb::Subscription])
500
510
  end
@@ -939,13 +949,22 @@ module Orb
939
949
  created_at_lt: T.nilable(Time),
940
950
  created_at_lte: T.nilable(Time),
941
951
  cursor: T.nilable(String),
942
- customer_id: T.nilable(String),
943
- external_customer_id: T.nilable(String),
952
+ customer_id:
953
+ T.nilable(Orb::SubscriptionListSummaryParams::CustomerID::Variants),
954
+ external_customer_id:
955
+ T.nilable(
956
+ Orb::SubscriptionListSummaryParams::ExternalCustomerID::Variants
957
+ ),
944
958
  external_plan_id: T.nilable(String),
945
959
  limit: Integer,
946
960
  plan_id: T.nilable(String),
947
961
  status:
948
- T.nilable(Orb::SubscriptionListSummaryParams::Status::OrSymbol),
962
+ T.nilable(
963
+ T.any(
964
+ Orb::SubscriptionStatusFilter::OrSymbol,
965
+ T::Array[Orb::SubscriptionStatusFilter::OrSymbol]
966
+ )
967
+ ),
949
968
  request_options: Orb::RequestOptions::OrHash
950
969
  ).returns(
951
970
  Orb::Internal::Page[Orb::Models::SubscriptionListSummaryResponse]
data/sig/orb/client.rbs CHANGED
@@ -16,8 +16,6 @@ module Orb
16
16
 
17
17
  attr_reader top_level: Orb::Resources::TopLevel
18
18
 
19
- attr_reader beta: Orb::Resources::Beta
20
-
21
19
  attr_reader coupons: Orb::Resources::Coupons
22
20
 
23
21
  attr_reader credit_notes: Orb::Resources::CreditNotes
@@ -20,7 +20,7 @@ module Orb
20
20
  invoice_date_lte: Time?,
21
21
  is_recurring: bool?,
22
22
  limit: Integer,
23
- status: ::Array[Orb::Models::InvoiceListParams::status]?,
23
+ status: Orb::Models::InvoiceListParams::status?,
24
24
  subscription_id: String?
25
25
  }
26
26
  & Orb::Internal::Type::request_parameters
@@ -67,7 +67,7 @@ module Orb
67
67
 
68
68
  def limit=: (Integer) -> Integer
69
69
 
70
- attr_accessor status: ::Array[Orb::Models::InvoiceListParams::status]?
70
+ attr_accessor status: Orb::Models::InvoiceListParams::status?
71
71
 
72
72
  attr_accessor subscription_id: String?
73
73
 
@@ -90,7 +90,7 @@ module Orb
90
90
  ?invoice_date_lte: Time?,
91
91
  ?is_recurring: bool?,
92
92
  ?limit: Integer,
93
- ?status: ::Array[Orb::Models::InvoiceListParams::status]?,
93
+ ?status: Orb::Models::InvoiceListParams::status?,
94
94
  ?subscription_id: String?,
95
95
  ?request_options: Orb::request_opts
96
96
  ) -> void
@@ -114,7 +114,7 @@ module Orb
114
114
  invoice_date_lte: Time?,
115
115
  is_recurring: bool?,
116
116
  limit: Integer,
117
- status: ::Array[Orb::Models::InvoiceListParams::status]?,
117
+ status: Orb::Models::InvoiceListParams::status?,
118
118
  subscription_id: String?,
119
119
  request_options: Orb::RequestOptions
120
120
  }
@@ -130,18 +130,16 @@ module Orb
130
130
  def self?.values: -> ::Array[Orb::Models::InvoiceListParams::date_type]
131
131
  end
132
132
 
133
- type status = :draft | :issued | :paid | :synced | :void
133
+ type status =
134
+ Orb::Models::invoice_status_filter
135
+ | ::Array[Orb::Models::invoice_status_filter]
134
136
 
135
137
  module Status
136
- extend Orb::Internal::Type::Enum
138
+ extend Orb::Internal::Type::Union
137
139
 
138
- DRAFT: :draft
139
- ISSUED: :issued
140
- PAID: :paid
141
- SYNCED: :synced
142
- VOID: :void
140
+ def self?.variants: -> ::Array[Orb::Models::InvoiceListParams::status]
143
141
 
144
- def self?.values: -> ::Array[Orb::Models::InvoiceListParams::status]
142
+ InvoiceStatusFilterArray: Orb::Internal::Type::Converter
145
143
  end
146
144
  end
147
145
  end
@@ -125,18 +125,16 @@ module Orb
125
125
  def self?.values: -> ::Array[Orb::Models::InvoiceListSummaryParams::date_type]
126
126
  end
127
127
 
128
- type status = :draft | :issued | :paid | :synced | :void
128
+ type status =
129
+ Orb::Models::invoice_status_filter
130
+ | ::Array[Orb::Models::invoice_status_filter]
129
131
 
130
132
  module Status
131
- extend Orb::Internal::Type::Enum
133
+ extend Orb::Internal::Type::Union
132
134
 
133
- DRAFT: :draft
134
- ISSUED: :issued
135
- PAID: :paid
136
- SYNCED: :synced
137
- VOID: :void
135
+ def self?.variants: -> ::Array[Orb::Models::InvoiceListSummaryParams::status]
138
136
 
139
- def self?.values: -> ::Array[Orb::Models::InvoiceListSummaryParams::status]
137
+ InvoiceStatusFilterArray: Orb::Internal::Type::Converter
140
138
  end
141
139
  end
142
140
  end
@@ -0,0 +1,17 @@
1
+ module Orb
2
+ module Models
3
+ type invoice_status_filter = :draft | :issued | :paid | :synced | :void
4
+
5
+ module InvoiceStatusFilter
6
+ extend Orb::Internal::Type::Enum
7
+
8
+ DRAFT: :draft
9
+ ISSUED: :issued
10
+ PAID: :paid
11
+ SYNCED: :synced
12
+ VOID: :void
13
+
14
+ def self?.values: -> ::Array[Orb::Models::invoice_status_filter]
15
+ end
16
+ end
17
+ end