orb-billing 1.12.0 → 1.13.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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +1 -1
  4. data/lib/orb/client.rb +72 -0
  5. data/lib/orb/internal/util.rb +31 -0
  6. data/lib/orb/models/billable_metric.rb +10 -1
  7. data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb +11 -2
  8. data/lib/orb/models/customers/credits/ledger_create_entry_params.rb +11 -2
  9. data/lib/orb/models/invoice_create_params.rb +11 -1
  10. data/lib/orb/models/invoice_update_params.rb +11 -1
  11. data/lib/orb/models/item.rb +1 -0
  12. data/lib/orb/models/item_update_params.rb +1 -0
  13. data/lib/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rb +9 -1
  14. data/lib/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rb +9 -1
  15. data/lib/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rb +9 -1
  16. data/lib/orb/models/price.rb +9 -1
  17. data/lib/orb/models/price_create_params.rb +9 -1
  18. data/lib/orb/models/price_evaluate_multiple_params.rb +12 -1
  19. data/lib/orb/models/price_evaluate_params.rb +12 -1
  20. data/lib/orb/models/price_evaluate_preview_events_params.rb +12 -1
  21. data/lib/orb/models/price_interval.rb +12 -1
  22. data/lib/orb/models/subscription_create_params.rb +24 -2
  23. data/lib/orb/models/subscription_price_intervals_params.rb +24 -2
  24. data/lib/orb/models/subscription_schedule_plan_change_params.rb +24 -2
  25. data/lib/orb/resources/alerts.rb +11 -3
  26. data/lib/orb/resources/beta/external_plan_id.rb +4 -0
  27. data/lib/orb/resources/beta.rb +8 -0
  28. data/lib/orb/resources/coupons/subscriptions.rb +7 -1
  29. data/lib/orb/resources/coupons.rb +12 -1
  30. data/lib/orb/resources/credit_blocks.rb +2 -0
  31. data/lib/orb/resources/credit_notes.rb +4 -1
  32. data/lib/orb/resources/customers/balance_transactions.rb +20 -1
  33. data/lib/orb/resources/customers/costs.rb +22 -2
  34. data/lib/orb/resources/customers/credits/ledger.rb +18 -6
  35. data/lib/orb/resources/customers/credits/top_ups.rb +6 -2
  36. data/lib/orb/resources/customers/credits.rb +10 -2
  37. data/lib/orb/resources/customers.rb +58 -1
  38. data/lib/orb/resources/dimensional_price_groups.rb +2 -1
  39. data/lib/orb/resources/events/backfills.rb +5 -1
  40. data/lib/orb/resources/events/volume.rb +5 -1
  41. data/lib/orb/resources/events.rb +12 -2
  42. data/lib/orb/resources/invoice_line_items.rb +5 -0
  43. data/lib/orb/resources/invoices.rb +23 -10
  44. data/lib/orb/resources/items.rb +5 -1
  45. data/lib/orb/resources/license_types.rb +5 -1
  46. data/lib/orb/resources/licenses/external_licenses.rb +2 -1
  47. data/lib/orb/resources/licenses/usage.rb +4 -2
  48. data/lib/orb/resources/licenses.rb +4 -2
  49. data/lib/orb/resources/metrics.rb +5 -1
  50. data/lib/orb/resources/plans/external_plan_id.rb +4 -0
  51. data/lib/orb/resources/plans/migrations.rb +6 -1
  52. data/lib/orb/resources/plans.rb +14 -1
  53. data/lib/orb/resources/prices/external_price_id.rb +10 -0
  54. data/lib/orb/resources/prices.rb +25 -2
  55. data/lib/orb/resources/subscription_changes.rb +2 -1
  56. data/lib/orb/resources/subscriptions.rb +8 -4
  57. data/lib/orb/version.rb +1 -1
  58. data/rbi/orb/client.rbi +72 -0
  59. data/rbi/orb/internal/util.rbi +18 -0
  60. data/rbi/orb/models/billable_metric.rbi +11 -3
  61. data/rbi/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi +15 -2
  62. data/rbi/orb/models/customers/credits/ledger_create_entry_params.rbi +15 -2
  63. data/rbi/orb/models/invoice_create_params.rbi +12 -0
  64. data/rbi/orb/models/invoice_update_params.rbi +12 -0
  65. data/rbi/orb/models/item.rbi +5 -0
  66. data/rbi/orb/models/item_update_params.rbi +5 -0
  67. data/rbi/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rbi +8 -0
  68. data/rbi/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbi +8 -0
  69. data/rbi/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rbi +8 -0
  70. data/rbi/orb/models/price.rbi +8 -0
  71. data/rbi/orb/models/price_create_params.rbi +8 -0
  72. data/rbi/orb/models/price_evaluate_multiple_params.rbi +11 -0
  73. data/rbi/orb/models/price_evaluate_params.rbi +10 -0
  74. data/rbi/orb/models/price_evaluate_preview_events_params.rbi +11 -0
  75. data/rbi/orb/models/price_interval.rbi +13 -3
  76. data/rbi/orb/models/subscription_create_params.rbi +22 -0
  77. data/rbi/orb/models/subscription_price_intervals_params.rbi +22 -0
  78. data/rbi/orb/models/subscription_schedule_plan_change_params.rbi +22 -0
  79. data/rbi/orb/resources/alerts.rbi +5 -0
  80. data/rbi/orb/resources/beta/external_plan_id.rbi +4 -0
  81. data/rbi/orb/resources/beta.rbi +8 -0
  82. data/rbi/orb/resources/coupons/subscriptions.rbi +5 -0
  83. data/rbi/orb/resources/coupons.rbi +10 -0
  84. data/rbi/orb/resources/credit_blocks.rbi +2 -0
  85. data/rbi/orb/resources/credit_notes.rbi +2 -0
  86. data/rbi/orb/resources/customers/balance_transactions.rbi +18 -0
  87. data/rbi/orb/resources/customers/costs.rbi +18 -0
  88. data/rbi/orb/resources/customers/credits/ledger.rbi +14 -4
  89. data/rbi/orb/resources/customers/credits/top_ups.rbi +2 -0
  90. data/rbi/orb/resources/customers/credits.rbi +6 -0
  91. data/rbi/orb/resources/customers.rbi +56 -0
  92. data/rbi/orb/resources/events/backfills.rbi +3 -0
  93. data/rbi/orb/resources/events/volume.rbi +3 -0
  94. data/rbi/orb/resources/events.rbi +9 -0
  95. data/rbi/orb/resources/invoice_line_items.rbi +5 -0
  96. data/rbi/orb/resources/invoices.rbi +21 -5
  97. data/rbi/orb/resources/items.rbi +3 -0
  98. data/rbi/orb/resources/license_types.rbi +3 -0
  99. data/rbi/orb/resources/metrics.rbi +3 -0
  100. data/rbi/orb/resources/plans/external_plan_id.rbi +4 -0
  101. data/rbi/orb/resources/plans/migrations.rbi +4 -0
  102. data/rbi/orb/resources/plans.rbi +12 -0
  103. data/rbi/orb/resources/prices/external_price_id.rbi +10 -0
  104. data/rbi/orb/resources/prices.rbi +24 -0
  105. data/sig/orb/internal/util.rbs +10 -0
  106. data/sig/orb/models/billable_metric.rbs +8 -3
  107. data/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbs +7 -0
  108. data/sig/orb/models/customers/credits/ledger_create_entry_params.rbs +7 -0
  109. data/sig/orb/models/invoice_create_params.rbs +5 -0
  110. data/sig/orb/models/invoice_update_params.rbs +5 -0
  111. data/sig/orb/models/item.rbs +2 -0
  112. data/sig/orb/models/item_update_params.rbs +2 -0
  113. data/sig/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rbs +5 -0
  114. data/sig/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbs +5 -0
  115. data/sig/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rbs +5 -0
  116. data/sig/orb/models/price.rbs +5 -0
  117. data/sig/orb/models/price_create_params.rbs +5 -0
  118. data/sig/orb/models/price_evaluate_multiple_params.rbs +5 -0
  119. data/sig/orb/models/price_evaluate_params.rbs +6 -1
  120. data/sig/orb/models/price_evaluate_preview_events_params.rbs +5 -0
  121. data/sig/orb/models/price_interval.rbs +8 -3
  122. data/sig/orb/models/subscription_create_params.rbs +10 -0
  123. data/sig/orb/models/subscription_price_intervals_params.rbs +10 -0
  124. data/sig/orb/models/subscription_schedule_plan_change_params.rbs +10 -0
  125. data/sig/orb/resources/invoices.rbs +2 -0
  126. data/sig/orb/resources/prices.rbs +1 -0
  127. metadata +2 -2
