orb-billing 0.11.0 → 0.12.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 +19 -0
- data/README.md +1 -1
- data/lib/orb/internal/type/union.rb +3 -8
- data/lib/orb/internal/util.rb +8 -9
- data/lib/orb/models/amount_discount.rb +65 -1
- data/lib/orb/models/beta/external_plan_id_create_plan_version_params.rb +1437 -15
- data/lib/orb/models/beta_create_plan_version_params.rb +1435 -15
- data/lib/orb/models/percentage_discount.rb +65 -1
- data/lib/orb/models/subscription_create_params.rb +1435 -15
- data/lib/orb/models/subscription_price_intervals_params.rb +715 -5
- data/lib/orb/models/subscription_redeem_coupon_params.rb +17 -9
- data/lib/orb/models/subscription_schedule_plan_change_params.rb +1435 -15
- data/lib/orb/models/trial_discount.rb +65 -1
- data/lib/orb/models/usage_discount.rb +65 -1
- data/lib/orb/resources/subscriptions.rb +5 -3
- data/lib/orb/version.rb +1 -1
- data/rbi/orb/internal/util.rbi +2 -0
- data/rbi/orb/models/amount_discount.rbi +117 -0
- data/rbi/orb/models/beta/external_plan_id_create_plan_version_params.rbi +6145 -3045
- data/rbi/orb/models/beta_create_plan_version_params.rbi +6096 -2996
- data/rbi/orb/models/percentage_discount.rbi +131 -0
- data/rbi/orb/models/subscription_create_params.rbi +6037 -2937
- data/rbi/orb/models/subscription_price_intervals_params.rbi +1633 -83
- data/rbi/orb/models/subscription_redeem_coupon_params.rbi +16 -8
- data/rbi/orb/models/subscription_schedule_plan_change_params.rbi +6948 -3848
- data/rbi/orb/models/trial_discount.rbi +109 -0
- data/rbi/orb/models/usage_discount.rbi +109 -0
- data/rbi/orb/resources/subscriptions.rbi +6 -3
- data/sig/orb/models/amount_discount.rbs +58 -0
- data/sig/orb/models/beta/external_plan_id_create_plan_version_params.rbs +1130 -20
- data/sig/orb/models/beta_create_plan_version_params.rbs +1130 -20
- data/sig/orb/models/percentage_discount.rbs +58 -0
- data/sig/orb/models/subscription_create_params.rbs +1130 -20
- data/sig/orb/models/subscription_price_intervals_params.rbs +565 -10
- data/sig/orb/models/subscription_redeem_coupon_params.rbs +11 -6
- data/sig/orb/models/subscription_schedule_plan_change_params.rbs +1130 -20
- data/sig/orb/models/trial_discount.rbs +58 -0
- data/sig/orb/models/usage_discount.rbs +58 -0
- data/sig/orb/resources/subscriptions.rbs +2 -1
- metadata +2 -2
@@ -15,6 +15,12 @@ module Orb
|
|
15
15
|
# @return [Array<String>, nil]
|
16
16
|
optional :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String], nil?: true
|
17
17
|
|
18
|
+
# @!attribute filters
|
19
|
+
# The filters that determine which prices to apply this discount to.
|
20
|
+
#
|
21
|
+
# @return [Array<Orb::Models::TrialDiscount::Filter>, nil]
|
22
|
+
optional :filters, -> { Orb::Internal::Type::ArrayOf[Orb::TrialDiscount::Filter] }, nil?: true
|
23
|
+
|
18
24
|
# @!attribute reason
|
19
25
|
#
|
20
26
|
# @return [String, nil]
|
@@ -32,7 +38,7 @@ module Orb
|
|
32
38
|
# @return [Float, nil]
|
33
39
|
optional :trial_percentage_discount, Float, nil?: true
|
34
40
|
|
35
|
-
# @!method initialize(discount_type:, applies_to_price_ids: nil, reason: nil, trial_amount_discount: nil, trial_percentage_discount: nil)
|
41
|
+
# @!method initialize(discount_type:, applies_to_price_ids: nil, filters: nil, reason: nil, trial_amount_discount: nil, trial_percentage_discount: nil)
|
36
42
|
# Some parameter documentations has been truncated, see
|
37
43
|
# {Orb::Models::TrialDiscount} for more details.
|
38
44
|
#
|
@@ -40,6 +46,8 @@ module Orb
|
|
40
46
|
#
|
41
47
|
# @param applies_to_price_ids [Array<String>, nil] List of price_ids that this discount applies to. For plan/plan phase discounts,
|
42
48
|
#
|
49
|
+
# @param filters [Array<Orb::Models::TrialDiscount::Filter>, nil] The filters that determine which prices to apply this discount to.
|
50
|
+
#
|
43
51
|
# @param reason [String, nil]
|
44
52
|
#
|
45
53
|
# @param trial_amount_discount [String, nil] Only available if discount_type is `trial`
|
@@ -55,6 +63,62 @@ module Orb
|
|
55
63
|
# @!method self.values
|
56
64
|
# @return [Array<Symbol>]
|
57
65
|
end
|
66
|
+
|
67
|
+
class Filter < Orb::Internal::Type::BaseModel
|
68
|
+
# @!attribute field
|
69
|
+
# The property of the price to filter on.
|
70
|
+
#
|
71
|
+
# @return [Symbol, Orb::Models::TrialDiscount::Filter::Field]
|
72
|
+
required :field, enum: -> { Orb::TrialDiscount::Filter::Field }
|
73
|
+
|
74
|
+
# @!attribute operator
|
75
|
+
# Should prices that match the filter be included or excluded.
|
76
|
+
#
|
77
|
+
# @return [Symbol, Orb::Models::TrialDiscount::Filter::Operator]
|
78
|
+
required :operator, enum: -> { Orb::TrialDiscount::Filter::Operator }
|
79
|
+
|
80
|
+
# @!attribute values
|
81
|
+
# The IDs or values that match this filter.
|
82
|
+
#
|
83
|
+
# @return [Array<String>]
|
84
|
+
required :values, Orb::Internal::Type::ArrayOf[String]
|
85
|
+
|
86
|
+
# @!method initialize(field:, operator:, values:)
|
87
|
+
# @param field [Symbol, Orb::Models::TrialDiscount::Filter::Field] The property of the price to filter on.
|
88
|
+
#
|
89
|
+
# @param operator [Symbol, Orb::Models::TrialDiscount::Filter::Operator] Should prices that match the filter be included or excluded.
|
90
|
+
#
|
91
|
+
# @param values [Array<String>] The IDs or values that match this filter.
|
92
|
+
|
93
|
+
# The property of the price to filter on.
|
94
|
+
#
|
95
|
+
# @see Orb::Models::TrialDiscount::Filter#field
|
96
|
+
module Field
|
97
|
+
extend Orb::Internal::Type::Enum
|
98
|
+
|
99
|
+
PRICE_ID = :price_id
|
100
|
+
ITEM_ID = :item_id
|
101
|
+
PRICE_TYPE = :price_type
|
102
|
+
CURRENCY = :currency
|
103
|
+
PRICING_UNIT_ID = :pricing_unit_id
|
104
|
+
|
105
|
+
# @!method self.values
|
106
|
+
# @return [Array<Symbol>]
|
107
|
+
end
|
108
|
+
|
109
|
+
# Should prices that match the filter be included or excluded.
|
110
|
+
#
|
111
|
+
# @see Orb::Models::TrialDiscount::Filter#operator
|
112
|
+
module Operator
|
113
|
+
extend Orb::Internal::Type::Enum
|
114
|
+
|
115
|
+
INCLUDES = :includes
|
116
|
+
EXCLUDES = :excludes
|
117
|
+
|
118
|
+
# @!method self.values
|
119
|
+
# @return [Array<Symbol>]
|
120
|
+
end
|
121
|
+
end
|
58
122
|
end
|
59
123
|
end
|
60
124
|
end
|
@@ -22,12 +22,18 @@ module Orb
|
|
22
22
|
# @return [Array<String>, nil]
|
23
23
|
optional :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String], nil?: true
|
24
24
|
|
25
|
+
# @!attribute filters
|
26
|
+
# The filters that determine which prices to apply this discount to.
|
27
|
+
#
|
28
|
+
# @return [Array<Orb::Models::UsageDiscount::Filter>, nil]
|
29
|
+
optional :filters, -> { Orb::Internal::Type::ArrayOf[Orb::UsageDiscount::Filter] }, nil?: true
|
30
|
+
|
25
31
|
# @!attribute reason
|
26
32
|
#
|
27
33
|
# @return [String, nil]
|
28
34
|
optional :reason, String, nil?: true
|
29
35
|
|
30
|
-
# @!method initialize(discount_type:, usage_discount:, applies_to_price_ids: nil, reason: nil)
|
36
|
+
# @!method initialize(discount_type:, usage_discount:, applies_to_price_ids: nil, filters: nil, reason: nil)
|
31
37
|
# Some parameter documentations has been truncated, see
|
32
38
|
# {Orb::Models::UsageDiscount} for more details.
|
33
39
|
#
|
@@ -37,6 +43,8 @@ module Orb
|
|
37
43
|
#
|
38
44
|
# @param applies_to_price_ids [Array<String>, nil] List of price_ids that this discount applies to. For plan/plan phase discounts,
|
39
45
|
#
|
46
|
+
# @param filters [Array<Orb::Models::UsageDiscount::Filter>, nil] The filters that determine which prices to apply this discount to.
|
47
|
+
#
|
40
48
|
# @param reason [String, nil]
|
41
49
|
|
42
50
|
# @see Orb::Models::UsageDiscount#discount_type
|
@@ -48,6 +56,62 @@ module Orb
|
|
48
56
|
# @!method self.values
|
49
57
|
# @return [Array<Symbol>]
|
50
58
|
end
|
59
|
+
|
60
|
+
class Filter < Orb::Internal::Type::BaseModel
|
61
|
+
# @!attribute field
|
62
|
+
# The property of the price to filter on.
|
63
|
+
#
|
64
|
+
# @return [Symbol, Orb::Models::UsageDiscount::Filter::Field]
|
65
|
+
required :field, enum: -> { Orb::UsageDiscount::Filter::Field }
|
66
|
+
|
67
|
+
# @!attribute operator
|
68
|
+
# Should prices that match the filter be included or excluded.
|
69
|
+
#
|
70
|
+
# @return [Symbol, Orb::Models::UsageDiscount::Filter::Operator]
|
71
|
+
required :operator, enum: -> { Orb::UsageDiscount::Filter::Operator }
|
72
|
+
|
73
|
+
# @!attribute values
|
74
|
+
# The IDs or values that match this filter.
|
75
|
+
#
|
76
|
+
# @return [Array<String>]
|
77
|
+
required :values, Orb::Internal::Type::ArrayOf[String]
|
78
|
+
|
79
|
+
# @!method initialize(field:, operator:, values:)
|
80
|
+
# @param field [Symbol, Orb::Models::UsageDiscount::Filter::Field] The property of the price to filter on.
|
81
|
+
#
|
82
|
+
# @param operator [Symbol, Orb::Models::UsageDiscount::Filter::Operator] Should prices that match the filter be included or excluded.
|
83
|
+
#
|
84
|
+
# @param values [Array<String>] The IDs or values that match this filter.
|
85
|
+
|
86
|
+
# The property of the price to filter on.
|
87
|
+
#
|
88
|
+
# @see Orb::Models::UsageDiscount::Filter#field
|
89
|
+
module Field
|
90
|
+
extend Orb::Internal::Type::Enum
|
91
|
+
|
92
|
+
PRICE_ID = :price_id
|
93
|
+
ITEM_ID = :item_id
|
94
|
+
PRICE_TYPE = :price_type
|
95
|
+
CURRENCY = :currency
|
96
|
+
PRICING_UNIT_ID = :pricing_unit_id
|
97
|
+
|
98
|
+
# @!method self.values
|
99
|
+
# @return [Array<Symbol>]
|
100
|
+
end
|
101
|
+
|
102
|
+
# Should prices that match the filter be included or excluded.
|
103
|
+
#
|
104
|
+
# @see Orb::Models::UsageDiscount::Filter#operator
|
105
|
+
module Operator
|
106
|
+
extend Orb::Internal::Type::Enum
|
107
|
+
|
108
|
+
INCLUDES = :includes
|
109
|
+
EXCLUDES = :excludes
|
110
|
+
|
111
|
+
# @!method self.values
|
112
|
+
# @return [Array<Symbol>]
|
113
|
+
end
|
114
|
+
end
|
51
115
|
end
|
52
116
|
end
|
53
117
|
end
|
@@ -987,18 +987,20 @@ module Orb
|
|
987
987
|
#
|
988
988
|
# Redeem a coupon effective at a given time.
|
989
989
|
#
|
990
|
-
# @overload redeem_coupon(subscription_id, change_option:,
|
990
|
+
# @overload redeem_coupon(subscription_id, change_option:, allow_invoice_credit_or_void: nil, change_date: nil, coupon_id: nil, coupon_redemption_code: nil, request_options: {})
|
991
991
|
#
|
992
992
|
# @param subscription_id [String]
|
993
993
|
#
|
994
994
|
# @param change_option [Symbol, Orb::Models::SubscriptionRedeemCouponParams::ChangeOption]
|
995
995
|
#
|
996
|
-
# @param coupon_id [String] Coupon ID to be redeemed for this subscription.
|
997
|
-
#
|
998
996
|
# @param allow_invoice_credit_or_void [Boolean, nil] If false, this request will fail if it would void an issued invoice or create a
|
999
997
|
#
|
1000
998
|
# @param change_date [Time, nil] The date that the coupon discount should take effect. This parameter can only be
|
1001
999
|
#
|
1000
|
+
# @param coupon_id [String, nil] Coupon ID to be redeemed for this subscription.
|
1001
|
+
#
|
1002
|
+
# @param coupon_redemption_code [String, nil] Redemption code of the coupon to be redeemed for this subscription.
|
1003
|
+
#
|
1002
1004
|
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
1003
1005
|
#
|
1004
1006
|
# @return [Orb::Models::SubscriptionRedeemCouponResponse]
|
data/lib/orb/version.rb
CHANGED
data/rbi/orb/internal/util.rbi
CHANGED
@@ -326,6 +326,8 @@ module Orb
|
|
326
326
|
end
|
327
327
|
|
328
328
|
# @api private
|
329
|
+
#
|
330
|
+
# https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#special-considerations-for-multipart-content
|
329
331
|
sig do
|
330
332
|
params(body: T.anything).returns([String, T::Enumerable[String]])
|
331
333
|
end
|
@@ -18,6 +18,10 @@ module Orb
|
|
18
18
|
sig { returns(T.nilable(T::Array[String])) }
|
19
19
|
attr_accessor :applies_to_price_ids
|
20
20
|
|
21
|
+
# The filters that determine which prices to apply this discount to.
|
22
|
+
sig { returns(T.nilable(T::Array[Orb::AmountDiscount::Filter])) }
|
23
|
+
attr_accessor :filters
|
24
|
+
|
21
25
|
sig { returns(T.nilable(String)) }
|
22
26
|
attr_accessor :reason
|
23
27
|
|
@@ -26,6 +30,7 @@ module Orb
|
|
26
30
|
amount_discount: String,
|
27
31
|
discount_type: Orb::AmountDiscount::DiscountType::OrSymbol,
|
28
32
|
applies_to_price_ids: T.nilable(T::Array[String]),
|
33
|
+
filters: T.nilable(T::Array[Orb::AmountDiscount::Filter::OrHash]),
|
29
34
|
reason: T.nilable(String)
|
30
35
|
).returns(T.attached_class)
|
31
36
|
end
|
@@ -36,6 +41,8 @@ module Orb
|
|
36
41
|
# List of price_ids that this discount applies to. For plan/plan phase discounts,
|
37
42
|
# this can be a subset of prices.
|
38
43
|
applies_to_price_ids: nil,
|
44
|
+
# The filters that determine which prices to apply this discount to.
|
45
|
+
filters: nil,
|
39
46
|
reason: nil
|
40
47
|
)
|
41
48
|
end
|
@@ -46,6 +53,7 @@ module Orb
|
|
46
53
|
amount_discount: String,
|
47
54
|
discount_type: Orb::AmountDiscount::DiscountType::OrSymbol,
|
48
55
|
applies_to_price_ids: T.nilable(T::Array[String]),
|
56
|
+
filters: T.nilable(T::Array[Orb::AmountDiscount::Filter]),
|
49
57
|
reason: T.nilable(String)
|
50
58
|
}
|
51
59
|
)
|
@@ -70,6 +78,115 @@ module Orb
|
|
70
78
|
def self.values
|
71
79
|
end
|
72
80
|
end
|
81
|
+
|
82
|
+
class Filter < Orb::Internal::Type::BaseModel
|
83
|
+
OrHash =
|
84
|
+
T.type_alias do
|
85
|
+
T.any(Orb::AmountDiscount::Filter, Orb::Internal::AnyHash)
|
86
|
+
end
|
87
|
+
|
88
|
+
# The property of the price to filter on.
|
89
|
+
sig { returns(Orb::AmountDiscount::Filter::Field::OrSymbol) }
|
90
|
+
attr_accessor :field
|
91
|
+
|
92
|
+
# Should prices that match the filter be included or excluded.
|
93
|
+
sig { returns(Orb::AmountDiscount::Filter::Operator::OrSymbol) }
|
94
|
+
attr_accessor :operator
|
95
|
+
|
96
|
+
# The IDs or values that match this filter.
|
97
|
+
sig { returns(T::Array[String]) }
|
98
|
+
attr_accessor :values
|
99
|
+
|
100
|
+
sig do
|
101
|
+
params(
|
102
|
+
field: Orb::AmountDiscount::Filter::Field::OrSymbol,
|
103
|
+
operator: Orb::AmountDiscount::Filter::Operator::OrSymbol,
|
104
|
+
values: T::Array[String]
|
105
|
+
).returns(T.attached_class)
|
106
|
+
end
|
107
|
+
def self.new(
|
108
|
+
# The property of the price to filter on.
|
109
|
+
field:,
|
110
|
+
# Should prices that match the filter be included or excluded.
|
111
|
+
operator:,
|
112
|
+
# The IDs or values that match this filter.
|
113
|
+
values:
|
114
|
+
)
|
115
|
+
end
|
116
|
+
|
117
|
+
sig do
|
118
|
+
override.returns(
|
119
|
+
{
|
120
|
+
field: Orb::AmountDiscount::Filter::Field::OrSymbol,
|
121
|
+
operator: Orb::AmountDiscount::Filter::Operator::OrSymbol,
|
122
|
+
values: T::Array[String]
|
123
|
+
}
|
124
|
+
)
|
125
|
+
end
|
126
|
+
def to_hash
|
127
|
+
end
|
128
|
+
|
129
|
+
# The property of the price to filter on.
|
130
|
+
module Field
|
131
|
+
extend Orb::Internal::Type::Enum
|
132
|
+
|
133
|
+
TaggedSymbol =
|
134
|
+
T.type_alias { T.all(Symbol, Orb::AmountDiscount::Filter::Field) }
|
135
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
136
|
+
|
137
|
+
PRICE_ID =
|
138
|
+
T.let(:price_id, Orb::AmountDiscount::Filter::Field::TaggedSymbol)
|
139
|
+
ITEM_ID =
|
140
|
+
T.let(:item_id, Orb::AmountDiscount::Filter::Field::TaggedSymbol)
|
141
|
+
PRICE_TYPE =
|
142
|
+
T.let(:price_type, Orb::AmountDiscount::Filter::Field::TaggedSymbol)
|
143
|
+
CURRENCY =
|
144
|
+
T.let(:currency, Orb::AmountDiscount::Filter::Field::TaggedSymbol)
|
145
|
+
PRICING_UNIT_ID =
|
146
|
+
T.let(
|
147
|
+
:pricing_unit_id,
|
148
|
+
Orb::AmountDiscount::Filter::Field::TaggedSymbol
|
149
|
+
)
|
150
|
+
|
151
|
+
sig do
|
152
|
+
override.returns(
|
153
|
+
T::Array[Orb::AmountDiscount::Filter::Field::TaggedSymbol]
|
154
|
+
)
|
155
|
+
end
|
156
|
+
def self.values
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
# Should prices that match the filter be included or excluded.
|
161
|
+
module Operator
|
162
|
+
extend Orb::Internal::Type::Enum
|
163
|
+
|
164
|
+
TaggedSymbol =
|
165
|
+
T.type_alias do
|
166
|
+
T.all(Symbol, Orb::AmountDiscount::Filter::Operator)
|
167
|
+
end
|
168
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
169
|
+
|
170
|
+
INCLUDES =
|
171
|
+
T.let(
|
172
|
+
:includes,
|
173
|
+
Orb::AmountDiscount::Filter::Operator::TaggedSymbol
|
174
|
+
)
|
175
|
+
EXCLUDES =
|
176
|
+
T.let(
|
177
|
+
:excludes,
|
178
|
+
Orb::AmountDiscount::Filter::Operator::TaggedSymbol
|
179
|
+
)
|
180
|
+
|
181
|
+
sig do
|
182
|
+
override.returns(
|
183
|
+
T::Array[Orb::AmountDiscount::Filter::Operator::TaggedSymbol]
|
184
|
+
)
|
185
|
+
end
|
186
|
+
def self.values
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
73
190
|
end
|
74
191
|
end
|
75
192
|
end
|