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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/README.md +1 -1
  4. data/lib/orb/internal/type/union.rb +3 -8
  5. data/lib/orb/internal/util.rb +8 -9
  6. data/lib/orb/models/amount_discount.rb +65 -1
  7. data/lib/orb/models/beta/external_plan_id_create_plan_version_params.rb +1437 -15
  8. data/lib/orb/models/beta_create_plan_version_params.rb +1435 -15
  9. data/lib/orb/models/percentage_discount.rb +65 -1
  10. data/lib/orb/models/subscription_create_params.rb +1435 -15
  11. data/lib/orb/models/subscription_price_intervals_params.rb +715 -5
  12. data/lib/orb/models/subscription_redeem_coupon_params.rb +17 -9
  13. data/lib/orb/models/subscription_schedule_plan_change_params.rb +1435 -15
  14. data/lib/orb/models/trial_discount.rb +65 -1
  15. data/lib/orb/models/usage_discount.rb +65 -1
  16. data/lib/orb/resources/subscriptions.rb +5 -3
  17. data/lib/orb/version.rb +1 -1
  18. data/rbi/orb/internal/util.rbi +2 -0
  19. data/rbi/orb/models/amount_discount.rbi +117 -0
  20. data/rbi/orb/models/beta/external_plan_id_create_plan_version_params.rbi +6145 -3045
  21. data/rbi/orb/models/beta_create_plan_version_params.rbi +6096 -2996
  22. data/rbi/orb/models/percentage_discount.rbi +131 -0
  23. data/rbi/orb/models/subscription_create_params.rbi +6037 -2937
  24. data/rbi/orb/models/subscription_price_intervals_params.rbi +1633 -83
  25. data/rbi/orb/models/subscription_redeem_coupon_params.rbi +16 -8
  26. data/rbi/orb/models/subscription_schedule_plan_change_params.rbi +6948 -3848
  27. data/rbi/orb/models/trial_discount.rbi +109 -0
  28. data/rbi/orb/models/usage_discount.rbi +109 -0
  29. data/rbi/orb/resources/subscriptions.rbi +6 -3
  30. data/sig/orb/models/amount_discount.rbs +58 -0
  31. data/sig/orb/models/beta/external_plan_id_create_plan_version_params.rbs +1130 -20
  32. data/sig/orb/models/beta_create_plan_version_params.rbs +1130 -20
  33. data/sig/orb/models/percentage_discount.rbs +58 -0
  34. data/sig/orb/models/subscription_create_params.rbs +1130 -20
  35. data/sig/orb/models/subscription_price_intervals_params.rbs +565 -10
  36. data/sig/orb/models/subscription_redeem_coupon_params.rbs +11 -6
  37. data/sig/orb/models/subscription_schedule_plan_change_params.rbs +1130 -20
  38. data/sig/orb/models/trial_discount.rbs +58 -0
  39. data/sig/orb/models/usage_discount.rbs +58 -0
  40. data/sig/orb/resources/subscriptions.rbs +2 -1
  41. metadata +2 -2
@@ -19,6 +19,10 @@ module Orb
19
19
  sig { returns(T.nilable(T::Array[String])) }
20
20
  attr_accessor :applies_to_price_ids
21
21
 
22
+ # The filters that determine which prices to apply this discount to.
23
+ sig { returns(T.nilable(T::Array[Orb::PercentageDiscount::Filter])) }
24
+ attr_accessor :filters
25
+
22
26
  sig { returns(T.nilable(String)) }
23
27
  attr_accessor :reason
24
28
 
@@ -27,6 +31,7 @@ module Orb
27
31
  discount_type: Orb::PercentageDiscount::DiscountType::OrSymbol,
28
32
  percentage_discount: Float,
29
33
  applies_to_price_ids: T.nilable(T::Array[String]),
34
+ filters: T.nilable(T::Array[Orb::PercentageDiscount::Filter::OrHash]),
30
35
  reason: T.nilable(String)
31
36
  ).returns(T.attached_class)
32
37
  end
@@ -38,6 +43,8 @@ module Orb
38
43
  # List of price_ids that this discount applies to. For plan/plan phase discounts,
39
44
  # this can be a subset of prices.
40
45
  applies_to_price_ids: nil,
46
+ # The filters that determine which prices to apply this discount to.
47
+ filters: nil,
41
48
  reason: nil
42
49
  )
43
50
  end
@@ -48,6 +55,7 @@ module Orb
48
55
  discount_type: Orb::PercentageDiscount::DiscountType::OrSymbol,
49
56
  percentage_discount: Float,
