orb-billing 1.4.0 → 1.5.1

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +1 -1
  4. data/lib/orb/models/credit_note.rb +17 -1
  5. data/lib/orb/models/credit_note_create_params.rb +53 -2
  6. data/lib/orb/models/events/backfill_create_params.rb +2 -2
  7. data/lib/orb/models/mutated_subscription.rb +9 -6
  8. data/lib/orb/models/price_evaluate_multiple_params.rb +9 -1
  9. data/lib/orb/models/price_evaluate_multiple_response.rb +9 -1
  10. data/lib/orb/models/price_evaluate_preview_events_params.rb +9 -1
  11. data/lib/orb/models/price_evaluate_preview_events_response.rb +9 -1
  12. data/lib/orb/models/subscription.rb +9 -6
  13. data/lib/orb/models/subscription_price_intervals_params.rb +10 -10
  14. data/lib/orb/resources/credit_notes.rb +33 -1
  15. data/lib/orb/resources/customers/costs.rb +16 -16
  16. data/lib/orb/resources/customers/credits/ledger.rb +4 -4
  17. data/lib/orb/resources/invoices.rb +1 -1
  18. data/lib/orb/resources/subscriptions.rb +1 -1
  19. data/lib/orb/version.rb +1 -1
  20. data/rbi/orb/models/credit_note.rbi +19 -3
  21. data/rbi/orb/models/credit_note_create_params.rbi +69 -5
  22. data/rbi/orb/models/events/backfill_create_params.rbi +4 -4
  23. data/rbi/orb/models/mutated_subscription.rbi +12 -6
  24. data/rbi/orb/models/price_evaluate_multiple_params.rbi +8 -0
  25. data/rbi/orb/models/price_evaluate_multiple_response.rbi +8 -0
  26. data/rbi/orb/models/price_evaluate_preview_events_params.rbi +8 -0
  27. data/rbi/orb/models/price_evaluate_preview_events_response.rbi +8 -0
  28. data/rbi/orb/models/subscription.rbi +12 -6
  29. data/rbi/orb/models/subscription_price_intervals_params.rbi +12 -12
  30. data/rbi/orb/resources/credit_notes.rbi +37 -0
  31. data/rbi/orb/resources/customers/costs.rbi +16 -16
  32. data/rbi/orb/resources/customers/credits/ledger.rbi +4 -4
  33. data/rbi/orb/resources/events/backfills.rbi +2 -2
  34. data/rbi/orb/resources/invoices.rbi +1 -1
  35. data/rbi/orb/resources/subscriptions.rbi +1 -1
  36. data/sig/orb/models/credit_note.rbs +13 -3
  37. data/sig/orb/models/credit_note_create_params.rbs +34 -4
  38. data/sig/orb/models/price_evaluate_multiple_params.rbs +5 -0
  39. data/sig/orb/models/price_evaluate_multiple_response.rbs +5 -0
  40. data/sig/orb/models/price_evaluate_preview_events_params.rbs +5 -0
  41. data/sig/orb/models/price_evaluate_preview_events_response.rbs +5 -0
  42. data/sig/orb/resources/credit_notes.rbs +2 -0
  43. metadata +2 -2
@@ -211,6 +211,14 @@ module Orb
211
211
  end
212
212
  attr_writer :discounts
213
213
 
214
+ # The end time of the service period for this credit note line item.
215
+ sig { returns(T.nilable(Time)) }
216
+ attr_accessor :end_time_exclusive
217
+
218
+ # The start time of the service period for this credit note line item.
219
+ sig { returns(T.nilable(Time)) }
220
+ attr_accessor :start_time_inclusive
221
+
214
222
  sig do
215
223
  params(
216
224
  id: String,
@@ -220,7 +228,9 @@ module Orb
220
228
  quantity: T.nilable(Float),
221
229
  subtotal: String,
222
230
  tax_amounts: T::Array[Orb::TaxAmount::OrHash],
223
- discounts: T::Array[Orb::CreditNote::LineItem::Discount::OrHash]
231
+ discounts: T::Array[Orb::CreditNote::LineItem::Discount::OrHash],
232
+ end_time_exclusive: T.nilable(Time),
233
+ start_time_inclusive: T.nilable(Time)
224
234
  ).returns(T.attached_class)
225
235
  end