@@ -432,10 +432,11 @@ module Orb
432
432
  # @see Orb::Models::SubscriptionListParams
433
433
  def list(params = {})
434
434
  parsed, options = Orb::SubscriptionListParams.dump_request(params)
435
+ query = Orb::Internal::Util.encode_query_params(parsed)
435
436
  @client.request(
436
437
  method: :get,
437
438
  path: "subscriptions",
438
- query: parsed.transform_keys(
439
+ query: query.transform_keys(
439
440
  created_at_gt: "created_at[gt]",
440
441
  created_at_gte: "created_at[gte]",
441
442
  created_at_lt: "created_at[lt]",
@@ -591,10 +592,11 @@ module Orb
591
592
  # @see Orb::Models::SubscriptionFetchCostsParams
592
593
  def fetch_costs(subscription_id, params = {})
593
594
  parsed, options = Orb::SubscriptionFetchCostsParams.dump_request(params)
595
+ query = Orb::Internal::Util.encode_query_params(parsed)
594
596
  @client.request(
595
597
  method: :get,
596
598
  path: ["subscriptions/%1$s/costs", subscription_id],
597
- query: parsed,
599
+ query: query,
598
600
  model: Orb::Models::SubscriptionFetchCostsResponse,
599
601
  options: options
600
602
  )
@@ -631,10 +633,11 @@ module Orb
631
633
  # @see Orb::Models::SubscriptionFetchScheduleParams
632
634
  def fetch_schedule(subscription_id, params = {})
633
635
  parsed, options = Orb::SubscriptionFetchScheduleParams.dump_request(params)
636
+ query = Orb::Internal::Util.encode_query_params(parsed)
634
637
  @client.request(
635
638
  method: :get,
636
639
  path: ["subscriptions/%1$s/schedule", subscription_id],
637
- query: parsed.transform_keys(
640
+ query: query.transform_keys(
638
641
  start_date_gt: "start_date[gt]",
639
642
  start_date_gte: "start_date[gte]",
640
643
  start_date_lt: "start_date[lt]",
@@ -875,10 +878,11 @@ module Orb
875
878
  # @see Orb::Models::SubscriptionFetchUsageParams
876
879
  def fetch_usage(subscription_id, params = {})
877
880
  parsed, options = Orb::SubscriptionFetchUsageParams.dump_request(params)
881
+ query = Orb::Internal::Util.encode_query_params(parsed)
878
882
  @client.request(
879
883
  method: :get,
880
884
  path: ["subscriptions/%1$s/usage", subscription_id],
881
- query: parsed,
885
+ query: query,
882
886
  model: Orb::SubscriptionUsage,
883
887
  options: options
884
888
  )
data/lib/orb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orb
4
- VERSION = "1.12.0"
4
+ VERSION = "1.13.0"
5
5
  end
data/rbi/orb/client.rbi CHANGED
@@ -16,42 +16,109 @@ module Orb
16
16
  sig { returns(Orb::Resources::TopLevel) }
17
17
  attr_reader :top_level
18
18
 
19
+ # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
20
+ # subscribed to by a customer. Plans define the billing behavior of the
21
+ # subscription. You can see more about how to configure prices in the
22
+ # [Price resource](/reference/price).
19
23
  sig { returns(Orb::Resources::Beta) }
20
24
  attr_reader :beta
21
25
 
26
+ # A coupon represents a reusable discount configuration that can be applied either
27
+ # as a fixed or percentage amount to an invoice or subscription. Coupons are
28
+ # activated using a redemption code, which applies the discount to a subscription
29
+ # or invoice. The duration of a coupon determines how long it remains available
30
+ # for use by end users.
22
31
  sig { returns(Orb::Resources::Coupons) }
23
32
  attr_reader :coupons
24
33
 
34
+ # The [Credit Note](/invoicing/credit-notes) resource represents a credit that has
35
+ # been applied to a particular invoice.
25
36
  sig { returns(Orb::Resources::CreditNotes) }
26
37
  attr_reader :credit_notes
27
38
 
39
+ # A customer is a buyer of your products, and the other party to the billing
40
+ # relationship.
41
+ #
42
+ # In Orb, customers are assigned system generated identifiers automatically, but
43
+ # it's often desirable to have these match existing identifiers in your system. To
44
+ # avoid having to denormalize Orb ID information, you can pass in an
45
+ # `external_customer_id` with your own identifier. See
46
+ # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
47
+ # information about how these aliases work in Orb.
48
+ #
49
+ # In addition to having an identifier in your system, a customer may exist in a
50
+ # payment provider solution like Stripe. Use the `payment_provider_id` and the
51
+ # `payment_provider` enum field to express this mapping.
52
+ #
53
+ # A customer also has a timezone (from the standard
54
+ # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
55
+ # your account's timezone. See [Timezone localization](/essentials/timezones) for
56
+ # information on what this timezone parameter influences within Orb.
28
57
  sig { returns(Orb::Resources::Customers) }
29
58
  attr_reader :customers
30
59
 
60
+ # The [Event](/core-concepts#event) resource represents a usage event that has
61
+ # been created for a customer. Events are the core of Orb's usage-based billing
62
+ # model, and are used to calculate the usage charges for a given billing period.
31
63
  sig { returns(Orb::Resources::Events) }
32
64
  attr_reader :events
33
65
 
66
+ # An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity,
67
+ # representing the request for payment for a single subscription. This includes a
68
+ # set of line items, which correspond to prices in the subscription's plan and can
69
+ # represent fixed recurring fees or usage-based fees. They are generated at the
70
+ # end of a billing period, or as the result of an action, such as a cancellation.
34
71
  sig { returns(Orb::Resources::InvoiceLineItems) }
35
72
  attr_reader :invoice_line_items
36
73
 
74
+ # An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity,
75
+ # representing the request for payment for a single subscription. This includes a
76
+ # set of line items, which correspond to prices in the subscription's plan and can
77
+ # represent fixed recurring fees or usage-based fees. They are generated at the
78
+ # end of a billing period, or as the result of an action, such as a cancellation.
37
79
  sig { returns(Orb::Resources::Invoices) }
38
80
  attr_reader :invoices
39
81
 
82
+ # The Item resource represents a sellable product or good. Items are associated
83
+ # with all line items, billable metrics, and prices and are used for defining
84
+ # external sync behavior for invoices and tax calculation purposes.
40
85
  sig { returns(Orb::Resources::Items) }
41
86
  attr_reader :items
42
87
 
88
+ # The Metric resource represents a calculation of a quantity based on events.
89
+ # Metrics are defined by the query that transforms raw usage events into
90
+ # meaningful values for your customers.
43
91
  sig { returns(Orb::Resources::Metrics) }
44
92
  attr_reader :metrics
45
93
 
94
+ # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
95
+ # subscribed to by a customer. Plans define the billing behavior of the
96
+ # subscription. You can see more about how to configure prices in the
97
+ # [Price resource](/reference/price).
46
98
  sig { returns(Orb::Resources::Plans) }
47
99
  attr_reader :plans
48
100
 
101
+ # The Price resource represents a price that can be billed on a subscription,
102
+ # resulting in a charge on an invoice in the form of an invoice line item. Prices
103
+ # take a quantity and determine an amount to bill.
104
+ #
105
+ # Orb supports a few different pricing models out of the box. Each of these models
106
+ # is serialized differently in a given Price object. The model_type field
107
+ # determines the key for the configuration object that is present.
108
+ #
109
+ # For more on the types of prices, see
110
+ # [the core concepts documentation](/core-concepts#plan-and-price)
49
111
  sig { returns(Orb::Resources::Prices) }
50
112
  attr_reader :prices
51
113
 
52
114
  sig { returns(Orb::Resources::Subscriptions) }
53
115
  attr_reader :subscriptions
54
116
 
117
+ # [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending,
118
+ # usage, or credit balance and trigger webhooks when a threshold is exceeded.
119
+ #
120
+ # Alerts created through the API can be scoped to either customers or
121
+ # subscriptions.
55
122
  sig { returns(Orb::Resources::Alerts) }
56
123
  attr_reader :alerts
57
124
 
@@ -61,9 +128,14 @@ module Orb
61
128
  sig { returns(Orb::Resources::SubscriptionChanges) }
62
129
  attr_reader :subscription_changes
63
130
 
131
+ # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid
132
+ # credits within Orb.
64
133
  sig { returns(Orb::Resources::CreditBlocks) }
65
134
  attr_reader :credit_blocks
66
135
 
136
+ # The LicenseType resource represents a type of license that can be assigned to
137
+ # users. License types are used during billing by grouping metrics on the
138
+ # configured grouping key.
67
139
  sig { returns(Orb::Resources::LicenseTypes) }
68
140
  attr_reader :license_types
69
141
 
@@ -295,6 +295,24 @@ module Orb
295
295
  T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp)
296
296
 
297
297
  class << self
298
+ # @api private
299
+ sig do
300
+ params(query: Orb::Internal::AnyHash).returns(Orb::Internal::AnyHash)
301
+ end
302
+ def encode_query_params(query)
303
+ end
304
+
305
+ # @api private
306
+ sig do
307
+ params(
308
+ collection: Orb::Internal::AnyHash,
309
+ key: String,
310
+ element: T.anything
311
+ ).void
312
+ end
313
+ private def write_query_param_element!(collection, key, element)
314
+ end
315
+
298
316
  # @api private
299
317
  sig do
300
318
  params(
@@ -34,6 +34,9 @@ module Orb
34
34
  sig { returns(Orb::BillableMetric::Status::TaggedSymbol) }
35
35
  attr_accessor :status
36
36
 
37
+ sig { returns(T.nilable(T::Array[T::Hash[Symbol, T.anything]])) }
38
+ attr_accessor :parameter_definitions
39
+
37
40
  # The Metric resource represents a calculation of a quantity based on events.
38
41
  # Metrics are defined by the query that transforms raw usage events into
39
42
  # meaningful values for your customers.
@@ -44,7 +47,9 @@ module Orb
44
47
  item: Orb::Item::OrHash,
45
48
  metadata: T::Hash[Symbol, String],
46
49
  name: String,
47
- status: Orb::BillableMetric::Status::OrSymbol
50
+ status: Orb::BillableMetric::Status::OrSymbol,
51
+ parameter_definitions:
52
+ T.nilable(T::Array[T::Hash[Symbol, T.anything]])
48
53
  ).returns(T.attached_class)
49
54
  end
50
55
  def self.new(
@@ -60,7 +65,8 @@ module Orb
60
65
  # `null`.
61
66
  metadata:,
62
67
  name:,
63
- status:
68
+ status:,
69
+ parameter_definitions: nil
64
70
  )
65
71
  end
66
72
 
@@ -72,7 +78,9 @@ module Orb
72
78
  item: Orb::Item,
73
79
  metadata: T::Hash[Symbol, String],
74
80
  name: String,
75
- status: Orb::BillableMetric::Status::TaggedSymbol
81
+ status: Orb::BillableMetric::Status::TaggedSymbol,
82
+ parameter_definitions:
83
+ T.nilable(T::Array[T::Hash[Symbol, T.anything]])
76
84
  }
77
85
  )
78
86
  end
@@ -424,6 +424,13 @@ module Orb
424
424
  sig { returns(T.nilable(String)) }
425
425
  attr_accessor :item_id
426
426
 
427
+ # If true, the new credits purchase invoice will be marked as paid.
428
+ sig { returns(T.nilable(T::Boolean)) }
429
+ attr_reader :mark_as_paid
430
+
431
+ sig { params(mark_as_paid: T::Boolean).void }
432
+ attr_writer :mark_as_paid
433
+
427
434
  # An optional memo to display on the invoice.
428
435
  sig { returns(T.nilable(String)) }
429
436
  attr_accessor :memo
@@ -432,7 +439,8 @@ module Orb
432
439
  # based on the invoice or issuance date, depending on the account's configured due
433
440
  # date calculation method. A value of '0' here represents that the invoice is due
434
441
  # on issue, whereas a value of '30' represents that the customer has 30 days to
435
- # pay the invoice. Do not set this field if you want to set a custom due date.
442
+ # pay the invoice. You must set either `net_terms` or `custom_due_date`, but not
443
+ # both.
436
444
  sig { returns(T.nilable(Integer)) }
437
445
  attr_accessor :net_terms
438
446
 
@@ -460,6 +468,7 @@ module Orb
460
468
  Orb::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings::InvoiceDate::Variants
461
469
  ),
462
470
  item_id: T.nilable(String),
471
+ mark_as_paid: T::Boolean,
463
472
  memo: T.nilable(String),
464
473
  net_terms: T.nilable(Integer),
465
474
  require_successful_payment: T::Boolean
@@ -479,13 +488,16 @@ module Orb
479
488
  # The ID of the Item to be used for the invoice line item. If not provided, a
480
489
  # default 'Credits' item will be used.
481
490
  item_id: nil,
491
+ # If true, the new credits purchase invoice will be marked as paid.
492
+ mark_as_paid: nil,
482
493
  # An optional memo to display on the invoice.
483
494
  memo: nil,
484
495
  # The net terms determines the due date of the invoice. Due date is calculated
485
496
  # based on the invoice or issuance date, depending on the account's configured due
486
497
  # date calculation method. A value of '0' here represents that the invoice is due
487
498
  # on issue, whereas a value of '30' represents that the customer has 30 days to
488
- # pay the invoice. Do not set this field if you want to set a custom due date.
499
+ # pay the invoice. You must set either `net_terms` or `custom_due_date`, but not
500
+ # both.
489
501
  net_terms: nil,
490
502
  # If true, the new credit block will require that the corresponding invoice is
491
503
  # paid before it can be drawn down from.
@@ -506,6 +518,7 @@ module Orb
506
518
  Orb::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings::InvoiceDate::Variants
507
519
  ),
508
520
  item_id: T.nilable(String),
521
+ mark_as_paid: T::Boolean,
509
522
  memo: T.nilable(String),
510
523
  net_terms: T.nilable(Integer),
511
524
  require_successful_payment: T::Boolean
@@ -424,6 +424,13 @@ module Orb
424
424
  sig { returns(T.nilable(String)) }
425
425
  attr_accessor :item_id
426
426
 
427
+ # If true, the new credits purchase invoice will be marked as paid.
428
+ sig { returns(T.nilable(T::Boolean)) }
429
+ attr_reader :mark_as_paid
430
+
431
+ sig { params(mark_as_paid: T::Boolean).void }
432
+ attr_writer :mark_as_paid
433
+
427
434
  # An optional memo to display on the invoice.
428
435
  sig { returns(T.nilable(String)) }
429
436
  attr_accessor :memo
@@ -432,7 +439,8 @@ module Orb
432
439
  # based on the invoice or issuance date, depending on the account's configured due
433
440
  # date calculation method. A value of '0' here represents that the invoice is due
434
441
  # on issue, whereas a value of '30' represents that the customer has 30 days to
435
- # pay the invoice. Do not set this field if you want to set a custom due date.
442
+ # pay the invoice. You must set either `net_terms` or `custom_due_date`, but not
443
+ # both.
436
444
  sig { returns(T.nilable(Integer)) }
437
445
  attr_accessor :net_terms
438
446
 
@@ -460,6 +468,7 @@ module Orb
460
468
  Orb::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings::InvoiceDate::Variants
461
469
  ),
