From c1134f19e4d29b422fa601874b62a5894959f9a5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Jun 2024 21:19:03 +0000 Subject: [PATCH] feat(api)!: add semi_annual cadence and remove metadata from update items (#217) --- .stats.yml | 2 +- src/resources/invoices.ts | 15 +++ src/resources/items.ts | 7 -- src/resources/plans/plans.ts | 32 ++--- src/resources/prices/prices.ts | 72 +++++------ src/resources/subscriptions.ts | 139 +++++++++++++++++++--- tests/api-resources/invoices.test.ts | 6 + tests/api-resources/items.test.ts | 1 - tests/api-resources/subscriptions.test.ts | 46 +++++++ 9 files changed, 241 insertions(+), 79 deletions(-) diff --git a/.stats.yml b/.stats.yml index e7af37e..b83ed00 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-a6a1b7ffd49d131bfc4a1e8e508ac1fe23875c64b27c99f97dd4df06ea5e3ff5.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-6bef7452aabfcad0e298c7e0bbbd90aa6a1d954ad99a04fe756b827fd12a7ce9.yml diff --git a/src/resources/invoices.ts b/src/resources/invoices.ts index 48fe480..46da1a4 100644 --- a/src/resources/invoices.ts +++ b/src/resources/invoices.ts @@ -408,6 +408,11 @@ export namespace Invoice { */ next_attempt_at: string | null; + /** + * Number of auto-collection payment attempts. + */ + num_attempts: number | null; + /** * If Orb has ever attempted payment auto-collection for this invoice, this field * will reflect when that attempt occurred. In conjunction with `next_attempt_at`, @@ -1571,6 +1576,11 @@ export namespace InvoiceFetchUpcomingResponse { */ next_attempt_at: string | null; + /** + * Number of auto-collection payment attempts. + */ + num_attempts: number | null; + /** * If Orb has ever attempted payment auto-collection for this invoice, this field * will reflect when that attempt occurred. In conjunction with `next_attempt_at`, @@ -2469,6 +2479,11 @@ export interface InvoiceCreateParams { */ customer_id?: string | null; + /** + * An optional discount to attach to the invoice. + */ + discount?: Shared.Discount | null; + /** * The `external_customer_id` of the `Customer` to create this invoice for. One of * `customer_id` and `external_customer_id` are required. diff --git a/src/resources/items.ts b/src/resources/items.ts index 0053333..ea9e9c9 100644 --- a/src/resources/items.ts +++ b/src/resources/items.ts @@ -86,13 +86,6 @@ export interface ItemCreateParams { export interface ItemUpdateParams { external_connections: Array | 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 ItemUpdateParams { diff --git a/src/resources/plans/plans.ts b/src/resources/plans/plans.ts index 257484b..02c5495 100644 --- a/src/resources/plans/plans.ts +++ b/src/resources/plans/plans.ts @@ -228,7 +228,7 @@ export namespace Plan { */ duration: number | null; - duration_unit: 'daily' | 'monthly' | 'quarterly' | 'annual' | null; + duration_unit: 'daily' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual' | null; maximum: PlanPhase.Maximum | null; @@ -347,7 +347,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -416,7 +416,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -491,7 +491,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -586,7 +586,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -674,7 +674,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -770,7 +770,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -844,7 +844,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -933,7 +933,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -1014,7 +1014,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -1074,7 +1074,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -1134,7 +1134,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -1194,7 +1194,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -1254,7 +1254,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -1314,7 +1314,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. @@ -1374,7 +1374,7 @@ export namespace PlanCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * The id of the item the plan will be associated with. diff --git a/src/resources/prices/prices.ts b/src/resources/prices/prices.ts index 25fda5c..4f11dc1 100644 --- a/src/resources/prices/prices.ts +++ b/src/resources/prices/prices.ts @@ -360,7 +360,7 @@ export namespace Price { billable_metric: UnitPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -453,7 +453,7 @@ export namespace Price { billable_metric: PackagePrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -552,7 +552,7 @@ export namespace Price { billable_metric: MatrixPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -671,7 +671,7 @@ export namespace Price { billable_metric: TieredPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -783,7 +783,7 @@ export namespace Price { billable_metric: TieredBpsPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -903,7 +903,7 @@ export namespace Price { bps_config: BpsPrice.BpsConfig; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -1001,7 +1001,7 @@ export namespace Price { bulk_bps_config: BulkBpsPrice.BulkBpsConfig; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -1114,7 +1114,7 @@ export namespace Price { bulk_config: BulkPrice.BulkConfig; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -1219,7 +1219,7 @@ export namespace Price { billable_metric: ThresholdTotalAmountPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -1305,7 +1305,7 @@ export namespace Price { billable_metric: TieredPackagePrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -1391,7 +1391,7 @@ export namespace Price { billable_metric: GroupedTieredPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -1477,7 +1477,7 @@ export namespace Price { billable_metric: TieredWithMinimumPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -1563,7 +1563,7 @@ export namespace Price { billable_metric: TieredPackageWithMinimumPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -1649,7 +1649,7 @@ export namespace Price { billable_metric: PackageWithAllocationPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -1735,7 +1735,7 @@ export namespace Price { billable_metric: UnitWithPercentPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -1821,7 +1821,7 @@ export namespace Price { billable_metric: MatrixWithAllocationPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -1945,7 +1945,7 @@ export namespace Price { billable_metric: TieredWithProrationPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -2031,7 +2031,7 @@ export namespace Price { billable_metric: UnitWithProrationPrice.BillableMetric | null; - cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual'; + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual'; conversion_rate: number | null; @@ -2142,7 +2142,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -2210,7 +2210,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -2284,7 +2284,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -2378,7 +2378,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -2477,7 +2477,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -2564,7 +2564,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -2659,7 +2659,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -2732,7 +2732,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -2820,7 +2820,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -2900,7 +2900,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -2959,7 +2959,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -3018,7 +3018,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -3077,7 +3077,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -3136,7 +3136,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -3195,7 +3195,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -3254,7 +3254,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -3313,7 +3313,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -3372,7 +3372,7 @@ export namespace PriceCreateParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. diff --git a/src/resources/subscriptions.ts b/src/resources/subscriptions.ts index 8304595..8e370a7 100644 --- a/src/resources/subscriptions.ts +++ b/src/resources/subscriptions.ts @@ -3575,10 +3575,20 @@ export interface SubscriptionPriceIntervalsParams { */ add?: Array; + /** + * A list of adjustments to add to the subscription. + */ + add_adjustments?: Array; + /** * A list of price intervals to edit on the subscription. */ edit?: Array; + + /** + * A list of adjustments to edit on the subscription. + */ + edit_adjustments?: Array; } export namespace SubscriptionPriceIntervalsParams { @@ -3702,7 +3712,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -3770,7 +3780,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -3844,7 +3854,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -3938,7 +3948,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4037,7 +4047,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4124,7 +4134,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4219,7 +4229,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4292,7 +4302,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4380,7 +4390,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4460,7 +4470,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4519,7 +4529,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4578,7 +4588,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4637,7 +4647,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4696,7 +4706,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4755,7 +4765,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4814,7 +4824,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4873,7 +4883,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4932,7 +4942,7 @@ export namespace SubscriptionPriceIntervalsParams { /** * The cadence to bill for this price on. */ - cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time'; + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time'; /** * An ISO 4217 currency string for which this price is billed in. @@ -4988,6 +4998,80 @@ export namespace SubscriptionPriceIntervalsParams { } } + export interface AddAdjustment { + /** + * The definition of a new adjustment to create and add to the subscription. + */ + adjustment: + | AddAdjustment.NewPercentageDiscount + | AddAdjustment.NewAmountDiscount + | AddAdjustment.NewMinimum + | AddAdjustment.NewMaximum; + + /** + * The start date of the adjustment interval. This is the date that the adjustment + * will start affecting prices on the subscription. + */ + start_date: (string & {}) | Shared.BillingCycleRelativeDate; + + /** + * The end date of the adjustment interval. This is the date that the adjustment + * will stop affecting prices on the subscription. + */ + end_date?: (string & {}) | Shared.BillingCycleRelativeDate | null; + } + + export namespace AddAdjustment { + export interface NewPercentageDiscount { + adjustment_type: 'percentage_discount'; + + /** + * The set of price IDs to which this adjustment applies. + */ + applies_to_price_ids: Array; + + percentage_discount: number; + } + + export interface NewAmountDiscount { + adjustment_type: 'amount_discount'; + + amount_discount: string; + + /** + * The set of price IDs to which this adjustment applies. + */ + applies_to_price_ids: Array; + } + + export interface NewMinimum { + adjustment_type: 'minimum'; + + /** + * The set of price IDs to which this adjustment applies. + */ + applies_to_price_ids: Array; + + /** + * The item ID that revenue from this minimum will be attributed to. + */ + item_id: string; + + minimum_amount: string; + } + + export interface NewMaximum { + adjustment_type: 'maximum'; + + /** + * The set of price IDs to which this adjustment applies. + */ + applies_to_price_ids: Array; + + maximum_amount: string; + } + } + export interface Edit { /** * The id of the price interval to edit. @@ -5034,6 +5118,25 @@ export namespace SubscriptionPriceIntervalsParams { quantity: number; } } + + export interface EditAdjustment { + /** + * The id of the adjustment interval to edit. + */ + adjustment_interval_id: string; + + /** + * The updated end date of this adjustment interval. If not specified, the start + * date will not be updated. + */ + end_date?: (string & {}) | Shared.BillingCycleRelativeDate | null; + + /** + * The updated start date of this adjustment interval. If not specified, the start + * date will not be updated. + */ + start_date?: (string & {}) | Shared.BillingCycleRelativeDate; + } } export interface SubscriptionSchedulePlanChangeParams { diff --git a/tests/api-resources/invoices.test.ts b/tests/api-resources/invoices.test.ts index 0cc89eb..0792693 100644 --- a/tests/api-resources/invoices.test.ts +++ b/tests/api-resources/invoices.test.ts @@ -88,6 +88,12 @@ describe('resource invoices', () => { ], net_terms: 0, customer_id: '4khy3nwzktxv7', + discount: { + discount_type: 'percentage', + applies_to_price_ids: ['h74gfhdjvn7ujokd', '7hfgtgjnbvc3ujkl'], + reason: 'string', + percentage_discount: 0.15, + }, external_customer_id: 'external-customer-id', memo: 'An optional memo for my invoice.', metadata: { foo: 'string' }, diff --git a/tests/api-resources/items.test.ts b/tests/api-resources/items.test.ts index f08a6ef..cea11e8 100644 --- a/tests/api-resources/items.test.ts +++ b/tests/api-resources/items.test.ts @@ -48,7 +48,6 @@ describe('resource items', () => { { external_connection_name: 'stripe', external_entity_id: 'string' }, { external_connection_name: 'stripe', external_entity_id: 'string' }, ], - metadata: { foo: 'string' }, }); }); diff --git a/tests/api-resources/subscriptions.test.ts b/tests/api-resources/subscriptions.test.ts index 551606d..3ab500f 100644 --- a/tests/api-resources/subscriptions.test.ts +++ b/tests/api-resources/subscriptions.test.ts @@ -461,6 +461,35 @@ describe('resource subscriptions', () => { maximum_amount: 0, }, ], + add_adjustments: [ + { + adjustment: { + applies_to_price_ids: ['price_1', 'price_2'], + adjustment_type: 'percentage_discount', + percentage_discount: 0, + }, + start_date: '2019-12-27T18:11:19.117Z', + end_date: '2019-12-27T18:11:19.117Z', + }, + { + adjustment: { + applies_to_price_ids: ['price_1', 'price_2'], + adjustment_type: 'percentage_discount', + percentage_discount: 0, + }, + start_date: '2019-12-27T18:11:19.117Z', + end_date: '2019-12-27T18:11:19.117Z', + }, + { + adjustment: { + applies_to_price_ids: ['price_1', 'price_2'], + adjustment_type: 'percentage_discount', + percentage_discount: 0, + }, + start_date: '2019-12-27T18:11:19.117Z', + end_date: '2019-12-27T18:11:19.117Z', + }, + ], edit: [ { price_interval_id: 'sdfs6wdjvn7ujokd', @@ -496,6 +525,23 @@ describe('resource subscriptions', () => { billing_cycle_day: 0, }, ], + edit_adjustments: [ + { + adjustment_interval_id: 'sdfs6wdjvn7ujokd', + start_date: '2019-12-27T18:11:19.117Z', + end_date: '2019-12-27T18:11:19.117Z', + }, + { + adjustment_interval_id: 'sdfs6wdjvn7ujokd', + start_date: '2019-12-27T18:11:19.117Z', + end_date: '2019-12-27T18:11:19.117Z', + }, + { + adjustment_interval_id: 'sdfs6wdjvn7ujokd', + start_date: '2019-12-27T18:11:19.117Z', + end_date: '2019-12-27T18:11:19.117Z', + }, + ], }, { path: '/_stainless_unknown_path' }, ),