226
236
  def self.new(
@@ -239,7 +249,11 @@ module Orb
239
249
  # Any tax amounts applied onto the line item.
240
250
  tax_amounts:,
241
251
  # Any line item discounts from the invoice's line item.
242
- discounts: nil
252
+ discounts: nil,
253
+ # The end time of the service period for this credit note line item.
254
+ end_time_exclusive: nil,
255
+ # The start time of the service period for this credit note line item.
256
+ start_time_inclusive: nil
243
257
  )
244
258
  end
245
259
 
@@ -253,7 +267,9 @@ module Orb
253
267
  quantity: T.nilable(Float),
254
268
  subtotal: String,
255
269
  tax_amounts: T::Array[Orb::TaxAmount],
256
- discounts: T::Array[Orb::CreditNote::LineItem::Discount]
270
+ discounts: T::Array[Orb::CreditNote::LineItem::Discount],
271
+ end_time_exclusive: T.nilable(Time),
272
+ start_time_inclusive: T.nilable(Time)
257
273
  }
258
274
  )
259
275
  end
@@ -18,15 +18,31 @@ module Orb
18
18
  sig { returns(Orb::CreditNoteCreateParams::Reason::OrSymbol) }
19
19
  attr_accessor :reason
20
20
 
21
+ # A date string to specify the global credit note service period end date in the
22
+ # customer's timezone. This will be applied to all line items that don't have
23
+ # their own individual service periods specified. If not provided, line items will
24
+ # use their original invoice line item service periods. This date is inclusive.
25
+ sig { returns(T.nilable(Date)) }
26
+ attr_accessor :end_date
27
+
21
28
  # An optional memo to attach to the credit note.
22
29
  sig { returns(T.nilable(String)) }
23
30
  attr_accessor :memo
24
31
 
32
+ # A date string to specify the global credit note service period start date in the
33
+ # customer's timezone. This will be applied to all line items that don't have
34
+ # their own individual service periods specified. If not provided, line items will
35
+ # use their original invoice line item service periods. This date is inclusive.
36
+ sig { returns(T.nilable(Date)) }
37
+ attr_accessor :start_date
38
+
25
39
  sig do
26
40
  params(
27
41
  line_items: T::Array[Orb::CreditNoteCreateParams::LineItem::OrHash],
28
42
  reason: Orb::CreditNoteCreateParams::Reason::OrSymbol,
43
+ end_date: T.nilable(Date),
29
44
  memo: T.nilable(String),
45
+ start_date: T.nilable(Date),
30
46
  request_options: Orb::RequestOptions::OrHash
31
47
  ).returns(T.attached_class)
32
48
  end
@@ -34,8 +50,18 @@ module Orb
34
50
  line_items:,
35
51
  # An optional reason for the credit note.
36
52
  reason:,
53
+ # A date string to specify the global credit note service period end date in the
54
+ # customer's timezone. This will be applied to all line items that don't have
55
+ # their own individual service periods specified. If not provided, line items will
56
+ # use their original invoice line item service periods. This date is inclusive.
57
+ end_date: nil,
37
58
  # An optional memo to attach to the credit note.
38
59
  memo: nil,
60
+ # A date string to specify the global credit note service period start date in the
61
+ # customer's timezone. This will be applied to all line items that don't have
62
+ # their own individual service periods specified. If not provided, line items will
63
+ # use their original invoice line item service periods. This date is inclusive.
64
+ start_date: nil,
39
65
  request_options: {}
40
66
  )
41
67
  end
@@ -45,7 +71,9 @@ module Orb
45
71
  {
46
72
  line_items: T::Array[Orb::CreditNoteCreateParams::LineItem],
47
73
  reason: Orb::CreditNoteCreateParams::Reason::OrSymbol,
74
+ end_date: T.nilable(Date),
48
75
  memo: T.nilable(String),
76
+ start_date: T.nilable(Date),
49
77
  request_options: Orb::RequestOptions
50
78
  }
51
79
  )
@@ -67,21 +95,57 @@ module Orb
67
95
  sig { returns(String) }
68
96
  attr_accessor :invoice_line_item_id
69
97
 