462
470
  item_id: T.nilable(String),
471
+ mark_as_paid: T::Boolean,
463
472
  memo: T.nilable(String),
464
473
  net_terms: T.nilable(Integer),
465
474
  require_successful_payment: T::Boolean
@@ -479,13 +488,16 @@ module Orb
479
488
  # The ID of the Item to be used for the invoice line item. If not provided, a
480
489
  # default 'Credits' item will be used.
481
490
  item_id: nil,
491
+ # If true, the new credits purchase invoice will be marked as paid.
492
+ mark_as_paid: nil,
482
493
  # An optional memo to display on the invoice.
483
494
  memo: nil,
484
495
  # The net terms determines the due date of the invoice. Due date is calculated
485
496
  # based on the invoice or issuance date, depending on the account's configured due
486
497
  # date calculation method. A value of '0' here represents that the invoice is due
487
498
  # on issue, whereas a value of '30' represents that the customer has 30 days to
488
- # pay the invoice. Do not set this field if you want to set a custom due date.
499
+ # pay the invoice. You must set either `net_terms` or `custom_due_date`, but not
500
+ # both.
489
501
  net_terms: nil,
490
502
  # If true, the new credit block will require that the corresponding invoice is
491
503
  # paid before it can be drawn down from.
@@ -506,6 +518,7 @@ module Orb
506
518
  Orb::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings::InvoiceDate::Variants