50
57
  applies_to_price_ids: T.nilable(T::Array[String]),
58
+ filters: T.nilable(T::Array[Orb::PercentageDiscount::Filter]),
51
59
  reason: T.nilable(String)
52
60
  }
53
61
  )
@@ -76,6 +84,129 @@ module Orb
76
84
  def self.values
77
85
  end
78
86
  end
87
+
88
+ class Filter < Orb::Internal::Type::BaseModel
89
+ OrHash =
90
+ T.type_alias do
91
+ T.any(Orb::PercentageDiscount::Filter, Orb::Internal::AnyHash)
92
+ end
93
+
94
+ # The property of the price to filter on.
95
+ sig { returns(Orb::PercentageDiscount::Filter::Field::OrSymbol) }
96
+ attr_accessor :field
97
+
98
+ # Should prices that match the filter be included or excluded.
99
+ sig { returns(Orb::PercentageDiscount::Filter::Operator::OrSymbol) }
100
+ attr_accessor :operator
101
+
102
+ # The IDs or values that match this filter.
103
+ sig { returns(T::Array[String]) }
104
+ attr_accessor :values
105
+
106
+ sig do
107
+ params(
108
+ field: Orb::PercentageDiscount::Filter::Field::OrSymbol,
109
+ operator: Orb::PercentageDiscount::Filter::Operator::OrSymbol,
110
+ values: T::Array[String]
111
+ ).returns(T.attached_class)
112
+ end
113
+ def self.new(
114
+ # The property of the price to filter on.
115
+ field:,
116
+ # Should prices that match the filter be included or excluded.
117
+ operator:,
118
+ # The IDs or values that match this filter.
119
+ values:
120
+ )
121
+ end
122
+
123
+ sig do
124
+ override.returns(
125
+ {
126
+ field: Orb::PercentageDiscount::Filter::Field::OrSymbol,
127
+ operator: Orb::PercentageDiscount::Filter::Operator::OrSymbol,
128
+ values: T::Array[String]
129
+ }
130
+ )
131
+ end
132
+ def to_hash
133
+ end
134
+
135
+ # The property of the price to filter on.
136
+ module Field
137
+ extend Orb::Internal::Type::Enum
138
+
139
+ TaggedSymbol =
140
+ T.type_alias do
141
+ T.all(Symbol, Orb::PercentageDiscount::Filter::Field)
142
+ end
143
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
144
+
145
+ PRICE_ID =
146
+ T.let(
147
+ :price_id,
148
+ Orb::PercentageDiscount::Filter::Field::TaggedSymbol
149
+ )
150
+ ITEM_ID =
151
+ T.let(
152
+ :item_id,
153
+ Orb::PercentageDiscount::Filter::Field::TaggedSymbol
154
+ )
155
+ PRICE_TYPE =
156
+ T.let(
157
+ :price_type,
158
+ Orb::PercentageDiscount::Filter::Field::TaggedSymbol
159
+ )
160
+ CURRENCY =
161
+ T.let(
162
+ :currency,
163
+ Orb::PercentageDiscount::Filter::Field::TaggedSymbol
164
+ )
165
+ PRICING_UNIT_ID =
166
+ T.let(
167
+ :pricing_unit_id,
168
+ Orb::PercentageDiscount::Filter::Field::TaggedSymbol
169
+ )
170
+
171
+ sig do
172
+ override.returns(
173
+ T::Array[Orb::PercentageDiscount::Filter::Field::TaggedSymbol]
174
+ )
175
+ end
176
+ def self.values
177
+ end
178
+ end
179
+
180
+ # Should prices that match the filter be included or excluded.
181
+ module Operator
182
+ extend Orb::Internal::Type::Enum
183
+
184
+ TaggedSymbol =
185
+ T.type_alias do
186
+ T.all(Symbol, Orb::PercentageDiscount::Filter::Operator)
187
+ end
188
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
189
+
190
+ INCLUDES =
191
+ T.let(
192
+ :includes,
193
+ Orb::PercentageDiscount::Filter::Operator::TaggedSymbol
194
+ )
195
+ EXCLUDES =
196
+ T.let(
197
+ :excludes,
198
+ Orb::PercentageDiscount::Filter::Operator::TaggedSymbol
199
+ )
200
+
201
+ sig do
202
+ override.returns(
203
+ T::Array[Orb::PercentageDiscount::Filter::Operator::TaggedSymbol]
204
+ )
205
+ end
206
+ def self.values
207
+ end
208
+ end
209
+ end
79
210
  end
80
211
  end
81
212
  end