98
+ # A date string to specify this line item's credit note service period end date in
99
+ # the customer's timezone. If provided, this will be used for this specific line
100
+ # item. If not provided, will use the global end_date if available, otherwise
101
+ # defaults to the original invoice line item's end date. This date is inclusive.
102
+ sig { returns(T.nilable(Date)) }
103
+ attr_accessor :end_date
104
+
105
+ # A date string to specify this line item's credit note service period start date
106
+ # in the customer's timezone. If provided, this will be used for this specific
107
+ # line item. If not provided, will use the global start_date if available,
108
+ # otherwise defaults to the original invoice line item's start date. This date is
109
+ # inclusive.
110
+ sig { returns(T.nilable(Date)) }
111
+ attr_accessor :start_date
112
+
70
113
  sig do
71
- params(amount: String, invoice_line_item_id: String).returns(
72
- T.attached_class
73
- )
114
+ params(
115
+ amount: String,
116
+ invoice_line_item_id: String,
117
+ end_date: T.nilable(Date),
118
+ start_date: T.nilable(Date)
119
+ ).returns(T.attached_class)
74
120
  end
75
121
  def self.new(
76
122
  # The total amount in the invoice's currency to credit this line item.
77
123
  amount:,
78
124
  # The ID of the line item to credit.
79
- invoice_line_item_id:
125
+ invoice_line_item_id:,
126
+ # A date string to specify this line item's credit note service period end date in
127
+ # the customer's timezone. If provided, this will be used for this specific line
128
+ # item. If not provided, will use the global end_date if available, otherwise
129
+ # defaults to the original invoice line item's end date. This date is inclusive.
130
+ end_date: nil,
131
+ # A date string to specify this line item's credit note service period start date
132
+ # in the customer's timezone. If provided, this will be used for this specific
133
+ # line item. If not provided, will use the global start_date if available,
134
+ # otherwise defaults to the original invoice line item's start date. This date is
135
+ # inclusive.
136
+ start_date: nil
80
137
  )
81
138
  end
82
139
 
83
140
  sig do
84
- override.returns({ amount: String, invoice_line_item_id: String })
141
+ override.returns(
142
+ {
143
+ amount: String,
144
+ invoice_line_item_id: String,
145
+ end_date: T.nilable(Date),
146
+ start_date: T.nilable(Date)
147
+ }
148
+ )
85
149
  end
86
150
  def to_hash
87
151
  end
@@ -13,13 +13,13 @@ module Orb
13
13
  end
14
14
 
15
15
  # The (exclusive) end of the usage timeframe affected by this backfill. By
16
- # default, Orb allows backfills up to 10 days in duration at a time. Reach out to
16
+ # default, Orb allows backfills up to 31 days in duration at a time. Reach out to
17
17
  # discuss extending this limit and your use case.
18
18
  sig { returns(Time) }
19
19
  attr_accessor :timeframe_end
20
20
 
21
21
  # The (inclusive) start of the usage timeframe affected by this backfill. By
22
- # default, Orb allows backfills up to 10 days in duration at a time. Reach out to
22
+ # default, Orb allows backfills up to 31 days in duration at a time. Reach out to
23
23
  # discuss extending this limit and your use case.
24
24
  sig { returns(Time) }
25
25
  attr_accessor :timeframe_start
@@ -68,11 +68,11 @@ module Orb
68
68
  end