507
519
  ),
508
520
  item_id: T.nilable(String),
521
+ mark_as_paid: T::Boolean,
509
522
  memo: T.nilable(String),
510
523
  net_terms: T.nilable(Integer),
511
524
  require_successful_payment: T::Boolean
@@ -22,6 +22,12 @@ module Orb
22
22
  sig { returns(T::Array[Orb::InvoiceCreateParams::LineItem]) }
23
23
  attr_accessor :line_items
24
24
 
25
+ # Determines whether this invoice will automatically attempt to charge a saved
26
+ # payment method, if any. If not specified, the invoice inherits the customer's
27
+ # auto_collection setting.
28
+ sig { returns(T.nilable(T::Boolean)) }
29
+ attr_accessor :auto_collection
30
+
25
31
  # The id of the `Customer` to create this invoice for. One of `customer_id` and
26
32
  # `external_customer_id` are required.
27
33
  sig { returns(T.nilable(String)) }
@@ -85,6 +91,7 @@ module Orb
85
91
  currency: String,
86
92
  invoice_date: Time,
87
93
  line_items: T::Array[Orb::InvoiceCreateParams::LineItem::OrHash],
94
+ auto_collection: T.nilable(T::Boolean),
88
95
  customer_id: T.nilable(String),
89
96
  discount:
90
97
  T.nilable(
@@ -112,6 +119,10 @@ module Orb
112
119
  # set to the current time in the customer's timezone.
113
120
  invoice_date:,
114
121
  line_items:,
122
+ # Determines whether this invoice will automatically attempt to charge a saved
123
+ # payment method, if any. If not specified, the invoice inherits the customer's
124
+ # auto_collection setting.
125
+ auto_collection: nil,
115
126
  # The id of the `Customer` to create this invoice for. One of `customer_id` and
116
127
  # `external_customer_id` are required.
117
128
  customer_id: nil,
@@ -150,6 +161,7 @@ module Orb
150
161
  currency: String,
151
162
  invoice_date: Time,
152
163
  line_items: T::Array[Orb::InvoiceCreateParams::LineItem],
164
+ auto_collection: T.nilable(T::Boolean),
153
165
  customer_id: T.nilable(String),
154
166
  discount:
155
167
  T.nilable(
@@ -9,6 +9,12 @@ module Orb
9
9
  OrHash =
10
10
  T.type_alias { T.any(Orb::InvoiceUpdateParams, Orb::Internal::AnyHash) }
11
11
 
12
+ # Determines whether this invoice will automatically attempt to charge a saved
13
+ # payment method, if any. Can only be modified on draft invoices. If not
14
+ # specified, the invoice's existing setting is unchanged.
15
+ sig { returns(T.nilable(T::Boolean)) }
16
+ attr_accessor :auto_collection
17
+
12
18
  # An optional custom due date for the invoice. If not set, the due date will be
13
19
  # calculated based on the `net_terms` value.
14
20
  sig { returns(T.nilable(Orb::InvoiceUpdateParams::DueDate::Variants)) }
@@ -36,6 +42,7 @@ module Orb
36
42
 
37
43
  sig do
38
44
  params(
45
+ auto_collection: T.nilable(T::Boolean),
39
46
  due_date: T.nilable(Orb::InvoiceUpdateParams::DueDate::Variants),
40
47
  invoice_date:
41
48
  T.nilable(Orb::InvoiceUpdateParams::InvoiceDate::Variants),
@@ -45,6 +52,10 @@ module Orb
45
52
  ).returns(T.attached_class)
46
53
  end
47
54
  def self.new(
55
+ # Determines whether this invoice will automatically attempt to charge a saved
56
+ # payment method, if any. Can only be modified on draft invoices. If not
57
+ # specified, the invoice's existing setting is unchanged.
58
+ auto_collection: nil,
48
59
  # An optional custom due date for the invoice. If not set, the due date will be
49
60
  # calculated based on the `net_terms` value.
50
61
  due_date: nil,
@@ -67,6 +78,7 @@ module Orb
67
78
  sig do
68
79
  override.returns(
69
80
  {
81
+ auto_collection: T.nilable(T::Boolean),
70
82
  due_date: T.nilable(Orb::InvoiceUpdateParams::DueDate::Variants),
71
83
  invoice_date:
72
84
  T.nilable(Orb::InvoiceUpdateParams::InvoiceDate::Variants),
@@ -181,6 +181,11 @@ module Orb
181
181
  :numeral,
182
182
  Orb::Item::ExternalConnection::ExternalConnectionName::TaggedSymbol
183
183
  )
184
+ STRIPE_TAX =
185
+ T.let(
186
+ :stripe_tax,
187
+ Orb::Item::ExternalConnection::ExternalConnectionName::TaggedSymbol
188
+ )
184
189
 
185
190
  sig do
186
191
  override.returns(
@@ -162,6 +162,11 @@ module Orb
162
162
  :numeral,
163
163
  Orb::ItemUpdateParams::ExternalConnection::ExternalConnectionName::TaggedSymbol
164
164
  )
165
+ STRIPE_TAX =
166
+ T.let(
167
+ :stripe_tax,
168
+ Orb::ItemUpdateParams::ExternalConnection::ExternalConnectionName::TaggedSymbol
169
+ )
165
170
 
166
171
  sig do
167
172
  override.returns(
@@ -375,6 +375,10 @@ module Orb
375
375
  sig { returns(String) }
376
376
  attr_accessor :unit_price
377
377
 
378
+ # The property used to group this price
379
+ sig { returns(T.nilable(String)) }
380
+ attr_accessor :grouping_key
381
+
378
382
  # If true, the unit price will be prorated to the billing period
379
383
  sig { returns(T.nilable(T::Boolean)) }
380
384
  attr_accessor :prorate
@@ -392,6 +396,7 @@ module Orb
392
396
  Orb::NewFloatingScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor::OrHash
393
397
  ],
394
398
  unit_price: String,
399
+ grouping_key: T.nilable(String),
395
400
  prorate: T.nilable(T::Boolean),
396
401
  second_dimension: T.nilable(String)
397
402
  ).returns(T.attached_class)
@@ -403,6 +408,8 @@ module Orb
403
408
  matrix_scaling_factors:,
404
409
  # The final unit price to rate against the output of the matrix
405
410
  unit_price:,
411
+ # The property used to group this price
412
+ grouping_key: nil,
406
413
  # If true, the unit price will be prorated to the billing period
407
414
  prorate: nil,
408
415
  # Used to determine the unit rate (optional)
@@ -419,6 +426,7 @@ module Orb
419
426
  Orb::NewFloatingScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor
420
427
  ],
421
428
  unit_price: String,
429
+ grouping_key: T.nilable(String),
422
430
  prorate: T.nilable(T::Boolean),
423
431
  second_dimension: T.nilable(String)
424
432
  }
@@ -387,6 +387,10 @@ module Orb
387
387
  sig { returns(String) }
388
388
  attr_accessor :unit_price
389
389
 
390
+ # The property used to group this price
391
+ sig { returns(T.nilable(String)) }
392
+ attr_accessor :grouping_key
393
+
390
394
  # If true, the unit price will be prorated to the billing period
391
395
  sig { returns(T.nilable(T::Boolean)) }
392
396
  attr_accessor :prorate
@@ -404,6 +408,7 @@ module Orb
404
408
  Orb::NewPlanScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor::OrHash
405
409
  ],
