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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/orb/client.rb +0 -8
- data/lib/orb/models/invoice_list_params.rb +12 -11
- data/lib/orb/models/invoice_list_summary_params.rb +12 -11
- data/lib/orb/models/invoice_status_filter.rb +18 -0
- data/lib/orb/models/migration_create_params.rb +10 -1
- data/lib/orb/models/{beta_create_plan_version_params.rb → plan_create_plan_version_params.rb} +430 -430
- data/lib/orb/models/{beta_fetch_plan_version_params.rb → plan_fetch_plan_version_params.rb} +2 -2
- data/lib/orb/models/{beta_set_default_plan_version_params.rb → plan_set_default_plan_version_params.rb} +2 -2
- data/lib/orb/models/plan_version.rb +1 -1
- data/lib/orb/models/plans/draft_discard_params.rb +22 -0
- data/lib/orb/models/plans/draft_fetch_params.rb +22 -0
- data/lib/orb/models/plans/draft_publish_params.rb +31 -0
- data/lib/orb/models/plans/draft_save_params.rb +7522 -0
- data/lib/orb/models/plans/external_plan_id/draft_discard_params.rb +24 -0
- data/lib/orb/models/plans/external_plan_id/draft_fetch_params.rb +24 -0
- data/lib/orb/models/plans/external_plan_id/draft_publish_params.rb +33 -0
- data/lib/orb/models/plans/external_plan_id/draft_save_params.rb +7595 -0
- data/lib/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rb +430 -430
- data/lib/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rb +2 -2
- data/lib/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rb +2 -2
- data/lib/orb/models/plans/plan_version_draft.rb +279 -0
- data/lib/orb/models/subscription_list_params.rb +52 -15
- data/lib/orb/models/subscription_list_summary_params.rb +50 -15
- data/lib/orb/models/subscription_status_filter.rb +16 -0
- data/lib/orb/models.rb +10 -8
- data/lib/orb/resources/customers/credits/ledger.rb +56 -0
- data/lib/orb/resources/invoices.rb +16 -2
- data/lib/orb/resources/migrations.rb +3 -1
- data/lib/orb/resources/plans/draft.rb +124 -0
- data/lib/orb/resources/plans/external_plan_id/draft.rb +126 -0
- data/lib/orb/resources/plans/external_plan_id.rb +96 -0
- data/lib/orb/resources/plans.rb +96 -0
- data/lib/orb/resources/subscriptions.rb +6 -6
- data/lib/orb/version.rb +1 -1
- data/lib/orb.rb +19 -8
- data/rbi/orb/client.rbi +0 -7
- data/rbi/orb/models/invoice_list_params.rbi +37 -17
- data/rbi/orb/models/invoice_list_summary_params.rbi +38 -18
- data/rbi/orb/models/invoice_status_filter.rbi +22 -0
- data/rbi/orb/models/migration_create_params.rbi +13 -0
- data/rbi/orb/models/{beta_create_plan_version_params.rbi → plan_create_plan_version_params.rbi} +744 -744
- data/rbi/orb/models/{beta_fetch_plan_version_params.rbi → plan_fetch_plan_version_params.rbi} +2 -2
- data/rbi/orb/models/{beta_set_default_plan_version_params.rbi → plan_set_default_plan_version_params.rbi} +2 -2
- data/rbi/orb/models/plans/draft_discard_params.rbi +37 -0
- data/rbi/orb/models/plans/draft_fetch_params.rbi +37 -0
- data/rbi/orb/models/plans/draft_publish_params.rbi +54 -0
- data/rbi/orb/models/plans/draft_save_params.rbi +13143 -0
- data/rbi/orb/models/plans/external_plan_id/draft_discard_params.rbi +42 -0
- data/rbi/orb/models/plans/external_plan_id/draft_fetch_params.rbi +42 -0
- data/rbi/orb/models/plans/external_plan_id/draft_publish_params.rbi +59 -0
- data/rbi/orb/models/plans/external_plan_id/draft_save_params.rbi +13256 -0
- data/rbi/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rbi +744 -744
- data/rbi/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rbi +2 -2
- data/rbi/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rbi +2 -2
- data/rbi/orb/models/plans/plan_version_draft.rbi +502 -0
- data/rbi/orb/models/subscription_list_params.rbi +100 -21
- data/rbi/orb/models/subscription_list_summary_params.rbi +99 -28
- data/rbi/orb/models/subscription_status_filter.rbi +23 -0
- data/rbi/orb/models.rbi +10 -8
- data/rbi/orb/resources/customers/credits/ledger.rbi +56 -0
- data/rbi/orb/resources/invoices.rbi +28 -2
- data/rbi/orb/resources/migrations.rbi +4 -0
- data/rbi/orb/resources/{beta/external_plan_id.rbi → plans/draft.rbi} +58 -59
- data/rbi/orb/resources/plans/external_plan_id/draft.rbi +126 -0
- data/rbi/orb/resources/plans/external_plan_id.rbi +102 -0
- data/rbi/orb/resources/plans.rbi +94 -0
- data/rbi/orb/resources/subscriptions.rbi +25 -6
- data/sig/orb/client.rbs +0 -2
- data/sig/orb/models/invoice_list_params.rbs +10 -12
- data/sig/orb/models/invoice_list_summary_params.rbs +6 -8
- data/sig/orb/models/invoice_status_filter.rbs +17 -0
- data/sig/orb/models/migration_create_params.rbs +7 -0
- data/sig/orb/models/{beta_create_plan_version_params.rbs → plan_create_plan_version_params.rbs} +448 -448
- data/sig/orb/models/{beta_fetch_plan_version_params.rbs → plan_fetch_plan_version_params.rbs} +2 -2
- data/sig/orb/models/{beta_set_default_plan_version_params.rbs → plan_set_default_plan_version_params.rbs} +2 -2
- data/sig/orb/models/plans/draft_discard_params.rbs +25 -0
- data/sig/orb/models/plans/draft_fetch_params.rbs +25 -0
- data/sig/orb/models/plans/draft_publish_params.rbs +32 -0
- data/sig/orb/models/plans/draft_save_params.rbs +5210 -0
- data/sig/orb/models/plans/external_plan_id/draft_discard_params.rbs +27 -0
- data/sig/orb/models/plans/external_plan_id/draft_fetch_params.rbs +27 -0
- data/sig/orb/models/plans/external_plan_id/draft_publish_params.rbs +34 -0
- data/sig/orb/models/plans/external_plan_id/draft_save_params.rbs +5215 -0
- data/sig/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rbs +447 -447
- data/sig/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rbs +1 -1
- data/sig/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rbs +1 -1
- data/sig/orb/models/plans/plan_version_draft.rbs +205 -0
- data/sig/orb/models/subscription_list_params.rbs +34 -14
- data/sig/orb/models/subscription_list_summary_params.rbs +34 -14
- data/sig/orb/models/subscription_status_filter.rbs +15 -0
- data/sig/orb/models.rbs +10 -8
- data/sig/orb/resources/invoices.rbs +1 -1
- data/sig/orb/resources/migrations.rbs +1 -0
- data/sig/orb/resources/plans/draft.rbs +37 -0
- data/sig/orb/resources/plans/external_plan_id/draft.rbs +39 -0
- data/sig/orb/resources/plans/external_plan_id.rbs +27 -0
- data/sig/orb/resources/plans.rbs +27 -0
- data/sig/orb/resources/subscriptions.rbs +4 -4
- metadata +2044 -2005
- data/lib/orb/resources/beta/external_plan_id.rb +0 -108
- data/lib/orb/resources/beta.rb +0 -114
- data/rbi/orb/resources/beta.rbi +0 -110
- data/sig/orb/resources/beta/external_plan_id.rbs +0 -34
- data/sig/orb/resources/beta.rbs +0 -34
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Models
|
|
5
|
-
module
|
|
5
|
+
module Plans
|
|
6
6
|
class ExternalPlanIDFetchPlanVersionParams < Orb::Internal::Type::BaseModel
|
|
7
7
|
extend Orb::Internal::Type::RequestParameters::Converter
|
|
8
8
|
include Orb::Internal::Type::RequestParameters
|
|
@@ -10,7 +10,7 @@ module Orb
|
|
|
10
10
|
OrHash =
|
|
11
11
|
T.type_alias do
|
|
12
12
|
T.any(
|
|
13
|
-
Orb::
|
|
13
|
+
Orb::Plans::ExternalPlanIDFetchPlanVersionParams,
|
|
14
14
|
Orb::Internal::AnyHash
|
|
15
15
|
)
|
|
16
16
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Models
|
|
5
|
-
module
|
|
5
|
+
module Plans
|
|
6
6
|
class ExternalPlanIDSetDefaultPlanVersionParams < Orb::Internal::Type::BaseModel
|
|
7
7
|
extend Orb::Internal::Type::RequestParameters::Converter
|
|
8
8
|
include Orb::Internal::Type::RequestParameters
|
|
@@ -10,7 +10,7 @@ module Orb
|
|
|
10
10
|
OrHash =
|
|
11
11
|
T.type_alias do
|
|
12
12
|
T.any(
|
|
13
|
-
Orb::
|
|
13
|
+
Orb::Plans::ExternalPlanIDSetDefaultPlanVersionParams,
|
|
14
14
|
Orb::Internal::AnyHash
|
|
15
15
|
)
|
|
16
16
|
end
|
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Orb
|
|
4
|
+
module Models
|
|
5
|
+
PlanVersionDraft = Plans::PlanVersionDraft
|
|
6
|
+
|
|
7
|
+
module Plans
|
|
8
|
+
class PlanVersionDraft < Orb::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(Orb::Plans::PlanVersionDraft, Orb::Internal::AnyHash)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Adjustments on the draft. If the plan has phases, this includes adjustments
|
|
15
|
+
# across all phases of the plan.
|
|
16
|
+
sig do
|
|
17
|
+
returns(T::Array[Orb::Plans::PlanVersionDraft::Adjustment::Variants])
|
|
18
|
+
end
|
|
19
|
+
attr_accessor :adjustments
|
|
20
|
+
|
|
21
|
+
# The published version the draft is built on, the latest at read time.
|
|
22
|
+
sig { returns(Integer) }
|
|
23
|
+
attr_accessor :base_version
|
|
24
|
+
|
|
25
|
+
sig { returns(Time) }
|
|
26
|
+
attr_accessor :created_at
|
|
27
|
+
|
|
28
|
+
# Optional description of what changes in this draft
|
|
29
|
+
sig { returns(T.nilable(String)) }
|
|
30
|
+
attr_accessor :description
|
|
31
|
+
|
|
32
|
+
sig { returns(String) }
|
|
33
|
+
attr_accessor :plan_id
|
|
34
|
+
|
|
35
|
+
sig { returns(T.nilable(T::Array[Orb::PlanVersionPhase])) }
|
|
36
|
+
attr_accessor :plan_phases
|
|
37
|
+
|
|
38
|
+
# Prices on the draft. If the plan has phases, this includes prices across all
|
|
39
|
+
# phases of the plan.
|
|
40
|
+
sig { returns(T::Array[Orb::Price::Variants]) }
|
|
41
|
+
attr_accessor :prices
|
|
42
|
+
|
|
43
|
+
# The PlanVersionDraft resource represents a plan's unpublished next version: the
|
|
44
|
+
# prices and adjustments it will have once published, built on top of
|
|
45
|
+
# `base_version`.
|
|
46
|
+
sig do
|
|
47
|
+
params(
|
|
48
|
+
adjustments:
|
|
49
|
+
T::Array[
|
|
50
|
+
T.any(
|
|
51
|
+
Orb::PlanPhaseUsageDiscountAdjustment::OrHash,
|
|
52
|
+
Orb::PlanPhaseAmountDiscountAdjustment::OrHash,
|
|
53
|
+
Orb::PlanPhasePercentageDiscountAdjustment::OrHash,
|
|
54
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::OrHash,
|
|
55
|
+
Orb::PlanPhaseMinimumAdjustment::OrHash,
|
|
56
|
+
Orb::PlanPhaseMaximumAdjustment::OrHash
|
|
57
|
+
)
|
|
58
|
+
],
|
|
59
|
+
base_version: Integer,
|
|
60
|
+
created_at: Time,
|
|
61
|
+
description: T.nilable(String),
|
|
62
|
+
plan_id: String,
|
|
63
|
+
plan_phases: T.nilable(T::Array[Orb::PlanVersionPhase::OrHash]),
|
|
64
|
+
prices:
|
|
65
|
+
T::Array[
|
|
66
|
+
T.any(
|
|
67
|
+
Orb::Price::Unit::OrHash,
|
|
68
|
+
Orb::Price::Tiered::OrHash,
|
|
69
|
+
Orb::Price::Bulk::OrHash,
|
|
70
|
+
Orb::Price::BulkWithFilters::OrHash,
|
|
71
|
+
Orb::Price::Package::OrHash,
|
|
72
|
+
Orb::Price::Matrix::OrHash,
|
|
73
|
+
Orb::Price::ThresholdTotalAmount::OrHash,
|
|
74
|
+
Orb::Price::TieredPackage::OrHash,
|
|
75
|
+
Orb::Price::TieredWithMinimum::OrHash,
|
|
76
|
+
Orb::Price::GroupedTiered::OrHash,
|
|
77
|
+
Orb::Price::GroupedTieredMatrix::OrHash,
|
|
78
|
+
Orb::Price::TieredPackageWithMinimum::OrHash,
|
|
79
|
+
Orb::Price::PackageWithAllocation::OrHash,
|
|
80
|
+
Orb::Price::UnitWithPercent::OrHash,
|
|
81
|
+
Orb::Price::MatrixWithAllocation::OrHash,
|
|
82
|
+
Orb::Price::TieredMatrixWithAllocation::OrHash,
|
|
83
|
+
Orb::Price::MatrixWithThresholdDiscounts::OrHash,
|
|
84
|
+
Orb::Price::TieredWithProration::OrHash,
|
|
85
|
+
Orb::Price::UnitWithProration::OrHash,
|
|
86
|
+
Orb::Price::GroupedAllocation::OrHash,
|
|
87
|
+
Orb::Price::BulkWithProration::OrHash,
|
|
88
|
+
Orb::Price::GroupedWithProratedMinimum::OrHash,
|
|
89
|
+
Orb::Price::GroupedWithMeteredMinimum::OrHash,
|
|
90
|
+
Orb::Price::GroupedWithMinMaxThresholds::OrHash,
|
|
91
|
+
Orb::Price::MatrixWithDisplayName::OrHash,
|
|
92
|
+
Orb::Price::GroupedTieredPackage::OrHash,
|
|
93
|
+
Orb::Price::MaxGroupTieredPackage::OrHash,
|
|
94
|
+
Orb::Price::ScalableMatrixWithUnitPricing::OrHash,
|
|
95
|
+
Orb::Price::ScalableMatrixWithTieredPricing::OrHash,
|
|
96
|
+
Orb::Price::CumulativeGroupedBulk::OrHash,
|
|
97
|
+
Orb::Price::CumulativeGroupedAllocation::OrHash,
|
|
98
|
+
Orb::Price::DailyCreditAllowance::OrHash,
|
|
99
|
+
Orb::Price::MeteredAllowance::OrHash,
|
|
100
|
+
Orb::Price::MinimumComposite::OrHash,
|
|
101
|
+
Orb::Price::Percent::OrHash,
|
|
102
|
+
Orb::Price::EventOutput::OrHash,
|
|
103
|
+
Orb::Price::UnitWithMultiplier::OrHash
|
|
104
|
+
)
|
|
105
|
+
]
|
|
106
|
+
).returns(T.attached_class)
|
|
107
|
+
end
|
|
108
|
+
def self.new(
|
|
109
|
+
# Adjustments on the draft. If the plan has phases, this includes adjustments
|
|
110
|
+
# across all phases of the plan.
|
|
111
|
+
adjustments:,
|
|
112
|
+
# The published version the draft is built on, the latest at read time.
|
|
113
|
+
base_version:,
|
|
114
|
+
created_at:,
|
|
115
|
+
# Optional description of what changes in this draft
|
|
116
|
+
description:,
|
|
117
|
+
plan_id:,
|
|
118
|
+
plan_phases:,
|
|
119
|
+
# Prices on the draft. If the plan has phases, this includes prices across all
|
|
120
|
+
# phases of the plan.
|
|
121
|
+
prices:
|
|
122
|
+
)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
sig do
|
|
126
|
+
override.returns(
|
|
127
|
+
{
|
|
128
|
+
adjustments:
|
|
129
|
+
T::Array[Orb::Plans::PlanVersionDraft::Adjustment::Variants],
|
|
130
|
+
base_version: Integer,
|
|
131
|
+
created_at: Time,
|
|
132
|
+
description: T.nilable(String),
|
|
133
|
+
plan_id: String,
|
|
134
|
+
plan_phases: T.nilable(T::Array[Orb::PlanVersionPhase]),
|
|
135
|
+
prices: T::Array[Orb::Price::Variants]
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
end
|
|
139
|
+
def to_hash
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
module Adjustment
|
|
143
|
+
extend Orb::Internal::Type::Union
|
|
144
|
+
|
|
145
|
+
Variants =
|
|
146
|
+
T.type_alias do
|
|
147
|
+
T.any(
|
|
148
|
+
Orb::PlanPhaseUsageDiscountAdjustment,
|
|
149
|
+
Orb::PlanPhaseAmountDiscountAdjustment,
|
|
150
|
+
Orb::PlanPhasePercentageDiscountAdjustment,
|
|
151
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount,
|
|
152
|
+
Orb::PlanPhaseMinimumAdjustment,
|
|
153
|
+
Orb::PlanPhaseMaximumAdjustment
|
|
154
|
+
)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
class TieredPercentageDiscount < Orb::Internal::Type::BaseModel
|
|
158
|
+
OrHash =
|
|
159
|
+
T.type_alias do
|
|
160
|
+
T.any(
|
|
161
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount,
|
|
162
|
+
Orb::Internal::AnyHash
|
|
163
|
+
)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
sig { returns(String) }
|
|
167
|
+
attr_accessor :id
|
|
168
|
+
|
|
169
|
+
sig { returns(Symbol) }
|
|
170
|
+
attr_accessor :adjustment_type
|
|
171
|
+
|
|
172
|
+
# The price IDs that this adjustment applies to.
|
|
173
|
+
sig { returns(T::Array[String]) }
|
|
174
|
+
attr_accessor :applies_to_price_ids
|
|
175
|
+
|
|
176
|
+
# The filters that determine which prices to apply this adjustment to.
|
|
177
|
+
sig do
|
|
178
|
+
returns(
|
|
179
|
+
T::Array[
|
|
180
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter
|
|
181
|
+
]
|
|
182
|
+
)
|
|
183
|
+
end
|
|
184
|
+
attr_accessor :filters
|
|
185
|
+
|
|
186
|
+
# True for adjustments that apply to an entire invoice, false for adjustments that
|
|
187
|
+
# apply to only one price.
|
|
188
|
+
sig { returns(T::Boolean) }
|
|
189
|
+
attr_accessor :is_invoice_level
|
|
190
|
+
|
|
191
|
+
# The plan phase in which this adjustment is active.
|
|
192
|
+
sig { returns(T.nilable(Integer)) }
|
|
193
|
+
attr_accessor :plan_phase_order
|
|
194
|
+
|
|
195
|
+
# The reason for the adjustment.
|
|
196
|
+
sig { returns(T.nilable(String)) }
|
|
197
|
+
attr_accessor :reason
|
|
198
|
+
|
|
199
|
+
# The adjustment id this adjustment replaces. This adjustment will take the place
|
|
200
|
+
# of the replaced adjustment in plan version migrations.
|
|
201
|
+
sig { returns(T.nilable(String)) }
|
|
202
|
+
attr_accessor :replaces_adjustment_id
|
|
203
|
+
|
|
204
|
+
# The ordered, contiguous bands of cumulative eligible spend, each discounted at
|
|
205
|
+
# its own percentage (progressive fill-a-tier), applied to the prices this
|
|
206
|
+
# adjustment covers in a given billing period.
|
|
207
|
+
sig do
|
|
208
|
+
returns(
|
|
209
|
+
T::Array[
|
|
210
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Tier
|
|
211
|
+
]
|
|
212
|
+
)
|
|
213
|
+
end
|
|
214
|
+
attr_accessor :tiers
|
|
215
|
+
|
|
216
|
+
sig do
|
|
217
|
+
params(
|
|
218
|
+
id: String,
|
|
219
|
+
applies_to_price_ids: T::Array[String],
|
|
220
|
+
filters:
|
|
221
|
+
T::Array[
|
|
222
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::OrHash
|
|
223
|
+
],
|
|
224
|
+
is_invoice_level: T::Boolean,
|
|
225
|
+
plan_phase_order: T.nilable(Integer),
|
|
226
|
+
reason: T.nilable(String),
|
|
227
|
+
replaces_adjustment_id: T.nilable(String),
|
|
228
|
+
tiers:
|
|
229
|
+
T::Array[
|
|
230
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Tier::OrHash
|
|
231
|
+
],
|
|
232
|
+
adjustment_type: Symbol
|
|
233
|
+
).returns(T.attached_class)
|
|
234
|
+
end
|
|
235
|
+
def self.new(
|
|
236
|
+
id:,
|
|
237
|
+
# The price IDs that this adjustment applies to.
|
|
238
|
+
applies_to_price_ids:,
|
|
239
|
+
# The filters that determine which prices to apply this adjustment to.
|
|
240
|
+
filters:,
|
|
241
|
+
# True for adjustments that apply to an entire invoice, false for adjustments that
|
|
242
|
+
# apply to only one price.
|
|
243
|
+
is_invoice_level:,
|
|
244
|
+
# The plan phase in which this adjustment is active.
|
|
245
|
+
plan_phase_order:,
|
|
246
|
+
# The reason for the adjustment.
|
|
247
|
+
reason:,
|
|
248
|
+
# The adjustment id this adjustment replaces. This adjustment will take the place
|
|
249
|
+
# of the replaced adjustment in plan version migrations.
|
|
250
|
+
replaces_adjustment_id:,
|
|
251
|
+
# The ordered, contiguous bands of cumulative eligible spend, each discounted at
|
|
252
|
+
# its own percentage (progressive fill-a-tier), applied to the prices this
|
|
253
|
+
# adjustment covers in a given billing period.
|
|
254
|
+
tiers:,
|
|
255
|
+
adjustment_type: :tiered_percentage_discount
|
|
256
|
+
)
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
sig do
|
|
260
|
+
override.returns(
|
|
261
|
+
{
|
|
262
|
+
id: String,
|
|
263
|
+
adjustment_type: Symbol,
|
|
264
|
+
applies_to_price_ids: T::Array[String],
|
|
265
|
+
filters:
|
|
266
|
+
T::Array[
|
|
267
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter
|
|
268
|
+
],
|
|
269
|
+
is_invoice_level: T::Boolean,
|
|
270
|
+
plan_phase_order: T.nilable(Integer),
|
|
271
|
+
reason: T.nilable(String),
|
|
272
|
+
replaces_adjustment_id: T.nilable(String),
|
|
273
|
+
tiers:
|
|
274
|
+
T::Array[
|
|
275
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Tier
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
end
|
|
280
|
+
def to_hash
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
class Filter < Orb::Internal::Type::BaseModel
|
|
284
|
+
OrHash =
|
|
285
|
+
T.type_alias do
|
|
286
|
+
T.any(
|
|
287
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter,
|
|
288
|
+
Orb::Internal::AnyHash
|
|
289
|
+
)
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
# The property of the price to filter on.
|
|
293
|
+
sig do
|
|
294
|
+
returns(
|
|
295
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field::TaggedSymbol
|
|
296
|
+
)
|
|
297
|
+
end
|
|
298
|
+
attr_accessor :field
|
|
299
|
+
|
|
300
|
+
# Should prices that match the filter be included or excluded.
|
|
301
|
+
sig do
|
|
302
|
+
returns(
|
|
303
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Operator::TaggedSymbol
|
|
304
|
+
)
|
|
305
|
+
end
|
|
306
|
+
attr_accessor :operator
|
|
307
|
+
|
|
308
|
+
# The IDs or values that match this filter.
|
|
309
|
+
sig { returns(T::Array[String]) }
|
|
310
|
+
attr_accessor :values
|
|
311
|
+
|
|
312
|
+
sig do
|
|
313
|
+
params(
|
|
314
|
+
field:
|
|
315
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field::OrSymbol,
|
|
316
|
+
operator:
|
|
317
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Operator::OrSymbol,
|
|
318
|
+
values: T::Array[String]
|
|
319
|
+
).returns(T.attached_class)
|
|
320
|
+
end
|
|
321
|
+
def self.new(
|
|
322
|
+
# The property of the price to filter on.
|
|
323
|
+
field:,
|
|
324
|
+
# Should prices that match the filter be included or excluded.
|
|
325
|
+
operator:,
|
|
326
|
+
# The IDs or values that match this filter.
|
|
327
|
+
values:
|
|
328
|
+
)
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
sig do
|
|
332
|
+
override.returns(
|
|
333
|
+
{
|
|
334
|
+
field:
|
|
335
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field::TaggedSymbol,
|
|
336
|
+
operator:
|
|
337
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Operator::TaggedSymbol,
|
|
338
|
+
values: T::Array[String]
|
|
339
|
+
}
|
|
340
|
+
)
|
|
341
|
+
end
|
|
342
|
+
def to_hash
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
# The property of the price to filter on.
|
|
346
|
+
module Field
|
|
347
|
+
extend Orb::Internal::Type::Enum
|
|
348
|
+
|
|
349
|
+
TaggedSymbol =
|
|
350
|
+
T.type_alias do
|
|
351
|
+
T.all(
|
|
352
|
+
Symbol,
|
|
353
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field
|
|
354
|
+
)
|
|
355
|
+
end
|
|
356
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
357
|
+
|
|
358
|
+
PRICE_ID =
|
|
359
|
+
T.let(
|
|
360
|
+
:price_id,
|
|
361
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field::TaggedSymbol
|
|
362
|
+
)
|
|
363
|
+
ITEM_ID =
|
|
364
|
+
T.let(
|
|
365
|
+
:item_id,
|
|
366
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field::TaggedSymbol
|
|
367
|
+
)
|
|
368
|
+
PRICE_TYPE =
|
|
369
|
+
T.let(
|
|
370
|
+
:price_type,
|
|
371
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field::TaggedSymbol
|
|
372
|
+
)
|
|
373
|
+
CURRENCY =
|
|
374
|
+
T.let(
|
|
375
|
+
:currency,
|
|
376
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field::TaggedSymbol
|
|
377
|
+
)
|
|
378
|
+
PRICING_UNIT_ID =
|
|
379
|
+
T.let(
|
|
380
|
+
:pricing_unit_id,
|
|
381
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field::TaggedSymbol
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
sig do
|
|
385
|
+
override.returns(
|
|
386
|
+
T::Array[
|
|
387
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field::TaggedSymbol
|
|
388
|
+
]
|
|
389
|
+
)
|
|
390
|
+
end
|
|
391
|
+
def self.values
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
# Should prices that match the filter be included or excluded.
|
|
396
|
+
module Operator
|
|
397
|
+
extend Orb::Internal::Type::Enum
|
|
398
|
+
|
|
399
|
+
TaggedSymbol =
|
|
400
|
+
T.type_alias do
|
|
401
|
+
T.all(
|
|
402
|
+
Symbol,
|
|
403
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Operator
|
|
404
|
+
)
|
|
405
|
+
end
|
|
406
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
407
|
+
|
|
408
|
+
INCLUDES =
|
|
409
|
+
T.let(
|
|
410
|
+
:includes,
|
|
411
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Operator::TaggedSymbol
|
|
412
|
+
)
|
|
413
|
+
EXCLUDES =
|
|
414
|
+
T.let(
|
|
415
|
+
:excludes,
|
|
416
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Operator::TaggedSymbol
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
sig do
|
|
420
|
+
override.returns(
|
|
421
|
+
T::Array[
|
|
422
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Operator::TaggedSymbol
|
|
423
|
+
]
|
|
424
|
+
)
|
|
425
|
+
end
|
|
426
|
+
def self.values
|
|
427
|
+
end
|
|
428
|
+
end
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
class Tier < Orb::Internal::Type::BaseModel
|
|
432
|
+
OrHash =
|
|
433
|
+
T.type_alias do
|
|
434
|
+
T.any(
|
|
435
|
+
Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Tier,
|
|
436
|
+
Orb::Internal::AnyHash
|
|
437
|
+
)
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
# Exclusive lower bound of cumulative spend for this tier.
|
|
441
|
+
sig { returns(Float) }
|
|
442
|
+
attr_accessor :lower_bound
|
|
443
|
+
|
|
444
|
+
# The percentage (between 0 and 1) discounted from spend that falls within this
|
|
445
|
+
# tier.
|
|
446
|
+
sig { returns(Float) }
|
|
447
|
+
attr_accessor :percentage
|
|
448
|
+
|
|
449
|
+
# Inclusive upper bound of cumulative spend for this tier; null for the final
|
|
450
|
+
# open-ended tier.
|
|
451
|
+
sig { returns(T.nilable(Float)) }
|
|
452
|
+
attr_accessor :upper_bound
|
|
453
|
+
|
|
454
|
+
# One band of a tiered percentage discount. Bounds are denominated in the
|
|
455
|
+
# discount's currency. `lower_bound` is the exclusive start of the band and
|
|
456
|
+
# `upper_bound` is the inclusive end; `upper_bound` is null only for the
|
|
457
|
+
# open-ended final tier.
|
|
458
|
+
sig do
|
|
459
|
+
params(
|
|
460
|
+
lower_bound: Float,
|
|
461
|
+
percentage: Float,
|
|
462
|
+
upper_bound: T.nilable(Float)
|
|
463
|
+
).returns(T.attached_class)
|
|
464
|
+
end
|
|
465
|
+
def self.new(
|
|
466
|
+
# Exclusive lower bound of cumulative spend for this tier.
|
|
467
|
+
lower_bound:,
|
|
468
|
+
# The percentage (between 0 and 1) discounted from spend that falls within this
|
|
469
|
+
# tier.
|
|
470
|
+
percentage:,
|
|
471
|
+
# Inclusive upper bound of cumulative spend for this tier; null for the final
|
|
472
|
+
# open-ended tier.
|
|
473
|
+
upper_bound: nil
|
|
474
|
+
)
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
sig do
|
|
478
|
+
override.returns(
|
|
479
|
+
{
|
|
480
|
+
lower_bound: Float,
|
|
481
|
+
percentage: Float,
|
|
482
|
+
upper_bound: T.nilable(Float)
|
|
483
|
+
}
|
|
484
|
+
)
|
|
485
|
+
end
|
|
486
|
+
def to_hash
|
|
487
|
+
end
|
|
488
|
+
end
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
sig do
|
|
492
|
+
override.returns(
|
|
493
|
+
T::Array[Orb::Plans::PlanVersionDraft::Adjustment::Variants]
|
|
494
|
+
)
|
|
495
|
+
end
|
|
496
|
+
def self.variants
|
|
497
|
+
end
|
|
498
|
+
end
|
|
499
|
+
end
|
|
500
|
+
end
|
|
501
|
+
end
|
|
502
|
+
end
|