69
69
  def self.new(
70
70
  # The (exclusive) end of the usage timeframe affected by this backfill. By
71
- # default, Orb allows backfills up to 10 days in duration at a time. Reach out to
71
+ # default, Orb allows backfills up to 31 days in duration at a time. Reach out to
72
72
  # discuss extending this limit and your use case.
73
73
  timeframe_end:,
74
74
  # The (inclusive) start of the usage timeframe affected by this backfill. By
75
- # default, Orb allows backfills up to 10 days in duration at a time. Reach out to
75
+ # default, Orb allows backfills up to 31 days in duration at a time. Reach out to
76
76
  # discuss extending this limit and your use case.
77
77
  timeframe_start:,
78
78
  # The time at which no more events will be accepted for this backfill. The
@@ -87,7 +87,8 @@ module Orb
87
87
  sig { returns(T.nilable(String)) }
88
88
  attr_accessor :default_invoice_memo
89
89
 
90
- # The discount intervals for this subscription sorted by the start_date.
90
+ # The discount intervals for this subscription sorted by the start_date. This
91
+ # field is deprecated in favor of `adjustment_intervals`.
91
92
  sig do
92
93
  returns(T::Array[Orb::MutatedSubscription::DiscountInterval::Variants])
93
94
  end
@@ -103,7 +104,8 @@ module Orb
103
104
  sig { returns(T.nilable(String)) }
104
105
  attr_accessor :invoicing_threshold
105
106
 
106
- # The maximum intervals for this subscription sorted by the start_date.
107
+ # The maximum intervals for this subscription sorted by the start_date. This field
108
+ # is deprecated in favor of `adjustment_intervals`.
107
109
  sig { returns(T::Array[Orb::MaximumInterval]) }
108
110
  attr_accessor :maximum_intervals
109
111
 
@@ -114,7 +116,8 @@ module Orb
114
116
  sig { returns(T::Hash[Symbol, String]) }
115
117
  attr_accessor :metadata
116
118
 
117
- # The minimum intervals for this subscription sorted by the start_date.
119
+ # The minimum intervals for this subscription sorted by the start_date. This field
120
+ # is deprecated in favor of `adjustment_intervals`.
118
121
  sig { returns(T::Array[Orb::MinimumInterval]) }
119
122
  attr_accessor :minimum_intervals
120
123
 
@@ -282,20 +285,23 @@ module Orb
282
285
  # Determines the default memo on this subscriptions' invoices. Note that if this
283
286
  # is not provided, it is determined by the plan configuration.
284
287
  default_invoice_memo:,
285
- # The discount intervals for this subscription sorted by the start_date.
288
+ # The discount intervals for this subscription sorted by the start_date. This
289
+ # field is deprecated in favor of `adjustment_intervals`.
286
290
  discount_intervals:,
287
291
  # The date Orb stops billing for this subscription.
288
292
  end_date:,
289
293
  fixed_fee_quantity_schedule:,
290
294
  invoicing_threshold:,
291
- # The maximum intervals for this subscription sorted by the start_date.
295
+ # The maximum intervals for this subscription sorted by the start_date. This field
296
+ # is deprecated in favor of `adjustment_intervals`.
292
297
  maximum_intervals:,
293
298
  # User specified key-value pairs for the resource. If not present, this defaults
294
299
  # to an empty dictionary. Individual keys can be removed by setting the value to
295
300
  # `null`, and the entire metadata mapping can be cleared by setting `metadata` to
296
301
  # `null`.
297
302
  metadata:,
298
- # The minimum intervals for this subscription sorted by the start_date.
303
+ # The minimum intervals for this subscription sorted by the start_date. This field
304
+ # is deprecated in favor of `adjustment_intervals`.
299
305
  minimum_intervals:,
300
306
  # The name of the subscription.
301
307
  name:,
@@ -94,6 +94,10 @@ module Orb
94
94
  )
95
95
  end
96
96
 
97
+ # The external ID of a price to evaluate that exists in your Orb account.
98
+ sig { returns(T.nilable(String)) }
99
+ attr_accessor :external_price_id
100
+
97
101
  # A boolean
98
102
  # [computed property](/extensibility/advanced-metrics#computed-properties) used to
99
103
  # filter the underlying billable metric
@@ -155,6 +159,7 @@ module Orb
155
159
 
156
160
  sig do
157
161
  params(
162
+ external_price_id: T.nilable(String),
158
163
  filter: T.nilable(String),
159
164
  grouping_keys: T::Array[String],
160
165
  price:
@@ -194,6 +199,8 @@ module Orb
194
199
  ).returns(T.attached_class)
195
200
  end