406
410
  unit_price: String,
411
+ grouping_key: T.nilable(String),
407
412
  prorate: T.nilable(T::Boolean),
408
413
  second_dimension: T.nilable(String)
409
414
  ).returns(T.attached_class)
@@ -415,6 +420,8 @@ module Orb
415
420
  matrix_scaling_factors:,
416
421
  # The final unit price to rate against the output of the matrix
417
422
  unit_price:,
423
+ # The property used to group this price
424
+ grouping_key: nil,
418
425
  # If true, the unit price will be prorated to the billing period
419
426
  prorate: nil,
420
427
  # Used to determine the unit rate (optional)
@@ -431,6 +438,7 @@ module Orb
431
438
  Orb::NewPlanScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor
432
439
  ],
433
440
  unit_price: String,
441
+ grouping_key: T.nilable(String),
434
442
  prorate: T.nilable(T::Boolean),
435
443
  second_dimension: T.nilable(String)
436
444
  }
@@ -387,6 +387,10 @@ module Orb
387
387
  sig { returns(String) }
388
388
  attr_accessor :unit_price
389
389
 
390
+ # The property used to group this price
391
+ sig { returns(T.nilable(String)) }
392
+ attr_accessor :grouping_key
393
+
390
394
  # If true, the unit price will be prorated to the billing period
