diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 05988747..091cfb12 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.9.1" + ".": "0.10.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 8d440bd0..1265d475 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 114 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-faced218bf2dee89c8449bdb209e7090452d26c0646f0b998f84fe5bd3c4b7cb.yml -openapi_spec_hash: b3a957e9c012fad5093545f65614ea42 -config_hash: e63f2d098e5d12f63ae4cd8270aa5c3c +configured_endpoints: 115 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-d513be954ba2cb57489bd048f93790cabb13849f0f04d328a5a15694c99550df.yml +openapi_spec_hash: 0d42694f412abf65defc3f88646a809c +config_hash: 1e2186b09e57d7d27b6ab5c8e6410b31 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f5b4ab6..c33b61e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.10.0 (2025-06-02) + +Full Changelog: [v0.9.1...v0.10.0](https://github.com/orbcorp/orb-ruby/compare/v0.9.1...v0.10.0) + +### Features + +* **api:** api update ([38a8a32](https://github.com/orbcorp/orb-ruby/commit/38a8a32ad909bdad88f7085e40f01d7949058b79)) + + +### Chores + +* **internal:** version bump ([7568907](https://github.com/orbcorp/orb-ruby/commit/7568907e515144a8e43e9646e0499036b7dcbda7)) + ## 0.9.1 (2025-06-02) Full Changelog: [v0.9.0...v0.9.1](https://github.com/orbcorp/orb-ruby/compare/v0.9.0...v0.9.1) diff --git a/Gemfile.lock b/Gemfile.lock index 73e485f4..86ec432c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - orb-billing (0.9.0) + orb-billing (0.9.1) connection_pool GEM diff --git a/README.md b/README.md index 7a4d2959..95183e75 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "orb-billing", "~> 0.9.1" +gem "orb-billing", "~> 0.10.0" ``` diff --git a/lib/orb.rb b/lib/orb.rb index fbf7e8bb..c1936286 100644 --- a/lib/orb.rb +++ b/lib/orb.rb @@ -213,6 +213,8 @@ require_relative "orb/models/subscription_list_params" require_relative "orb/models/subscription_price_intervals_params" require_relative "orb/models/subscription_price_intervals_response" +require_relative "orb/models/subscription_redeem_coupon_params" +require_relative "orb/models/subscription_redeem_coupon_response" require_relative "orb/models/subscriptions" require_relative "orb/models/subscription_schedule_plan_change_params" require_relative "orb/models/subscription_schedule_plan_change_response" diff --git a/lib/orb/models.rb b/lib/orb/models.rb index bda8a1f0..5639da3a 100644 --- a/lib/orb/models.rb +++ b/lib/orb/models.rb @@ -244,6 +244,8 @@ module Orb SubscriptionPriceIntervalsParams = Orb::Models::SubscriptionPriceIntervalsParams + SubscriptionRedeemCouponParams = Orb::Models::SubscriptionRedeemCouponParams + SubscriptionsAPI = Orb::Models::SubscriptionsAPI SubscriptionSchedulePlanChangeParams = Orb::Models::SubscriptionSchedulePlanChangeParams diff --git a/lib/orb/models/invoice.rb b/lib/orb/models/invoice.rb index 1f5097d2..3e4beb44 100644 --- a/lib/orb/models/invoice.rb +++ b/lib/orb/models/invoice.rb @@ -1181,8 +1181,8 @@ class LineItem < Orb::Internal::Type::BaseModel # For more on the types of prices, see # [the core concepts documentation](/core-concepts#plan-and-price) # - # @return [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk, nil] - required :price, union: -> { Orb::Price }, nil?: true + # @return [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk] + required :price, union: -> { Orb::Price } # @!attribute quantity # Either the fixed fee quantity or the usage during the service period. @@ -1259,7 +1259,7 @@ class LineItem < Orb::Internal::Type::BaseModel # # @param partially_invoiced_amount [String] Any amount applied from a partial invoice # - # @param price [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk, nil] The Price resource represents a price that can be billed on a subscription, resu + # @param price [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk] The Price resource represents a price that can be billed on a subscription, resu # # @param quantity [Float] Either the fixed fee quantity or the usage during the service period. # diff --git a/lib/orb/models/invoice_fetch_upcoming_response.rb b/lib/orb/models/invoice_fetch_upcoming_response.rb index b0567086..bfd21f75 100644 --- a/lib/orb/models/invoice_fetch_upcoming_response.rb +++ b/lib/orb/models/invoice_fetch_upcoming_response.rb @@ -1185,8 +1185,8 @@ class LineItem < Orb::Internal::Type::BaseModel # For more on the types of prices, see # [the core concepts documentation](/core-concepts#plan-and-price) # - # @return [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk, nil] - required :price, union: -> { Orb::Price }, nil?: true + # @return [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk] + required :price, union: -> { Orb::Price } # @!attribute quantity # Either the fixed fee quantity or the usage during the service period. @@ -1262,7 +1262,7 @@ class LineItem < Orb::Internal::Type::BaseModel # # @param partially_invoiced_amount [String] Any amount applied from a partial invoice # - # @param price [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk, nil] The Price resource represents a price that can be billed on a subscription, resu + # @param price [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk] The Price resource represents a price that can be billed on a subscription, resu # # @param quantity [Float] Either the fixed fee quantity or the usage during the service period. # diff --git a/lib/orb/models/invoice_line_item_create_response.rb b/lib/orb/models/invoice_line_item_create_response.rb index 31e7f6eb..f5cc8f52 100644 --- a/lib/orb/models/invoice_line_item_create_response.rb +++ b/lib/orb/models/invoice_line_item_create_response.rb @@ -120,8 +120,8 @@ class InvoiceLineItemCreateResponse < Orb::Internal::Type::BaseModel # For more on the types of prices, see # [the core concepts documentation](/core-concepts#plan-and-price) # - # @return [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk, nil] - required :price, union: -> { Orb::Price }, nil?: true + # @return [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk] + required :price, union: -> { Orb::Price } # @!attribute quantity # Either the fixed fee quantity or the usage during the service period. @@ -197,7 +197,7 @@ class InvoiceLineItemCreateResponse < Orb::Internal::Type::BaseModel # # @param partially_invoiced_amount [String] Any amount applied from a partial invoice # - # @param price [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk, nil] The Price resource represents a price that can be billed on a subscription, resu + # @param price [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk] The Price resource represents a price that can be billed on a subscription, resu # # @param quantity [Float] Either the fixed fee quantity or the usage during the service period. # diff --git a/lib/orb/models/subscription_redeem_coupon_params.rb b/lib/orb/models/subscription_redeem_coupon_params.rb new file mode 100644 index 00000000..c8f5137d --- /dev/null +++ b/lib/orb/models/subscription_redeem_coupon_params.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +module Orb + module Models + # @see Orb::Resources::Subscriptions#redeem_coupon + class SubscriptionRedeemCouponParams < Orb::Internal::Type::BaseModel + extend Orb::Internal::Type::RequestParameters::Converter + include Orb::Internal::Type::RequestParameters + + # @!attribute change_option + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponParams::ChangeOption] + required :change_option, enum: -> { Orb::SubscriptionRedeemCouponParams::ChangeOption } + + # @!attribute coupon_id + # Coupon ID to be redeemed for this subscription. + # + # @return [String] + required :coupon_id, String + + # @!attribute allow_invoice_credit_or_void + # If false, this request will fail if it would void an issued invoice or create a + # credit note. Consider using this as a safety mechanism if you do not expect + # existing invoices to be changed. + # + # @return [Boolean, nil] + optional :allow_invoice_credit_or_void, Orb::Internal::Type::Boolean, nil?: true + + # @!attribute change_date + # The date that the coupon discount should take effect. This parameter can only be + # passed if the `change_option` is `requested_date`. + # + # @return [Time, nil] + optional :change_date, Time, nil?: true + + # @!method initialize(change_option:, coupon_id:, allow_invoice_credit_or_void: nil, change_date: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponParams} for more details. + # + # @param change_option [Symbol, Orb::Models::SubscriptionRedeemCouponParams::ChangeOption] + # + # @param coupon_id [String] Coupon ID to be redeemed for this subscription. + # + # @param allow_invoice_credit_or_void [Boolean, nil] If false, this request will fail if it would void an issued invoice or create a + # + # @param change_date [Time, nil] The date that the coupon discount should take effect. This parameter can only be + # + # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}] + + module ChangeOption + extend Orb::Internal::Type::Enum + + REQUESTED_DATE = :requested_date + END_OF_SUBSCRIPTION_TERM = :end_of_subscription_term + IMMEDIATE = :immediate + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/orb/models/subscription_redeem_coupon_response.rb b/lib/orb/models/subscription_redeem_coupon_response.rb new file mode 100644 index 00000000..e3b1a9f0 --- /dev/null +++ b/lib/orb/models/subscription_redeem_coupon_response.rb @@ -0,0 +1,1883 @@ +# frozen_string_literal: true + +module Orb + module Models + # @see Orb::Resources::Subscriptions#redeem_coupon + class SubscriptionRedeemCouponResponse < Orb::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute active_plan_phase_order + # The current plan phase that is active, only if the subscription's plan has + # phases. + # + # @return [Integer, nil] + required :active_plan_phase_order, Integer, nil?: true + + # @!attribute adjustment_intervals + # The adjustment intervals for this subscription sorted by the start_date of the + # adjustment interval. + # + # @return [Array] + required :adjustment_intervals, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval] } + + # @!attribute auto_collection + # Determines whether issued invoices for this subscription will automatically be + # charged with the saved payment method on the due date. This property defaults to + # the plan's behavior. If null, defaults to the customer's setting. + # + # @return [Boolean, nil] + required :auto_collection, Orb::Internal::Type::Boolean, nil?: true + + # @!attribute billing_cycle_anchor_configuration + # + # @return [Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration] + required :billing_cycle_anchor_configuration, + -> { Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration } + + # @!attribute billing_cycle_day + # The day of the month on which the billing cycle is anchored. If the maximum + # number of days in a month is greater than this value, the last day of the month + # is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing + # period begins on the 30th. + # + # @return [Integer] + required :billing_cycle_day, Integer + + # @!attribute created_at + # + # @return [Time] + required :created_at, Time + + # @!attribute current_billing_period_end_date + # The end of the current billing period. This is an exclusive timestamp, such that + # the instant returned is not part of the billing period. Set to null for + # subscriptions that are not currently active. + # + # @return [Time, nil] + required :current_billing_period_end_date, Time, nil?: true + + # @!attribute current_billing_period_start_date + # The start date of the current billing period. This is an inclusive timestamp; + # the instant returned is exactly the beginning of the billing period. Set to null + # if the subscription is not currently active. + # + # @return [Time, nil] + required :current_billing_period_start_date, Time, nil?: true + + # @!attribute customer + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. + # + # @return [Orb::Models::Customer] + required :customer, -> { Orb::Customer } + + # @!attribute default_invoice_memo + # Determines the default memo on this subscriptions' invoices. Note that if this + # is not provided, it is determined by the plan configuration. + # + # @return [String, nil] + required :default_invoice_memo, String, nil?: true + + # @!attribute discount_intervals + # @deprecated + # + # The discount intervals for this subscription sorted by the start_date. + # + # @return [Array] + required :discount_intervals, + -> { Orb::Internal::Type::ArrayOf[union: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval] } + + # @!attribute end_date + # The date Orb stops billing for this subscription. + # + # @return [Time, nil] + required :end_date, Time, nil?: true + + # @!attribute fixed_fee_quantity_schedule + # + # @return [Array] + required :fixed_fee_quantity_schedule, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::FixedFeeQuantitySchedule] } + + # @!attribute invoicing_threshold + # + # @return [String, nil] + required :invoicing_threshold, String, nil?: true + + # @!attribute maximum_intervals + # @deprecated + # + # The maximum intervals for this subscription sorted by the start_date. + # + # @return [Array] + required :maximum_intervals, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval] } + + # @!attribute metadata + # User specified key-value pairs for the resource. If not present, this defaults + # to an empty dictionary. Individual keys can be removed by setting the value to + # `null`, and the entire metadata mapping can be cleared by setting `metadata` to + # `null`. + # + # @return [Hash{Symbol=>String}] + required :metadata, Orb::Internal::Type::HashOf[String] + + # @!attribute minimum_intervals + # @deprecated + # + # The minimum intervals for this subscription sorted by the start_date. + # + # @return [Array] + required :minimum_intervals, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval] } + + # @!attribute name + # The name of the subscription. + # + # @return [String] + required :name, String + + # @!attribute net_terms + # Determines the difference between the invoice issue date for subscription + # invoices as the date that they are due. A value of `0` here represents that the + # invoice is due on issue, whereas a value of `30` represents that the customer + # has a month to pay the invoice. + # + # @return [Integer] + required :net_terms, Integer + + # @!attribute pending_subscription_change + # A pending subscription change if one exists on this subscription. + # + # @return [Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange, nil] + required :pending_subscription_change, + -> { Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange }, + nil?: true + + # @!attribute plan + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). + # + # @return [Orb::Models::Plan, nil] + required :plan, -> { Orb::Plan }, nil?: true + + # @!attribute price_intervals + # The price intervals for this subscription. + # + # @return [Array] + required :price_intervals, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval] } + + # @!attribute redeemed_coupon + # + # @return [Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon, nil] + required :redeemed_coupon, + -> { Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon }, + nil?: true + + # @!attribute start_date + # The date Orb starts billing for this subscription. + # + # @return [Time] + required :start_date, Time + + # @!attribute status + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::Status] + required :status, enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::Status } + + # @!attribute trial_info + # + # @return [Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo] + required :trial_info, -> { Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo } + + # @!attribute changed_resources + # The resources that were changed as part of this operation. Only present when + # fetched through the subscription changes API or if the + # `include_changed_resources` parameter was passed in the request. + # + # @return [Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources, nil] + optional :changed_resources, + -> { Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources }, + nil?: true + + # @!method initialize(id:, active_plan_phase_order:, adjustment_intervals:, auto_collection:, billing_cycle_anchor_configuration:, billing_cycle_day:, created_at:, current_billing_period_end_date:, current_billing_period_start_date:, customer:, default_invoice_memo:, discount_intervals:, end_date:, fixed_fee_quantity_schedule:, invoicing_threshold:, maximum_intervals:, metadata:, minimum_intervals:, name:, net_terms:, pending_subscription_change:, plan:, price_intervals:, redeemed_coupon:, start_date:, status:, trial_info:, changed_resources: nil) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponResponse} for more details. + # + # @param id [String] + # + # @param active_plan_phase_order [Integer, nil] The current plan phase that is active, only if the subscription's plan has phase + # + # @param adjustment_intervals [Array] The adjustment intervals for this subscription sorted by the start_date of the a + # + # @param auto_collection [Boolean, nil] Determines whether issued invoices for this subscription will automatically be c + # + # @param billing_cycle_anchor_configuration [Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration] + # + # @param billing_cycle_day [Integer] The day of the month on which the billing cycle is anchored. If the maximum numb + # + # @param created_at [Time] + # + # @param current_billing_period_end_date [Time, nil] The end of the current billing period. This is an exclusive timestamp, such that + # + # @param current_billing_period_start_date [Time, nil] The start date of the current billing period. This is an inclusive timestamp; th + # + # @param customer [Orb::Models::Customer] A customer is a buyer of your products, and the other party to the billing relat + # + # @param default_invoice_memo [String, nil] Determines the default memo on this subscriptions' invoices. Note that if this i + # + # @param discount_intervals [Array] The discount intervals for this subscription sorted by the start_date. + # + # @param end_date [Time, nil] The date Orb stops billing for this subscription. + # + # @param fixed_fee_quantity_schedule [Array] + # + # @param invoicing_threshold [String, nil] + # + # @param maximum_intervals [Array] The maximum intervals for this subscription sorted by the start_date. + # + # @param metadata [Hash{Symbol=>String}] User specified key-value pairs for the resource. If not present, this defaults t + # + # @param minimum_intervals [Array] The minimum intervals for this subscription sorted by the start_date. + # + # @param name [String] The name of the subscription. + # + # @param net_terms [Integer] Determines the difference between the invoice issue date for subscription invoic + # + # @param pending_subscription_change [Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange, nil] A pending subscription change if one exists on this subscription. + # + # @param plan [Orb::Models::Plan, nil] The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # + # @param price_intervals [Array] The price intervals for this subscription. + # + # @param redeemed_coupon [Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon, nil] + # + # @param start_date [Time] The date Orb starts billing for this subscription. + # + # @param status [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::Status] + # + # @param trial_info [Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo] + # + # @param changed_resources [Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources, nil] The resources that were changed as part of this operation. Only present when fet + + class AdjustmentInterval < Orb::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute adjustment + # + # @return [Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum] + required :adjustment, + union: -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment } + + # @!attribute applies_to_price_interval_ids + # The price interval IDs that this adjustment applies to. + # + # @return [Array] + required :applies_to_price_interval_ids, Orb::Internal::Type::ArrayOf[String] + + # @!attribute end_date + # The end date of the adjustment interval. + # + # @return [Time, nil] + required :end_date, Time, nil?: true + + # @!attribute start_date + # The start date of the adjustment interval. + # + # @return [Time] + required :start_date, Time + + # @!method initialize(id:, adjustment:, applies_to_price_interval_ids:, end_date:, start_date:) + # @param id [String] + # + # @param adjustment [Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum] + # + # @param applies_to_price_interval_ids [Array] The price interval IDs that this adjustment applies to. + # + # @param end_date [Time, nil] The end date of the adjustment interval. + # + # @param start_date [Time] The start date of the adjustment interval. + + # @see Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval#adjustment + module Adjustment + extend Orb::Internal::Type::Union + + discriminator :adjustment_type + + variant :usage_discount, + -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount } + + variant :amount_discount, + -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount } + + variant :percentage_discount, + -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount } + + variant :minimum, + -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum } + + variant :maximum, + -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum } + + class UsageDiscount < Orb::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute adjustment_type + # + # @return [Symbol, :usage_discount] + required :adjustment_type, const: :usage_discount + + # @!attribute applies_to_price_ids + # @deprecated + # + # The price IDs that this adjustment applies to. + # + # @return [Array] + required :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String] + + # @!attribute filters + # The filters that determine which prices to apply this adjustment to. + # + # @return [Array] + required :filters, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter] } + + # @!attribute is_invoice_level + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + # + # @return [Boolean] + required :is_invoice_level, Orb::Internal::Type::Boolean + + # @!attribute plan_phase_order + # The plan phase in which this adjustment is active. + # + # @return [Integer, nil] + required :plan_phase_order, Integer, nil?: true + + # @!attribute reason + # The reason for the adjustment. + # + # @return [String, nil] + required :reason, String, nil?: true + + # @!attribute usage_discount + # The number of usage units by which to discount the price this adjustment applies + # to in a given billing period. + # + # @return [Float] + required :usage_discount, Float + + # @!method initialize(id:, applies_to_price_ids:, filters:, is_invoice_level:, plan_phase_order:, reason:, usage_discount:, adjustment_type: :usage_discount) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount} + # for more details. + # + # @param id [String] + # + # @param applies_to_price_ids [Array] The price IDs that this adjustment applies to. + # + # @param filters [Array] The filters that determine which prices to apply this adjustment to. + # + # @param is_invoice_level [Boolean] True for adjustments that apply to an entire invocice, false for adjustments tha + # + # @param plan_phase_order [Integer, nil] The plan phase in which this adjustment is active. + # + # @param reason [String, nil] The reason for the adjustment. + # + # @param usage_discount [Float] The number of usage units by which to discount the price this adjustment applies + # + # @param adjustment_type [Symbol, :usage_discount] + + class Filter < Orb::Internal::Type::BaseModel + # @!attribute field + # The property of the price to filter on. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field] + required :field, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field } + + # @!attribute operator + # Should prices that match the filter be included or excluded. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Operator] + required :operator, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Operator } + + # @!attribute values + # The IDs or values that match this filter. + # + # @return [Array] + required :values, Orb::Internal::Type::ArrayOf[String] + + # @!method initialize(field:, operator:, values:) + # @param field [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field] The property of the price to filter on. + # + # @param operator [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Operator] Should prices that match the filter be included or excluded. + # + # @param values [Array] The IDs or values that match this filter. + + # The property of the price to filter on. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter#field + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID = :price_id + ITEM_ID = :item_id + PRICE_TYPE = :price_type + CURRENCY = :currency + PRICING_UNIT_ID = :pricing_unit_id + + # @!method self.values + # @return [Array] + end + + # Should prices that match the filter be included or excluded. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter#operator + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES = :includes + EXCLUDES = :excludes + + # @!method self.values + # @return [Array] + end + end + end + + class AmountDiscount < Orb::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute adjustment_type + # + # @return [Symbol, :amount_discount] + required :adjustment_type, const: :amount_discount + + # @!attribute amount_discount + # The amount by which to discount the prices this adjustment applies to in a given + # billing period. + # + # @return [String] + required :amount_discount, String + + # @!attribute applies_to_price_ids + # @deprecated + # + # The price IDs that this adjustment applies to. + # + # @return [Array] + required :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String] + + # @!attribute filters + # The filters that determine which prices to apply this adjustment to. + # + # @return [Array] + required :filters, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter] } + + # @!attribute is_invoice_level + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + # + # @return [Boolean] + required :is_invoice_level, Orb::Internal::Type::Boolean + + # @!attribute plan_phase_order + # The plan phase in which this adjustment is active. + # + # @return [Integer, nil] + required :plan_phase_order, Integer, nil?: true + + # @!attribute reason + # The reason for the adjustment. + # + # @return [String, nil] + required :reason, String, nil?: true + + # @!method initialize(id:, amount_discount:, applies_to_price_ids:, filters:, is_invoice_level:, plan_phase_order:, reason:, adjustment_type: :amount_discount) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount} + # for more details. + # + # @param id [String] + # + # @param amount_discount [String] The amount by which to discount the prices this adjustment applies to in a given + # + # @param applies_to_price_ids [Array] The price IDs that this adjustment applies to. + # + # @param filters [Array] The filters that determine which prices to apply this adjustment to. + # + # @param is_invoice_level [Boolean] True for adjustments that apply to an entire invocice, false for adjustments tha + # + # @param plan_phase_order [Integer, nil] The plan phase in which this adjustment is active. + # + # @param reason [String, nil] The reason for the adjustment. + # + # @param adjustment_type [Symbol, :amount_discount] + + class Filter < Orb::Internal::Type::BaseModel + # @!attribute field + # The property of the price to filter on. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field] + required :field, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field } + + # @!attribute operator + # Should prices that match the filter be included or excluded. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Operator] + required :operator, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Operator } + + # @!attribute values + # The IDs or values that match this filter. + # + # @return [Array] + required :values, Orb::Internal::Type::ArrayOf[String] + + # @!method initialize(field:, operator:, values:) + # @param field [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field] The property of the price to filter on. + # + # @param operator [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Operator] Should prices that match the filter be included or excluded. + # + # @param values [Array] The IDs or values that match this filter. + + # The property of the price to filter on. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter#field + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID = :price_id + ITEM_ID = :item_id + PRICE_TYPE = :price_type + CURRENCY = :currency + PRICING_UNIT_ID = :pricing_unit_id + + # @!method self.values + # @return [Array] + end + + # Should prices that match the filter be included or excluded. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter#operator + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES = :includes + EXCLUDES = :excludes + + # @!method self.values + # @return [Array] + end + end + end + + class PercentageDiscount < Orb::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute adjustment_type + # + # @return [Symbol, :percentage_discount] + required :adjustment_type, const: :percentage_discount + + # @!attribute applies_to_price_ids + # @deprecated + # + # The price IDs that this adjustment applies to. + # + # @return [Array] + required :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String] + + # @!attribute filters + # The filters that determine which prices to apply this adjustment to. + # + # @return [Array] + required :filters, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter] } + + # @!attribute is_invoice_level + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + # + # @return [Boolean] + required :is_invoice_level, Orb::Internal::Type::Boolean + + # @!attribute percentage_discount + # The percentage (as a value between 0 and 1) by which to discount the price + # intervals this adjustment applies to in a given billing period. + # + # @return [Float] + required :percentage_discount, Float + + # @!attribute plan_phase_order + # The plan phase in which this adjustment is active. + # + # @return [Integer, nil] + required :plan_phase_order, Integer, nil?: true + + # @!attribute reason + # The reason for the adjustment. + # + # @return [String, nil] + required :reason, String, nil?: true + + # @!method initialize(id:, applies_to_price_ids:, filters:, is_invoice_level:, percentage_discount:, plan_phase_order:, reason:, adjustment_type: :percentage_discount) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount} + # for more details. + # + # @param id [String] + # + # @param applies_to_price_ids [Array] The price IDs that this adjustment applies to. + # + # @param filters [Array] The filters that determine which prices to apply this adjustment to. + # + # @param is_invoice_level [Boolean] True for adjustments that apply to an entire invocice, false for adjustments tha + # + # @param percentage_discount [Float] The percentage (as a value between 0 and 1) by which to discount the price inter + # + # @param plan_phase_order [Integer, nil] The plan phase in which this adjustment is active. + # + # @param reason [String, nil] The reason for the adjustment. + # + # @param adjustment_type [Symbol, :percentage_discount] + + class Filter < Orb::Internal::Type::BaseModel + # @!attribute field + # The property of the price to filter on. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field] + required :field, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field } + + # @!attribute operator + # Should prices that match the filter be included or excluded. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Operator] + required :operator, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Operator } + + # @!attribute values + # The IDs or values that match this filter. + # + # @return [Array] + required :values, Orb::Internal::Type::ArrayOf[String] + + # @!method initialize(field:, operator:, values:) + # @param field [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field] The property of the price to filter on. + # + # @param operator [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Operator] Should prices that match the filter be included or excluded. + # + # @param values [Array] The IDs or values that match this filter. + + # The property of the price to filter on. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter#field + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID = :price_id + ITEM_ID = :item_id + PRICE_TYPE = :price_type + CURRENCY = :currency + PRICING_UNIT_ID = :pricing_unit_id + + # @!method self.values + # @return [Array] + end + + # Should prices that match the filter be included or excluded. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter#operator + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES = :includes + EXCLUDES = :excludes + + # @!method self.values + # @return [Array] + end + end + end + + class Minimum < Orb::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute adjustment_type + # + # @return [Symbol, :minimum] + required :adjustment_type, const: :minimum + + # @!attribute applies_to_price_ids + # @deprecated + # + # The price IDs that this adjustment applies to. + # + # @return [Array] + required :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String] + + # @!attribute filters + # The filters that determine which prices to apply this adjustment to. + # + # @return [Array] + required :filters, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter] } + + # @!attribute is_invoice_level + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + # + # @return [Boolean] + required :is_invoice_level, Orb::Internal::Type::Boolean + + # @!attribute item_id + # The item ID that revenue from this minimum will be attributed to. + # + # @return [String] + required :item_id, String + + # @!attribute minimum_amount + # The minimum amount to charge in a given billing period for the prices this + # adjustment applies to. + # + # @return [String] + required :minimum_amount, String + + # @!attribute plan_phase_order + # The plan phase in which this adjustment is active. + # + # @return [Integer, nil] + required :plan_phase_order, Integer, nil?: true + + # @!attribute reason + # The reason for the adjustment. + # + # @return [String, nil] + required :reason, String, nil?: true + + # @!method initialize(id:, applies_to_price_ids:, filters:, is_invoice_level:, item_id:, minimum_amount:, plan_phase_order:, reason:, adjustment_type: :minimum) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum} + # for more details. + # + # @param id [String] + # + # @param applies_to_price_ids [Array] The price IDs that this adjustment applies to. + # + # @param filters [Array] The filters that determine which prices to apply this adjustment to. + # + # @param is_invoice_level [Boolean] True for adjustments that apply to an entire invocice, false for adjustments tha + # + # @param item_id [String] The item ID that revenue from this minimum will be attributed to. + # + # @param minimum_amount [String] The minimum amount to charge in a given billing period for the prices this adjus + # + # @param plan_phase_order [Integer, nil] The plan phase in which this adjustment is active. + # + # @param reason [String, nil] The reason for the adjustment. + # + # @param adjustment_type [Symbol, :minimum] + + class Filter < Orb::Internal::Type::BaseModel + # @!attribute field + # The property of the price to filter on. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field] + required :field, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field } + + # @!attribute operator + # Should prices that match the filter be included or excluded. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Operator] + required :operator, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Operator } + + # @!attribute values + # The IDs or values that match this filter. + # + # @return [Array] + required :values, Orb::Internal::Type::ArrayOf[String] + + # @!method initialize(field:, operator:, values:) + # @param field [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field] The property of the price to filter on. + # + # @param operator [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Operator] Should prices that match the filter be included or excluded. + # + # @param values [Array] The IDs or values that match this filter. + + # The property of the price to filter on. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter#field + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID = :price_id + ITEM_ID = :item_id + PRICE_TYPE = :price_type + CURRENCY = :currency + PRICING_UNIT_ID = :pricing_unit_id + + # @!method self.values + # @return [Array] + end + + # Should prices that match the filter be included or excluded. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter#operator + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES = :includes + EXCLUDES = :excludes + + # @!method self.values + # @return [Array] + end + end + end + + class Maximum < Orb::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute adjustment_type + # + # @return [Symbol, :maximum] + required :adjustment_type, const: :maximum + + # @!attribute applies_to_price_ids + # @deprecated + # + # The price IDs that this adjustment applies to. + # + # @return [Array] + required :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String] + + # @!attribute filters + # The filters that determine which prices to apply this adjustment to. + # + # @return [Array] + required :filters, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter] } + + # @!attribute is_invoice_level + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + # + # @return [Boolean] + required :is_invoice_level, Orb::Internal::Type::Boolean + + # @!attribute maximum_amount + # The maximum amount to charge in a given billing period for the prices this + # adjustment applies to. + # + # @return [String] + required :maximum_amount, String + + # @!attribute plan_phase_order + # The plan phase in which this adjustment is active. + # + # @return [Integer, nil] + required :plan_phase_order, Integer, nil?: true + + # @!attribute reason + # The reason for the adjustment. + # + # @return [String, nil] + required :reason, String, nil?: true + + # @!method initialize(id:, applies_to_price_ids:, filters:, is_invoice_level:, maximum_amount:, plan_phase_order:, reason:, adjustment_type: :maximum) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum} + # for more details. + # + # @param id [String] + # + # @param applies_to_price_ids [Array] The price IDs that this adjustment applies to. + # + # @param filters [Array] The filters that determine which prices to apply this adjustment to. + # + # @param is_invoice_level [Boolean] True for adjustments that apply to an entire invocice, false for adjustments tha + # + # @param maximum_amount [String] The maximum amount to charge in a given billing period for the prices this adjus + # + # @param plan_phase_order [Integer, nil] The plan phase in which this adjustment is active. + # + # @param reason [String, nil] The reason for the adjustment. + # + # @param adjustment_type [Symbol, :maximum] + + class Filter < Orb::Internal::Type::BaseModel + # @!attribute field + # The property of the price to filter on. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field] + required :field, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field } + + # @!attribute operator + # Should prices that match the filter be included or excluded. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Operator] + required :operator, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Operator } + + # @!attribute values + # The IDs or values that match this filter. + # + # @return [Array] + required :values, Orb::Internal::Type::ArrayOf[String] + + # @!method initialize(field:, operator:, values:) + # @param field [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field] The property of the price to filter on. + # + # @param operator [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Operator] Should prices that match the filter be included or excluded. + # + # @param values [Array] The IDs or values that match this filter. + + # The property of the price to filter on. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter#field + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID = :price_id + ITEM_ID = :item_id + PRICE_TYPE = :price_type + CURRENCY = :currency + PRICING_UNIT_ID = :pricing_unit_id + + # @!method self.values + # @return [Array] + end + + # Should prices that match the filter be included or excluded. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter#operator + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES = :includes + EXCLUDES = :excludes + + # @!method self.values + # @return [Array] + end + end + end + + # @!method self.variants + # @return [Array(Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum, Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum)] + end + end + + # @see Orb::Models::SubscriptionRedeemCouponResponse#billing_cycle_anchor_configuration + class BillingCycleAnchorConfiguration < Orb::Internal::Type::BaseModel + # @!attribute day + # The day of the month on which the billing cycle is anchored. If the maximum + # number of days in a month is greater than this value, the last day of the month + # is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing + # period begins on the 30th. + # + # @return [Integer] + required :day, Integer + + # @!attribute month + # The month on which the billing cycle is anchored (e.g. a quarterly price + # anchored in February would have cycles starting February, May, August, and + # November). + # + # @return [Integer, nil] + optional :month, Integer, nil?: true + + # @!attribute year + # The year on which the billing cycle is anchored (e.g. a 2 year billing cycle + # anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.). + # + # @return [Integer, nil] + optional :year, Integer, nil?: true + + # @!method initialize(day:, month: nil, year: nil) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration} + # for more details. + # + # @param day [Integer] The day of the month on which the billing cycle is anchored. If the maximum numb + # + # @param month [Integer, nil] The month on which the billing cycle is anchored (e.g. a quarterly price anchore + # + # @param year [Integer, nil] The year on which the billing cycle is anchored (e.g. a 2 year billing cycle anc + end + + module DiscountInterval + extend Orb::Internal::Type::Union + + discriminator :discount_type + + variant :amount, -> { Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount } + + variant :percentage, -> { Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage } + + variant :usage, -> { Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage } + + class Amount < Orb::Internal::Type::BaseModel + # @!attribute amount_discount + # Only available if discount_type is `amount`. + # + # @return [String] + required :amount_discount, String + + # @!attribute applies_to_price_interval_ids + # The price interval ids that this discount interval applies to. + # + # @return [Array] + required :applies_to_price_interval_ids, Orb::Internal::Type::ArrayOf[String] + + # @!attribute discount_type + # + # @return [Symbol, :amount] + required :discount_type, const: :amount + + # @!attribute end_date + # The end date of the discount interval. + # + # @return [Time, nil] + required :end_date, Time, nil?: true + + # @!attribute filters + # The filters that determine which prices this discount interval applies to. + # + # @return [Array] + required :filters, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter] } + + # @!attribute start_date + # The start date of the discount interval. + # + # @return [Time] + required :start_date, Time + + # @!method initialize(amount_discount:, applies_to_price_interval_ids:, end_date:, filters:, start_date:, discount_type: :amount) + # @param amount_discount [String] Only available if discount_type is `amount`. + # + # @param applies_to_price_interval_ids [Array] The price interval ids that this discount interval applies to. + # + # @param end_date [Time, nil] The end date of the discount interval. + # + # @param filters [Array] The filters that determine which prices this discount interval applies to. + # + # @param start_date [Time] The start date of the discount interval. + # + # @param discount_type [Symbol, :amount] + + class Filter < Orb::Internal::Type::BaseModel + # @!attribute field + # The property of the price to filter on. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field] + required :field, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field } + + # @!attribute operator + # Should prices that match the filter be included or excluded. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Operator] + required :operator, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Operator } + + # @!attribute values + # The IDs or values that match this filter. + # + # @return [Array] + required :values, Orb::Internal::Type::ArrayOf[String] + + # @!method initialize(field:, operator:, values:) + # @param field [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field] The property of the price to filter on. + # + # @param operator [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Operator] Should prices that match the filter be included or excluded. + # + # @param values [Array] The IDs or values that match this filter. + + # The property of the price to filter on. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter#field + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID = :price_id + ITEM_ID = :item_id + PRICE_TYPE = :price_type + CURRENCY = :currency + PRICING_UNIT_ID = :pricing_unit_id + + # @!method self.values + # @return [Array] + end + + # Should prices that match the filter be included or excluded. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter#operator + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES = :includes + EXCLUDES = :excludes + + # @!method self.values + # @return [Array] + end + end + end + + class Percentage < Orb::Internal::Type::BaseModel + # @!attribute applies_to_price_interval_ids + # The price interval ids that this discount interval applies to. + # + # @return [Array] + required :applies_to_price_interval_ids, Orb::Internal::Type::ArrayOf[String] + + # @!attribute discount_type + # + # @return [Symbol, :percentage] + required :discount_type, const: :percentage + + # @!attribute end_date + # The end date of the discount interval. + # + # @return [Time, nil] + required :end_date, Time, nil?: true + + # @!attribute filters + # The filters that determine which prices this discount interval applies to. + # + # @return [Array] + required :filters, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter] } + + # @!attribute percentage_discount + # Only available if discount_type is `percentage`.This is a number between 0 + # and 1. + # + # @return [Float] + required :percentage_discount, Float + + # @!attribute start_date + # The start date of the discount interval. + # + # @return [Time] + required :start_date, Time + + # @!method initialize(applies_to_price_interval_ids:, end_date:, filters:, percentage_discount:, start_date:, discount_type: :percentage) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage} + # for more details. + # + # @param applies_to_price_interval_ids [Array] The price interval ids that this discount interval applies to. + # + # @param end_date [Time, nil] The end date of the discount interval. + # + # @param filters [Array] The filters that determine which prices this discount interval applies to. + # + # @param percentage_discount [Float] Only available if discount_type is `percentage`.This is a number between 0 and 1 + # + # @param start_date [Time] The start date of the discount interval. + # + # @param discount_type [Symbol, :percentage] + + class Filter < Orb::Internal::Type::BaseModel + # @!attribute field + # The property of the price to filter on. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field] + required :field, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field } + + # @!attribute operator + # Should prices that match the filter be included or excluded. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Operator] + required :operator, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Operator } + + # @!attribute values + # The IDs or values that match this filter. + # + # @return [Array] + required :values, Orb::Internal::Type::ArrayOf[String] + + # @!method initialize(field:, operator:, values:) + # @param field [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field] The property of the price to filter on. + # + # @param operator [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Operator] Should prices that match the filter be included or excluded. + # + # @param values [Array] The IDs or values that match this filter. + + # The property of the price to filter on. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter#field + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID = :price_id + ITEM_ID = :item_id + PRICE_TYPE = :price_type + CURRENCY = :currency + PRICING_UNIT_ID = :pricing_unit_id + + # @!method self.values + # @return [Array] + end + + # Should prices that match the filter be included or excluded. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter#operator + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES = :includes + EXCLUDES = :excludes + + # @!method self.values + # @return [Array] + end + end + end + + class Usage < Orb::Internal::Type::BaseModel + # @!attribute applies_to_price_interval_ids + # The price interval ids that this discount interval applies to. + # + # @return [Array] + required :applies_to_price_interval_ids, Orb::Internal::Type::ArrayOf[String] + + # @!attribute discount_type + # + # @return [Symbol, :usage] + required :discount_type, const: :usage + + # @!attribute end_date + # The end date of the discount interval. + # + # @return [Time, nil] + required :end_date, Time, nil?: true + + # @!attribute filters + # The filters that determine which prices this discount interval applies to. + # + # @return [Array] + required :filters, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter] } + + # @!attribute start_date + # The start date of the discount interval. + # + # @return [Time] + required :start_date, Time + + # @!attribute usage_discount + # Only available if discount_type is `usage`. Number of usage units that this + # discount is for + # + # @return [Float] + required :usage_discount, Float + + # @!method initialize(applies_to_price_interval_ids:, end_date:, filters:, start_date:, usage_discount:, discount_type: :usage) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage} for + # more details. + # + # @param applies_to_price_interval_ids [Array] The price interval ids that this discount interval applies to. + # + # @param end_date [Time, nil] The end date of the discount interval. + # + # @param filters [Array] The filters that determine which prices this discount interval applies to. + # + # @param start_date [Time] The start date of the discount interval. + # + # @param usage_discount [Float] Only available if discount_type is `usage`. Number of usage units that this disc + # + # @param discount_type [Symbol, :usage] + + class Filter < Orb::Internal::Type::BaseModel + # @!attribute field + # The property of the price to filter on. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field] + required :field, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field } + + # @!attribute operator + # Should prices that match the filter be included or excluded. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Operator] + required :operator, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Operator } + + # @!attribute values + # The IDs or values that match this filter. + # + # @return [Array] + required :values, Orb::Internal::Type::ArrayOf[String] + + # @!method initialize(field:, operator:, values:) + # @param field [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field] The property of the price to filter on. + # + # @param operator [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Operator] Should prices that match the filter be included or excluded. + # + # @param values [Array] The IDs or values that match this filter. + + # The property of the price to filter on. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter#field + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID = :price_id + ITEM_ID = :item_id + PRICE_TYPE = :price_type + CURRENCY = :currency + PRICING_UNIT_ID = :pricing_unit_id + + # @!method self.values + # @return [Array] + end + + # Should prices that match the filter be included or excluded. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter#operator + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES = :includes + EXCLUDES = :excludes + + # @!method self.values + # @return [Array] + end + end + end + + # @!method self.variants + # @return [Array(Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage, Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage)] + end + + class FixedFeeQuantitySchedule < Orb::Internal::Type::BaseModel + # @!attribute end_date + # + # @return [Time, nil] + required :end_date, Time, nil?: true + + # @!attribute price_id + # + # @return [String] + required :price_id, String + + # @!attribute quantity + # + # @return [Float] + required :quantity, Float + + # @!attribute start_date + # + # @return [Time] + required :start_date, Time + + # @!method initialize(end_date:, price_id:, quantity:, start_date:) + # @param end_date [Time, nil] + # @param price_id [String] + # @param quantity [Float] + # @param start_date [Time] + end + + class MaximumInterval < Orb::Internal::Type::BaseModel + # @!attribute applies_to_price_interval_ids + # The price interval ids that this maximum interval applies to. + # + # @return [Array] + required :applies_to_price_interval_ids, Orb::Internal::Type::ArrayOf[String] + + # @!attribute end_date + # The end date of the maximum interval. + # + # @return [Time, nil] + required :end_date, Time, nil?: true + + # @!attribute filters + # The filters that determine which prices this maximum interval applies to. + # + # @return [Array] + required :filters, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter] } + + # @!attribute maximum_amount + # The maximum amount to charge in a given billing period for the price intervals + # this transform applies to. + # + # @return [String] + required :maximum_amount, String + + # @!attribute start_date + # The start date of the maximum interval. + # + # @return [Time] + required :start_date, Time + + # @!method initialize(applies_to_price_interval_ids:, end_date:, filters:, maximum_amount:, start_date:) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval} for more + # details. + # + # @param applies_to_price_interval_ids [Array] The price interval ids that this maximum interval applies to. + # + # @param end_date [Time, nil] The end date of the maximum interval. + # + # @param filters [Array] The filters that determine which prices this maximum interval applies to. + # + # @param maximum_amount [String] The maximum amount to charge in a given billing period for the price intervals t + # + # @param start_date [Time] The start date of the maximum interval. + + class Filter < Orb::Internal::Type::BaseModel + # @!attribute field + # The property of the price to filter on. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field] + required :field, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field } + + # @!attribute operator + # Should prices that match the filter be included or excluded. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Operator] + required :operator, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Operator } + + # @!attribute values + # The IDs or values that match this filter. + # + # @return [Array] + required :values, Orb::Internal::Type::ArrayOf[String] + + # @!method initialize(field:, operator:, values:) + # @param field [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field] The property of the price to filter on. + # + # @param operator [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Operator] Should prices that match the filter be included or excluded. + # + # @param values [Array] The IDs or values that match this filter. + + # The property of the price to filter on. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter#field + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID = :price_id + ITEM_ID = :item_id + PRICE_TYPE = :price_type + CURRENCY = :currency + PRICING_UNIT_ID = :pricing_unit_id + + # @!method self.values + # @return [Array] + end + + # Should prices that match the filter be included or excluded. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter#operator + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES = :includes + EXCLUDES = :excludes + + # @!method self.values + # @return [Array] + end + end + end + + class MinimumInterval < Orb::Internal::Type::BaseModel + # @!attribute applies_to_price_interval_ids + # The price interval ids that this minimum interval applies to. + # + # @return [Array] + required :applies_to_price_interval_ids, Orb::Internal::Type::ArrayOf[String] + + # @!attribute end_date + # The end date of the minimum interval. + # + # @return [Time, nil] + required :end_date, Time, nil?: true + + # @!attribute filters + # The filters that determine which prices this minimum interval applies to. + # + # @return [Array] + required :filters, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter] } + + # @!attribute minimum_amount + # The minimum amount to charge in a given billing period for the price intervals + # this minimum applies to. + # + # @return [String] + required :minimum_amount, String + + # @!attribute start_date + # The start date of the minimum interval. + # + # @return [Time] + required :start_date, Time + + # @!method initialize(applies_to_price_interval_ids:, end_date:, filters:, minimum_amount:, start_date:) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval} for more + # details. + # + # @param applies_to_price_interval_ids [Array] The price interval ids that this minimum interval applies to. + # + # @param end_date [Time, nil] The end date of the minimum interval. + # + # @param filters [Array] The filters that determine which prices this minimum interval applies to. + # + # @param minimum_amount [String] The minimum amount to charge in a given billing period for the price intervals t + # + # @param start_date [Time] The start date of the minimum interval. + + class Filter < Orb::Internal::Type::BaseModel + # @!attribute field + # The property of the price to filter on. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field] + required :field, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field } + + # @!attribute operator + # Should prices that match the filter be included or excluded. + # + # @return [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Operator] + required :operator, + enum: -> { Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Operator } + + # @!attribute values + # The IDs or values that match this filter. + # + # @return [Array] + required :values, Orb::Internal::Type::ArrayOf[String] + + # @!method initialize(field:, operator:, values:) + # @param field [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field] The property of the price to filter on. + # + # @param operator [Symbol, Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Operator] Should prices that match the filter be included or excluded. + # + # @param values [Array] The IDs or values that match this filter. + + # The property of the price to filter on. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter#field + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID = :price_id + ITEM_ID = :item_id + PRICE_TYPE = :price_type + CURRENCY = :currency + PRICING_UNIT_ID = :pricing_unit_id + + # @!method self.values + # @return [Array] + end + + # Should prices that match the filter be included or excluded. + # + # @see Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter#operator + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES = :includes + EXCLUDES = :excludes + + # @!method self.values + # @return [Array] + end + end + end + + # @see Orb::Models::SubscriptionRedeemCouponResponse#pending_subscription_change + class PendingSubscriptionChange < Orb::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!method initialize(id:) + # A pending subscription change if one exists on this subscription. + # + # @param id [String] + end + + class PriceInterval < Orb::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute billing_cycle_day + # The day of the month that Orb bills for this price + # + # @return [Integer] + required :billing_cycle_day, Integer + + # @!attribute current_billing_period_end_date + # The end of the current billing period. This is an exclusive timestamp, such that + # the instant returned is exactly the end of the billing period. Set to null if + # this price interval is not currently active. + # + # @return [Time, nil] + required :current_billing_period_end_date, Time, nil?: true + + # @!attribute current_billing_period_start_date + # The start date of the current billing period. This is an inclusive timestamp; + # the instant returned is exactly the beginning of the billing period. Set to null + # if this price interval is not currently active. + # + # @return [Time, nil] + required :current_billing_period_start_date, Time, nil?: true + + # @!attribute end_date + # The end date of the price interval. This is the date that Orb stops billing for + # this price. + # + # @return [Time, nil] + required :end_date, Time, nil?: true + + # @!attribute filter + # An additional filter to apply to usage queries. + # + # @return [String, nil] + required :filter, String, nil?: true + + # @!attribute fixed_fee_quantity_transitions + # The fixed fee quantity transitions for this price interval. This is only + # relevant for fixed fees. + # + # @return [Array, nil] + required :fixed_fee_quantity_transitions, + -> { Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval::FixedFeeQuantityTransition] }, + nil?: true + + # @!attribute price + # The Price resource represents a price that can be billed on a subscription, + # resulting in a charge on an invoice in the form of an invoice line item. Prices + # take a quantity and determine an amount to bill. + # + # Orb supports a few different pricing models out of the box. Each of these models + # is serialized differently in a given Price object. The model_type field + # determines the key for the configuration object that is present. + # + # For more on the types of prices, see + # [the core concepts documentation](/core-concepts#plan-and-price) + # + # @return [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk] + required :price, union: -> { Orb::Price } + + # @!attribute start_date + # The start date of the price interval. This is the date that Orb starts billing + # for this price. + # + # @return [Time] + required :start_date, Time + + # @!attribute usage_customer_ids + # A list of customer IDs whose usage events will be aggregated and billed under + # this price interval. + # + # @return [Array, nil] + required :usage_customer_ids, Orb::Internal::Type::ArrayOf[String], nil?: true + + # @!method initialize(id:, billing_cycle_day:, current_billing_period_end_date:, current_billing_period_start_date:, end_date:, filter:, fixed_fee_quantity_transitions:, price:, start_date:, usage_customer_ids:) + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval} for more details. + # + # The Price Interval resource represents a period of time for which a price will + # bill on a subscription. A subscription’s price intervals define its billing + # behavior. + # + # @param id [String] + # + # @param billing_cycle_day [Integer] The day of the month that Orb bills for this price + # + # @param current_billing_period_end_date [Time, nil] The end of the current billing period. This is an exclusive timestamp, such that + # + # @param current_billing_period_start_date [Time, nil] The start date of the current billing period. This is an inclusive timestamp; th + # + # @param end_date [Time, nil] The end date of the price interval. This is the date that Orb stops billing for + # + # @param filter [String, nil] An additional filter to apply to usage queries. + # + # @param fixed_fee_quantity_transitions [Array, nil] The fixed fee quantity transitions for this price interval. This is only relevan + # + # @param price [Orb::Models::Price::Unit, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::Tiered, Orb::Models::Price::TieredBps, Orb::Models::Price::Bps, Orb::Models::Price::BulkBps, Orb::Models::Price::Bulk, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::GroupedTiered, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk] The Price resource represents a price that can be billed on a subscription, resu + # + # @param start_date [Time] The start date of the price interval. This is the date that Orb starts billing f + # + # @param usage_customer_ids [Array, nil] A list of customer IDs whose usage events will be aggregated and billed under th + + class FixedFeeQuantityTransition < Orb::Internal::Type::BaseModel + # @!attribute effective_date + # + # @return [Time] + required :effective_date, Time + + # @!attribute price_id + # + # @return [String] + required :price_id, String + + # @!attribute quantity + # + # @return [Integer] + required :quantity, Integer + + # @!method initialize(effective_date:, price_id:, quantity:) + # @param effective_date [Time] + # @param price_id [String] + # @param quantity [Integer] + end + end + + # @see Orb::Models::SubscriptionRedeemCouponResponse#redeemed_coupon + class RedeemedCoupon < Orb::Internal::Type::BaseModel + # @!attribute coupon_id + # + # @return [String] + required :coupon_id, String + + # @!attribute end_date + # + # @return [Time, nil] + required :end_date, Time, nil?: true + + # @!attribute start_date + # + # @return [Time] + required :start_date, Time + + # @!method initialize(coupon_id:, end_date:, start_date:) + # @param coupon_id [String] + # @param end_date [Time, nil] + # @param start_date [Time] + end + + # @see Orb::Models::SubscriptionRedeemCouponResponse#status + module Status + extend Orb::Internal::Type::Enum + + ACTIVE = :active + ENDED = :ended + UPCOMING = :upcoming + + # @!method self.values + # @return [Array] + end + + # @see Orb::Models::SubscriptionRedeemCouponResponse#trial_info + class TrialInfo < Orb::Internal::Type::BaseModel + # @!attribute end_date + # + # @return [Time, nil] + required :end_date, Time, nil?: true + + # @!method initialize(end_date:) + # @param end_date [Time, nil] + end + + # @see Orb::Models::SubscriptionRedeemCouponResponse#changed_resources + class ChangedResources < Orb::Internal::Type::BaseModel + # @!attribute created_credit_notes + # The credit notes that were created as part of this operation. + # + # @return [Array] + required :created_credit_notes, -> { Orb::Internal::Type::ArrayOf[Orb::CreditNote] } + + # @!attribute created_invoices + # The invoices that were created as part of this operation. + # + # @return [Array] + required :created_invoices, -> { Orb::Internal::Type::ArrayOf[Orb::Invoice] } + + # @!attribute voided_credit_notes + # The credit notes that were voided as part of this operation. + # + # @return [Array] + required :voided_credit_notes, -> { Orb::Internal::Type::ArrayOf[Orb::CreditNote] } + + # @!attribute voided_invoices + # The invoices that were voided as part of this operation. + # + # @return [Array] + required :voided_invoices, -> { Orb::Internal::Type::ArrayOf[Orb::Invoice] } + + # @!method initialize(created_credit_notes:, created_invoices:, voided_credit_notes:, voided_invoices:) + # The resources that were changed as part of this operation. Only present when + # fetched through the subscription changes API or if the + # `include_changed_resources` parameter was passed in the request. + # + # @param created_credit_notes [Array] The credit notes that were created as part of this operation. + # + # @param created_invoices [Array] The invoices that were created as part of this operation. + # + # @param voided_credit_notes [Array] The credit notes that were voided as part of this operation. + # + # @param voided_invoices [Array] The invoices that were voided as part of this operation. + end + end + end +end diff --git a/lib/orb/resources/subscriptions.rb b/lib/orb/resources/subscriptions.rb index 34f2639c..df8161f2 100644 --- a/lib/orb/resources/subscriptions.rb +++ b/lib/orb/resources/subscriptions.rb @@ -982,6 +982,39 @@ def price_intervals(subscription_id, params = {}) ) end + # Some parameter documentations has been truncated, see + # {Orb::Models::SubscriptionRedeemCouponParams} for more details. + # + # Redeem a coupon effective at a given time. + # + # @overload redeem_coupon(subscription_id, change_option:, coupon_id:, allow_invoice_credit_or_void: nil, change_date: nil, request_options: {}) + # + # @param subscription_id [String] + # + # @param change_option [Symbol, Orb::Models::SubscriptionRedeemCouponParams::ChangeOption] + # + # @param coupon_id [String] Coupon ID to be redeemed for this subscription. + # + # @param allow_invoice_credit_or_void [Boolean, nil] If false, this request will fail if it would void an issued invoice or create a + # + # @param change_date [Time, nil] The date that the coupon discount should take effect. This parameter can only be + # + # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Orb::Models::SubscriptionRedeemCouponResponse] + # + # @see Orb::Models::SubscriptionRedeemCouponParams + def redeem_coupon(subscription_id, params) + parsed, options = Orb::SubscriptionRedeemCouponParams.dump_request(params) + @client.request( + method: :post, + path: ["subscriptions/%1$s/redeem_coupon", subscription_id], + body: parsed, + model: Orb::Models::SubscriptionRedeemCouponResponse, + options: options + ) + end + # Some parameter documentations has been truncated, see # {Orb::Models::SubscriptionSchedulePlanChangeParams} for more details. # diff --git a/lib/orb/version.rb b/lib/orb/version.rb index cc93d37e..75f05a0c 100644 --- a/lib/orb/version.rb +++ b/lib/orb/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Orb - VERSION = "0.9.1" + VERSION = "0.10.0" end diff --git a/rbi/orb/models.rbi b/rbi/orb/models.rbi index 666b12d6..70cb8287 100644 --- a/rbi/orb/models.rbi +++ b/rbi/orb/models.rbi @@ -214,6 +214,8 @@ module Orb SubscriptionPriceIntervalsParams = Orb::Models::SubscriptionPriceIntervalsParams + SubscriptionRedeemCouponParams = Orb::Models::SubscriptionRedeemCouponParams + SubscriptionsAPI = Orb::Models::SubscriptionsAPI SubscriptionSchedulePlanChangeParams = diff --git a/rbi/orb/models/invoice.rbi b/rbi/orb/models/invoice.rbi index 6e93fc95..2920ecdc 100644 --- a/rbi/orb/models/invoice.rbi +++ b/rbi/orb/models/invoice.rbi @@ -1646,7 +1646,7 @@ module Orb # # For more on the types of prices, see # [the core concepts documentation](/core-concepts#plan-and-price) - sig { returns(T.nilable(Orb::Price::Variants)) } + sig { returns(Orb::Price::Variants) } attr_accessor :price # Either the fixed fee quantity or the usage during the service period. @@ -1710,37 +1710,35 @@ module Orb name: String, partially_invoiced_amount: String, price: - T.nilable( - T.any( - Orb::Price::Unit::OrHash, - Orb::Price::Package::OrHash, - Orb::Price::Matrix::OrHash, - Orb::Price::Tiered::OrHash, - Orb::Price::TieredBps::OrHash, - Orb::Price::Bps::OrHash, - Orb::Price::BulkBps::OrHash, - Orb::Price::Bulk::OrHash, - Orb::Price::ThresholdTotalAmount::OrHash, - Orb::Price::TieredPackage::OrHash, - Orb::Price::GroupedTiered::OrHash, - Orb::Price::TieredWithMinimum::OrHash, - Orb::Price::TieredPackageWithMinimum::OrHash, - Orb::Price::PackageWithAllocation::OrHash, - Orb::Price::UnitWithPercent::OrHash, - Orb::Price::MatrixWithAllocation::OrHash, - Orb::Price::TieredWithProration::OrHash, - Orb::Price::UnitWithProration::OrHash, - Orb::Price::GroupedAllocation::OrHash, - Orb::Price::GroupedWithProratedMinimum::OrHash, - Orb::Price::GroupedWithMeteredMinimum::OrHash, - Orb::Price::MatrixWithDisplayName::OrHash, - Orb::Price::BulkWithProration::OrHash, - Orb::Price::GroupedTieredPackage::OrHash, - Orb::Price::MaxGroupTieredPackage::OrHash, - Orb::Price::ScalableMatrixWithUnitPricing::OrHash, - Orb::Price::ScalableMatrixWithTieredPricing::OrHash, - Orb::Price::CumulativeGroupedBulk::OrHash - ) + T.any( + Orb::Price::Unit::OrHash, + Orb::Price::Package::OrHash, + Orb::Price::Matrix::OrHash, + Orb::Price::Tiered::OrHash, + Orb::Price::TieredBps::OrHash, + Orb::Price::Bps::OrHash, + Orb::Price::BulkBps::OrHash, + Orb::Price::Bulk::OrHash, + Orb::Price::ThresholdTotalAmount::OrHash, + Orb::Price::TieredPackage::OrHash, + Orb::Price::GroupedTiered::OrHash, + Orb::Price::TieredWithMinimum::OrHash, + Orb::Price::TieredPackageWithMinimum::OrHash, + Orb::Price::PackageWithAllocation::OrHash, + Orb::Price::UnitWithPercent::OrHash, + Orb::Price::MatrixWithAllocation::OrHash, + Orb::Price::TieredWithProration::OrHash, + Orb::Price::UnitWithProration::OrHash, + Orb::Price::GroupedAllocation::OrHash, + Orb::Price::GroupedWithProratedMinimum::OrHash, + Orb::Price::GroupedWithMeteredMinimum::OrHash, + Orb::Price::MatrixWithDisplayName::OrHash, + Orb::Price::BulkWithProration::OrHash, + Orb::Price::GroupedTieredPackage::OrHash, + Orb::Price::MaxGroupTieredPackage::OrHash, + Orb::Price::ScalableMatrixWithUnitPricing::OrHash, + Orb::Price::ScalableMatrixWithTieredPricing::OrHash, + Orb::Price::CumulativeGroupedBulk::OrHash ), quantity: Float, start_date: Time, @@ -1840,7 +1838,7 @@ module Orb minimum_amount: T.nilable(String), name: String, partially_invoiced_amount: String, - price: T.nilable(Orb::Price::Variants), + price: Orb::Price::Variants, quantity: Float, start_date: Time, sub_line_items: diff --git a/rbi/orb/models/invoice_fetch_upcoming_response.rbi b/rbi/orb/models/invoice_fetch_upcoming_response.rbi index f21ccac1..afdd7e2b 100644 --- a/rbi/orb/models/invoice_fetch_upcoming_response.rbi +++ b/rbi/orb/models/invoice_fetch_upcoming_response.rbi @@ -2421,7 +2421,7 @@ module Orb # # For more on the types of prices, see # [the core concepts documentation](/core-concepts#plan-and-price) - sig { returns(T.nilable(Orb::Price::Variants)) } + sig { returns(Orb::Price::Variants) } attr_accessor :price # Either the fixed fee quantity or the usage during the service period. @@ -2503,37 +2503,35 @@ module Orb name: String, partially_invoiced_amount: String, price: - T.nilable( - T.any( - Orb::Price::Unit::OrHash, - Orb::Price::Package::OrHash, - Orb::Price::Matrix::OrHash, - Orb::Price::Tiered::OrHash, - Orb::Price::TieredBps::OrHash, - Orb::Price::Bps::OrHash, - Orb::Price::BulkBps::OrHash, - Orb::Price::Bulk::OrHash, - Orb::Price::ThresholdTotalAmount::OrHash, - Orb::Price::TieredPackage::OrHash, - Orb::Price::GroupedTiered::OrHash, - Orb::Price::TieredWithMinimum::OrHash, - Orb::Price::TieredPackageWithMinimum::OrHash, - Orb::Price::PackageWithAllocation::OrHash, - Orb::Price::UnitWithPercent::OrHash, - Orb::Price::MatrixWithAllocation::OrHash, - Orb::Price::TieredWithProration::OrHash, - Orb::Price::UnitWithProration::OrHash, - Orb::Price::GroupedAllocation::OrHash, - Orb::Price::GroupedWithProratedMinimum::OrHash, - Orb::Price::GroupedWithMeteredMinimum::OrHash, - Orb::Price::MatrixWithDisplayName::OrHash, - Orb::Price::BulkWithProration::OrHash, - Orb::Price::GroupedTieredPackage::OrHash, - Orb::Price::MaxGroupTieredPackage::OrHash, - Orb::Price::ScalableMatrixWithUnitPricing::OrHash, - Orb::Price::ScalableMatrixWithTieredPricing::OrHash, - Orb::Price::CumulativeGroupedBulk::OrHash - ) + T.any( + Orb::Price::Unit::OrHash, + Orb::Price::Package::OrHash, + Orb::Price::Matrix::OrHash, + Orb::Price::Tiered::OrHash, + Orb::Price::TieredBps::OrHash, + Orb::Price::Bps::OrHash, + Orb::Price::BulkBps::OrHash, + Orb::Price::Bulk::OrHash, + Orb::Price::ThresholdTotalAmount::OrHash, + Orb::Price::TieredPackage::OrHash, + Orb::Price::GroupedTiered::OrHash, + Orb::Price::TieredWithMinimum::OrHash, + Orb::Price::TieredPackageWithMinimum::OrHash, + Orb::Price::PackageWithAllocation::OrHash, + Orb::Price::UnitWithPercent::OrHash, + Orb::Price::MatrixWithAllocation::OrHash, + Orb::Price::TieredWithProration::OrHash, + Orb::Price::UnitWithProration::OrHash, + Orb::Price::GroupedAllocation::OrHash, + Orb::Price::GroupedWithProratedMinimum::OrHash, + Orb::Price::GroupedWithMeteredMinimum::OrHash, + Orb::Price::MatrixWithDisplayName::OrHash, + Orb::Price::BulkWithProration::OrHash, + Orb::Price::GroupedTieredPackage::OrHash, + Orb::Price::MaxGroupTieredPackage::OrHash, + Orb::Price::ScalableMatrixWithUnitPricing::OrHash, + Orb::Price::ScalableMatrixWithTieredPricing::OrHash, + Orb::Price::CumulativeGroupedBulk::OrHash ), quantity: Float, start_date: Time, @@ -2644,7 +2642,7 @@ module Orb minimum_amount: T.nilable(String), name: String, partially_invoiced_amount: String, - price: T.nilable(Orb::Price::Variants), + price: Orb::Price::Variants, quantity: Float, start_date: Time, sub_line_items: diff --git a/rbi/orb/models/invoice_line_item_create_response.rbi b/rbi/orb/models/invoice_line_item_create_response.rbi index 1809b22a..f687aaa4 100644 --- a/rbi/orb/models/invoice_line_item_create_response.rbi +++ b/rbi/orb/models/invoice_line_item_create_response.rbi @@ -116,7 +116,7 @@ module Orb # # For more on the types of prices, see # [the core concepts documentation](/core-concepts#plan-and-price) - sig { returns(T.nilable(Orb::Price::Variants)) } + sig { returns(Orb::Price::Variants) } attr_accessor :price # Either the fixed fee quantity or the usage during the service period. @@ -194,37 +194,35 @@ module Orb name: String, partially_invoiced_amount: String, price: - T.nilable( - T.any( - Orb::Price::Unit::OrHash, - Orb::Price::Package::OrHash, - Orb::Price::Matrix::OrHash, - Orb::Price::Tiered::OrHash, - Orb::Price::TieredBps::OrHash, - Orb::Price::Bps::OrHash, - Orb::Price::BulkBps::OrHash, - Orb::Price::Bulk::OrHash, - Orb::Price::ThresholdTotalAmount::OrHash, - Orb::Price::TieredPackage::OrHash, - Orb::Price::GroupedTiered::OrHash, - Orb::Price::TieredWithMinimum::OrHash, - Orb::Price::TieredPackageWithMinimum::OrHash, - Orb::Price::PackageWithAllocation::OrHash, - Orb::Price::UnitWithPercent::OrHash, - Orb::Price::MatrixWithAllocation::OrHash, - Orb::Price::TieredWithProration::OrHash, - Orb::Price::UnitWithProration::OrHash, - Orb::Price::GroupedAllocation::OrHash, - Orb::Price::GroupedWithProratedMinimum::OrHash, - Orb::Price::GroupedWithMeteredMinimum::OrHash, - Orb::Price::MatrixWithDisplayName::OrHash, - Orb::Price::BulkWithProration::OrHash, - Orb::Price::GroupedTieredPackage::OrHash, - Orb::Price::MaxGroupTieredPackage::OrHash, - Orb::Price::ScalableMatrixWithUnitPricing::OrHash, - Orb::Price::ScalableMatrixWithTieredPricing::OrHash, - Orb::Price::CumulativeGroupedBulk::OrHash - ) + T.any( + Orb::Price::Unit::OrHash, + Orb::Price::Package::OrHash, + Orb::Price::Matrix::OrHash, + Orb::Price::Tiered::OrHash, + Orb::Price::TieredBps::OrHash, + Orb::Price::Bps::OrHash, + Orb::Price::BulkBps::OrHash, + Orb::Price::Bulk::OrHash, + Orb::Price::ThresholdTotalAmount::OrHash, + Orb::Price::TieredPackage::OrHash, + Orb::Price::GroupedTiered::OrHash, + Orb::Price::TieredWithMinimum::OrHash, + Orb::Price::TieredPackageWithMinimum::OrHash, + Orb::Price::PackageWithAllocation::OrHash, + Orb::Price::UnitWithPercent::OrHash, + Orb::Price::MatrixWithAllocation::OrHash, + Orb::Price::TieredWithProration::OrHash, + Orb::Price::UnitWithProration::OrHash, + Orb::Price::GroupedAllocation::OrHash, + Orb::Price::GroupedWithProratedMinimum::OrHash, + Orb::Price::GroupedWithMeteredMinimum::OrHash, + Orb::Price::MatrixWithDisplayName::OrHash, + Orb::Price::BulkWithProration::OrHash, + Orb::Price::GroupedTieredPackage::OrHash, + Orb::Price::MaxGroupTieredPackage::OrHash, + Orb::Price::ScalableMatrixWithUnitPricing::OrHash, + Orb::Price::ScalableMatrixWithTieredPricing::OrHash, + Orb::Price::CumulativeGroupedBulk::OrHash ), quantity: Float, start_date: Time, @@ -331,7 +329,7 @@ module Orb minimum_amount: T.nilable(String), name: String, partially_invoiced_amount: String, - price: T.nilable(Orb::Price::Variants), + price: Orb::Price::Variants, quantity: Float, start_date: Time, sub_line_items: diff --git a/rbi/orb/models/subscription_redeem_coupon_params.rbi b/rbi/orb/models/subscription_redeem_coupon_params.rbi new file mode 100644 index 00000000..40b63e70 --- /dev/null +++ b/rbi/orb/models/subscription_redeem_coupon_params.rbi @@ -0,0 +1,111 @@ +# typed: strong + +module Orb + module Models + class SubscriptionRedeemCouponParams < Orb::Internal::Type::BaseModel + extend Orb::Internal::Type::RequestParameters::Converter + include Orb::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Orb::SubscriptionRedeemCouponParams, Orb::Internal::AnyHash) + end + + sig do + returns(Orb::SubscriptionRedeemCouponParams::ChangeOption::OrSymbol) + end + attr_accessor :change_option + + # Coupon ID to be redeemed for this subscription. + sig { returns(String) } + attr_accessor :coupon_id + + # If false, this request will fail if it would void an issued invoice or create a + # credit note. Consider using this as a safety mechanism if you do not expect + # existing invoices to be changed. + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :allow_invoice_credit_or_void + + # The date that the coupon discount should take effect. This parameter can only be + # passed if the `change_option` is `requested_date`. + sig { returns(T.nilable(Time)) } + attr_accessor :change_date + + sig do + params( + change_option: + Orb::SubscriptionRedeemCouponParams::ChangeOption::OrSymbol, + coupon_id: String, + allow_invoice_credit_or_void: T.nilable(T::Boolean), + change_date: T.nilable(Time), + request_options: Orb::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + change_option:, + # Coupon ID to be redeemed for this subscription. + coupon_id:, + # If false, this request will fail if it would void an issued invoice or create a + # credit note. Consider using this as a safety mechanism if you do not expect + # existing invoices to be changed. + allow_invoice_credit_or_void: nil, + # The date that the coupon discount should take effect. This parameter can only be + # passed if the `change_option` is `requested_date`. + change_date: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + change_option: + Orb::SubscriptionRedeemCouponParams::ChangeOption::OrSymbol, + coupon_id: String, + allow_invoice_credit_or_void: T.nilable(T::Boolean), + change_date: T.nilable(Time), + request_options: Orb::RequestOptions + } + ) + end + def to_hash + end + + module ChangeOption + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Orb::SubscriptionRedeemCouponParams::ChangeOption) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + REQUESTED_DATE = + T.let( + :requested_date, + Orb::SubscriptionRedeemCouponParams::ChangeOption::TaggedSymbol + ) + END_OF_SUBSCRIPTION_TERM = + T.let( + :end_of_subscription_term, + Orb::SubscriptionRedeemCouponParams::ChangeOption::TaggedSymbol + ) + IMMEDIATE = + T.let( + :immediate, + Orb::SubscriptionRedeemCouponParams::ChangeOption::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::SubscriptionRedeemCouponParams::ChangeOption::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/orb/models/subscription_redeem_coupon_response.rbi b/rbi/orb/models/subscription_redeem_coupon_response.rbi new file mode 100644 index 00000000..c6345fd1 --- /dev/null +++ b/rbi/orb/models/subscription_redeem_coupon_response.rbi @@ -0,0 +1,3557 @@ +# typed: strong + +module Orb + module Models + class SubscriptionRedeemCouponResponse < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse, + Orb::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + # The current plan phase that is active, only if the subscription's plan has + # phases. + sig { returns(T.nilable(Integer)) } + attr_accessor :active_plan_phase_order + + # The adjustment intervals for this subscription sorted by the start_date of the + # adjustment interval. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval + ] + ) + end + attr_accessor :adjustment_intervals + + # Determines whether issued invoices for this subscription will automatically be + # charged with the saved payment method on the due date. This property defaults to + # the plan's behavior. If null, defaults to the customer's setting. + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :auto_collection + + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration + ) + end + attr_reader :billing_cycle_anchor_configuration + + sig do + params( + billing_cycle_anchor_configuration: + Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration::OrHash + ).void + end + attr_writer :billing_cycle_anchor_configuration + + # The day of the month on which the billing cycle is anchored. If the maximum + # number of days in a month is greater than this value, the last day of the month + # is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing + # period begins on the 30th. + sig { returns(Integer) } + attr_accessor :billing_cycle_day + + sig { returns(Time) } + attr_accessor :created_at + + # The end of the current billing period. This is an exclusive timestamp, such that + # the instant returned is not part of the billing period. Set to null for + # subscriptions that are not currently active. + sig { returns(T.nilable(Time)) } + attr_accessor :current_billing_period_end_date + + # The start date of the current billing period. This is an inclusive timestamp; + # the instant returned is exactly the beginning of the billing period. Set to null + # if the subscription is not currently active. + sig { returns(T.nilable(Time)) } + attr_accessor :current_billing_period_start_date + + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. + sig { returns(Orb::Customer) } + attr_reader :customer + + sig { params(customer: Orb::Customer::OrHash).void } + attr_writer :customer + + # Determines the default memo on this subscriptions' invoices. Note that if this + # is not provided, it is determined by the plan configuration. + sig { returns(T.nilable(String)) } + attr_accessor :default_invoice_memo + + # The discount intervals for this subscription sorted by the start_date. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Variants + ] + ) + end + attr_accessor :discount_intervals + + # The date Orb stops billing for this subscription. + sig { returns(T.nilable(Time)) } + attr_accessor :end_date + + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::FixedFeeQuantitySchedule + ] + ) + end + attr_accessor :fixed_fee_quantity_schedule + + sig { returns(T.nilable(String)) } + attr_accessor :invoicing_threshold + + # The maximum intervals for this subscription sorted by the start_date. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval + ] + ) + end + attr_accessor :maximum_intervals + + # User specified key-value pairs for the resource. If not present, this defaults + # to an empty dictionary. Individual keys can be removed by setting the value to + # `null`, and the entire metadata mapping can be cleared by setting `metadata` to + # `null`. + sig { returns(T::Hash[Symbol, String]) } + attr_accessor :metadata + + # The minimum intervals for this subscription sorted by the start_date. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval + ] + ) + end + attr_accessor :minimum_intervals + + # The name of the subscription. + sig { returns(String) } + attr_accessor :name + + # Determines the difference between the invoice issue date for subscription + # invoices as the date that they are due. A value of `0` here represents that the + # invoice is due on issue, whereas a value of `30` represents that the customer + # has a month to pay the invoice. + sig { returns(Integer) } + attr_accessor :net_terms + + # A pending subscription change if one exists on this subscription. + sig do + returns( + T.nilable( + Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange + ) + ) + end + attr_reader :pending_subscription_change + + sig do + params( + pending_subscription_change: + T.nilable( + Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange::OrHash + ) + ).void + end + attr_writer :pending_subscription_change + + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). + sig { returns(T.nilable(Orb::Plan)) } + attr_reader :plan + + sig { params(plan: T.nilable(Orb::Plan::OrHash)).void } + attr_writer :plan + + # The price intervals for this subscription. + sig do + returns( + T::Array[Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval] + ) + end + attr_accessor :price_intervals + + sig do + returns( + T.nilable( + Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon + ) + ) + end + attr_reader :redeemed_coupon + + sig do + params( + redeemed_coupon: + T.nilable( + Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon::OrHash + ) + ).void + end + attr_writer :redeemed_coupon + + # The date Orb starts billing for this subscription. + sig { returns(Time) } + attr_accessor :start_date + + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::Status::TaggedSymbol + ) + end + attr_accessor :status + + sig { returns(Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo) } + attr_reader :trial_info + + sig do + params( + trial_info: + Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo::OrHash + ).void + end + attr_writer :trial_info + + # The resources that were changed as part of this operation. Only present when + # fetched through the subscription changes API or if the + # `include_changed_resources` parameter was passed in the request. + sig do + returns( + T.nilable( + Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources + ) + ) + end + attr_reader :changed_resources + + sig do + params( + changed_resources: + T.nilable( + Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources::OrHash + ) + ).void + end + attr_writer :changed_resources + + sig do + params( + id: String, + active_plan_phase_order: T.nilable(Integer), + adjustment_intervals: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::OrHash + ], + auto_collection: T.nilable(T::Boolean), + billing_cycle_anchor_configuration: + Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration::OrHash, + billing_cycle_day: Integer, + created_at: Time, + current_billing_period_end_date: T.nilable(Time), + current_billing_period_start_date: T.nilable(Time), + customer: Orb::Customer::OrHash, + default_invoice_memo: T.nilable(String), + discount_intervals: + T::Array[ + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::OrHash, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::OrHash, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::OrHash + ) + ], + end_date: T.nilable(Time), + fixed_fee_quantity_schedule: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::FixedFeeQuantitySchedule::OrHash + ], + invoicing_threshold: T.nilable(String), + maximum_intervals: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::OrHash + ], + metadata: T::Hash[Symbol, String], + minimum_intervals: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::OrHash + ], + name: String, + net_terms: Integer, + pending_subscription_change: + T.nilable( + Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange::OrHash + ), + plan: T.nilable(Orb::Plan::OrHash), + price_intervals: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval::OrHash + ], + redeemed_coupon: + T.nilable( + Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon::OrHash + ), + start_date: Time, + status: + Orb::Models::SubscriptionRedeemCouponResponse::Status::OrSymbol, + trial_info: + Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo::OrHash, + changed_resources: + T.nilable( + Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources::OrHash + ) + ).returns(T.attached_class) + end + def self.new( + id:, + # The current plan phase that is active, only if the subscription's plan has + # phases. + active_plan_phase_order:, + # The adjustment intervals for this subscription sorted by the start_date of the + # adjustment interval. + adjustment_intervals:, + # Determines whether issued invoices for this subscription will automatically be + # charged with the saved payment method on the due date. This property defaults to + # the plan's behavior. If null, defaults to the customer's setting. + auto_collection:, + billing_cycle_anchor_configuration:, + # The day of the month on which the billing cycle is anchored. If the maximum + # number of days in a month is greater than this value, the last day of the month + # is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing + # period begins on the 30th. + billing_cycle_day:, + created_at:, + # The end of the current billing period. This is an exclusive timestamp, such that + # the instant returned is not part of the billing period. Set to null for + # subscriptions that are not currently active. + current_billing_period_end_date:, + # The start date of the current billing period. This is an inclusive timestamp; + # the instant returned is exactly the beginning of the billing period. Set to null + # if the subscription is not currently active. + current_billing_period_start_date:, + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. + customer:, + # Determines the default memo on this subscriptions' invoices. Note that if this + # is not provided, it is determined by the plan configuration. + default_invoice_memo:, + # The discount intervals for this subscription sorted by the start_date. + discount_intervals:, + # The date Orb stops billing for this subscription. + end_date:, + fixed_fee_quantity_schedule:, + invoicing_threshold:, + # The maximum intervals for this subscription sorted by the start_date. + maximum_intervals:, + # User specified key-value pairs for the resource. If not present, this defaults + # to an empty dictionary. Individual keys can be removed by setting the value to + # `null`, and the entire metadata mapping can be cleared by setting `metadata` to + # `null`. + metadata:, + # The minimum intervals for this subscription sorted by the start_date. + minimum_intervals:, + # The name of the subscription. + name:, + # Determines the difference between the invoice issue date for subscription + # invoices as the date that they are due. A value of `0` here represents that the + # invoice is due on issue, whereas a value of `30` represents that the customer + # has a month to pay the invoice. + net_terms:, + # A pending subscription change if one exists on this subscription. + pending_subscription_change:, + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). + plan:, + # The price intervals for this subscription. + price_intervals:, + redeemed_coupon:, + # The date Orb starts billing for this subscription. + start_date:, + status:, + trial_info:, + # The resources that were changed as part of this operation. Only present when + # fetched through the subscription changes API or if the + # `include_changed_resources` parameter was passed in the request. + changed_resources: nil + ) + end + + sig do + override.returns( + { + id: String, + active_plan_phase_order: T.nilable(Integer), + adjustment_intervals: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval + ], + auto_collection: T.nilable(T::Boolean), + billing_cycle_anchor_configuration: + Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration, + billing_cycle_day: Integer, + created_at: Time, + current_billing_period_end_date: T.nilable(Time), + current_billing_period_start_date: T.nilable(Time), + customer: Orb::Customer, + default_invoice_memo: T.nilable(String), + discount_intervals: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Variants + ], + end_date: T.nilable(Time), + fixed_fee_quantity_schedule: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::FixedFeeQuantitySchedule + ], + invoicing_threshold: T.nilable(String), + maximum_intervals: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval + ], + metadata: T::Hash[Symbol, String], + minimum_intervals: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval + ], + name: String, + net_terms: Integer, + pending_subscription_change: + T.nilable( + Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange + ), + plan: T.nilable(Orb::Plan), + price_intervals: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval + ], + redeemed_coupon: + T.nilable( + Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon + ), + start_date: Time, + status: + Orb::Models::SubscriptionRedeemCouponResponse::Status::TaggedSymbol, + trial_info: + Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo, + changed_resources: + T.nilable( + Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources + ) + } + ) + end + def to_hash + end + + class AdjustmentInterval < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval, + Orb::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Variants + ) + end + attr_accessor :adjustment + + # The price interval IDs that this adjustment applies to. + sig { returns(T::Array[String]) } + attr_accessor :applies_to_price_interval_ids + + # The end date of the adjustment interval. + sig { returns(T.nilable(Time)) } + attr_accessor :end_date + + # The start date of the adjustment interval. + sig { returns(Time) } + attr_accessor :start_date + + sig do + params( + id: String, + adjustment: + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::OrHash, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::OrHash, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::OrHash, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::OrHash, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::OrHash + ), + applies_to_price_interval_ids: T::Array[String], + end_date: T.nilable(Time), + start_date: Time + ).returns(T.attached_class) + end + def self.new( + id:, + adjustment:, + # The price interval IDs that this adjustment applies to. + applies_to_price_interval_ids:, + # The end date of the adjustment interval. + end_date:, + # The start date of the adjustment interval. + start_date: + ) + end + + sig do + override.returns( + { + id: String, + adjustment: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Variants, + applies_to_price_interval_ids: T::Array[String], + end_date: T.nilable(Time), + start_date: Time + } + ) + end + def to_hash + end + + module Adjustment + extend Orb::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum + ) + end + + class UsageDiscount < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount, + Orb::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig { returns(Symbol) } + attr_accessor :adjustment_type + + # The price IDs that this adjustment applies to. + sig { returns(T::Array[String]) } + attr_accessor :applies_to_price_ids + + # The filters that determine which prices to apply this adjustment to. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter + ] + ) + end + attr_accessor :filters + + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + sig { returns(T::Boolean) } + attr_accessor :is_invoice_level + + # The plan phase in which this adjustment is active. + sig { returns(T.nilable(Integer)) } + attr_accessor :plan_phase_order + + # The reason for the adjustment. + sig { returns(T.nilable(String)) } + attr_accessor :reason + + # The number of usage units by which to discount the price this adjustment applies + # to in a given billing period. + sig { returns(Float) } + attr_accessor :usage_discount + + sig do + params( + id: String, + applies_to_price_ids: T::Array[String], + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::OrHash + ], + is_invoice_level: T::Boolean, + plan_phase_order: T.nilable(Integer), + reason: T.nilable(String), + usage_discount: Float, + adjustment_type: Symbol + ).returns(T.attached_class) + end + def self.new( + id:, + # The price IDs that this adjustment applies to. + applies_to_price_ids:, + # The filters that determine which prices to apply this adjustment to. + filters:, + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + is_invoice_level:, + # The plan phase in which this adjustment is active. + plan_phase_order:, + # The reason for the adjustment. + reason:, + # The number of usage units by which to discount the price this adjustment applies + # to in a given billing period. + usage_discount:, + adjustment_type: :usage_discount + ) + end + + sig do + override.returns( + { + id: String, + adjustment_type: Symbol, + applies_to_price_ids: T::Array[String], + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter + ], + is_invoice_level: T::Boolean, + plan_phase_order: T.nilable(Integer), + reason: T.nilable(String), + usage_discount: Float + } + ) + end + def to_hash + end + + class Filter < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter, + Orb::Internal::AnyHash + ) + end + + # The property of the price to filter on. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol + ) + end + attr_accessor :field + + # Should prices that match the filter be included or excluded. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Operator::TaggedSymbol + ) + end + attr_accessor :operator + + # The IDs or values that match this filter. + sig { returns(T::Array[String]) } + attr_accessor :values + + sig do + params( + field: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field::OrSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Operator::OrSymbol, + values: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # The property of the price to filter on. + field:, + # Should prices that match the filter be included or excluded. + operator:, + # The IDs or values that match this filter. + values: + ) + end + + sig do + override.returns( + { + field: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Operator::TaggedSymbol, + values: T::Array[String] + } + ) + end + def to_hash + end + + # The property of the price to filter on. + module Field + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRICE_ID = + T.let( + :price_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol + ) + ITEM_ID = + T.let( + :item_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol + ) + PRICE_TYPE = + T.let( + :price_type, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol + ) + CURRENCY = + T.let( + :currency, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol + ) + PRICING_UNIT_ID = + T.let( + :pricing_unit_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Field::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Should prices that match the filter be included or excluded. + module Operator + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Operator + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCLUDES = + T.let( + :includes, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Operator::TaggedSymbol + ) + EXCLUDES = + T.let( + :excludes, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Operator::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::Operator::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class AmountDiscount < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount, + Orb::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig { returns(Symbol) } + attr_accessor :adjustment_type + + # The amount by which to discount the prices this adjustment applies to in a given + # billing period. + sig { returns(String) } + attr_accessor :amount_discount + + # The price IDs that this adjustment applies to. + sig { returns(T::Array[String]) } + attr_accessor :applies_to_price_ids + + # The filters that determine which prices to apply this adjustment to. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter + ] + ) + end + attr_accessor :filters + + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + sig { returns(T::Boolean) } + attr_accessor :is_invoice_level + + # The plan phase in which this adjustment is active. + sig { returns(T.nilable(Integer)) } + attr_accessor :plan_phase_order + + # The reason for the adjustment. + sig { returns(T.nilable(String)) } + attr_accessor :reason + + sig do + params( + id: String, + amount_discount: String, + applies_to_price_ids: T::Array[String], + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::OrHash + ], + is_invoice_level: T::Boolean, + plan_phase_order: T.nilable(Integer), + reason: T.nilable(String), + adjustment_type: Symbol + ).returns(T.attached_class) + end + def self.new( + id:, + # The amount by which to discount the prices this adjustment applies to in a given + # billing period. + amount_discount:, + # The price IDs that this adjustment applies to. + applies_to_price_ids:, + # The filters that determine which prices to apply this adjustment to. + filters:, + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + is_invoice_level:, + # The plan phase in which this adjustment is active. + plan_phase_order:, + # The reason for the adjustment. + reason:, + adjustment_type: :amount_discount + ) + end + + sig do + override.returns( + { + id: String, + adjustment_type: Symbol, + amount_discount: String, + applies_to_price_ids: T::Array[String], + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter + ], + is_invoice_level: T::Boolean, + plan_phase_order: T.nilable(Integer), + reason: T.nilable(String) + } + ) + end + def to_hash + end + + class Filter < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter, + Orb::Internal::AnyHash + ) + end + + # The property of the price to filter on. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol + ) + end + attr_accessor :field + + # Should prices that match the filter be included or excluded. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Operator::TaggedSymbol + ) + end + attr_accessor :operator + + # The IDs or values that match this filter. + sig { returns(T::Array[String]) } + attr_accessor :values + + sig do + params( + field: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field::OrSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Operator::OrSymbol, + values: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # The property of the price to filter on. + field:, + # Should prices that match the filter be included or excluded. + operator:, + # The IDs or values that match this filter. + values: + ) + end + + sig do + override.returns( + { + field: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Operator::TaggedSymbol, + values: T::Array[String] + } + ) + end + def to_hash + end + + # The property of the price to filter on. + module Field + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRICE_ID = + T.let( + :price_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol + ) + ITEM_ID = + T.let( + :item_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol + ) + PRICE_TYPE = + T.let( + :price_type, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol + ) + CURRENCY = + T.let( + :currency, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol + ) + PRICING_UNIT_ID = + T.let( + :pricing_unit_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Field::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Should prices that match the filter be included or excluded. + module Operator + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Operator + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCLUDES = + T.let( + :includes, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Operator::TaggedSymbol + ) + EXCLUDES = + T.let( + :excludes, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Operator::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::Operator::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class PercentageDiscount < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount, + Orb::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig { returns(Symbol) } + attr_accessor :adjustment_type + + # The price IDs that this adjustment applies to. + sig { returns(T::Array[String]) } + attr_accessor :applies_to_price_ids + + # The filters that determine which prices to apply this adjustment to. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter + ] + ) + end + attr_accessor :filters + + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + sig { returns(T::Boolean) } + attr_accessor :is_invoice_level + + # The percentage (as a value between 0 and 1) by which to discount the price + # intervals this adjustment applies to in a given billing period. + sig { returns(Float) } + attr_accessor :percentage_discount + + # The plan phase in which this adjustment is active. + sig { returns(T.nilable(Integer)) } + attr_accessor :plan_phase_order + + # The reason for the adjustment. + sig { returns(T.nilable(String)) } + attr_accessor :reason + + sig do + params( + id: String, + applies_to_price_ids: T::Array[String], + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::OrHash + ], + is_invoice_level: T::Boolean, + percentage_discount: Float, + plan_phase_order: T.nilable(Integer), + reason: T.nilable(String), + adjustment_type: Symbol + ).returns(T.attached_class) + end + def self.new( + id:, + # The price IDs that this adjustment applies to. + applies_to_price_ids:, + # The filters that determine which prices to apply this adjustment to. + filters:, + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + is_invoice_level:, + # The percentage (as a value between 0 and 1) by which to discount the price + # intervals this adjustment applies to in a given billing period. + percentage_discount:, + # The plan phase in which this adjustment is active. + plan_phase_order:, + # The reason for the adjustment. + reason:, + adjustment_type: :percentage_discount + ) + end + + sig do + override.returns( + { + id: String, + adjustment_type: Symbol, + applies_to_price_ids: T::Array[String], + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter + ], + is_invoice_level: T::Boolean, + percentage_discount: Float, + plan_phase_order: T.nilable(Integer), + reason: T.nilable(String) + } + ) + end + def to_hash + end + + class Filter < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter, + Orb::Internal::AnyHash + ) + end + + # The property of the price to filter on. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol + ) + end + attr_accessor :field + + # Should prices that match the filter be included or excluded. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Operator::TaggedSymbol + ) + end + attr_accessor :operator + + # The IDs or values that match this filter. + sig { returns(T::Array[String]) } + attr_accessor :values + + sig do + params( + field: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field::OrSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Operator::OrSymbol, + values: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # The property of the price to filter on. + field:, + # Should prices that match the filter be included or excluded. + operator:, + # The IDs or values that match this filter. + values: + ) + end + + sig do + override.returns( + { + field: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Operator::TaggedSymbol, + values: T::Array[String] + } + ) + end + def to_hash + end + + # The property of the price to filter on. + module Field + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRICE_ID = + T.let( + :price_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol + ) + ITEM_ID = + T.let( + :item_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol + ) + PRICE_TYPE = + T.let( + :price_type, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol + ) + CURRENCY = + T.let( + :currency, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol + ) + PRICING_UNIT_ID = + T.let( + :pricing_unit_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Field::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Should prices that match the filter be included or excluded. + module Operator + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Operator + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCLUDES = + T.let( + :includes, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Operator::TaggedSymbol + ) + EXCLUDES = + T.let( + :excludes, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Operator::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::Operator::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class Minimum < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum, + Orb::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig { returns(Symbol) } + attr_accessor :adjustment_type + + # The price IDs that this adjustment applies to. + sig { returns(T::Array[String]) } + attr_accessor :applies_to_price_ids + + # The filters that determine which prices to apply this adjustment to. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter + ] + ) + end + attr_accessor :filters + + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + sig { returns(T::Boolean) } + attr_accessor :is_invoice_level + + # The item ID that revenue from this minimum will be attributed to. + sig { returns(String) } + attr_accessor :item_id + + # The minimum amount to charge in a given billing period for the prices this + # adjustment applies to. + sig { returns(String) } + attr_accessor :minimum_amount + + # The plan phase in which this adjustment is active. + sig { returns(T.nilable(Integer)) } + attr_accessor :plan_phase_order + + # The reason for the adjustment. + sig { returns(T.nilable(String)) } + attr_accessor :reason + + sig do + params( + id: String, + applies_to_price_ids: T::Array[String], + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::OrHash + ], + is_invoice_level: T::Boolean, + item_id: String, + minimum_amount: String, + plan_phase_order: T.nilable(Integer), + reason: T.nilable(String), + adjustment_type: Symbol + ).returns(T.attached_class) + end + def self.new( + id:, + # The price IDs that this adjustment applies to. + applies_to_price_ids:, + # The filters that determine which prices to apply this adjustment to. + filters:, + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + is_invoice_level:, + # The item ID that revenue from this minimum will be attributed to. + item_id:, + # The minimum amount to charge in a given billing period for the prices this + # adjustment applies to. + minimum_amount:, + # The plan phase in which this adjustment is active. + plan_phase_order:, + # The reason for the adjustment. + reason:, + adjustment_type: :minimum + ) + end + + sig do + override.returns( + { + id: String, + adjustment_type: Symbol, + applies_to_price_ids: T::Array[String], + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter + ], + is_invoice_level: T::Boolean, + item_id: String, + minimum_amount: String, + plan_phase_order: T.nilable(Integer), + reason: T.nilable(String) + } + ) + end + def to_hash + end + + class Filter < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter, + Orb::Internal::AnyHash + ) + end + + # The property of the price to filter on. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field::TaggedSymbol + ) + end + attr_accessor :field + + # Should prices that match the filter be included or excluded. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Operator::TaggedSymbol + ) + end + attr_accessor :operator + + # The IDs or values that match this filter. + sig { returns(T::Array[String]) } + attr_accessor :values + + sig do + params( + field: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field::OrSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Operator::OrSymbol, + values: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # The property of the price to filter on. + field:, + # Should prices that match the filter be included or excluded. + operator:, + # The IDs or values that match this filter. + values: + ) + end + + sig do + override.returns( + { + field: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field::TaggedSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Operator::TaggedSymbol, + values: T::Array[String] + } + ) + end + def to_hash + end + + # The property of the price to filter on. + module Field + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRICE_ID = + T.let( + :price_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field::TaggedSymbol + ) + ITEM_ID = + T.let( + :item_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field::TaggedSymbol + ) + PRICE_TYPE = + T.let( + :price_type, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field::TaggedSymbol + ) + CURRENCY = + T.let( + :currency, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field::TaggedSymbol + ) + PRICING_UNIT_ID = + T.let( + :pricing_unit_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Field::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Should prices that match the filter be included or excluded. + module Operator + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Operator + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCLUDES = + T.let( + :includes, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Operator::TaggedSymbol + ) + EXCLUDES = + T.let( + :excludes, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Operator::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::Operator::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class Maximum < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum, + Orb::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig { returns(Symbol) } + attr_accessor :adjustment_type + + # The price IDs that this adjustment applies to. + sig { returns(T::Array[String]) } + attr_accessor :applies_to_price_ids + + # The filters that determine which prices to apply this adjustment to. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter + ] + ) + end + attr_accessor :filters + + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + sig { returns(T::Boolean) } + attr_accessor :is_invoice_level + + # The maximum amount to charge in a given billing period for the prices this + # adjustment applies to. + sig { returns(String) } + attr_accessor :maximum_amount + + # The plan phase in which this adjustment is active. + sig { returns(T.nilable(Integer)) } + attr_accessor :plan_phase_order + + # The reason for the adjustment. + sig { returns(T.nilable(String)) } + attr_accessor :reason + + sig do + params( + id: String, + applies_to_price_ids: T::Array[String], + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::OrHash + ], + is_invoice_level: T::Boolean, + maximum_amount: String, + plan_phase_order: T.nilable(Integer), + reason: T.nilable(String), + adjustment_type: Symbol + ).returns(T.attached_class) + end + def self.new( + id:, + # The price IDs that this adjustment applies to. + applies_to_price_ids:, + # The filters that determine which prices to apply this adjustment to. + filters:, + # True for adjustments that apply to an entire invocice, false for adjustments + # that apply to only one price. + is_invoice_level:, + # The maximum amount to charge in a given billing period for the prices this + # adjustment applies to. + maximum_amount:, + # The plan phase in which this adjustment is active. + plan_phase_order:, + # The reason for the adjustment. + reason:, + adjustment_type: :maximum + ) + end + + sig do + override.returns( + { + id: String, + adjustment_type: Symbol, + applies_to_price_ids: T::Array[String], + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter + ], + is_invoice_level: T::Boolean, + maximum_amount: String, + plan_phase_order: T.nilable(Integer), + reason: T.nilable(String) + } + ) + end + def to_hash + end + + class Filter < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter, + Orb::Internal::AnyHash + ) + end + + # The property of the price to filter on. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field::TaggedSymbol + ) + end + attr_accessor :field + + # Should prices that match the filter be included or excluded. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Operator::TaggedSymbol + ) + end + attr_accessor :operator + + # The IDs or values that match this filter. + sig { returns(T::Array[String]) } + attr_accessor :values + + sig do + params( + field: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field::OrSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Operator::OrSymbol, + values: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # The property of the price to filter on. + field:, + # Should prices that match the filter be included or excluded. + operator:, + # The IDs or values that match this filter. + values: + ) + end + + sig do + override.returns( + { + field: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field::TaggedSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Operator::TaggedSymbol, + values: T::Array[String] + } + ) + end + def to_hash + end + + # The property of the price to filter on. + module Field + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRICE_ID = + T.let( + :price_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field::TaggedSymbol + ) + ITEM_ID = + T.let( + :item_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field::TaggedSymbol + ) + PRICE_TYPE = + T.let( + :price_type, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field::TaggedSymbol + ) + CURRENCY = + T.let( + :currency, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field::TaggedSymbol + ) + PRICING_UNIT_ID = + T.let( + :pricing_unit_id, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Field::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Should prices that match the filter be included or excluded. + module Operator + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Operator + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCLUDES = + T.let( + :includes, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Operator::TaggedSymbol + ) + EXCLUDES = + T.let( + :excludes, + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Operator::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::Operator::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Variants + ] + ) + end + def self.variants + end + end + end + + class BillingCycleAnchorConfiguration < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration, + Orb::Internal::AnyHash + ) + end + + # The day of the month on which the billing cycle is anchored. If the maximum + # number of days in a month is greater than this value, the last day of the month + # is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing + # period begins on the 30th. + sig { returns(Integer) } + attr_accessor :day + + # The month on which the billing cycle is anchored (e.g. a quarterly price + # anchored in February would have cycles starting February, May, August, and + # November). + sig { returns(T.nilable(Integer)) } + attr_accessor :month + + # The year on which the billing cycle is anchored (e.g. a 2 year billing cycle + # anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.). + sig { returns(T.nilable(Integer)) } + attr_accessor :year + + sig do + params( + day: Integer, + month: T.nilable(Integer), + year: T.nilable(Integer) + ).returns(T.attached_class) + end + def self.new( + # The day of the month on which the billing cycle is anchored. If the maximum + # number of days in a month is greater than this value, the last day of the month + # is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing + # period begins on the 30th. + day:, + # The month on which the billing cycle is anchored (e.g. a quarterly price + # anchored in February would have cycles starting February, May, August, and + # November). + month: nil, + # The year on which the billing cycle is anchored (e.g. a 2 year billing cycle + # anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.). + year: nil + ) + end + + sig do + override.returns( + { + day: Integer, + month: T.nilable(Integer), + year: T.nilable(Integer) + } + ) + end + def to_hash + end + end + + module DiscountInterval + extend Orb::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage + ) + end + + class Amount < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount, + Orb::Internal::AnyHash + ) + end + + # Only available if discount_type is `amount`. + sig { returns(String) } + attr_accessor :amount_discount + + # The price interval ids that this discount interval applies to. + sig { returns(T::Array[String]) } + attr_accessor :applies_to_price_interval_ids + + sig { returns(Symbol) } + attr_accessor :discount_type + + # The end date of the discount interval. + sig { returns(T.nilable(Time)) } + attr_accessor :end_date + + # The filters that determine which prices this discount interval applies to. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter + ] + ) + end + attr_accessor :filters + + # The start date of the discount interval. + sig { returns(Time) } + attr_accessor :start_date + + sig do + params( + amount_discount: String, + applies_to_price_interval_ids: T::Array[String], + end_date: T.nilable(Time), + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::OrHash + ], + start_date: Time, + discount_type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Only available if discount_type is `amount`. + amount_discount:, + # The price interval ids that this discount interval applies to. + applies_to_price_interval_ids:, + # The end date of the discount interval. + end_date:, + # The filters that determine which prices this discount interval applies to. + filters:, + # The start date of the discount interval. + start_date:, + discount_type: :amount + ) + end + + sig do + override.returns( + { + amount_discount: String, + applies_to_price_interval_ids: T::Array[String], + discount_type: Symbol, + end_date: T.nilable(Time), + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter + ], + start_date: Time + } + ) + end + def to_hash + end + + class Filter < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter, + Orb::Internal::AnyHash + ) + end + + # The property of the price to filter on. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field::TaggedSymbol + ) + end + attr_accessor :field + + # Should prices that match the filter be included or excluded. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Operator::TaggedSymbol + ) + end + attr_accessor :operator + + # The IDs or values that match this filter. + sig { returns(T::Array[String]) } + attr_accessor :values + + sig do + params( + field: + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field::OrSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Operator::OrSymbol, + values: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # The property of the price to filter on. + field:, + # Should prices that match the filter be included or excluded. + operator:, + # The IDs or values that match this filter. + values: + ) + end + + sig do + override.returns( + { + field: + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field::TaggedSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Operator::TaggedSymbol, + values: T::Array[String] + } + ) + end + def to_hash + end + + # The property of the price to filter on. + module Field + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRICE_ID = + T.let( + :price_id, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field::TaggedSymbol + ) + ITEM_ID = + T.let( + :item_id, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field::TaggedSymbol + ) + PRICE_TYPE = + T.let( + :price_type, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field::TaggedSymbol + ) + CURRENCY = + T.let( + :currency, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field::TaggedSymbol + ) + PRICING_UNIT_ID = + T.let( + :pricing_unit_id, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Field::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Should prices that match the filter be included or excluded. + module Operator + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Operator + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCLUDES = + T.let( + :includes, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Operator::TaggedSymbol + ) + EXCLUDES = + T.let( + :excludes, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Operator::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::Operator::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class Percentage < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage, + Orb::Internal::AnyHash + ) + end + + # The price interval ids that this discount interval applies to. + sig { returns(T::Array[String]) } + attr_accessor :applies_to_price_interval_ids + + sig { returns(Symbol) } + attr_accessor :discount_type + + # The end date of the discount interval. + sig { returns(T.nilable(Time)) } + attr_accessor :end_date + + # The filters that determine which prices this discount interval applies to. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter + ] + ) + end + attr_accessor :filters + + # Only available if discount_type is `percentage`.This is a number between 0 + # and 1. + sig { returns(Float) } + attr_accessor :percentage_discount + + # The start date of the discount interval. + sig { returns(Time) } + attr_accessor :start_date + + sig do + params( + applies_to_price_interval_ids: T::Array[String], + end_date: T.nilable(Time), + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::OrHash + ], + percentage_discount: Float, + start_date: Time, + discount_type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The price interval ids that this discount interval applies to. + applies_to_price_interval_ids:, + # The end date of the discount interval. + end_date:, + # The filters that determine which prices this discount interval applies to. + filters:, + # Only available if discount_type is `percentage`.This is a number between 0 + # and 1. + percentage_discount:, + # The start date of the discount interval. + start_date:, + discount_type: :percentage + ) + end + + sig do + override.returns( + { + applies_to_price_interval_ids: T::Array[String], + discount_type: Symbol, + end_date: T.nilable(Time), + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter + ], + percentage_discount: Float, + start_date: Time + } + ) + end + def to_hash + end + + class Filter < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter, + Orb::Internal::AnyHash + ) + end + + # The property of the price to filter on. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field::TaggedSymbol + ) + end + attr_accessor :field + + # Should prices that match the filter be included or excluded. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Operator::TaggedSymbol + ) + end + attr_accessor :operator + + # The IDs or values that match this filter. + sig { returns(T::Array[String]) } + attr_accessor :values + + sig do + params( + field: + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field::OrSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Operator::OrSymbol, + values: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # The property of the price to filter on. + field:, + # Should prices that match the filter be included or excluded. + operator:, + # The IDs or values that match this filter. + values: + ) + end + + sig do + override.returns( + { + field: + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field::TaggedSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Operator::TaggedSymbol, + values: T::Array[String] + } + ) + end + def to_hash + end + + # The property of the price to filter on. + module Field + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRICE_ID = + T.let( + :price_id, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field::TaggedSymbol + ) + ITEM_ID = + T.let( + :item_id, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field::TaggedSymbol + ) + PRICE_TYPE = + T.let( + :price_type, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field::TaggedSymbol + ) + CURRENCY = + T.let( + :currency, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field::TaggedSymbol + ) + PRICING_UNIT_ID = + T.let( + :pricing_unit_id, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Field::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Should prices that match the filter be included or excluded. + module Operator + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Operator + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCLUDES = + T.let( + :includes, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Operator::TaggedSymbol + ) + EXCLUDES = + T.let( + :excludes, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Operator::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::Operator::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class Usage < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage, + Orb::Internal::AnyHash + ) + end + + # The price interval ids that this discount interval applies to. + sig { returns(T::Array[String]) } + attr_accessor :applies_to_price_interval_ids + + sig { returns(Symbol) } + attr_accessor :discount_type + + # The end date of the discount interval. + sig { returns(T.nilable(Time)) } + attr_accessor :end_date + + # The filters that determine which prices this discount interval applies to. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter + ] + ) + end + attr_accessor :filters + + # The start date of the discount interval. + sig { returns(Time) } + attr_accessor :start_date + + # Only available if discount_type is `usage`. Number of usage units that this + # discount is for + sig { returns(Float) } + attr_accessor :usage_discount + + sig do + params( + applies_to_price_interval_ids: T::Array[String], + end_date: T.nilable(Time), + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::OrHash + ], + start_date: Time, + usage_discount: Float, + discount_type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The price interval ids that this discount interval applies to. + applies_to_price_interval_ids:, + # The end date of the discount interval. + end_date:, + # The filters that determine which prices this discount interval applies to. + filters:, + # The start date of the discount interval. + start_date:, + # Only available if discount_type is `usage`. Number of usage units that this + # discount is for + usage_discount:, + discount_type: :usage + ) + end + + sig do + override.returns( + { + applies_to_price_interval_ids: T::Array[String], + discount_type: Symbol, + end_date: T.nilable(Time), + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter + ], + start_date: Time, + usage_discount: Float + } + ) + end + def to_hash + end + + class Filter < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter, + Orb::Internal::AnyHash + ) + end + + # The property of the price to filter on. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field::TaggedSymbol + ) + end + attr_accessor :field + + # Should prices that match the filter be included or excluded. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Operator::TaggedSymbol + ) + end + attr_accessor :operator + + # The IDs or values that match this filter. + sig { returns(T::Array[String]) } + attr_accessor :values + + sig do + params( + field: + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field::OrSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Operator::OrSymbol, + values: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # The property of the price to filter on. + field:, + # Should prices that match the filter be included or excluded. + operator:, + # The IDs or values that match this filter. + values: + ) + end + + sig do + override.returns( + { + field: + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field::TaggedSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Operator::TaggedSymbol, + values: T::Array[String] + } + ) + end + def to_hash + end + + # The property of the price to filter on. + module Field + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRICE_ID = + T.let( + :price_id, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field::TaggedSymbol + ) + ITEM_ID = + T.let( + :item_id, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field::TaggedSymbol + ) + PRICE_TYPE = + T.let( + :price_type, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field::TaggedSymbol + ) + CURRENCY = + T.let( + :currency, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field::TaggedSymbol + ) + PRICING_UNIT_ID = + T.let( + :pricing_unit_id, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Field::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Should prices that match the filter be included or excluded. + module Operator + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Operator + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCLUDES = + T.let( + :includes, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Operator::TaggedSymbol + ) + EXCLUDES = + T.let( + :excludes, + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Operator::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::Operator::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Variants + ] + ) + end + def self.variants + end + end + + class FixedFeeQuantitySchedule < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::FixedFeeQuantitySchedule, + Orb::Internal::AnyHash + ) + end + + sig { returns(T.nilable(Time)) } + attr_accessor :end_date + + sig { returns(String) } + attr_accessor :price_id + + sig { returns(Float) } + attr_accessor :quantity + + sig { returns(Time) } + attr_accessor :start_date + + sig do + params( + end_date: T.nilable(Time), + price_id: String, + quantity: Float, + start_date: Time + ).returns(T.attached_class) + end + def self.new(end_date:, price_id:, quantity:, start_date:) + end + + sig do + override.returns( + { + end_date: T.nilable(Time), + price_id: String, + quantity: Float, + start_date: Time + } + ) + end + def to_hash + end + end + + class MaximumInterval < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval, + Orb::Internal::AnyHash + ) + end + + # The price interval ids that this maximum interval applies to. + sig { returns(T::Array[String]) } + attr_accessor :applies_to_price_interval_ids + + # The end date of the maximum interval. + sig { returns(T.nilable(Time)) } + attr_accessor :end_date + + # The filters that determine which prices this maximum interval applies to. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter + ] + ) + end + attr_accessor :filters + + # The maximum amount to charge in a given billing period for the price intervals + # this transform applies to. + sig { returns(String) } + attr_accessor :maximum_amount + + # The start date of the maximum interval. + sig { returns(Time) } + attr_accessor :start_date + + sig do + params( + applies_to_price_interval_ids: T::Array[String], + end_date: T.nilable(Time), + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::OrHash + ], + maximum_amount: String, + start_date: Time + ).returns(T.attached_class) + end + def self.new( + # The price interval ids that this maximum interval applies to. + applies_to_price_interval_ids:, + # The end date of the maximum interval. + end_date:, + # The filters that determine which prices this maximum interval applies to. + filters:, + # The maximum amount to charge in a given billing period for the price intervals + # this transform applies to. + maximum_amount:, + # The start date of the maximum interval. + start_date: + ) + end + + sig do + override.returns( + { + applies_to_price_interval_ids: T::Array[String], + end_date: T.nilable(Time), + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter + ], + maximum_amount: String, + start_date: Time + } + ) + end + def to_hash + end + + class Filter < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter, + Orb::Internal::AnyHash + ) + end + + # The property of the price to filter on. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field::TaggedSymbol + ) + end + attr_accessor :field + + # Should prices that match the filter be included or excluded. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Operator::TaggedSymbol + ) + end + attr_accessor :operator + + # The IDs or values that match this filter. + sig { returns(T::Array[String]) } + attr_accessor :values + + sig do + params( + field: + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field::OrSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Operator::OrSymbol, + values: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # The property of the price to filter on. + field:, + # Should prices that match the filter be included or excluded. + operator:, + # The IDs or values that match this filter. + values: + ) + end + + sig do + override.returns( + { + field: + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field::TaggedSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Operator::TaggedSymbol, + values: T::Array[String] + } + ) + end + def to_hash + end + + # The property of the price to filter on. + module Field + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRICE_ID = + T.let( + :price_id, + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field::TaggedSymbol + ) + ITEM_ID = + T.let( + :item_id, + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field::TaggedSymbol + ) + PRICE_TYPE = + T.let( + :price_type, + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field::TaggedSymbol + ) + CURRENCY = + T.let( + :currency, + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field::TaggedSymbol + ) + PRICING_UNIT_ID = + T.let( + :pricing_unit_id, + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Field::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Should prices that match the filter be included or excluded. + module Operator + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Operator + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCLUDES = + T.let( + :includes, + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Operator::TaggedSymbol + ) + EXCLUDES = + T.let( + :excludes, + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Operator::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::Operator::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class MinimumInterval < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval, + Orb::Internal::AnyHash + ) + end + + # The price interval ids that this minimum interval applies to. + sig { returns(T::Array[String]) } + attr_accessor :applies_to_price_interval_ids + + # The end date of the minimum interval. + sig { returns(T.nilable(Time)) } + attr_accessor :end_date + + # The filters that determine which prices this minimum interval applies to. + sig do + returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter + ] + ) + end + attr_accessor :filters + + # The minimum amount to charge in a given billing period for the price intervals + # this minimum applies to. + sig { returns(String) } + attr_accessor :minimum_amount + + # The start date of the minimum interval. + sig { returns(Time) } + attr_accessor :start_date + + sig do + params( + applies_to_price_interval_ids: T::Array[String], + end_date: T.nilable(Time), + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::OrHash + ], + minimum_amount: String, + start_date: Time + ).returns(T.attached_class) + end + def self.new( + # The price interval ids that this minimum interval applies to. + applies_to_price_interval_ids:, + # The end date of the minimum interval. + end_date:, + # The filters that determine which prices this minimum interval applies to. + filters:, + # The minimum amount to charge in a given billing period for the price intervals + # this minimum applies to. + minimum_amount:, + # The start date of the minimum interval. + start_date: + ) + end + + sig do + override.returns( + { + applies_to_price_interval_ids: T::Array[String], + end_date: T.nilable(Time), + filters: + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter + ], + minimum_amount: String, + start_date: Time + } + ) + end + def to_hash + end + + class Filter < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter, + Orb::Internal::AnyHash + ) + end + + # The property of the price to filter on. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field::TaggedSymbol + ) + end + attr_accessor :field + + # Should prices that match the filter be included or excluded. + sig do + returns( + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Operator::TaggedSymbol + ) + end + attr_accessor :operator + + # The IDs or values that match this filter. + sig { returns(T::Array[String]) } + attr_accessor :values + + sig do + params( + field: + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field::OrSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Operator::OrSymbol, + values: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # The property of the price to filter on. + field:, + # Should prices that match the filter be included or excluded. + operator:, + # The IDs or values that match this filter. + values: + ) + end + + sig do + override.returns( + { + field: + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field::TaggedSymbol, + operator: + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Operator::TaggedSymbol, + values: T::Array[String] + } + ) + end + def to_hash + end + + # The property of the price to filter on. + module Field + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRICE_ID = + T.let( + :price_id, + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field::TaggedSymbol + ) + ITEM_ID = + T.let( + :item_id, + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field::TaggedSymbol + ) + PRICE_TYPE = + T.let( + :price_type, + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field::TaggedSymbol + ) + CURRENCY = + T.let( + :currency, + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field::TaggedSymbol + ) + PRICING_UNIT_ID = + T.let( + :pricing_unit_id, + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Field::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Should prices that match the filter be included or excluded. + module Operator + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Operator + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCLUDES = + T.let( + :includes, + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Operator::TaggedSymbol + ) + EXCLUDES = + T.let( + :excludes, + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Operator::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::Operator::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class PendingSubscriptionChange < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange, + Orb::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + # A pending subscription change if one exists on this subscription. + sig { params(id: String).returns(T.attached_class) } + def self.new(id:) + end + + sig { override.returns({ id: String }) } + def to_hash + end + end + + class PriceInterval < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval, + Orb::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + # The day of the month that Orb bills for this price + sig { returns(Integer) } + attr_accessor :billing_cycle_day + + # The end of the current billing period. This is an exclusive timestamp, such that + # the instant returned is exactly the end of the billing period. Set to null if + # this price interval is not currently active. + sig { returns(T.nilable(Time)) } + attr_accessor :current_billing_period_end_date + + # The start date of the current billing period. This is an inclusive timestamp; + # the instant returned is exactly the beginning of the billing period. Set to null + # if this price interval is not currently active. + sig { returns(T.nilable(Time)) } + attr_accessor :current_billing_period_start_date + + # The end date of the price interval. This is the date that Orb stops billing for + # this price. + sig { returns(T.nilable(Time)) } + attr_accessor :end_date + + # An additional filter to apply to usage queries. + sig { returns(T.nilable(String)) } + attr_accessor :filter + + # The fixed fee quantity transitions for this price interval. This is only + # relevant for fixed fees. + sig do + returns( + T.nilable( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval::FixedFeeQuantityTransition + ] + ) + ) + end + attr_accessor :fixed_fee_quantity_transitions + + # The Price resource represents a price that can be billed on a subscription, + # resulting in a charge on an invoice in the form of an invoice line item. Prices + # take a quantity and determine an amount to bill. + # + # Orb supports a few different pricing models out of the box. Each of these models + # is serialized differently in a given Price object. The model_type field + # determines the key for the configuration object that is present. + # + # For more on the types of prices, see + # [the core concepts documentation](/core-concepts#plan-and-price) + sig { returns(Orb::Price::Variants) } + attr_accessor :price + + # The start date of the price interval. This is the date that Orb starts billing + # for this price. + sig { returns(Time) } + attr_accessor :start_date + + # A list of customer IDs whose usage events will be aggregated and billed under + # this price interval. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :usage_customer_ids + + # The Price Interval resource represents a period of time for which a price will + # bill on a subscription. A subscription’s price intervals define its billing + # behavior. + sig do + params( + id: String, + billing_cycle_day: Integer, + current_billing_period_end_date: T.nilable(Time), + current_billing_period_start_date: T.nilable(Time), + end_date: T.nilable(Time), + filter: T.nilable(String), + fixed_fee_quantity_transitions: + T.nilable( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval::FixedFeeQuantityTransition::OrHash + ] + ), + price: + T.any( + Orb::Price::Unit::OrHash, + Orb::Price::Package::OrHash, + Orb::Price::Matrix::OrHash, + Orb::Price::Tiered::OrHash, + Orb::Price::TieredBps::OrHash, + Orb::Price::Bps::OrHash, + Orb::Price::BulkBps::OrHash, + Orb::Price::Bulk::OrHash, + Orb::Price::ThresholdTotalAmount::OrHash, + Orb::Price::TieredPackage::OrHash, + Orb::Price::GroupedTiered::OrHash, + Orb::Price::TieredWithMinimum::OrHash, + Orb::Price::TieredPackageWithMinimum::OrHash, + Orb::Price::PackageWithAllocation::OrHash, + Orb::Price::UnitWithPercent::OrHash, + Orb::Price::MatrixWithAllocation::OrHash, + Orb::Price::TieredWithProration::OrHash, + Orb::Price::UnitWithProration::OrHash, + Orb::Price::GroupedAllocation::OrHash, + Orb::Price::GroupedWithProratedMinimum::OrHash, + Orb::Price::GroupedWithMeteredMinimum::OrHash, + Orb::Price::MatrixWithDisplayName::OrHash, + Orb::Price::BulkWithProration::OrHash, + Orb::Price::GroupedTieredPackage::OrHash, + Orb::Price::MaxGroupTieredPackage::OrHash, + Orb::Price::ScalableMatrixWithUnitPricing::OrHash, + Orb::Price::ScalableMatrixWithTieredPricing::OrHash, + Orb::Price::CumulativeGroupedBulk::OrHash + ), + start_date: Time, + usage_customer_ids: T.nilable(T::Array[String]) + ).returns(T.attached_class) + end + def self.new( + id:, + # The day of the month that Orb bills for this price + billing_cycle_day:, + # The end of the current billing period. This is an exclusive timestamp, such that + # the instant returned is exactly the end of the billing period. Set to null if + # this price interval is not currently active. + current_billing_period_end_date:, + # The start date of the current billing period. This is an inclusive timestamp; + # the instant returned is exactly the beginning of the billing period. Set to null + # if this price interval is not currently active. + current_billing_period_start_date:, + # The end date of the price interval. This is the date that Orb stops billing for + # this price. + end_date:, + # An additional filter to apply to usage queries. + filter:, + # The fixed fee quantity transitions for this price interval. This is only + # relevant for fixed fees. + fixed_fee_quantity_transitions:, + # The Price resource represents a price that can be billed on a subscription, + # resulting in a charge on an invoice in the form of an invoice line item. Prices + # take a quantity and determine an amount to bill. + # + # Orb supports a few different pricing models out of the box. Each of these models + # is serialized differently in a given Price object. The model_type field + # determines the key for the configuration object that is present. + # + # For more on the types of prices, see + # [the core concepts documentation](/core-concepts#plan-and-price) + price:, + # The start date of the price interval. This is the date that Orb starts billing + # for this price. + start_date:, + # A list of customer IDs whose usage events will be aggregated and billed under + # this price interval. + usage_customer_ids: + ) + end + + sig do + override.returns( + { + id: String, + billing_cycle_day: Integer, + current_billing_period_end_date: T.nilable(Time), + current_billing_period_start_date: T.nilable(Time), + end_date: T.nilable(Time), + filter: T.nilable(String), + fixed_fee_quantity_transitions: + T.nilable( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval::FixedFeeQuantityTransition + ] + ), + price: Orb::Price::Variants, + start_date: Time, + usage_customer_ids: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + class FixedFeeQuantityTransition < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval::FixedFeeQuantityTransition, + Orb::Internal::AnyHash + ) + end + + sig { returns(Time) } + attr_accessor :effective_date + + sig { returns(String) } + attr_accessor :price_id + + sig { returns(Integer) } + attr_accessor :quantity + + sig do + params( + effective_date: Time, + price_id: String, + quantity: Integer + ).returns(T.attached_class) + end + def self.new(effective_date:, price_id:, quantity:) + end + + sig do + override.returns( + { effective_date: Time, price_id: String, quantity: Integer } + ) + end + def to_hash + end + end + end + + class RedeemedCoupon < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon, + Orb::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :coupon_id + + sig { returns(T.nilable(Time)) } + attr_accessor :end_date + + sig { returns(Time) } + attr_accessor :start_date + + sig do + params( + coupon_id: String, + end_date: T.nilable(Time), + start_date: Time + ).returns(T.attached_class) + end + def self.new(coupon_id:, end_date:, start_date:) + end + + sig do + override.returns( + { coupon_id: String, end_date: T.nilable(Time), start_date: Time } + ) + end + def to_hash + end + end + + module Status + extend Orb::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Orb::Models::SubscriptionRedeemCouponResponse::Status) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + ACTIVE = + T.let( + :active, + Orb::Models::SubscriptionRedeemCouponResponse::Status::TaggedSymbol + ) + ENDED = + T.let( + :ended, + Orb::Models::SubscriptionRedeemCouponResponse::Status::TaggedSymbol + ) + UPCOMING = + T.let( + :upcoming, + Orb::Models::SubscriptionRedeemCouponResponse::Status::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Orb::Models::SubscriptionRedeemCouponResponse::Status::TaggedSymbol + ] + ) + end + def self.values + end + end + + class TrialInfo < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo, + Orb::Internal::AnyHash + ) + end + + sig { returns(T.nilable(Time)) } + attr_accessor :end_date + + sig { params(end_date: T.nilable(Time)).returns(T.attached_class) } + def self.new(end_date:) + end + + sig { override.returns({ end_date: T.nilable(Time) }) } + def to_hash + end + end + + class ChangedResources < Orb::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources, + Orb::Internal::AnyHash + ) + end + + # The credit notes that were created as part of this operation. + sig { returns(T::Array[Orb::CreditNote]) } + attr_accessor :created_credit_notes + + # The invoices that were created as part of this operation. + sig { returns(T::Array[Orb::Invoice]) } + attr_accessor :created_invoices + + # The credit notes that were voided as part of this operation. + sig { returns(T::Array[Orb::CreditNote]) } + attr_accessor :voided_credit_notes + + # The invoices that were voided as part of this operation. + sig { returns(T::Array[Orb::Invoice]) } + attr_accessor :voided_invoices + + # The resources that were changed as part of this operation. Only present when + # fetched through the subscription changes API or if the + # `include_changed_resources` parameter was passed in the request. + sig do + params( + created_credit_notes: T::Array[Orb::CreditNote::OrHash], + created_invoices: T::Array[Orb::Invoice::OrHash], + voided_credit_notes: T::Array[Orb::CreditNote::OrHash], + voided_invoices: T::Array[Orb::Invoice::OrHash] + ).returns(T.attached_class) + end + def self.new( + # The credit notes that were created as part of this operation. + created_credit_notes:, + # The invoices that were created as part of this operation. + created_invoices:, + # The credit notes that were voided as part of this operation. + voided_credit_notes:, + # The invoices that were voided as part of this operation. + voided_invoices: + ) + end + + sig do + override.returns( + { + created_credit_notes: T::Array[Orb::CreditNote], + created_invoices: T::Array[Orb::Invoice], + voided_credit_notes: T::Array[Orb::CreditNote], + voided_invoices: T::Array[Orb::Invoice] + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/orb/resources/subscriptions.rbi b/rbi/orb/resources/subscriptions.rbi index 87ff9522..c308c26b 100644 --- a/rbi/orb/resources/subscriptions.rbi +++ b/rbi/orb/resources/subscriptions.rbi @@ -1007,6 +1007,34 @@ module Orb ) end + # Redeem a coupon effective at a given time. + sig do + params( + subscription_id: String, + change_option: + Orb::SubscriptionRedeemCouponParams::ChangeOption::OrSymbol, + coupon_id: String, + allow_invoice_credit_or_void: T.nilable(T::Boolean), + change_date: T.nilable(Time), + request_options: Orb::RequestOptions::OrHash + ).returns(Orb::Models::SubscriptionRedeemCouponResponse) + end + def redeem_coupon( + subscription_id, + change_option:, + # Coupon ID to be redeemed for this subscription. + coupon_id:, + # If false, this request will fail if it would void an issued invoice or create a + # credit note. Consider using this as a safety mechanism if you do not expect + # existing invoices to be changed. + allow_invoice_credit_or_void: nil, + # The date that the coupon discount should take effect. This parameter can only be + # passed if the `change_option` is `requested_date`. + change_date: nil, + request_options: {} + ) + end + # This endpoint can be used to change an existing subscription's plan. It returns # the serialized updated subscription object. # diff --git a/sig/orb/models.rbs b/sig/orb/models.rbs index 1920bc54..527d0865 100644 --- a/sig/orb/models.rbs +++ b/sig/orb/models.rbs @@ -203,6 +203,8 @@ module Orb class SubscriptionPriceIntervalsParams = Orb::Models::SubscriptionPriceIntervalsParams + class SubscriptionRedeemCouponParams = Orb::Models::SubscriptionRedeemCouponParams + class SubscriptionsAPI = Orb::Models::SubscriptionsAPI class SubscriptionSchedulePlanChangeParams = Orb::Models::SubscriptionSchedulePlanChangeParams diff --git a/sig/orb/models/invoice.rbs b/sig/orb/models/invoice.rbs index 5f6c338a..d2c748df 100644 --- a/sig/orb/models/invoice.rbs +++ b/sig/orb/models/invoice.rbs @@ -841,7 +841,7 @@ module Orb minimum_amount: String?, name: String, partially_invoiced_amount: String, - price: Orb::Models::price?, + price: Orb::Models::price, quantity: Float, start_date: Time, sub_line_items: ::Array[Orb::Models::Invoice::LineItem::sub_line_item], @@ -881,7 +881,7 @@ module Orb attr_accessor partially_invoiced_amount: String - attr_accessor price: Orb::Models::price? + attr_accessor price: Orb::Models::price attr_accessor quantity: Float @@ -911,7 +911,7 @@ module Orb minimum_amount: String?, name: String, partially_invoiced_amount: String, - price: Orb::Models::price?, + price: Orb::Models::price, quantity: Float, start_date: Time, sub_line_items: ::Array[Orb::Models::Invoice::LineItem::sub_line_item], @@ -936,7 +936,7 @@ module Orb minimum_amount: String?, name: String, partially_invoiced_amount: String, - price: Orb::Models::price?, + price: Orb::Models::price, quantity: Float, start_date: Time, sub_line_items: ::Array[Orb::Models::Invoice::LineItem::sub_line_item], diff --git a/sig/orb/models/invoice_fetch_upcoming_response.rbs b/sig/orb/models/invoice_fetch_upcoming_response.rbs index 58b74f13..ce8711ca 100644 --- a/sig/orb/models/invoice_fetch_upcoming_response.rbs +++ b/sig/orb/models/invoice_fetch_upcoming_response.rbs @@ -841,7 +841,7 @@ module Orb minimum_amount: String?, name: String, partially_invoiced_amount: String, - price: Orb::Models::price?, + price: Orb::Models::price, quantity: Float, start_date: Time, sub_line_items: ::Array[Orb::Models::InvoiceFetchUpcomingResponse::LineItem::sub_line_item], @@ -881,7 +881,7 @@ module Orb attr_accessor partially_invoiced_amount: String - attr_accessor price: Orb::Models::price? + attr_accessor price: Orb::Models::price attr_accessor quantity: Float @@ -911,7 +911,7 @@ module Orb minimum_amount: String?, name: String, partially_invoiced_amount: String, - price: Orb::Models::price?, + price: Orb::Models::price, quantity: Float, start_date: Time, sub_line_items: ::Array[Orb::Models::InvoiceFetchUpcomingResponse::LineItem::sub_line_item], @@ -936,7 +936,7 @@ module Orb minimum_amount: String?, name: String, partially_invoiced_amount: String, - price: Orb::Models::price?, + price: Orb::Models::price, quantity: Float, start_date: Time, sub_line_items: ::Array[Orb::Models::InvoiceFetchUpcomingResponse::LineItem::sub_line_item], diff --git a/sig/orb/models/invoice_line_item_create_response.rbs b/sig/orb/models/invoice_line_item_create_response.rbs index c230cefd..2a73351f 100644 --- a/sig/orb/models/invoice_line_item_create_response.rbs +++ b/sig/orb/models/invoice_line_item_create_response.rbs @@ -17,7 +17,7 @@ module Orb minimum_amount: String?, name: String, partially_invoiced_amount: String, - price: Orb::Models::price?, + price: Orb::Models::price, quantity: Float, start_date: Time, sub_line_items: ::Array[Orb::Models::InvoiceLineItemCreateResponse::sub_line_item], @@ -57,7 +57,7 @@ module Orb attr_accessor partially_invoiced_amount: String - attr_accessor price: Orb::Models::price? + attr_accessor price: Orb::Models::price attr_accessor quantity: Float @@ -87,7 +87,7 @@ module Orb minimum_amount: String?, name: String, partially_invoiced_amount: String, - price: Orb::Models::price?, + price: Orb::Models::price, quantity: Float, start_date: Time, sub_line_items: ::Array[Orb::Models::InvoiceLineItemCreateResponse::sub_line_item], @@ -112,7 +112,7 @@ module Orb minimum_amount: String?, name: String, partially_invoiced_amount: String, - price: Orb::Models::price?, + price: Orb::Models::price, quantity: Float, start_date: Time, sub_line_items: ::Array[Orb::Models::InvoiceLineItemCreateResponse::sub_line_item], diff --git a/sig/orb/models/subscription_redeem_coupon_params.rbs b/sig/orb/models/subscription_redeem_coupon_params.rbs new file mode 100644 index 00000000..ce55696a --- /dev/null +++ b/sig/orb/models/subscription_redeem_coupon_params.rbs @@ -0,0 +1,54 @@ +module Orb + module Models + type subscription_redeem_coupon_params = + { + change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option, + coupon_id: String, + allow_invoice_credit_or_void: bool?, + change_date: Time? + } + & Orb::Internal::Type::request_parameters + + class SubscriptionRedeemCouponParams < Orb::Internal::Type::BaseModel + extend Orb::Internal::Type::RequestParameters::Converter + include Orb::Internal::Type::RequestParameters + + attr_accessor change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option + + attr_accessor coupon_id: String + + attr_accessor allow_invoice_credit_or_void: bool? + + attr_accessor change_date: Time? + + def initialize: ( + change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option, + coupon_id: String, + ?allow_invoice_credit_or_void: bool?, + ?change_date: Time?, + ?request_options: Orb::request_opts + ) -> void + + def to_hash: -> { + change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option, + coupon_id: String, + allow_invoice_credit_or_void: bool?, + change_date: Time?, + request_options: Orb::RequestOptions + } + + type change_option = + :requested_date | :end_of_subscription_term | :immediate + + module ChangeOption + extend Orb::Internal::Type::Enum + + REQUESTED_DATE: :requested_date + END_OF_SUBSCRIPTION_TERM: :end_of_subscription_term + IMMEDIATE: :immediate + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponParams::change_option] + end + end + end +end diff --git a/sig/orb/models/subscription_redeem_coupon_response.rbs b/sig/orb/models/subscription_redeem_coupon_response.rbs new file mode 100644 index 00000000..f7865da0 --- /dev/null +++ b/sig/orb/models/subscription_redeem_coupon_response.rbs @@ -0,0 +1,1445 @@ +module Orb + module Models + type subscription_redeem_coupon_response = + { + id: String, + active_plan_phase_order: Integer?, + adjustment_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval], + auto_collection: bool?, + billing_cycle_anchor_configuration: Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration, + billing_cycle_day: Integer, + created_at: Time, + current_billing_period_end_date: Time?, + current_billing_period_start_date: Time?, + customer: Orb::Customer, + default_invoice_memo: String?, + discount_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::discount_interval], + end_date: Time?, + fixed_fee_quantity_schedule: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::FixedFeeQuantitySchedule], + invoicing_threshold: String?, + maximum_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval], + metadata: ::Hash[Symbol, String], + minimum_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval], + name: String, + net_terms: Integer, + pending_subscription_change: Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange?, + plan: Orb::Plan?, + price_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval], + redeemed_coupon: Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon?, + start_date: Time, + status: Orb::Models::SubscriptionRedeemCouponResponse::status, + trial_info: Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo, + changed_resources: Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources? + } + + class SubscriptionRedeemCouponResponse < Orb::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor active_plan_phase_order: Integer? + + attr_accessor adjustment_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval] + + attr_accessor auto_collection: bool? + + attr_accessor billing_cycle_anchor_configuration: Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration + + attr_accessor billing_cycle_day: Integer + + attr_accessor created_at: Time + + attr_accessor current_billing_period_end_date: Time? + + attr_accessor current_billing_period_start_date: Time? + + attr_accessor customer: Orb::Customer + + attr_accessor default_invoice_memo: String? + + attr_accessor discount_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::discount_interval] + + attr_accessor end_date: Time? + + attr_accessor fixed_fee_quantity_schedule: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::FixedFeeQuantitySchedule] + + attr_accessor invoicing_threshold: String? + + attr_accessor maximum_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval] + + attr_accessor metadata: ::Hash[Symbol, String] + + attr_accessor minimum_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval] + + attr_accessor name: String + + attr_accessor net_terms: Integer + + attr_accessor pending_subscription_change: Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange? + + attr_accessor plan: Orb::Plan? + + attr_accessor price_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval] + + attr_accessor redeemed_coupon: Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon? + + attr_accessor start_date: Time + + attr_accessor status: Orb::Models::SubscriptionRedeemCouponResponse::status + + attr_accessor trial_info: Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo + + attr_accessor changed_resources: Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources? + + def initialize: ( + id: String, + active_plan_phase_order: Integer?, + adjustment_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval], + auto_collection: bool?, + billing_cycle_anchor_configuration: Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration, + billing_cycle_day: Integer, + created_at: Time, + current_billing_period_end_date: Time?, + current_billing_period_start_date: Time?, + customer: Orb::Customer, + default_invoice_memo: String?, + discount_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::discount_interval], + end_date: Time?, + fixed_fee_quantity_schedule: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::FixedFeeQuantitySchedule], + invoicing_threshold: String?, + maximum_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval], + metadata: ::Hash[Symbol, String], + minimum_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval], + name: String, + net_terms: Integer, + pending_subscription_change: Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange?, + plan: Orb::Plan?, + price_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval], + redeemed_coupon: Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon?, + start_date: Time, + status: Orb::Models::SubscriptionRedeemCouponResponse::status, + trial_info: Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo, + ?changed_resources: Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources? + ) -> void + + def to_hash: -> { + id: String, + active_plan_phase_order: Integer?, + adjustment_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval], + auto_collection: bool?, + billing_cycle_anchor_configuration: Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration, + billing_cycle_day: Integer, + created_at: Time, + current_billing_period_end_date: Time?, + current_billing_period_start_date: Time?, + customer: Orb::Customer, + default_invoice_memo: String?, + discount_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::discount_interval], + end_date: Time?, + fixed_fee_quantity_schedule: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::FixedFeeQuantitySchedule], + invoicing_threshold: String?, + maximum_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval], + metadata: ::Hash[Symbol, String], + minimum_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval], + name: String, + net_terms: Integer, + pending_subscription_change: Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange?, + plan: Orb::Plan?, + price_intervals: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval], + redeemed_coupon: Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon?, + start_date: Time, + status: Orb::Models::SubscriptionRedeemCouponResponse::status, + trial_info: Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo, + changed_resources: Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources? + } + + type adjustment_interval = + { + id: String, + adjustment: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::adjustment, + applies_to_price_interval_ids: ::Array[String], + end_date: Time?, + start_date: Time + } + + class AdjustmentInterval < Orb::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor adjustment: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::adjustment + + attr_accessor applies_to_price_interval_ids: ::Array[String] + + attr_accessor end_date: Time? + + attr_accessor start_date: Time + + def initialize: ( + id: String, + adjustment: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::adjustment, + applies_to_price_interval_ids: ::Array[String], + end_date: Time?, + start_date: Time + ) -> void + + def to_hash: -> { + id: String, + adjustment: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::adjustment, + applies_to_price_interval_ids: ::Array[String], + end_date: Time?, + start_date: Time + } + + type adjustment = + Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount + | Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount + | Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount + | Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum + | Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum + + module Adjustment + extend Orb::Internal::Type::Union + + type usage_discount = + { + id: String, + adjustment_type: :usage_discount, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter], + is_invoice_level: bool, + plan_phase_order: Integer?, + reason: String?, + usage_discount: Float + } + + class UsageDiscount < Orb::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor adjustment_type: :usage_discount + + attr_accessor applies_to_price_ids: ::Array[String] + + attr_accessor filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter] + + attr_accessor is_invoice_level: bool + + attr_accessor plan_phase_order: Integer? + + attr_accessor reason: String? + + attr_accessor usage_discount: Float + + def initialize: ( + id: String, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter], + is_invoice_level: bool, + plan_phase_order: Integer?, + reason: String?, + usage_discount: Float, + ?adjustment_type: :usage_discount + ) -> void + + def to_hash: -> { + id: String, + adjustment_type: :usage_discount, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter], + is_invoice_level: bool, + plan_phase_order: Integer?, + reason: String?, + usage_discount: Float + } + + type filter = + { + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::operator, + values: ::Array[String] + } + + class Filter < Orb::Internal::Type::BaseModel + attr_accessor field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::field + + attr_accessor operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::operator + + attr_accessor values: ::Array[String] + + def initialize: ( + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::operator, + values: ::Array[String] + ) -> void + + def to_hash: -> { + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::operator, + values: ::Array[String] + } + + type field = + :price_id + | :item_id + | :price_type + | :currency + | :pricing_unit_id + + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID: :price_id + ITEM_ID: :item_id + PRICE_TYPE: :price_type + CURRENCY: :currency + PRICING_UNIT_ID: :pricing_unit_id + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::field] + end + + type operator = :includes | :excludes + + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES: :includes + EXCLUDES: :excludes + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::UsageDiscount::Filter::operator] + end + end + end + + type amount_discount = + { + id: String, + adjustment_type: :amount_discount, + amount_discount: String, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter], + is_invoice_level: bool, + plan_phase_order: Integer?, + reason: String? + } + + class AmountDiscount < Orb::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor adjustment_type: :amount_discount + + attr_accessor amount_discount: String + + attr_accessor applies_to_price_ids: ::Array[String] + + attr_accessor filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter] + + attr_accessor is_invoice_level: bool + + attr_accessor plan_phase_order: Integer? + + attr_accessor reason: String? + + def initialize: ( + id: String, + amount_discount: String, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter], + is_invoice_level: bool, + plan_phase_order: Integer?, + reason: String?, + ?adjustment_type: :amount_discount + ) -> void + + def to_hash: -> { + id: String, + adjustment_type: :amount_discount, + amount_discount: String, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter], + is_invoice_level: bool, + plan_phase_order: Integer?, + reason: String? + } + + type filter = + { + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::operator, + values: ::Array[String] + } + + class Filter < Orb::Internal::Type::BaseModel + attr_accessor field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::field + + attr_accessor operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::operator + + attr_accessor values: ::Array[String] + + def initialize: ( + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::operator, + values: ::Array[String] + ) -> void + + def to_hash: -> { + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::operator, + values: ::Array[String] + } + + type field = + :price_id + | :item_id + | :price_type + | :currency + | :pricing_unit_id + + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID: :price_id + ITEM_ID: :item_id + PRICE_TYPE: :price_type + CURRENCY: :currency + PRICING_UNIT_ID: :pricing_unit_id + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::field] + end + + type operator = :includes | :excludes + + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES: :includes + EXCLUDES: :excludes + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::AmountDiscount::Filter::operator] + end + end + end + + type percentage_discount = + { + id: String, + adjustment_type: :percentage_discount, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter], + is_invoice_level: bool, + percentage_discount: Float, + plan_phase_order: Integer?, + reason: String? + } + + class PercentageDiscount < Orb::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor adjustment_type: :percentage_discount + + attr_accessor applies_to_price_ids: ::Array[String] + + attr_accessor filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter] + + attr_accessor is_invoice_level: bool + + attr_accessor percentage_discount: Float + + attr_accessor plan_phase_order: Integer? + + attr_accessor reason: String? + + def initialize: ( + id: String, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter], + is_invoice_level: bool, + percentage_discount: Float, + plan_phase_order: Integer?, + reason: String?, + ?adjustment_type: :percentage_discount + ) -> void + + def to_hash: -> { + id: String, + adjustment_type: :percentage_discount, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter], + is_invoice_level: bool, + percentage_discount: Float, + plan_phase_order: Integer?, + reason: String? + } + + type filter = + { + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::operator, + values: ::Array[String] + } + + class Filter < Orb::Internal::Type::BaseModel + attr_accessor field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::field + + attr_accessor operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::operator + + attr_accessor values: ::Array[String] + + def initialize: ( + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::operator, + values: ::Array[String] + ) -> void + + def to_hash: -> { + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::operator, + values: ::Array[String] + } + + type field = + :price_id + | :item_id + | :price_type + | :currency + | :pricing_unit_id + + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID: :price_id + ITEM_ID: :item_id + PRICE_TYPE: :price_type + CURRENCY: :currency + PRICING_UNIT_ID: :pricing_unit_id + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::field] + end + + type operator = :includes | :excludes + + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES: :includes + EXCLUDES: :excludes + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::PercentageDiscount::Filter::operator] + end + end + end + + type minimum = + { + id: String, + adjustment_type: :minimum, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter], + is_invoice_level: bool, + item_id: String, + minimum_amount: String, + plan_phase_order: Integer?, + reason: String? + } + + class Minimum < Orb::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor adjustment_type: :minimum + + attr_accessor applies_to_price_ids: ::Array[String] + + attr_accessor filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter] + + attr_accessor is_invoice_level: bool + + attr_accessor item_id: String + + attr_accessor minimum_amount: String + + attr_accessor plan_phase_order: Integer? + + attr_accessor reason: String? + + def initialize: ( + id: String, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter], + is_invoice_level: bool, + item_id: String, + minimum_amount: String, + plan_phase_order: Integer?, + reason: String?, + ?adjustment_type: :minimum + ) -> void + + def to_hash: -> { + id: String, + adjustment_type: :minimum, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter], + is_invoice_level: bool, + item_id: String, + minimum_amount: String, + plan_phase_order: Integer?, + reason: String? + } + + type filter = + { + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::operator, + values: ::Array[String] + } + + class Filter < Orb::Internal::Type::BaseModel + attr_accessor field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::field + + attr_accessor operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::operator + + attr_accessor values: ::Array[String] + + def initialize: ( + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::operator, + values: ::Array[String] + ) -> void + + def to_hash: -> { + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::operator, + values: ::Array[String] + } + + type field = + :price_id + | :item_id + | :price_type + | :currency + | :pricing_unit_id + + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID: :price_id + ITEM_ID: :item_id + PRICE_TYPE: :price_type + CURRENCY: :currency + PRICING_UNIT_ID: :pricing_unit_id + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::field] + end + + type operator = :includes | :excludes + + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES: :includes + EXCLUDES: :excludes + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Minimum::Filter::operator] + end + end + end + + type maximum = + { + id: String, + adjustment_type: :maximum, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter], + is_invoice_level: bool, + maximum_amount: String, + plan_phase_order: Integer?, + reason: String? + } + + class Maximum < Orb::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor adjustment_type: :maximum + + attr_accessor applies_to_price_ids: ::Array[String] + + attr_accessor filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter] + + attr_accessor is_invoice_level: bool + + attr_accessor maximum_amount: String + + attr_accessor plan_phase_order: Integer? + + attr_accessor reason: String? + + def initialize: ( + id: String, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter], + is_invoice_level: bool, + maximum_amount: String, + plan_phase_order: Integer?, + reason: String?, + ?adjustment_type: :maximum + ) -> void + + def to_hash: -> { + id: String, + adjustment_type: :maximum, + applies_to_price_ids: ::Array[String], + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter], + is_invoice_level: bool, + maximum_amount: String, + plan_phase_order: Integer?, + reason: String? + } + + type filter = + { + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::operator, + values: ::Array[String] + } + + class Filter < Orb::Internal::Type::BaseModel + attr_accessor field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::field + + attr_accessor operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::operator + + attr_accessor values: ::Array[String] + + def initialize: ( + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::operator, + values: ::Array[String] + ) -> void + + def to_hash: -> { + field: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::operator, + values: ::Array[String] + } + + type field = + :price_id + | :item_id + | :price_type + | :currency + | :pricing_unit_id + + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID: :price_id + ITEM_ID: :item_id + PRICE_TYPE: :price_type + CURRENCY: :currency + PRICING_UNIT_ID: :pricing_unit_id + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::field] + end + + type operator = :includes | :excludes + + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES: :includes + EXCLUDES: :excludes + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::Adjustment::Maximum::Filter::operator] + end + end + end + + def self?.variants: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval::adjustment] + end + end + + type billing_cycle_anchor_configuration = + { day: Integer, month: Integer?, year: Integer? } + + class BillingCycleAnchorConfiguration < Orb::Internal::Type::BaseModel + attr_accessor day: Integer + + attr_accessor month: Integer? + + attr_accessor year: Integer? + + def initialize: ( + day: Integer, + ?month: Integer?, + ?year: Integer? + ) -> void + + def to_hash: -> { day: Integer, month: Integer?, year: Integer? } + end + + type discount_interval = + Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount + | Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage + | Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage + + module DiscountInterval + extend Orb::Internal::Type::Union + + type amount = + { + amount_discount: String, + applies_to_price_interval_ids: ::Array[String], + discount_type: :amount, + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter], + start_date: Time + } + + class Amount < Orb::Internal::Type::BaseModel + attr_accessor amount_discount: String + + attr_accessor applies_to_price_interval_ids: ::Array[String] + + attr_accessor discount_type: :amount + + attr_accessor end_date: Time? + + attr_accessor filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter] + + attr_accessor start_date: Time + + def initialize: ( + amount_discount: String, + applies_to_price_interval_ids: ::Array[String], + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter], + start_date: Time, + ?discount_type: :amount + ) -> void + + def to_hash: -> { + amount_discount: String, + applies_to_price_interval_ids: ::Array[String], + discount_type: :amount, + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter], + start_date: Time + } + + type filter = + { + field: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::operator, + values: ::Array[String] + } + + class Filter < Orb::Internal::Type::BaseModel + attr_accessor field: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::field + + attr_accessor operator: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::operator + + attr_accessor values: ::Array[String] + + def initialize: ( + field: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::operator, + values: ::Array[String] + ) -> void + + def to_hash: -> { + field: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::operator, + values: ::Array[String] + } + + type field = + :price_id | :item_id | :price_type | :currency | :pricing_unit_id + + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID: :price_id + ITEM_ID: :item_id + PRICE_TYPE: :price_type + CURRENCY: :currency + PRICING_UNIT_ID: :pricing_unit_id + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::field] + end + + type operator = :includes | :excludes + + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES: :includes + EXCLUDES: :excludes + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Amount::Filter::operator] + end + end + end + + type percentage = + { + applies_to_price_interval_ids: ::Array[String], + discount_type: :percentage, + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter], + percentage_discount: Float, + start_date: Time + } + + class Percentage < Orb::Internal::Type::BaseModel + attr_accessor applies_to_price_interval_ids: ::Array[String] + + attr_accessor discount_type: :percentage + + attr_accessor end_date: Time? + + attr_accessor filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter] + + attr_accessor percentage_discount: Float + + attr_accessor start_date: Time + + def initialize: ( + applies_to_price_interval_ids: ::Array[String], + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter], + percentage_discount: Float, + start_date: Time, + ?discount_type: :percentage + ) -> void + + def to_hash: -> { + applies_to_price_interval_ids: ::Array[String], + discount_type: :percentage, + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter], + percentage_discount: Float, + start_date: Time + } + + type filter = + { + field: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::operator, + values: ::Array[String] + } + + class Filter < Orb::Internal::Type::BaseModel + attr_accessor field: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::field + + attr_accessor operator: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::operator + + attr_accessor values: ::Array[String] + + def initialize: ( + field: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::operator, + values: ::Array[String] + ) -> void + + def to_hash: -> { + field: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::operator, + values: ::Array[String] + } + + type field = + :price_id | :item_id | :price_type | :currency | :pricing_unit_id + + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID: :price_id + ITEM_ID: :item_id + PRICE_TYPE: :price_type + CURRENCY: :currency + PRICING_UNIT_ID: :pricing_unit_id + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::field] + end + + type operator = :includes | :excludes + + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES: :includes + EXCLUDES: :excludes + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Percentage::Filter::operator] + end + end + end + + type usage = + { + applies_to_price_interval_ids: ::Array[String], + discount_type: :usage, + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter], + start_date: Time, + usage_discount: Float + } + + class Usage < Orb::Internal::Type::BaseModel + attr_accessor applies_to_price_interval_ids: ::Array[String] + + attr_accessor discount_type: :usage + + attr_accessor end_date: Time? + + attr_accessor filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter] + + attr_accessor start_date: Time + + attr_accessor usage_discount: Float + + def initialize: ( + applies_to_price_interval_ids: ::Array[String], + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter], + start_date: Time, + usage_discount: Float, + ?discount_type: :usage + ) -> void + + def to_hash: -> { + applies_to_price_interval_ids: ::Array[String], + discount_type: :usage, + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter], + start_date: Time, + usage_discount: Float + } + + type filter = + { + field: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::operator, + values: ::Array[String] + } + + class Filter < Orb::Internal::Type::BaseModel + attr_accessor field: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::field + + attr_accessor operator: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::operator + + attr_accessor values: ::Array[String] + + def initialize: ( + field: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::operator, + values: ::Array[String] + ) -> void + + def to_hash: -> { + field: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::operator, + values: ::Array[String] + } + + type field = + :price_id | :item_id | :price_type | :currency | :pricing_unit_id + + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID: :price_id + ITEM_ID: :item_id + PRICE_TYPE: :price_type + CURRENCY: :currency + PRICING_UNIT_ID: :pricing_unit_id + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::field] + end + + type operator = :includes | :excludes + + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES: :includes + EXCLUDES: :excludes + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval::Usage::Filter::operator] + end + end + end + + def self?.variants: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::discount_interval] + end + + type fixed_fee_quantity_schedule = + { end_date: Time?, price_id: String, quantity: Float, start_date: Time } + + class FixedFeeQuantitySchedule < Orb::Internal::Type::BaseModel + attr_accessor end_date: Time? + + attr_accessor price_id: String + + attr_accessor quantity: Float + + attr_accessor start_date: Time + + def initialize: ( + end_date: Time?, + price_id: String, + quantity: Float, + start_date: Time + ) -> void + + def to_hash: -> { + end_date: Time?, + price_id: String, + quantity: Float, + start_date: Time + } + end + + type maximum_interval = + { + applies_to_price_interval_ids: ::Array[String], + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter], + maximum_amount: String, + start_date: Time + } + + class MaximumInterval < Orb::Internal::Type::BaseModel + attr_accessor applies_to_price_interval_ids: ::Array[String] + + attr_accessor end_date: Time? + + attr_accessor filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter] + + attr_accessor maximum_amount: String + + attr_accessor start_date: Time + + def initialize: ( + applies_to_price_interval_ids: ::Array[String], + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter], + maximum_amount: String, + start_date: Time + ) -> void + + def to_hash: -> { + applies_to_price_interval_ids: ::Array[String], + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter], + maximum_amount: String, + start_date: Time + } + + type filter = + { + field: Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::operator, + values: ::Array[String] + } + + class Filter < Orb::Internal::Type::BaseModel + attr_accessor field: Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::field + + attr_accessor operator: Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::operator + + attr_accessor values: ::Array[String] + + def initialize: ( + field: Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::operator, + values: ::Array[String] + ) -> void + + def to_hash: -> { + field: Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::operator, + values: ::Array[String] + } + + type field = + :price_id | :item_id | :price_type | :currency | :pricing_unit_id + + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID: :price_id + ITEM_ID: :item_id + PRICE_TYPE: :price_type + CURRENCY: :currency + PRICING_UNIT_ID: :pricing_unit_id + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::field] + end + + type operator = :includes | :excludes + + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES: :includes + EXCLUDES: :excludes + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval::Filter::operator] + end + end + end + + type minimum_interval = + { + applies_to_price_interval_ids: ::Array[String], + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter], + minimum_amount: String, + start_date: Time + } + + class MinimumInterval < Orb::Internal::Type::BaseModel + attr_accessor applies_to_price_interval_ids: ::Array[String] + + attr_accessor end_date: Time? + + attr_accessor filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter] + + attr_accessor minimum_amount: String + + attr_accessor start_date: Time + + def initialize: ( + applies_to_price_interval_ids: ::Array[String], + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter], + minimum_amount: String, + start_date: Time + ) -> void + + def to_hash: -> { + applies_to_price_interval_ids: ::Array[String], + end_date: Time?, + filters: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter], + minimum_amount: String, + start_date: Time + } + + type filter = + { + field: Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::operator, + values: ::Array[String] + } + + class Filter < Orb::Internal::Type::BaseModel + attr_accessor field: Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::field + + attr_accessor operator: Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::operator + + attr_accessor values: ::Array[String] + + def initialize: ( + field: Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::operator, + values: ::Array[String] + ) -> void + + def to_hash: -> { + field: Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::field, + operator: Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::operator, + values: ::Array[String] + } + + type field = + :price_id | :item_id | :price_type | :currency | :pricing_unit_id + + module Field + extend Orb::Internal::Type::Enum + + PRICE_ID: :price_id + ITEM_ID: :item_id + PRICE_TYPE: :price_type + CURRENCY: :currency + PRICING_UNIT_ID: :pricing_unit_id + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::field] + end + + type operator = :includes | :excludes + + module Operator + extend Orb::Internal::Type::Enum + + INCLUDES: :includes + EXCLUDES: :excludes + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval::Filter::operator] + end + end + end + + type pending_subscription_change = { id: String } + + class PendingSubscriptionChange < Orb::Internal::Type::BaseModel + attr_accessor id: String + + def initialize: (id: String) -> void + + def to_hash: -> { id: String } + end + + type price_interval = + { + id: String, + billing_cycle_day: Integer, + current_billing_period_end_date: Time?, + current_billing_period_start_date: Time?, + end_date: Time?, + filter: String?, + fixed_fee_quantity_transitions: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval::FixedFeeQuantityTransition]?, + price: Orb::Models::price, + start_date: Time, + usage_customer_ids: ::Array[String]? + } + + class PriceInterval < Orb::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor billing_cycle_day: Integer + + attr_accessor current_billing_period_end_date: Time? + + attr_accessor current_billing_period_start_date: Time? + + attr_accessor end_date: Time? + + attr_accessor filter: String? + + attr_accessor fixed_fee_quantity_transitions: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval::FixedFeeQuantityTransition]? + + attr_accessor price: Orb::Models::price + + attr_accessor start_date: Time + + attr_accessor usage_customer_ids: ::Array[String]? + + def initialize: ( + id: String, + billing_cycle_day: Integer, + current_billing_period_end_date: Time?, + current_billing_period_start_date: Time?, + end_date: Time?, + filter: String?, + fixed_fee_quantity_transitions: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval::FixedFeeQuantityTransition]?, + price: Orb::Models::price, + start_date: Time, + usage_customer_ids: ::Array[String]? + ) -> void + + def to_hash: -> { + id: String, + billing_cycle_day: Integer, + current_billing_period_end_date: Time?, + current_billing_period_start_date: Time?, + end_date: Time?, + filter: String?, + fixed_fee_quantity_transitions: ::Array[Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval::FixedFeeQuantityTransition]?, + price: Orb::Models::price, + start_date: Time, + usage_customer_ids: ::Array[String]? + } + + type fixed_fee_quantity_transition = + { effective_date: Time, price_id: String, quantity: Integer } + + class FixedFeeQuantityTransition < Orb::Internal::Type::BaseModel + attr_accessor effective_date: Time + + attr_accessor price_id: String + + attr_accessor quantity: Integer + + def initialize: ( + effective_date: Time, + price_id: String, + quantity: Integer + ) -> void + + def to_hash: -> { + effective_date: Time, + price_id: String, + quantity: Integer + } + end + end + + type redeemed_coupon = + { coupon_id: String, end_date: Time?, start_date: Time } + + class RedeemedCoupon < Orb::Internal::Type::BaseModel + attr_accessor coupon_id: String + + attr_accessor end_date: Time? + + attr_accessor start_date: Time + + def initialize: ( + coupon_id: String, + end_date: Time?, + start_date: Time + ) -> void + + def to_hash: -> { coupon_id: String, end_date: Time?, start_date: Time } + end + + type status = :active | :ended | :upcoming + + module Status + extend Orb::Internal::Type::Enum + + ACTIVE: :active + ENDED: :ended + UPCOMING: :upcoming + + def self?.values: -> ::Array[Orb::Models::SubscriptionRedeemCouponResponse::status] + end + + type trial_info = { end_date: Time? } + + class TrialInfo < Orb::Internal::Type::BaseModel + attr_accessor end_date: Time? + + def initialize: (end_date: Time?) -> void + + def to_hash: -> { end_date: Time? } + end + + type changed_resources = + { + created_credit_notes: ::Array[Orb::CreditNote], + created_invoices: ::Array[Orb::Invoice], + voided_credit_notes: ::Array[Orb::CreditNote], + voided_invoices: ::Array[Orb::Invoice] + } + + class ChangedResources < Orb::Internal::Type::BaseModel + attr_accessor created_credit_notes: ::Array[Orb::CreditNote] + + attr_accessor created_invoices: ::Array[Orb::Invoice] + + attr_accessor voided_credit_notes: ::Array[Orb::CreditNote] + + attr_accessor voided_invoices: ::Array[Orb::Invoice] + + def initialize: ( + created_credit_notes: ::Array[Orb::CreditNote], + created_invoices: ::Array[Orb::Invoice], + voided_credit_notes: ::Array[Orb::CreditNote], + voided_invoices: ::Array[Orb::Invoice] + ) -> void + + def to_hash: -> { + created_credit_notes: ::Array[Orb::CreditNote], + created_invoices: ::Array[Orb::Invoice], + voided_credit_notes: ::Array[Orb::CreditNote], + voided_invoices: ::Array[Orb::Invoice] + } + end + end + end +end diff --git a/sig/orb/resources/subscriptions.rbs b/sig/orb/resources/subscriptions.rbs index 8e31894a..2ada0f75 100644 --- a/sig/orb/resources/subscriptions.rbs +++ b/sig/orb/resources/subscriptions.rbs @@ -119,6 +119,15 @@ module Orb ?request_options: Orb::request_opts ) -> Orb::Models::SubscriptionPriceIntervalsResponse + def redeem_coupon: ( + String subscription_id, + change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option, + coupon_id: String, + ?allow_invoice_credit_or_void: bool?, + ?change_date: Time?, + ?request_options: Orb::request_opts + ) -> Orb::Models::SubscriptionRedeemCouponResponse + def schedule_plan_change: ( String subscription_id, change_option: Orb::Models::SubscriptionSchedulePlanChangeParams::change_option, diff --git a/test/orb/resources/invoice_line_items_test.rb b/test/orb/resources/invoice_line_items_test.rb index 2af99ceb..d2550d61 100644 --- a/test/orb/resources/invoice_line_items_test.rb +++ b/test/orb/resources/invoice_line_items_test.rb @@ -35,7 +35,7 @@ def test_create_required_params minimum_amount: String | nil, name: String, partially_invoiced_amount: String, - price: Orb::Price | nil, + price: Orb::Price, quantity: Float, start_date: Time, sub_line_items: ^(Orb::Internal::Type::ArrayOf[union: Orb::Models::InvoiceLineItemCreateResponse::SubLineItem]), diff --git a/test/orb/resources/subscriptions_test.rb b/test/orb/resources/subscriptions_test.rb index f2af6af6..b531414c 100644 --- a/test/orb/resources/subscriptions_test.rb +++ b/test/orb/resources/subscriptions_test.rb @@ -310,6 +310,52 @@ def test_price_intervals end end + def test_redeem_coupon_required_params + response = + @orb.subscriptions.redeem_coupon( + "subscription_id", + change_option: :requested_date, + coupon_id: "coupon_id" + ) + + assert_pattern do + response => Orb::Models::SubscriptionRedeemCouponResponse + end + + assert_pattern do + response => { + id: String, + active_plan_phase_order: Integer | nil, + adjustment_intervals: ^(Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::AdjustmentInterval]), + auto_collection: Orb::Internal::Type::Boolean | nil, + billing_cycle_anchor_configuration: Orb::Models::SubscriptionRedeemCouponResponse::BillingCycleAnchorConfiguration, + billing_cycle_day: Integer, + created_at: Time, + current_billing_period_end_date: Time | nil, + current_billing_period_start_date: Time | nil, + customer: Orb::Customer, + default_invoice_memo: String | nil, + discount_intervals: ^(Orb::Internal::Type::ArrayOf[union: Orb::Models::SubscriptionRedeemCouponResponse::DiscountInterval]), + end_date: Time | nil, + fixed_fee_quantity_schedule: ^(Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::FixedFeeQuantitySchedule]), + invoicing_threshold: String | nil, + maximum_intervals: ^(Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::MaximumInterval]), + metadata: ^(Orb::Internal::Type::HashOf[String]), + minimum_intervals: ^(Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::MinimumInterval]), + name: String, + net_terms: Integer, + pending_subscription_change: Orb::Models::SubscriptionRedeemCouponResponse::PendingSubscriptionChange | nil, + plan: Orb::Plan | nil, + price_intervals: ^(Orb::Internal::Type::ArrayOf[Orb::Models::SubscriptionRedeemCouponResponse::PriceInterval]), + redeemed_coupon: Orb::Models::SubscriptionRedeemCouponResponse::RedeemedCoupon | nil, + start_date: Time, + status: Orb::Models::SubscriptionRedeemCouponResponse::Status, + trial_info: Orb::Models::SubscriptionRedeemCouponResponse::TrialInfo, + changed_resources: Orb::Models::SubscriptionRedeemCouponResponse::ChangedResources | nil + } + end + end + def test_schedule_plan_change_required_params response = @orb.subscriptions.schedule_plan_change("subscription_id", change_option: :requested_date)