diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c1ce2c41..ad4acf8c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.36.0" + ".": "4.37.0" } diff --git a/.stats.yml b/.stats.yml index e670c774..6a74fe0f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-bf3e71b33372f4a9307f4b6cb689ea46b3cf583ecc5d79eee9601cd0b0467c9a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0f43f737c6520ed2a2407628511350362959997f89a868c50aa38d47d5791171.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index b6b1c707..22e57a1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 4.37.0 (2024-11-25) + +Full Changelog: [v4.36.0...v4.37.0](https://github.com/orbcorp/orb-node/compare/v4.36.0...v4.37.0) + +### Features + +* **api:** api update ([#400](https://github.com/orbcorp/orb-node/issues/400)) ([51f7af8](https://github.com/orbcorp/orb-node/commit/51f7af8d42168b2b6a48cc2cba2023c036bed26d)) + + +### Chores + +* rebuild project due to codegen change ([#397](https://github.com/orbcorp/orb-node/issues/397)) ([1dbe63e](https://github.com/orbcorp/orb-node/commit/1dbe63e53509b3ad4b3a24cc2095d255259dec4c)) + + +### Documentation + +* remove suggestion to use `npm` call out ([#399](https://github.com/orbcorp/orb-node/issues/399)) ([d329ab8](https://github.com/orbcorp/orb-node/commit/d329ab81a84693cb7e8890bf9726e04f531c9328)) + ## 4.36.0 (2024-11-15) Full Changelog: [v4.35.0...v4.36.0](https://github.com/orbcorp/orb-node/compare/v4.35.0...v4.36.0) diff --git a/README.md b/README.md index 77d948a4..98924b37 100644 --- a/README.md +++ b/README.md @@ -352,7 +352,7 @@ The following runtimes are supported: - Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more) - Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions. -- Deno v1.28.0 or higher, using `import Orb from "npm:orb-billing"`. +- Deno v1.28.0 or higher. - Bun 1.0 or later. - Cloudflare Workers. - Vercel Edge Runtime. diff --git a/package.json b/package.json index f132328d..f1d2f869 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orb-billing", - "version": "4.36.0", + "version": "4.37.0", "description": "The official TypeScript library for the Orb API", "author": "Orb ", "types": "dist/index.d.ts", diff --git a/src/resources/subscriptions.ts b/src/resources/subscriptions.ts index 95c807fa..4978ecb5 100644 --- a/src/resources/subscriptions.ts +++ b/src/resources/subscriptions.ts @@ -18360,6 +18360,8 @@ export interface SubscriptionSchedulePlanChangeParams { */ billing_cycle_alignment?: 'unchanged' | 'plan_change_date' | 'start_of_month' | null; + billing_cycle_anchor_configuration?: SubscriptionSchedulePlanChangeParams.BillingCycleAnchorConfiguration | null; + /** * The date that the plan change should take effect. This parameter can only be * passed if the `change_option` is `requested_date`. @@ -20946,6 +20948,29 @@ export namespace SubscriptionSchedulePlanChangeParams { } } + export interface BillingCycleAnchorConfiguration { + /** + * 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: number; + + /** + * 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?: number | null; + + /** + * 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?: number | null; + } + export interface RemoveAdjustment { /** * The id of the adjustment to remove on the subscription. diff --git a/src/version.ts b/src/version.ts index 460925ca..33019f3d 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.36.0'; // x-release-please-version +export const VERSION = '4.37.0'; // x-release-please-version diff --git a/tests/api-resources/alerts.test.ts b/tests/api-resources/alerts.test.ts index e99ceca7..1d82b2c8 100644 --- a/tests/api-resources/alerts.test.ts +++ b/tests/api-resources/alerts.test.ts @@ -28,9 +28,7 @@ describe('resource alerts', () => { }); test('update: only required params', async () => { - const responsePromise = client.alerts.update('alert_configuration_id', { - thresholds: [{ value: 0 }, { value: 0 }, { value: 0 }], - }); + const responsePromise = client.alerts.update('alert_configuration_id', { thresholds: [{ value: 0 }] }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -41,9 +39,7 @@ describe('resource alerts', () => { }); test('update: required and optional params', async () => { - const response = await client.alerts.update('alert_configuration_id', { - thresholds: [{ value: 0 }, { value: 0 }, { value: 0 }], - }); + const response = await client.alerts.update('alert_configuration_id', { thresholds: [{ value: 0 }] }); }); // plan_version=0 breaks Prism @@ -103,7 +99,7 @@ describe('resource alerts', () => { const response = await client.alerts.createForCustomer('customer_id', { currency: 'currency', type: 'usage_exceeded', - thresholds: [{ value: 0 }, { value: 0 }, { value: 0 }], + thresholds: [{ value: 0 }], }); }); @@ -125,13 +121,13 @@ describe('resource alerts', () => { const response = await client.alerts.createForExternalCustomer('external_customer_id', { currency: 'currency', type: 'usage_exceeded', - thresholds: [{ value: 0 }, { value: 0 }, { value: 0 }], + thresholds: [{ value: 0 }], }); }); test('createForSubscription: only required params', async () => { const responsePromise = client.alerts.createForSubscription('subscription_id', { - thresholds: [{ value: 0 }, { value: 0 }, { value: 0 }], + thresholds: [{ value: 0 }], type: 'usage_exceeded', }); const rawResponse = await responsePromise.asResponse(); @@ -145,7 +141,7 @@ describe('resource alerts', () => { test('createForSubscription: required and optional params', async () => { const response = await client.alerts.createForSubscription('subscription_id', { - thresholds: [{ value: 0 }, { value: 0 }, { value: 0 }], + thresholds: [{ value: 0 }], type: 'usage_exceeded', metric_id: 'metric_id', }); diff --git a/tests/api-resources/customers/customers.test.ts b/tests/api-resources/customers/customers.test.ts index 2ae7d375..abbde7fb 100644 --- a/tests/api-resources/customers/customers.test.ts +++ b/tests/api-resources/customers/customers.test.ts @@ -27,12 +27,10 @@ describe('resource customers', () => { accounting_sync_configuration: { accounting_providers: [ { external_provider_id: 'external_provider_id', provider_type: 'provider_type' }, - { external_provider_id: 'external_provider_id', provider_type: 'provider_type' }, - { external_provider_id: 'external_provider_id', provider_type: 'provider_type' }, ], excluded: true, }, - additional_emails: ['string', 'string', 'string'], + additional_emails: ['string'], auto_collection: true, billing_address: { city: 'city', diff --git a/tests/api-resources/events/events.test.ts b/tests/api-resources/events/events.test.ts index dff68357..af7321be 100644 --- a/tests/api-resources/events/events.test.ts +++ b/tests/api-resources/events/events.test.ts @@ -61,18 +61,6 @@ describe('resource events', () => { properties: {}, timestamp: '2020-12-09T16:09:53Z', }, - { - event_name: 'event_name', - idempotency_key: 'idempotency_key', - properties: {}, - timestamp: '2020-12-09T16:09:53Z', - }, - { - event_name: 'event_name', - idempotency_key: 'idempotency_key', - properties: {}, - timestamp: '2020-12-09T16:09:53Z', - }, ], }); const rawResponse = await responsePromise.asResponse(); @@ -95,22 +83,6 @@ describe('resource events', () => { customer_id: 'customer_id', external_customer_id: 'external_customer_id', }, - { - event_name: 'event_name', - idempotency_key: 'idempotency_key', - properties: {}, - timestamp: '2020-12-09T16:09:53Z', - customer_id: 'customer_id', - external_customer_id: 'external_customer_id', - }, - { - event_name: 'event_name', - idempotency_key: 'idempotency_key', - properties: {}, - timestamp: '2020-12-09T16:09:53Z', - customer_id: 'customer_id', - external_customer_id: 'external_customer_id', - }, ], backfill_id: 'backfill_id', debug: true, diff --git a/tests/api-resources/invoices.test.ts b/tests/api-resources/invoices.test.ts index 54c45eb8..8cf01698 100644 --- a/tests/api-resources/invoices.test.ts +++ b/tests/api-resources/invoices.test.ts @@ -116,7 +116,7 @@ describe('resource invoices', () => { 'invoice_date[lte]': '2019-12-27T18:11:19.117Z', is_recurring: true, limit: 1, - status: ['draft', 'issued', 'paid'], + status: ['draft'], subscription_id: 'subscription_id', }, { path: '/_stainless_unknown_path' }, diff --git a/tests/api-resources/subscriptions.test.ts b/tests/api-resources/subscriptions.test.ts index 302a638a..796d8b3e 100644 --- a/tests/api-resources/subscriptions.test.ts +++ b/tests/api-resources/subscriptions.test.ts @@ -59,7 +59,7 @@ describe('resource subscriptions', () => { 'created_at[lt]': '2019-12-27T18:11:19.117Z', 'created_at[lte]': '2019-12-27T18:11:19.117Z', cursor: 'cursor', - customer_id: ['string', 'string', 'string'], + customer_id: ['string'], external_customer_id: 'external_customer_id', limit: 1, status: 'active', @@ -259,26 +259,6 @@ describe('resource subscriptions', () => { plan_phase_order: 0, start_date: '2019-12-27T18:11:19.117Z', }, - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - end_date: '2019-12-27T18:11:19.117Z', - plan_phase_order: 0, - start_date: '2019-12-27T18:11:19.117Z', - }, - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - end_date: '2019-12-27T18:11:19.117Z', - plan_phase_order: 0, - start_date: '2019-12-27T18:11:19.117Z', - }, ], add_prices: [ { @@ -289,112 +269,6 @@ describe('resource subscriptions', () => { percentage_discount: 0.15, usage_discount: 0, }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - ], - end_date: '2019-12-27T18:11:19.117Z', - external_price_id: 'external_price_id', - maximum_amount: '1.23', - minimum_amount: '1.23', - plan_phase_order: 0, - price: { - cadence: 'annual', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - currency: 'currency', - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - reference_id: 'reference_id', - }, - price_id: 'h74gfhdjvn7ujokd', - start_date: '2019-12-27T18:11:19.117Z', - }, - { - discounts: [ - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - ], - end_date: '2019-12-27T18:11:19.117Z', - external_price_id: 'external_price_id', - maximum_amount: '1.23', - minimum_amount: '1.23', - plan_phase_order: 0, - price: { - cadence: 'annual', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - currency: 'currency', - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - reference_id: 'reference_id', - }, - price_id: 'h74gfhdjvn7ujokd', - start_date: '2019-12-27T18:11:19.117Z', - }, - { - discounts: [ - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, ], end_date: '2019-12-27T18:11:19.117Z', external_price_id: 'external_price_id', @@ -426,6 +300,7 @@ describe('resource subscriptions', () => { align_billing_with_plan_change_date: true, auto_collection: true, billing_cycle_alignment: 'unchanged', + billing_cycle_anchor_configuration: { day: 1, month: 1, year: 0 }, change_date: '2017-07-21T17:32:28Z', coupon_redemption_code: 'coupon_redemption_code', credits_overage_rate: 0, @@ -437,17 +312,9 @@ describe('resource subscriptions', () => { per_credit_overage_amount: 0, plan_id: 'ZMwNQefe7J3ecf7W', plan_version_number: 0, - price_overrides: [{}, {}, {}], - remove_adjustments: [ - { adjustment_id: 'h74gfhdjvn7ujokd' }, - { adjustment_id: 'h74gfhdjvn7ujokd' }, - { adjustment_id: 'h74gfhdjvn7ujokd' }, - ], - remove_prices: [ - { external_price_id: 'external_price_id', price_id: 'h74gfhdjvn7ujokd' }, - { external_price_id: 'external_price_id', price_id: 'h74gfhdjvn7ujokd' }, - { external_price_id: 'external_price_id', price_id: 'h74gfhdjvn7ujokd' }, - ], + price_overrides: [{}], + remove_adjustments: [{ adjustment_id: 'h74gfhdjvn7ujokd' }], + remove_prices: [{ external_price_id: 'external_price_id', price_id: 'h74gfhdjvn7ujokd' }], replace_adjustments: [ { adjustment: { @@ -457,22 +324,6 @@ describe('resource subscriptions', () => { }, replaces_adjustment_id: 'replaces_adjustment_id', }, - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - replaces_adjustment_id: 'replaces_adjustment_id', - }, - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - replaces_adjustment_id: 'replaces_adjustment_id', - }, ], replace_prices: [ { @@ -484,110 +335,6 @@ describe('resource subscriptions', () => { percentage_discount: 0.15, usage_discount: 0, }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - ], - external_price_id: 'external_price_id', - fixed_price_quantity: 2, - maximum_amount: '1.23', - minimum_amount: '1.23', - price: { - cadence: 'annual', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - currency: 'currency', - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - reference_id: 'reference_id', - }, - price_id: 'h74gfhdjvn7ujokd', - }, - { - replaces_price_id: 'replaces_price_id', - discounts: [ - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - ], - external_price_id: 'external_price_id', - fixed_price_quantity: 2, - maximum_amount: '1.23', - minimum_amount: '1.23', - price: { - cadence: 'annual', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - currency: 'currency', - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - reference_id: 'reference_id', - }, - price_id: 'h74gfhdjvn7ujokd', - }, - { - replaces_price_id: 'replaces_price_id', - discounts: [ - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, ], external_price_id: 'external_price_id', fixed_price_quantity: 2,