391
395
  sig { returns(T.nilable(T::Boolean)) }
392
396
  attr_accessor :prorate
@@ -404,6 +408,7 @@ module Orb
404
408
  Orb::NewSubscriptionScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor::OrHash
405
409
  ],
406
410
  unit_price: String,
411
+ grouping_key: T.nilable(String),
407
412
  prorate: T.nilable(T::Boolean),
408
413
  second_dimension: T.nilable(String)
409
414
  ).returns(T.attached_class)
@@ -415,6 +420,8 @@ module Orb
415
420
  matrix_scaling_factors:,
416
421
  # The final unit price to rate against the output of the matrix
417
422
  unit_price:,
423
+ # The property used to group this price
424
+ grouping_key: nil,
418
425
  # If true, the unit price will be prorated to the billing period
419
426
  prorate: nil,
420
427
  # Used to determine the unit rate (optional)
@@ -431,6 +438,7 @@ module Orb
431
438
  Orb::NewSubscriptionScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor
432
439
  ],
433
440
  unit_price: String,
441
+ grouping_key: T.nilable(String),
434
442
  prorate: T.nilable(T::Boolean),
435
443
  second_dimension: T.nilable(String)
436
444
  }
@@ -17378,6 +17378,10 @@ module Orb
17378
17378
  sig { returns(String) }