196
201
  def self.new(
202
+ # The external ID of a price to evaluate that exists in your Orb account.
203
+ external_price_id: nil,
197
204
  # A boolean
198
205
  # [computed property](/extensibility/advanced-metrics#computed-properties) used to
199
206
  # filter the underlying billable metric
@@ -213,6 +220,7 @@ module Orb
213
220
  sig do
214
221
  override.returns(
215
222
  {
223
+ external_price_id: T.nilable(String),
216
224
  filter: T.nilable(String),
217
225
  grouping_keys: T::Array[String],
218
226
  price:
@@ -50,6 +50,10 @@ module Orb
50
50
  sig { returns(T::Array[Orb::EvaluatePriceGroup]) }
51
51
  attr_accessor :price_groups
52
52
 
53
+ # The external ID of the price
54
+ sig { returns(T.nilable(String)) }
55
+ attr_accessor :external_price_id
56
+
53
57
  # The index of the inline price
54
58
  sig { returns(T.nilable(Integer)) }
55
59
  attr_accessor :inline_price_index
@@ -62,6 +66,7 @@ module Orb
62
66
  params(
63
67
  currency: String,
64
68
  price_groups: T::Array[Orb::EvaluatePriceGroup::OrHash],
69
+ external_price_id: T.nilable(String),
65
70
  inline_price_index: T.nilable(Integer),
66
71
  price_id: T.nilable(String)
67
72
  ).returns(T.attached_class)
@@ -71,6 +76,8 @@ module Orb
71
76
  currency:,
72
77
  # The computed price groups associated with input price.
73
78
  price_groups:,
79
+ # The external ID of the price
80
+ external_price_id: nil,
74
81
  # The index of the inline price
75
82
  inline_price_index: nil,
76
83
  # The ID of the price
@@ -83,6 +90,7 @@ module Orb
83
90
  {
84
91
  currency: String,
85
92
  price_groups: T::Array[Orb::EvaluatePriceGroup],
93
+ external_price_id: T.nilable(String),
86
94
  inline_price_index: T.nilable(Integer),
87
95
  price_id: T.nilable(String)
88
96
  }
@@ -195,6 +195,10 @@ module Orb
195
195
  )
196
196
  end
197
197
 
198
+ # The external ID of a price to evaluate that exists in your Orb account.
199
+ sig { returns(T.nilable(String)) }
200
+ attr_accessor :external_price_id
201
+
198
202
  # A boolean
199
203
  # [computed property](/extensibility/advanced-metrics#computed-properties) used to
200
204
  # filter the underlying billable metric
@@ -256,6 +260,7 @@ module Orb
256
260
 
257
261
  sig do
258
262
  params(
263
+ external_price_id: T.nilable(String),
259
264
  filter: T.nilable(String),
260
265
  grouping_keys: T::Array[String],
261
266
  price:
@@ -295,6 +300,8 @@ module Orb
295
300
  ).returns(T.attached_class)
296
301
  end
297
302
  def self.new(
303
+ # The external ID of a price to evaluate that exists in your Orb account.
304
+ external_price_id: nil,
298
305
  # A boolean
299
306
  # [computed property](/extensibility/advanced-metrics#computed-properties) used to
300
307
  # filter the underlying billable metric
@@ -314,6 +321,7 @@ module Orb
314
321
  sig do
315
322
  override.returns(
316
323
  {
324
+ external_price_id: T.nilable(String),
317
325
  filter: T.nilable(String),
318
326
  grouping_keys: T::Array[String],
319
327
  price:
@@ -55,6 +55,10 @@ module Orb
55
55
  sig { returns(T::Array[Orb::EvaluatePriceGroup]) }
56
56
  attr_accessor :price_groups
57
57
 
58
+ # The external ID of the price
59
+ sig { returns(T.nilable(String)) }
60
+ attr_accessor :external_price_id
61
+
58
62
  # The index of the inline price
59
63
  sig { returns(T.nilable(Integer)) }
60
64
  attr_accessor :inline_price_index
@@ -67,6 +71,7 @@ module Orb
67
71
  params(
68
72
  currency: String,
69
73
  price_groups: T::Array[Orb::EvaluatePriceGroup::OrHash],
74
+ external_price_id: T.nilable(String),
70
75
  inline_price_index: T.nilable(Integer),
71
76
  price_id: T.nilable(String)
72
77
  ).returns(T.attached_class)
@@ -76,6 +81,8 @@ module Orb
76
81
  currency:,
77
82
  # The computed price groups associated with input price.
78
83
  price_groups:,
84
+ # The external ID of the price
85
+ external_price_id: nil,
79
86
  # The index of the inline price
80
87
  inline_price_index: nil,
81
88
  # The ID of the price
@@ -88,6 +95,7 @@ module Orb
88
95
  {
89
96
  currency: String,
90
97
  price_groups: T::Array[Orb::EvaluatePriceGroup],
98
+ external_price_id: T.nilable(String),
91
99
  inline_price_index: T.nilable(Integer),
92
100
  price_id: T.nilable(String)
93
101
  }
@@ -86,7 +86,8 @@ module Orb
86
86
  sig { returns(T.nilable(String)) }
87
87
  attr_accessor :default_invoice_memo
88
88
 
89
- # The discount intervals for this subscription sorted by the start_date.
89
+ # The discount intervals for this subscription sorted by the start_date. This
90
+ # field is deprecated in favor of `adjustment_intervals`.
90
91
  sig { returns(T::Array[Orb::Subscription::DiscountInterval::Variants]) }
91
92
  attr_accessor :discount_intervals
92
93
 
@@ -100,7 +101,8 @@ module Orb
100
101
  sig { returns(T.nilable(String)) }
101
102
  attr_accessor :invoicing_threshold
102
103
 
103
- # The maximum intervals for this subscription sorted by the start_date.
104
+ # The maximum intervals for this subscription sorted by the start_date. This field
105
+ # is deprecated in favor of `adjustment_intervals`.
104
106
  sig { returns(T::Array[Orb::MaximumInterval]) }
105
107
  attr_accessor :maximum_intervals
106
108
 
@@ -111,7 +113,8 @@ module Orb
111
113
  sig { returns(T::Hash[Symbol, String]) }
112
114
  attr_accessor :metadata
113
115
 
114
- # The minimum intervals for this subscription sorted by the start_date.
116
+ # The minimum intervals for this subscription sorted by the start_date. This field
117
+ # is deprecated in favor of `adjustment_intervals`.
115
118
  sig { returns(T::Array[Orb::MinimumInterval]) }
116
119
  attr_accessor :minimum_intervals
117
120
 
@@ -282,20 +285,23 @@ module Orb
282
285
  # Determines the default memo on this subscriptions' invoices. Note that if this
283
286
  # is not provided, it is determined by the plan configuration.
284
287
  default_invoice_memo:,
285
- # The discount intervals for this subscription sorted by the start_date.
288
+ # The discount intervals for this subscription sorted by the start_date. This
289
+ # field is deprecated in favor of `adjustment_intervals`.
286
290
  discount_intervals:,
287
291
  # The date Orb stops billing for this subscription.
288
292
  end_date:,
289
293
  fixed_fee_quantity_schedule:,
290
294
  invoicing_threshold:,
291
- # The maximum intervals for this subscription sorted by the start_date.
295
+ # The maximum intervals for this subscription sorted by the start_date. This field
296
+ # is deprecated in favor of `adjustment_intervals`.
292
297
  maximum_intervals:,
293
298
  # User specified key-value pairs for the resource. If not present, this defaults
294
299
  # to an empty dictionary. Individual keys can be removed by setting the value to
295
300
  # `null`, and the entire metadata mapping can be cleared by setting `metadata` to
296
301
  # `null`.
297
302
  metadata:,
298
- # The minimum intervals for this subscription sorted by the start_date.
303
+ # The minimum intervals for this subscription sorted by the start_date. This field
304
+ # is deprecated in favor of `adjustment_intervals`.
299
305
  minimum_intervals:,
300
306
  # The name of the subscription.
301
307
  name:,
@@ -888,8 +888,8 @@ module Orb
888
888
  sig { returns(T.nilable(Integer)) }
889
889
  attr_accessor :billing_cycle_day
890
890
 
891
- # The updated end date of this price interval. If not specified, the start date
892
- # will not be updated.
891
+ # The updated end date of this price interval. If not specified, the end date will
892
+ # not be updated.
893
893
  sig do
894
894
  returns(
895
895
  T.nilable(T.any(Time, Orb::BillingCycleRelativeDate::OrSymbol))
@@ -967,8 +967,8 @@ module Orb
967
967
  # billing cycle day will not be updated. Note that overlapping price intervals
968
968
  # must have the same billing cycle day.
969
969
  billing_cycle_day: nil,
970
- # The updated end date of this price interval. If not specified, the start date
971
- # will not be updated.
970
+ # The updated end date of this price interval. If not specified, the end date will
971
+ # not be updated.
972
972
  end_date: nil,
973
973
  # An additional filter to apply to usage queries. This filter must be expressed as
974
974
  # a boolean
@@ -1014,8 +1014,8 @@ module Orb
1014
1014
  def to_hash
1015
1015
  end
1016
1016
 
1017
- # The updated end date of this price interval. If not specified, the start date
1018
- # will not be updated.
1017
+ # The updated end date of this price interval. If not specified, the end date will
1018
+ # not be updated.
1019
1019
  module EndDate
1020
1020
  extend Orb::Internal::Type::Union
1021
1021
 
@@ -1105,8 +1105,8 @@ module Orb
1105
1105
  sig { returns(String) }
1106
1106
  attr_accessor :adjustment_interval_id
1107
1107
 
1108
- # The updated end date of this adjustment interval. If not specified, the start
1109
- # date will not be updated.
1108
+ # The updated end date of this adjustment interval. If not specified, the end date
1109
+ # will not be updated.
1110
1110
  sig do
1111
1111
  returns(
1112
1112
  T.nilable(T.any(Time, Orb::BillingCycleRelativeDate::OrSymbol))
@@ -1141,8 +1141,8 @@ module Orb
1141
1141
  def self.new(
1142
1142
  # The id of the adjustment interval to edit.
1143
1143
  adjustment_interval_id:,
1144
- # The updated end date of this adjustment interval. If not specified, the start
1145
- # date will not be updated.
1144
+ # The updated end date of this adjustment interval. If not specified, the end date
1145
+ # will not be updated.
1146
1146
  end_date: nil,
1147
1147
  # The updated start date of this adjustment interval. If not specified, the start
1148
1148
  # date will not be updated.
@@ -1163,8 +1163,8 @@ module Orb
1163
1163
  def to_hash
1164
1164
  end
1165
1165
 
1166
- # The updated end date of this adjustment interval. If not specified, the start
1167
- # date will not be updated.
1166
+ # The updated end date of this adjustment interval. If not specified, the end date
1167
+ # will not be updated.
1168
1168
  module EndDate
1169
1169
  extend Orb::Internal::Type::Union
1170
1170
 
@@ -5,11 +5,38 @@ module Orb
5
5
  class CreditNotes
6
6
  # This endpoint is used to create a single
7
7
  # [`Credit Note`](/invoicing/credit-notes).
8
+ #
9
+ # The credit note service period configuration supports two explicit modes:
10
+ #
11
+ # 1. Global service periods: Specify start_date and end_date at the credit note
12
+ # level. These dates will be applied to all line items uniformly.
13
+ #
14
+ # 2. Individual service periods: Specify start_date and end_date for each line
15
+ # item. When using this mode, ALL line items must have individual periods
16
+ # specified.
17
+ #
18
+ # 3. Default behavior: If no service periods are specified (neither global nor
19
+ # individual), the original invoice line item service periods will be used.
20
+ #
21
+ # Note: Mixing global and individual service periods in the same request is not
22
+ # allowed to prevent confusion.
23
+ #
24
+ # Service period dates are normalized to the start of the day in the customer's
25
+ # timezone to ensure consistent handling across different timezones.
26
+ #
27
+ # Date Format: Use start_date and end_date with format "YYYY-MM-DD" (e.g.,
28
+ # "2023-09-22") to match other Orb APIs like /v1/invoice_line_items.
29
+ #
30
+ # Note: Both start_date and end_date are inclusive - the service period will cover
31
+ # both the start date and end date completely (from start of start_date to end of
32
+ # end_date).
8
33
  sig do
9
34
  params(
10
35
  line_items: T::Array[Orb::CreditNoteCreateParams::LineItem::OrHash],
11
36
  reason: Orb::CreditNoteCreateParams::Reason::OrSymbol,
37
+ end_date: T.nilable(Date),
12
38
  memo: T.nilable(String),
39
+ start_date: T.nilable(Date),
13
40
  request_options: Orb::RequestOptions::OrHash
14
41
  ).returns(Orb::CreditNote)
15
42
  end
@@ -17,8 +44,18 @@ module Orb
17
44
  line_items:,
18
45
  # An optional reason for the credit note.
19
46
  reason:,
47
+ # A date string to specify the global credit note service period end date in the
48
+ # customer's timezone. This will be applied to all line items that don't have
49
+ # their own individual service periods specified. If not provided, line items will
50
+ # use their original invoice line item service periods. This date is inclusive.
51
+ end_date: nil,
20
52
  # An optional memo to attach to the credit note.
21
53
  memo: nil,
54
+ # A date string to specify the global credit note service period start date in the
55
+ # customer's timezone. This will be applied to all line items that don't have
56
+ # their own individual service periods specified. If not provided, line items will
57
+ # use their original invoice line item service periods. This date is inclusive.
58
+ start_date: nil,
22
59
  request_options: {}
23
60
  )
24
61
  end
@@ -57,17 +57,17 @@ module Orb
57
57
  #
58
58
  # A customer that uses a few API calls a day but has a minimum commitment might
59
59
  # exhibit the following pattern for their subtotal and total in the first few days
60
- # of the month. Here, we assume that each API call is $2.50, the customer's plan
61
- # has a monthly minimum of $50 for this price, and that the subscription's billing
62
- # period bounds are aligned to the first of the month:
60
+ # of the month. Here, we assume that each API call is \$2.50, the customer's plan
61
+ # has a monthly minimum of \$50 for this price, and that the subscription's
62
+ # billing period bounds are aligned to the first of the month:
63
63
  #
64
64
  # | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
65
65
  # | --------------- | ------------- | ---------------- | -------- | ------------------------ |
66
- # | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
67
- # | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
68
- # | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
69
- # | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
70
- # | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
66
+ # | 2023-02-01 | 2023-02-02 | 9 | \$22.50 | \$50.00 |
67
+ # | 2023-02-01 | 2023-02-03 | 19 | \$47.50 | \$50.00 |
68
+ # | 2023-02-01 | 2023-02-04 | 20 | \$50.00 | \$50.00 |
69
+ # | 2023-02-01 | 2023-02-05 | 28 | \$70.00 | \$70.00 |
70
+ # | 2023-02-01 | 2023-02-06 | 36 | \$90.00 | \$90.00 |
71
71
  #
72
72
  # ### Periodic values
73
73
  #
@@ -202,17 +202,17 @@ module Orb
202
202
  #
203
203
  # A customer that uses a few API calls a day but has a minimum commitment might
204
204
  # exhibit the following pattern for their subtotal and total in the first few days
205
- # of the month. Here, we assume that each API call is $2.50, the customer's plan
206
- # has a monthly minimum of $50 for this price, and that the subscription's billing
207
- # period bounds are aligned to the first of the month:
205
+ # of the month. Here, we assume that each API call is \$2.50, the customer's plan
206
+ # has a monthly minimum of \$50 for this price, and that the subscription's
207
+ # billing period bounds are aligned to the first of the month:
208
208
  #
209
209
  # | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
210
210
  # | --------------- | ------------- | ---------------- | -------- | ------------------------ |
211
- # | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
212
- # | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
213
- # | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
214
- # | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
215
- # | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
211
+ # | 2023-02-01 | 2023-02-02 | 9 | \$22.50 | \$50.00 |
212
+ # | 2023-02-01 | 2023-02-03 | 19 | \$47.50 | \$50.00 |
213
+ # | 2023-02-01 | 2023-02-04 | 20 | \$50.00 | \$50.00 |
214
+ # | 2023-02-01 | 2023-02-05 | 28 | \$70.00 | \$70.00 |
215
+ # | 2023-02-01 | 2023-02-06 | 36 | \$90.00 | \$90.00 |
216
216
  #
217
217
  # ### Periodic values
218
218
  #
@@ -43,8 +43,8 @@ module Orb
43
43
  # deductions take place from a non-expiring credit block.
44
44
  #
45
45
  # If there are multiple blocks with the same expiration date, Orb will deduct from
46
- # the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost
47
- # basis before paid credits with a $5.00 cost basis).
46
+ # the block with the _lower cost basis_ first (e.g. trial credits with a \$0 cost
47
+ # basis before paid credits with a \$5.00 cost basis).
48
48
  #
49
49
  # It's also possible for a single usage event's deduction to _span_ credit blocks.
50
50
  # In this case, Orb will deduct from the next block, ending at the credit block
@@ -528,8 +528,8 @@ module Orb
528
528
  # deductions take place from a non-expiring credit block.
529
529
  #
530
530
  # If there are multiple blocks with the same expiration date, Orb will deduct from
531
- # the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost
532
- # basis before paid credits with a $5.00 cost basis).
531
+ # the block with the _lower cost basis_ first (e.g. trial credits with a \$0 cost
532
+ # basis before paid credits with a \$5.00 cost basis).
533
533
  #
534
534
  # It's also possible for a single usage event's deduction to _span_ credit blocks.
535
535
  # In this case, Orb will deduct from the next block, ending at the credit block