diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4cce3762..83a9352d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.56.0" + ".": "4.57.0" } diff --git a/.stats.yml b/.stats.yml index 4de92a98..e5439953 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 103 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-2824cb456b8e3a7ce1ea34aa37a2c8e63d5b70425a5863502ffe1e1b1ef7efaf.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-4dede72b827939939b5386cda07c3bc1fa2eea79901819792c1820e8531718d6.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index f1af1922..0799620d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 4.57.0 (2025-02-15) + +Full Changelog: [v4.56.0...v4.57.0](https://github.com/orbcorp/orb-node/compare/v4.56.0...v4.57.0) + +### Features + +* **api:** api update ([#506](https://github.com/orbcorp/orb-node/issues/506)) ([a8ca5ec](https://github.com/orbcorp/orb-node/commit/a8ca5ec2ac40fc2394b66040c747e53079518ddb)) +* **api:** api update ([#508](https://github.com/orbcorp/orb-node/issues/508)) ([e491b0e](https://github.com/orbcorp/orb-node/commit/e491b0ef6a2ac3138847b5dcdda888f5f90a9218)) + + +### Bug Fixes + +* **client:** fix export map for index exports ([#509](https://github.com/orbcorp/orb-node/issues/509)) ([c994913](https://github.com/orbcorp/orb-node/commit/c9949137fca48db8aed4d430cff6dd934a99a220)) + ## 4.56.0 (2025-02-11) Full Changelog: [v4.55.0...v4.56.0](https://github.com/orbcorp/orb-node/compare/v4.55.0...v4.56.0) diff --git a/package.json b/package.json index 124032c7..07bf0d4d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orb-billing", - "version": "4.56.0", + "version": "4.57.0", "description": "The official TypeScript library for the Orb API", "author": "Orb ", "types": "dist/index.d.ts", @@ -107,17 +107,38 @@ "default": "./dist/index.mjs" }, "./*.mjs": { - "types": "./dist/*.d.ts", - "default": "./dist/*.mjs" + "types": [ + "./dist/*.d.ts", + "./dist/*/index.d.ts" + ], + "default": [ + "./dist/*.mjs", + "./dist/*/index.mjs" + ] }, "./*.js": { - "types": "./dist/*.d.ts", - "default": "./dist/*.js" + "types": [ + "./dist/*.d.ts", + "./dist/*/index.d.ts" + ], + "default": [ + "./dist/*.js", + "./dist/*/index.js" + ] }, "./*": { - "types": "./dist/*.d.ts", - "require": "./dist/*.js", - "default": "./dist/*.mjs" + "types": [ + "./dist/*.d.ts", + "./dist/*/index.d.ts" + ], + "require": [ + "./dist/*.js", + "./dist/*/index.js" + ], + "default": [ + "./dist/*.mjs", + "./dist/*/index.mjs" + ] } } } diff --git a/src/resources/customers/costs.ts b/src/resources/customers/costs.ts index 6ab48c5f..befee2f5 100644 --- a/src/resources/customers/costs.ts +++ b/src/resources/customers/costs.ts @@ -311,19 +311,15 @@ export namespace CostListResponse { export namespace Data { export interface PerPriceCost { /** - * 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) + * The price object */ price: PricesAPI.Price; + /** + * The price the cost is associated with + */ + price_id: string; + /** * Price's contributions for the timeframe, excluding any minimums and discounts. */ @@ -368,19 +364,15 @@ export namespace CostListByExternalIDResponse { export namespace Data { export interface PerPriceCost { /** - * 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) + * The price object */ price: PricesAPI.Price; + /** + * The price the cost is associated with + */ + price_id: string; + /** * Price's contributions for the timeframe, excluding any minimums and discounts. */ diff --git a/src/resources/plans/plans.ts b/src/resources/plans/plans.ts index 7d3d2dcc..6cf625d7 100644 --- a/src/resources/plans/plans.ts +++ b/src/resources/plans/plans.ts @@ -500,6 +500,7 @@ export interface PlanCreateParams { | PlanCreateParams.NewPlanMaxGroupTieredPackagePrice | PlanCreateParams.NewPlanScalableMatrixWithUnitPricingPrice | PlanCreateParams.NewPlanScalableMatrixWithTieredPricingPrice + | PlanCreateParams.NewPlanCumulativeGroupedBulkPrice >; /** @@ -3413,6 +3414,119 @@ export namespace PlanCreateParams { duration_unit: 'day' | 'month'; } } + + export interface NewPlanCumulativeGroupedBulkPrice { + /** + * The cadence to bill for this price on. + */ + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom'; + + cumulative_grouped_bulk_config: Record; + + /** + * The id of the item the plan will be associated with. + */ + item_id: string; + + model_type: 'cumulative_grouped_bulk'; + + /** + * The name of the price. + */ + name: string; + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + billable_metric_id?: string | null; + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + billed_in_advance?: boolean | null; + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + billing_cycle_configuration?: NewPlanCumulativeGroupedBulkPrice.BillingCycleConfiguration | null; + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + conversion_rate?: number | null; + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + currency?: string | null; + + /** + * An alias for the price. + */ + external_price_id?: string | null; + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fixed_price_quantity?: number | null; + + /** + * The property used to group this price on an invoice + */ + invoice_grouping_key?: string | null; + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + invoicing_cycle_configuration?: NewPlanCumulativeGroupedBulkPrice.InvoicingCycleConfiguration | null; + + /** + * User-specified key/value pairs for the resource. 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?: Record | null; + } + + export namespace NewPlanCumulativeGroupedBulkPrice { + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + export interface BillingCycleConfiguration { + /** + * The duration of the billing period. + */ + duration: number; + + /** + * The unit of billing period duration. + */ + duration_unit: 'day' | 'month'; + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + export interface InvoicingCycleConfiguration { + /** + * The duration of the billing period. + */ + duration: number; + + /** + * The unit of billing period duration. + */ + duration_unit: 'day' | 'month'; + } + } } export interface PlanUpdateParams { diff --git a/src/resources/prices/prices.ts b/src/resources/prices/prices.ts index 6e64babb..8026e412 100644 --- a/src/resources/prices/prices.ts +++ b/src/resources/prices/prices.ts @@ -149,7 +149,8 @@ export type Price = | Price.GroupedTieredPackagePrice | Price.MaxGroupTieredPackagePrice | Price.ScalableMatrixWithUnitPricingPrice - | Price.ScalableMatrixWithTieredPricingPrice; + | Price.ScalableMatrixWithTieredPricingPrice + | Price.CumulativeGroupedBulkPrice; export namespace Price { export interface UnitPrice { @@ -3546,6 +3547,124 @@ export namespace Price { dimensional_price_group_id: string; } } + + export interface CumulativeGroupedBulkPrice { + id: string; + + billable_metric: CumulativeGroupedBulkPrice.BillableMetric | null; + + billing_cycle_configuration: CumulativeGroupedBulkPrice.BillingCycleConfiguration; + + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual' | 'custom'; + + conversion_rate: number | null; + + created_at: string; + + credit_allocation: CumulativeGroupedBulkPrice.CreditAllocation | null; + + cumulative_grouped_bulk_config: Record; + + currency: string; + + discount: Shared.Discount | null; + + external_price_id: string | null; + + fixed_price_quantity: number | null; + + invoicing_cycle_configuration: CumulativeGroupedBulkPrice.InvoicingCycleConfiguration | null; + + item: CumulativeGroupedBulkPrice.Item; + + maximum: CumulativeGroupedBulkPrice.Maximum | null; + + maximum_amount: string | null; + + /** + * 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: Record; + + minimum: CumulativeGroupedBulkPrice.Minimum | null; + + minimum_amount: string | null; + + model_type: 'cumulative_grouped_bulk'; + + name: string; + + plan_phase_order: number | null; + + price_type: 'usage_price' | 'fixed_price'; + + dimensional_price_configuration?: CumulativeGroupedBulkPrice.DimensionalPriceConfiguration | null; + } + + export namespace CumulativeGroupedBulkPrice { + export interface BillableMetric { + id: string; + } + + export interface BillingCycleConfiguration { + duration: number; + + duration_unit: 'day' | 'month'; + } + + export interface CreditAllocation { + allows_rollover: boolean; + + currency: string; + } + + export interface InvoicingCycleConfiguration { + duration: number; + + duration_unit: 'day' | 'month'; + } + + export interface Item { + id: string; + + name: string; + } + + export interface Maximum { + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase + * maximums, this can be a subset of prices. + */ + applies_to_price_ids: Array; + + /** + * Maximum amount applied + */ + maximum_amount: string; + } + + export interface Minimum { + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase + * minimums, this can be a subset of prices. + */ + applies_to_price_ids: Array; + + /** + * Minimum amount applied + */ + minimum_amount: string; + } + + export interface DimensionalPriceConfiguration { + dimension_values: Array; + + dimensional_price_group_id: string; + } + } } export interface PriceEvaluateResponse { @@ -3579,7 +3698,8 @@ export type PriceCreateParams = | PriceCreateParams.NewFloatingBulkWithProrationPrice | PriceCreateParams.NewFloatingGroupedTieredPackagePrice | PriceCreateParams.NewFloatingScalableMatrixWithUnitPricingPrice - | PriceCreateParams.NewFloatingScalableMatrixWithTieredPricingPrice; + | PriceCreateParams.NewFloatingScalableMatrixWithTieredPricingPrice + | PriceCreateParams.NewFloatingCumulativeGroupedBulkPrice; export declare namespace PriceCreateParams { export interface NewFloatingUnitPrice { @@ -6814,6 +6934,118 @@ export declare namespace PriceCreateParams { duration_unit: 'day' | 'month'; } } + + export interface NewFloatingCumulativeGroupedBulkPrice { + /** + * The cadence to bill for this price on. + */ + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom'; + + cumulative_grouped_bulk_config: Record; + + /** + * An ISO 4217 currency string for which this price is billed in. + */ + currency: string; + + /** + * The id of the item the plan will be associated with. + */ + item_id: string; + + model_type: 'cumulative_grouped_bulk'; + + /** + * The name of the price. + */ + name: string; + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + billable_metric_id?: string | null; + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + billed_in_advance?: boolean | null; + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + billing_cycle_configuration?: NewFloatingCumulativeGroupedBulkPrice.BillingCycleConfiguration | null; + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + conversion_rate?: number | null; + + /** + * An alias for the price. + */ + external_price_id?: string | null; + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fixed_price_quantity?: number | null; + + /** + * The property used to group this price on an invoice + */ + invoice_grouping_key?: string | null; + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + invoicing_cycle_configuration?: NewFloatingCumulativeGroupedBulkPrice.InvoicingCycleConfiguration | null; + + /** + * User-specified key/value pairs for the resource. 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?: Record | null; + } + + export namespace NewFloatingCumulativeGroupedBulkPrice { + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + export interface BillingCycleConfiguration { + /** + * The duration of the billing period. + */ + duration: number; + + /** + * The unit of billing period duration. + */ + duration_unit: 'day' | 'month'; + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + export interface InvoicingCycleConfiguration { + /** + * The duration of the billing period. + */ + duration: number; + + /** + * The unit of billing period duration. + */ + duration_unit: 'day' | 'month'; + } + } } export interface PriceUpdateParams { diff --git a/src/resources/subscriptions.ts b/src/resources/subscriptions.ts index 4650512c..983c6a04 100644 --- a/src/resources/subscriptions.ts +++ b/src/resources/subscriptions.ts @@ -2999,19 +2999,15 @@ export namespace SubscriptionFetchCostsResponse { export namespace Data { export interface PerPriceCost { /** - * 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) + * The price object */ price: PricesAPI.Price; + /** + * The price the cost is associated with + */ + price_id: string; + /** * Price's contributions for the timeframe, excluding any minimums and discounts. */ @@ -13239,6 +13235,13 @@ export interface SubscriptionCancelParams { */ cancel_option: 'end_of_subscription_term' | 'immediate' | 'requested_date'; + /** + * 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?: boolean | null; + /** * The date that the cancellation should take effect. This parameter can only be * passed if the `cancel_option` is `requested_date`. @@ -13337,6 +13340,13 @@ export interface SubscriptionPriceIntervalsParams { */ add_adjustments?: Array; + /** + * 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?: boolean | null; + /** * A list of price intervals to edit on the subscription. */ @@ -13429,6 +13439,7 @@ export namespace SubscriptionPriceIntervalsParams { | Add.NewFloatingGroupedTieredPackagePrice | Add.NewFloatingScalableMatrixWithUnitPricingPrice | Add.NewFloatingScalableMatrixWithTieredPricingPrice + | Add.NewFloatingCumulativeGroupedBulkPrice | null; /** @@ -16738,6 +16749,118 @@ export namespace SubscriptionPriceIntervalsParams { duration_unit: 'day' | 'month'; } } + + export interface NewFloatingCumulativeGroupedBulkPrice { + /** + * The cadence to bill for this price on. + */ + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom'; + + cumulative_grouped_bulk_config: Record; + + /** + * An ISO 4217 currency string for which this price is billed in. + */ + currency: string; + + /** + * The id of the item the plan will be associated with. + */ + item_id: string; + + model_type: 'cumulative_grouped_bulk'; + + /** + * The name of the price. + */ + name: string; + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + billable_metric_id?: string | null; + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + billed_in_advance?: boolean | null; + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + billing_cycle_configuration?: NewFloatingCumulativeGroupedBulkPrice.BillingCycleConfiguration | null; + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + conversion_rate?: number | null; + + /** + * An alias for the price. + */ + external_price_id?: string | null; + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fixed_price_quantity?: number | null; + + /** + * The property used to group this price on an invoice + */ + invoice_grouping_key?: string | null; + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + invoicing_cycle_configuration?: NewFloatingCumulativeGroupedBulkPrice.InvoicingCycleConfiguration | null; + + /** + * User-specified key/value pairs for the resource. 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?: Record | null; + } + + export namespace NewFloatingCumulativeGroupedBulkPrice { + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + export interface BillingCycleConfiguration { + /** + * The duration of the billing period. + */ + duration: number; + + /** + * The unit of billing period duration. + */ + duration_unit: 'day' | 'month'; + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + export interface InvoicingCycleConfiguration { + /** + * The duration of the billing period. + */ + duration: number; + + /** + * The unit of billing period duration. + */ + duration_unit: 'day' | 'month'; + } + } } export interface AddAdjustment { @@ -22216,6 +22339,13 @@ export namespace SubscriptionSchedulePlanChangeParams { } export interface SubscriptionTriggerPhaseParams { + /** + * 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?: boolean | null; + /** * The date on which the phase change should take effect. If not provided, defaults * to today in the customer's timezone. @@ -22238,6 +22368,13 @@ export interface SubscriptionUpdateFixedFeeQuantityParams { quantity: number; + /** + * 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?: boolean | null; + /** * Determines when the change takes effect. Note that if `effective_date` is * specified, this defaults to `effective_date`. Otherwise, this defaults to diff --git a/src/version.ts b/src/version.ts index 03692402..99e4b86d 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.56.0'; // x-release-please-version +export const VERSION = '4.57.0'; // x-release-please-version diff --git a/tests/api-resources/subscriptions.test.ts b/tests/api-resources/subscriptions.test.ts index 984d0ebc..f6db4134 100644 --- a/tests/api-resources/subscriptions.test.ts +++ b/tests/api-resources/subscriptions.test.ts @@ -85,6 +85,7 @@ describe('resource subscriptions', () => { test('cancel: required and optional params', async () => { const response = await client.subscriptions.cancel('subscription_id', { cancel_option: 'end_of_subscription_term', + allow_invoice_credit_or_void: true, cancellation_date: '2019-12-27T18:11:19.117Z', }); }); @@ -466,6 +467,7 @@ describe('resource subscriptions', () => { const response = await client.subscriptions.updateFixedFeeQuantity('subscription_id', { price_id: 'price_id', quantity: 0, + allow_invoice_credit_or_void: true, change_option: 'immediate', effective_date: '2022-12-21', });