17379
17379
  attr_accessor :unit_price
17380
17380
 
17381
+ # The property used to group this price
17382
+ sig { returns(T.nilable(String)) }
17383
+ attr_accessor :grouping_key
17384
+
17381
17385
  # If true, the unit price will be prorated to the billing period
17382
17386
  sig { returns(T.nilable(T::Boolean)) }
17383
17387
  attr_accessor :prorate
@@ -17395,6 +17399,7 @@ module Orb
17395
17399
  Orb::Price::ScalableMatrixWithUnitPricing::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor::OrHash
17396
17400
  ],
17397
17401
  unit_price: String,
17402
+ grouping_key: T.nilable(String),
17398
17403
  prorate: T.nilable(T::Boolean),
17399
17404
  second_dimension: T.nilable(String)
17400
17405
  ).returns(T.attached_class)
@@ -17406,6 +17411,8 @@ module Orb
17406
17411
  matrix_scaling_factors:,
17407
17412
  # The final unit price to rate against the output of the matrix
17408
17413
  unit_price:,
17414
+ # The property used to group this price
17415
+ grouping_key: nil,
17409
17416
  # If true, the unit price will be prorated to the billing period
17410
17417
  prorate: nil,
17411
17418
  # Used to determine the unit rate (optional)
@@ -17422,6 +17429,7 @@ module Orb
17422
17429
  Orb::Price::ScalableMatrixWithUnitPricing::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor
17423
17430
  ],
17424
17431
  unit_price: String,
17432
+ grouping_key: T.nilable(String),
17425
17433
  prorate: T.nilable(T::Boolean),
17426
17434
  second_dimension: T.nilable(String)
17427
17435
  }
@@ -2343,6 +2343,10 @@ module Orb
2343
2343
  sig { returns(String) }
2344
2344
  attr_accessor :unit_price
2345
2345
 
2346
+ # The property used to group this price
2347
+ sig { returns(T.nilable(String)) }
2348
+ attr_accessor :grouping_key
2349
+
2346
2350
  # If true, the unit price will be prorated to the billing period
2347
2351
  sig { returns(T.nilable(T::Boolean)) }
2348
2352
  attr_accessor :prorate
@@ -2360,6 +2364,7 @@ module Orb
2360
2364
  Orb::PriceCreateParams::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor::OrHash
2361
2365
  ],
2362
2366
  unit_price: String,
2367
+ grouping_key: T.nilable(String),
2363
2368
  prorate: T.nilable(T::Boolean),
2364
2369
  second_dimension: T.nilable(String)
2365
2370
  ).returns(T.attached_class)
@@ -2371,6 +2376,8 @@ module Orb
2371
2376
  matrix_scaling_factors:,
2372
2377
  # The final unit price to rate against the output of the matrix
2373
2378
  unit_price:,
2379
+ # The property used to group this price
2380
+ grouping_key: nil,
2374
2381
  # If true, the unit price will be prorated to the billing period
2375
2382
  prorate: nil,
2376
2383
  # Used to determine the unit rate (optional)
@@ -2387,6 +2394,7 @@ module Orb
2387
2394
  Orb::PriceCreateParams::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor
2388
2395
  ],
2389
2396
  unit_price: String,
2397
+ grouping_key: T.nilable(String),
2390
2398
  prorate: T.nilable(T::Boolean),
2391
2399
  second_dimension: T.nilable(String)
2392
2400
  }