diff --git a/LICENSE b/LICENSE index b85cedd2..4771c25c 100644 --- a/LICENSE +++ b/LICENSE @@ -3,7 +3,7 @@ License: The MIT License (MIT) http://opensource.org/licenses/MIT -Copyright (c) 2014 - 2025 APIMATIC Limited +Copyright (c) 2014 - 2026 APIMATIC Limited Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 979e48b7..040fe01c 100644 --- a/README.md +++ b/README.md @@ -29,28 +29,30 @@ curl -u :x -H Accept:application/json -H Content-Type:application/json Run the following command from your project directory to install the package from npm: ```bash -npm install @maxio-com/advanced-billing-sdk@8.0.0 +npm install @maxio-com/advanced-billing-sdk@9.0.0 ``` -For additional package details, see the [Npm page for the @maxio-com/advanced-billing-sdk@8.0.0 npm](https://www.npmjs.com/package/@maxio-com/advanced-billing-sdk/v/8.0.0). +For additional package details, see the [Npm page for the @maxio-com/advanced-billing-sdk@9.0.0 npm](https://www.npmjs.com/package/@maxio-com/advanced-billing-sdk/v/9.0.0). ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/client.md) The following parameters are configurable for the API Client: | Parameter | Type | Description | | --- | --- | --- | | site | `string` | The subdomain for your Advanced Billing site.
*Default*: `'subdomain'` | -| environment | `Environment` | The API environment.
**Default: `Environment.US`** | +| environment | [`Environment`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/README.md#environments) | The API environment.
**Default: `Environment.US`** | | timeout | `number` | Timeout for API calls.
*Default*: `120000` | -| httpClientOptions | [`Partial`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/http-client-options.md) | Stable configurable http client options. | +| httpClientOptions | [`Partial`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/http-client-options.md) | Stable configurable http client options. | | unstableHttpClientOptions | `any` | Unstable configurable http client options. | -| basicAuthCredentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/auth/basic-authentication.md) | The credential object for basicAuth | +| basicAuthCredentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/auth/basic-authentication.md) | The credential object for basicAuth | The API client can be initialized as follows: +### Code-Based Client Initialization + ```ts import { Client, Environment } from '@maxio-com/advanced-billing-sdk'; @@ -65,6 +67,47 @@ const client = new Client({ }); ``` +### Configuration-Based Client Initialization + +```ts +import * as path from 'path'; +import * as fs from 'fs'; +import { Client } from '@maxio-com/advanced-billing-sdk'; + +// Provide absolute path for the configuration file +const absolutePath = path.resolve('./config.json'); + +// Read the configuration file content +const fileContent = fs.readFileSync(absolutePath, 'utf-8'); + +// Initialize client from JSON configuration content +const client = Client.fromJsonConfig(fileContent); +``` + +See the [Configuration-Based Client Initialization](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/configuration-based-client-initialization.md) section for details. + +### Environment-Based Client Initialization + +```ts +import * as dotenv from 'dotenv'; +import * as path from 'path'; +import * as fs from 'fs'; +import { Client } from '@maxio-com/advanced-billing-sdk'; + +// Optional - Provide absolute path for the .env file +const absolutePath = path.resolve('./.env'); + +if (fs.existsSync(absolutePath)) { + // Load environment variables from .env file + dotenv.config({ path: absolutePath, override: true }); +} + +// Initialize client using environment variables +const client = Client.fromEnvironment(process.env); +``` + +See the [Environment-Based Client Initialization](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/environment-based-client-initialization.md) section for details. + ## Environments The SDK can be configured to use a different environment for making API calls. Available environments are: @@ -80,57 +123,60 @@ The SDK can be configured to use a different environment for making API calls. A This API uses the following authentication schemes. -* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/auth/basic-authentication.md) +* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/auth/basic-authentication.md) ## List of APIs -* [API Exports](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/api-exports.md) -* [Advance Invoice](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/advance-invoice.md) -* [Billing Portal](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/billing-portal.md) -* [Component Price Points](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/component-price-points.md) -* [Custom Fields](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/custom-fields.md) -* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/events-based-billing-segments.md) -* [Payment Profiles](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/payment-profiles.md) -* [Product Families](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/product-families.md) -* [Product Price Points](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/product-price-points.md) -* [Proforma Invoices](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/proforma-invoices.md) -* [Reason Codes](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/reason-codes.md) -* [Referral Codes](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/referral-codes.md) -* [Sales Commissions](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/sales-commissions.md) -* [Subscription Components](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/subscription-components.md) -* [Subscription Groups](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/subscription-groups.md) -* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/subscription-group-invoice-account.md) -* [Subscription Group Status](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/subscription-group-status.md) -* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/subscription-invoice-account.md) -* [Subscription Notes](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/subscription-notes.md) -* [Subscription Products](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/subscription-products.md) -* [Subscription Status](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/subscription-status.md) -* [Coupons](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/coupons.md) -* [Components](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/components.md) -* [Customers](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/customers.md) -* [Events](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/events.md) -* [Insights](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/insights.md) -* [Invoices](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/invoices.md) -* [Offers](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/offers.md) -* [Products](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/products.md) -* [Sites](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/sites.md) -* [Subscriptions](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/subscriptions.md) -* [Webhooks](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/controllers/webhooks.md) +* [API Exports](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/api-exports.md) +* [Advance Invoice](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/advance-invoice.md) +* [Billing Portal](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/billing-portal.md) +* [Component Price Points](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/component-price-points.md) +* [Custom Fields](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/custom-fields.md) +* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/events-based-billing-segments.md) +* [Payment Profiles](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/payment-profiles.md) +* [Product Families](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/product-families.md) +* [Product Price Points](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/product-price-points.md) +* [Proforma Invoices](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/proforma-invoices.md) +* [Reason Codes](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/reason-codes.md) +* [Referral Codes](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/referral-codes.md) +* [Sales Commissions](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/sales-commissions.md) +* [Subscription Components](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/subscription-components.md) +* [Subscription Groups](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/subscription-groups.md) +* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/subscription-group-invoice-account.md) +* [Subscription Group Status](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/subscription-group-status.md) +* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/subscription-invoice-account.md) +* [Subscription Notes](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/subscription-notes.md) +* [Subscription Products](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/subscription-products.md) +* [Subscription Renewals](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/subscription-renewals.md) +* [Subscription Status](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/subscription-status.md) +* [Coupons](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/coupons.md) +* [Components](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/components.md) +* [Customers](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/customers.md) +* [Events](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/events.md) +* [Insights](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/insights.md) +* [Invoices](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/invoices.md) +* [Offers](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/offers.md) +* [Products](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/products.md) +* [Sites](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/sites.md) +* [Subscriptions](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/subscriptions.md) +* [Webhooks](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/controllers/webhooks.md) ## SDK Infrastructure ### Configuration -* [HttpClientOptions](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/http-client-options.md) -* [RetryConfiguration](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/retry-configuration.md) -* [ProxySettings](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/proxy-settings.md) +* [HttpClientOptions](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/http-client-options.md) +* [RetryConfiguration](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/retry-configuration.md) +* [ProxySettings](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/proxy-settings.md) +* [Configuration-Based Client Initialization](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/configuration-based-client-initialization.md) +* [Environment-Based Client Initialization](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/environment-based-client-initialization.md) ### HTTP -* [HttpRequest](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/http-request.md) +* [HttpRequest](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/http-request.md) ### Utilities -* [ApiResponse](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/api-response.md) -* [ApiError](https://www.github.com/maxio-com/ab-typescript-sdk/tree/8.0.0/doc/api-error.md) +* [ApiResponse](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/api-response.md) +* [ApiError](https://www.github.com/maxio-com/ab-typescript-sdk/tree/9.0.0/doc/api-error.md) diff --git a/doc/auth/basic-authentication.md b/doc/auth/basic-authentication.md index 25c3f2e5..0edaee17 100644 --- a/doc/auth/basic-authentication.md +++ b/doc/auth/basic-authentication.md @@ -9,8 +9,8 @@ Documentation for accessing and setting credentials for BasicAuth. | Name | Type | Description | Setter | | --- | --- | --- | --- | -| BasicAuthUserName | `string` | The username to use with basic authentication | `username` | -| BasicAuthPassword | `string` | The password to use with basic authentication | `password` | +| basicAuthUserName | `string` | The username to use with basic authentication | `username` | +| basicAuthPassword | `string` | The password to use with basic authentication | `password` | diff --git a/doc/client.md b/doc/client.md index c1a54bf1..17b5b753 100644 --- a/doc/client.md +++ b/doc/client.md @@ -6,7 +6,7 @@ The following parameters are configurable for the API Client: | Parameter | Type | Description | | --- | --- | --- | | site | `string` | The subdomain for your Advanced Billing site.
*Default*: `'subdomain'` | -| environment | `Environment` | The API environment.
**Default: `Environment.US`** | +| environment | [`Environment`](../README.md#environments) | The API environment.
**Default: `Environment.US`** | | timeout | `number` | Timeout for API calls.
*Default*: `120000` | | httpClientOptions | [`Partial`](../doc/http-client-options.md) | Stable configurable http client options. | | unstableHttpClientOptions | `any` | Unstable configurable http client options. | @@ -14,6 +14,8 @@ The following parameters are configurable for the API Client: The API client can be initialized as follows: +## Code-Based Client Initialization + ```ts import { Client, Environment } from '@maxio-com/advanced-billing-sdk'; @@ -28,3 +30,44 @@ const client = new Client({ }); ``` +## Configuration-Based Client Initialization + +```ts +import * as path from 'path'; +import * as fs from 'fs'; +import { Client } from '@maxio-com/advanced-billing-sdk'; + +// Provide absolute path for the configuration file +const absolutePath = path.resolve('./config.json'); + +// Read the configuration file content +const fileContent = fs.readFileSync(absolutePath, 'utf-8'); + +// Initialize client from JSON configuration content +const client = Client.fromJsonConfig(fileContent); +``` + +See the [Configuration-Based Client Initialization](../doc/configuration-based-client-initialization.md) section for details. + +## Environment-Based Client Initialization + +```ts +import * as dotenv from 'dotenv'; +import * as path from 'path'; +import * as fs from 'fs'; +import { Client } from '@maxio-com/advanced-billing-sdk'; + +// Optional - Provide absolute path for the .env file +const absolutePath = path.resolve('./.env'); + +if (fs.existsSync(absolutePath)) { + // Load environment variables from .env file + dotenv.config({ path: absolutePath, override: true }); +} + +// Initialize client using environment variables +const client = Client.fromEnvironment(process.env); +``` + +See the [Environment-Based Client Initialization](../doc/environment-based-client-initialization.md) section for details. + diff --git a/doc/configuration-based-client-initialization.md b/doc/configuration-based-client-initialization.md new file mode 100644 index 00000000..cee0a8dd --- /dev/null +++ b/doc/configuration-based-client-initialization.md @@ -0,0 +1,72 @@ + +# Configuration-Based Client Initialization + +The SDK client can be initialized directly from a JSON configuration file using the `fromJsonConfig` static method available on the `Client` class.` This allows you to store and load configuration settings from JSON files, making it easier to organize and manage different configurations across environments. + +## Node.js Environment + +In Node.js environments, you can use the `fs` module to read the configuration file from the file system. + +```ts +import * as path from 'path'; +import * as fs from 'fs'; +import { Client } from '@maxio-com/advanced-billing-sdk'; + +// Provide absolute path for the .env file +const absolutePath = path.resolve('./config.json'); + +// Read the configuration file content +const fileContent = fs.readFileSync(absolutePath, 'utf-8'); + +// Initialize client from JSON configuration content +const client = Client.fromJsonConfig(fileContent); +``` + +## Browser Environment + +In browser environments, you can use the `import` function to load the configuration file. + +```ts +import { Client } from '@maxio-com/advanced-billing-sdk'; + +// Load configuration using dynamic import +const configModule = await import('./config.json', { assert: { type: 'json' } }); + +// Initialize client from JSON configuration content +const client = Client.fromJsonConfig(JSON.stringify(configModule.default)); +``` + +## Example Configuration File + +```json +{ + "timeout": 30000, + "environment": "US", + "site": "subdomain", + "basicAuthCredentials": { + "username": "username", + "password": "password" + }, + "httpClientOptions": { + "timeout": 30000, + "retryConfig": { + "maxNumberOfRetries": 3, + "retryOnTimeout": true, + "retryInterval": 10, + "maximumRetryWaitTime": 120, + "backoffFactor": 2, + "httpStatusCodesToRetry": [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], + "httpMethodsToRetry": ["GET", "PUT", "DELETE"] + }, + "proxySettings": { + "address": "http://localhost:3000", + "port": 8080, + "auth": { + "username": "username", + "password": "password" + } + } + } +} +``` + diff --git a/doc/controllers/advance-invoice.md b/doc/controllers/advance-invoice.md index 885198c5..5e3b6041 100644 --- a/doc/controllers/advance-invoice.md +++ b/doc/controllers/advance-invoice.md @@ -34,7 +34,7 @@ async issueAdvanceInvoice( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`IssueAdvanceInvoiceRequest \| undefined`](../../doc/models/issue-advance-invoice-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -74,6 +74,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -101,7 +104,7 @@ async readAdvanceInvoice( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -161,7 +164,7 @@ async voidAdvanceInvoice( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`VoidInvoiceRequest \| undefined`](../../doc/models/void-invoice-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | diff --git a/doc/controllers/api-exports.md b/doc/controllers/api-exports.md index de7d67b0..f3e98800 100644 --- a/doc/controllers/api-exports.md +++ b/doc/controllers/api-exports.md @@ -288,6 +288,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SingleErrorResponseError) { + console.log(error.result); + } } } ``` @@ -343,6 +346,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SingleErrorResponseError) { + console.log(error.result); + } } } ``` @@ -398,6 +404,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SingleErrorResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/billing-portal.md b/doc/controllers/billing-portal.md index 47707aa0..53f142a9 100644 --- a/doc/controllers/billing-portal.md +++ b/doc/controllers/billing-portal.md @@ -79,6 +79,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -145,6 +148,11 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } else if (error instanceof TooManyManagementLinkRequestsError) { + console.log(error.result); + } } } ``` @@ -229,6 +237,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/component-price-points.md b/doc/controllers/component-price-points.md index f4c05430..6548468b 100644 --- a/doc/controllers/component-price-points.md +++ b/doc/controllers/component-price-points.md @@ -14,6 +14,7 @@ const componentPricePointsController = new ComponentPricePointsController(client * [Create Component Price Point](../../doc/controllers/component-price-points.md#create-component-price-point) * [List Component Price Points](../../doc/controllers/component-price-points.md#list-component-price-points) * [Bulk Create Component Price Points](../../doc/controllers/component-price-points.md#bulk-create-component-price-points) +* [Clone Component Price Point](../../doc/controllers/component-price-points.md#clone-component-price-point) * [Update Component Price Point](../../doc/controllers/component-price-points.md#update-component-price-point) * [Read Component Price Point](../../doc/controllers/component-price-points.md#read-component-price-point) * [Archive Component Price Point](../../doc/controllers/component-price-points.md#archive-component-price-point) @@ -192,6 +193,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorArrayMapResponseError) { + console.log(error.result); + } } } ``` @@ -421,6 +425,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -481,6 +488,164 @@ try { | 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) | +# Clone Component Price Point + +Clones a component price point. Custom price points (tied to a specific subscription) cannot be cloned. The following attributes are copied from the source price point: + +- Pricing scheme +- All price tiers (with starting/ending quantities and unit prices) +- Tax included setting +- Currency prices (if definitive pricing is set) +- Overage pricing (for prepaid usage components) +- Interval settings (if multi-frequency is enabled) +- Event-based billing segments (if applicable) + +```ts +async cloneComponentPricePoint( + componentId: CloneComponentPricePointComponentId, + pricePointId: CloneComponentPricePointPricePointId, + body?: CloneComponentPricePointRequest, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `componentId` | [`CloneComponentPricePointComponentId`](../../doc/models/containers/clone-component-price-point-component-id.md) | Template, Required | This is a container for one-of cases. | +| `pricePointId` | [`CloneComponentPricePointPricePointId`](../../doc/models/containers/clone-component-price-point-price-point-id.md) | Template, Required | This is a container for one-of cases. | +| `body` | [`CloneComponentPricePointRequest \| undefined`](../../doc/models/clone-component-price-point-request.md) | Body, Optional | - | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ComponentPricePointCurrencyOverageResponse`](../../doc/models/component-price-point-currency-overage-response.md). + +## Example Usage + +```ts +const componentId: CloneComponentPricePointComponentId = 144; + +const pricePointId: CloneComponentPricePointPricePointId = 188; + +const body: CloneComponentPricePointRequest = { + pricePoint: { + name: 'Pro Usage Tiered Clone', + }, +}; + +try { + const response = await componentPricePointsController.cloneComponentPricePoint( + componentId, + pricePointId, + body + ); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } + } +} +``` + +## Example Response *(as JSON)* + +```json +{ + "price_point": { + "id": 9012, + "name": "Pro Usage Tiered Clone", + "type": "catalog", + "pricing_scheme": "tiered", + "component_id": 1234, + "handle": "pro-usage-tiered-clone", + "archived_at": null, + "created_at": "2024-05-01T12:34:56-04:00", + "updated_at": "2024-05-01T12:34:56-04:00", + "use_site_exchange_rate": false, + "currency_prices": [ + { + "id": 3001, + "currency": "EUR", + "price": "9.99", + "formatted_price": "€9.99", + "price_id": 4001, + "price_point_id": 9012 + } + ], + "currency_overage_prices": [ + { + "id": 3002, + "currency": "EUR", + "price": "2.50", + "formatted_price": "€2.50", + "price_id": 4002, + "price_point_id": 9012 + } + ], + "renew_prepaid_allocation": true, + "rollover_prepaid_remainder": false, + "expiration_interval": 1, + "expiration_interval_unit": "month", + "overage_pricing_scheme": "tiered", + "subscription_id": 4321, + "prices": [ + { + "id": 4001, + "component_id": 1234, + "starting_quantity": 1, + "ending_quantity": 100, + "unit_price": "9.99", + "price_point_id": 9012, + "formatted_unit_price": "$9.99", + "segment_id": null + } + ], + "overage_prices": [ + { + "id": 4002, + "component_id": 1234, + "starting_quantity": 101, + "ending_quantity": null, + "unit_price": "2.50", + "price_point_id": 9012, + "formatted_unit_price": "$2.50", + "segment_id": null + } + ], + "tax_included": false, + "interval": 1, + "interval_unit": "month" + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 404 | Not Found | `ApiError` | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) | + + # Update Component Price Point When updating a price point, prices can be updated as well by creating new prices or editing / removing existing ones. @@ -565,6 +730,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorArrayMapResponseError) { + console.log(error.result); + } } } ``` @@ -586,7 +754,7 @@ async readComponentPricePoint( pricePointId: ReadComponentPricePointPricePointId, currencyPrices?: boolean, requestOptions?: RequestOptions -): Promise> +): Promise> ``` ## Parameters @@ -600,7 +768,7 @@ async readComponentPricePoint( ## Response Type -This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ComponentPricePointResponse`](../../doc/models/component-price-point-response.md). +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ComponentPricePointCurrencyOverageResponse`](../../doc/models/component-price-point-currency-overage-response.md). ## Example Usage @@ -691,6 +859,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -900,6 +1071,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorArrayMapResponseError) { + console.log(error.result); + } } } ``` @@ -995,6 +1169,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorArrayMapResponseError) { + console.log(error.result); + } } } ``` @@ -1106,6 +1283,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/components.md b/doc/controllers/components.md index c728cd88..caba7ca1 100644 --- a/doc/controllers/components.md +++ b/doc/controllers/components.md @@ -97,6 +97,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -241,6 +244,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -372,6 +378,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -505,6 +514,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -655,6 +667,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -945,6 +960,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -1040,6 +1058,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -1327,6 +1348,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/coupons.md b/doc/controllers/coupons.md index 45bccf1c..30a068fd 100644 --- a/doc/controllers/coupons.md +++ b/doc/controllers/coupons.md @@ -115,6 +115,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -549,6 +552,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -973,6 +979,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SingleStringErrorResponseError) { + console.log(error.result); + } } } ``` @@ -1080,6 +1089,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorStringMapResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/custom-fields.md b/doc/controllers/custom-fields.md index c55e9d26..f296025f 100644 --- a/doc/controllers/custom-fields.md +++ b/doc/controllers/custom-fields.md @@ -103,6 +103,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SingleErrorResponseError) { + console.log(error.result); + } } } ``` @@ -320,6 +323,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SingleErrorResponseError) { + console.log(error.result); + } } } ``` @@ -465,6 +471,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SingleErrorResponseError) { + console.log(error.result); + } } } ``` @@ -627,6 +636,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SingleErrorResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/customers.md b/doc/controllers/customers.md index fe1745a5..44138d5c 100644 --- a/doc/controllers/customers.md +++ b/doc/controllers/customers.md @@ -106,6 +106,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof CustomerErrorResponseError) { + console.log(error.result); + } } } ``` @@ -483,6 +486,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof CustomerErrorResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/events-based-billing-segments.md b/doc/controllers/events-based-billing-segments.md index f97a3eca..3678be32 100644 --- a/doc/controllers/events-based-billing-segments.md +++ b/doc/controllers/events-based-billing-segments.md @@ -96,6 +96,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof EventBasedBillingSegmentErrorsError) { + console.log(error.result); + } } } ``` @@ -183,6 +186,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof EventBasedBillingListSegmentsErrorsError) { + console.log(error.result); + } } } ``` @@ -258,6 +264,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof EventBasedBillingSegmentErrorsError) { + console.log(error.result); + } } } ``` @@ -403,6 +412,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof EventBasedBillingSegmentError) { + console.log(error.result); + } } } ``` @@ -475,6 +487,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof EventBasedBillingSegmentError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/events.md b/doc/controllers/events.md index 997c11f3..9063a299 100644 --- a/doc/controllers/events.md +++ b/doc/controllers/events.md @@ -280,7 +280,7 @@ async listSubscriptionEvents( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `page` | `number \| undefined` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

**Constraints**: `>= 1` | | `perPage` | `number \| undefined` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
Use in query `per_page=200`.

**Default**: `20`

**Constraints**: `<= 200` | | `sinceId` | `bigint \| undefined` | Query, Optional | Returns events with an id greater than or equal to the one specified | diff --git a/doc/controllers/insights.md b/doc/controllers/insights.md index 9bfdc370..c79e539e 100644 --- a/doc/controllers/insights.md +++ b/doc/controllers/insights.md @@ -387,6 +387,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SubscriptionsMrrErrorResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md index 42ddf5e2..2c6934c5 100644 --- a/doc/controllers/invoices.md +++ b/doc/controllers/invoices.md @@ -98,6 +98,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -1248,6 +1251,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -1348,6 +1354,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -2154,7 +2163,7 @@ async recordPaymentForSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`RecordPaymentRequest \| undefined`](../../doc/models/record-payment-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -2199,6 +2208,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -2290,6 +2302,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -2360,6 +2375,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -2937,7 +2955,7 @@ async createInvoice( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`CreateInvoiceRequest \| undefined`](../../doc/models/create-invoice-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -2985,6 +3003,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorArrayMapResponseError) { + console.log(error.result); + } } } ``` @@ -3097,6 +3118,8 @@ try { This endpoint allows for invoices to be programmatically delivered via email. This endpoint supports the delivery of both ad-hoc and automatically generated invoices. Additionally, this endpoint supports email delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients. +**File Attachments**: You can attach files to invoice emails using `attachment_urls[]` parameter by providing URLs to the files you want to attach. When using attachments, the request must use `multipart/form-data` content type. Max 10 files, 10MB per file. + If no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address. On success, a 204 no-content response will be returned. The response does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned. @@ -3161,6 +3184,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -3221,6 +3247,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -3335,6 +3364,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -3537,7 +3569,7 @@ try { # Issue Invoice -This endpoint allows you to issue an invoice that is in "pending" status. For example, you can issue an invoice that was created when allocating new quantity on a component and using "accrue charges" option. +This endpoint allows you to issue an invoice that is in "pending" or "draft" status. For example, you can issue an invoice that was created when allocating new quantity on a component and using "accrue charges" option. You cannot issue a pending child invoice that was created for a member subscription in a group. @@ -3601,6 +3633,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/offers.md b/doc/controllers/offers.md index c2d5d02a..f563e2eb 100644 --- a/doc/controllers/offers.md +++ b/doc/controllers/offers.md @@ -93,6 +93,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorArrayMapResponseError) { + console.log(error.result); + } } } ``` @@ -207,6 +210,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/payment-profiles.md b/doc/controllers/payment-profiles.md index 55676a85..e00b14c0 100644 --- a/doc/controllers/payment-profiles.md +++ b/doc/controllers/payment-profiles.md @@ -153,6 +153,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -545,6 +548,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorStringMapResponseError) { + console.log(error.result); + } } } ``` @@ -625,6 +631,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -639,7 +648,7 @@ try { # Delete Subscriptions Payment Profile -This will delete a payment profile belonging to the customer on the subscription. +Deletes a payment profile belonging to the customer on the subscription. + If the customer has multiple subscriptions, the payment profile will be removed from all of them. @@ -657,7 +666,7 @@ async deleteSubscriptionsPaymentProfile( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `paymentProfileId` | `number` | Template, Required | The Chargify id of the payment profile | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -759,6 +768,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -801,7 +813,7 @@ try { # Delete Subscription Group Payment Profile -This will delete a Payment Profile belonging to a Subscription Group. +Deletes a Payment Profile belonging to a Subscription Group. **Note**: If the Payment Profile belongs to multiple Subscription Groups and/or Subscriptions, it will be removed from all of them. @@ -878,7 +890,7 @@ async changeSubscriptionDefaultPaymentProfile( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `paymentProfileId` | `number` | Template, Required | The Chargify id of the payment profile | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -916,6 +928,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -1015,6 +1030,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -1106,6 +1124,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -1138,7 +1159,7 @@ async sendRequestUpdatePaymentEmail( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -1170,6 +1191,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/product-families.md b/doc/controllers/product-families.md index b87c2381..c05212d6 100644 --- a/doc/controllers/product-families.md +++ b/doc/controllers/product-families.md @@ -274,6 +274,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -380,7 +383,8 @@ try { "handle": "acme-projects", "accounting_code": null, "created_at": "2013-02-20T15:05:51-07:00", - "updated_at": "2013-02-20T15:05:51-07:00" + "updated_at": "2013-02-20T15:05:51-07:00", + "archived_at": null } }, { @@ -391,7 +395,8 @@ try { "handle": "bat-family", "accounting_code": null, "created_at": "2014-04-16T12:41:13-06:00", - "updated_at": "2014-04-16T12:41:13-06:00" + "updated_at": "2014-04-16T12:41:13-06:00", + "archived_at": "2024-11-05T09:30:00-07:00" } } ] @@ -460,7 +465,8 @@ try { "name": "Acme Projects", "description": "", "handle": "billing-plans", - "accounting_code": null + "accounting_code": null, + "archived_at": null } } ``` diff --git a/doc/controllers/product-price-points.md b/doc/controllers/product-price-points.md index 48b22119..d3895f0a 100644 --- a/doc/controllers/product-price-points.md +++ b/doc/controllers/product-price-points.md @@ -93,6 +93,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ProductPricePointErrorResponseError) { + console.log(error.result); + } } } ``` @@ -476,6 +479,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -917,6 +923,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorArrayMapResponseError) { + console.log(error.result); + } } } ``` @@ -1014,6 +1023,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorArrayMapResponseError) { + console.log(error.result); + } } } ``` @@ -1125,6 +1137,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/products.md b/doc/controllers/products.md index ae0a6e3d..9d7f12a8 100644 --- a/doc/controllers/products.md +++ b/doc/controllers/products.md @@ -90,6 +90,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -302,6 +305,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -410,6 +416,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/proforma-invoices.md b/doc/controllers/proforma-invoices.md index 71f5aef9..7185eb90 100644 --- a/doc/controllers/proforma-invoices.md +++ b/doc/controllers/proforma-invoices.md @@ -15,6 +15,7 @@ const proformaInvoicesController = new ProformaInvoicesController(client); * [Read Proforma Invoice](../../doc/controllers/proforma-invoices.md#read-proforma-invoice) * [Create Proforma Invoice](../../doc/controllers/proforma-invoices.md#create-proforma-invoice) * [List Proforma Invoices](../../doc/controllers/proforma-invoices.md#list-proforma-invoices) +* [Deliver Proforma Invoice](../../doc/controllers/proforma-invoices.md#deliver-proforma-invoice) * [Void Proforma Invoice](../../doc/controllers/proforma-invoices.md#void-proforma-invoice) * [Preview Proforma Invoice](../../doc/controllers/proforma-invoices.md#preview-proforma-invoice) * [Create Signup Proforma Invoice](../../doc/controllers/proforma-invoices.md#create-signup-proforma-invoice) @@ -74,6 +75,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -258,7 +262,7 @@ async createProformaInvoice( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -290,6 +294,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -344,7 +351,7 @@ async listProformaInvoices( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `startDate` | `string \| undefined` | Query, Optional | The beginning date range for the invoice's Due Date, in the YYYY-MM-DD format. | | `endDate` | `string \| undefined` | Query, Optional | The ending date range for the invoice's Due Date, in the YYYY-MM-DD format. | | `status` | [`ProformaInvoiceStatus \| undefined`](../../doc/models/proforma-invoice-status.md) | Query, Optional | The current status of the invoice. Allowed Values: draft, open, paid, pending, voided | @@ -404,6 +411,90 @@ try { ``` +# Deliver Proforma Invoice + +Allows for proforma invoices to be programmatically delivered via email. Supports email +delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients. + +If `recipient_emails` is omitted, the system will fall back to the primary recipient derived from the invoice or +subscription. At least one recipient must be present, either via the request body or via this default behavior, so an +empty body may still succeed when defaults are available. + +```ts +async deliverProformaInvoice( + proformaInvoiceUid: string, + body?: DeliverProformaInvoiceRequest, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `proformaInvoiceUid` | `string` | Template, Required | The uid of the proforma invoice | +| `body` | [`DeliverProformaInvoiceRequest \| undefined`](../../doc/models/deliver-proforma-invoice-request.md) | Body, Optional | - | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ProformaInvoice`](../../doc/models/proforma-invoice.md). + +## Example Usage + +```ts +const proformaInvoiceUid = 'proforma_invoice_uid4'; + +const body: DeliverProformaInvoiceRequest = { + recipientEmails: [ + 'user0@example.com' + ], + ccRecipientEmails: [ + 'user1@example.com' + ], + bccRecipientEmails: [ + 'user2@example.com' + ], +}; + +try { + const response = await proformaInvoicesController.deliverProformaInvoice( + proformaInvoiceUid, + body + ); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 404 | Not Found | `ApiError` | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) | + + # Void Proforma Invoice This endpoint will void a proforma invoice that has the status "draft". @@ -461,6 +552,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -494,7 +588,7 @@ async previewProformaInvoice( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -526,6 +620,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -600,6 +697,11 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ProformaBadRequestErrorResponseError) { + console.log(error.result); + } else if (error instanceof ErrorArrayMapResponseError) { + console.log(error.result); + } } } ``` @@ -679,6 +781,11 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ProformaBadRequestErrorResponseError) { + console.log(error.result); + } else if (error instanceof ErrorArrayMapResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/reason-codes.md b/doc/controllers/reason-codes.md index 451876ba..4c342a98 100644 --- a/doc/controllers/reason-codes.md +++ b/doc/controllers/reason-codes.md @@ -84,6 +84,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -152,6 +155,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -310,6 +316,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/referral-codes.md b/doc/controllers/referral-codes.md index 40e37348..af7ffb7c 100644 --- a/doc/controllers/referral-codes.md +++ b/doc/controllers/referral-codes.md @@ -64,6 +64,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SingleStringErrorResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/subscription-components.md b/doc/controllers/subscription-components.md index 2e1dae49..a431a5b1 100644 --- a/doc/controllers/subscription-components.md +++ b/doc/controllers/subscription-components.md @@ -45,7 +45,7 @@ async readSubscriptionComponent( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `componentId` | `number` | Template, Required | The Advanced Billing id of the component. Alternatively, the component's handle prefixed by `handle:` | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -160,7 +160,7 @@ async listSubscriptionComponents( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `dateField` | [`SubscriptionListDateField \| undefined`](../../doc/models/subscription-list-date-field.md) | Query, Optional | The type of filter you'd like to apply to your search. Use in query `date_field=updated_at`. | | `direction` | [`SortingDirection \| undefined`](../../doc/models/sorting-direction.md) | Query, Optional | Controls the order in which results are returned.
Use in query `direction=asc`. | | `filter` | [`ListSubscriptionComponentsFilter \| undefined`](../../doc/models/list-subscription-components-filter.md) | Query, Optional | Filter to use for List Subscription Components operation | @@ -281,7 +281,7 @@ async bulkUpdateSubscriptionComponentsPricePoints( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`BulkComponentsPricePointAssignment \| undefined`](../../doc/models/bulk-components-price-point-assignment.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -334,6 +334,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ComponentPricePointError) { + console.log(error.result); + } } } ``` @@ -379,7 +382,7 @@ async bulkResetSubscriptionComponentsPricePoints( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -518,41 +521,13 @@ try { # Allocate Component -This endpoint creates a new allocation, setting the current allocated quantity for the Component and recording a memo. - -**Notice**: Allocations can only be updated for Quantity, On/Off, and Prepaid Components. - -## Allocations Documentation - -Full documentation on how to record Allocations in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview). It is focused on how allocations operate within the Advanced Billing UI.It goes into greater detail on how the user interface will react when recording allocations. - -This documentation also goes into greater detail on how proration is taken into consideration when applying component allocations. +Creates an allocation, sets the current allocated quantity for the component, and records a memo. Allocations can only be updated for Quantity, On/Off, and Prepaid Components. -## Proration Schemes +When creating an allocation via the API, you can pass the `upgrade_charge`, `downgrade_credit`, and `accrue_charge` to be applied. -Changing the allocated quantity of a component mid-period can result in either a Charge or Credit being applied to the subscription. When creating an allocation via the API, you can pass the `upgrade_charge`, `downgrade_credit`, and `accrue_charge` to be applied. +> **Note:** These proration and accural fields are ignored for Prepaid Components since this component type always generate charges immediately without proration. -**Notice:** These proration and accural fields will be ignored for Prepaid Components since this component type always generate charges immediately without proration. - -For background information on prorated components and upgrade/downgrade schemes, see [Setting Component Allocations.](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration). -See the tables below for valid values. - -| upgrade_charge | Definition                                                        | -|----------------|-------------------------------------------------------------------| -| `full`         | A charge is added for the full price of the component.            | -| `prorated`     | A charge is added for the prorated price of the component change. | -| `none`         | No charge is added.                                               | - -| downgrade_credit | Definition                                        | -|------------------|---------------------------------------------------| -| `full`           | A full price credit is added for the amount owed. | -| `prorated`       | A prorated credit is added for the amount owed.   | -| `none`           | No charge is added.                               | - -| accrue_charge | Definition                                                                                               | -|---------------|------------------------------------------------------------------------------------------------------------| -| `true`        | Attempt to charge the customer at next renewal. | -| `false`       | Attempt to charge the customer right away. If it fails, the charge will be accrued until the next renewal. | +For information on prorated components and upgrade/downgrade schemes, see [Setting Component Allocations.](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration) ### Order of Resolution for upgrade_charge and downgrade_credit @@ -566,7 +541,9 @@ See the tables below for valid values. 1. Allocation API call top level (outside of the `allocations` array) 2. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration#proration-schemes) -**NOTE: Proration uses the current price of the component as well as the current tax rates. Changes to either may cause the prorated charge/credit to be wrong.** +> **Note:** Proration uses the current price of the component as well as the current tax rates. Changes to either may cause the prorated charge/credit to be wrong. + +For more informaiton see the [Component Allocations](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview) product Documentation. ```ts async allocateComponent( @@ -581,7 +558,7 @@ async allocateComponent( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `componentId` | `number` | Template, Required | The Advanced Billing id of the component | | `body` | [`CreateAllocationRequest \| undefined`](../../doc/models/create-allocation-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -599,8 +576,44 @@ const componentId = 222; const body: CreateAllocationRequest = { allocation: { - quantity: 5, - memo: 'Recoding component purchase of Acme Support', + quantity: 10, + decimalQuantity: '10.0', + previousQuantity: 5, + decimalPreviousQuantity: '5.0', + memo: 'Increase seats to 10', + prorationDowngradeScheme: 'prorate', + prorationUpgradeScheme: 'full-price-attempt-capture', + downgradeCredit: DowngradeCreditCreditType.Prorated, + upgradeCharge: UpgradeChargeCreditType.Full, + accrueCharge: false, + pricePointId: 789, + billingSchedule: { + initialBillingAt: '2025-02-28', + }, + customPrice: { + prices: [ + { + startingQuantity: 1, + unitPrice: '49.00', + endingQuantity: 25, + }, + { + startingQuantity: 26, + unitPrice: '39.00', + endingQuantity: null, + } + ], + taxIncluded: false, + pricingScheme: PricingScheme.PerUnit, + interval: 1, + intervalUnit: IntervalUnit.Month, + listPricePointId: 4321, + useDefaultListPrice: false, + renewPrepaidAllocation: false, + rolloverPrepaidRemainder: false, + expirationInterval: 150, + expirationIntervalUnit: ExpirationIntervalUnit.Never, + }, }, }; @@ -628,6 +641,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -675,21 +691,6 @@ This endpoint returns the 50 most recent Allocations, ordered by most recent fir When a subscription's on/off component has been toggled to on (`1`) or off (`0`), usage will be logged in this response. -## Querying data via Advanced Billing gem - -You can also query the current quantity via the [official Advanced Billing Gem.](http://github.com/chargify/chargify_api_ares) - -```# First way -component = Chargify::Subscription::Component.find(1, :params => {:subscription_id => 7}) -puts component.allocated_quantity -# => 23 - -# Second way -component = Chargify::Subscription.find(7).component(1) -puts component.allocated_quantity -# => 23 -``` - ```ts async listAllocations( subscriptionId: number, @@ -703,7 +704,7 @@ async listAllocations( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `componentId` | `number` | Template, Required | The Advanced Billing id of the component | | `page` | `number \| undefined` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

**Constraints**: `>= 1` | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -745,6 +746,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -804,11 +808,25 @@ try { # Allocate Components -Creates multiple allocations, setting the current allocated quantity for each of the components and recording a memo. The charges and/or credits that are created will be rolled up into a single total which is used to determine whether this is an upgrade or a downgrade. Be aware of the Order of Resolutions explained below in determining the proration scheme. +Creates multiple allocations, sets the current allocated quantity for each of the components, and recording a memo. A `component_id` is required for each allocation. -A `component_id` is required for each allocation. +The charges and/or credits that are created will be rolled up into a single total which is used to determine whether this is an upgrade or a downgrade. -This endpoint only responds to JSON. It is not available for XML. +### Order of Resolution for upgrade_charge and downgrade_credit + +1. Per allocation in API call (within a single allocation of the `allocations` array) +2. [Component-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview) +3. Allocation API call top level (outside of the `allocations` array) +4. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration#proration-schemes) + +### Order of Resolution for accrue charge + +1. Allocation API call top level (outside of the `allocations` array) +2. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration#proration-schemes) + +> **Note:** Proration uses the current price of the component as well as the current tax rates. Changes to either may cause the prorated charge/credit to be wrong. + +For more informaiton see the [Component Allocations](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview) product Documentation. ```ts async allocateComponents( @@ -822,7 +840,7 @@ async allocateComponents( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`AllocateComponents \| undefined`](../../doc/models/allocate-components.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -875,6 +893,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -952,7 +973,7 @@ async previewAllocations( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`PreviewAllocationsRequest \| undefined`](../../doc/models/preview-allocations-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -1002,6 +1023,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ComponentAllocationError) { + console.log(error.result); + } } } ``` @@ -1144,7 +1168,7 @@ async updatePrepaidUsageAllocationExpirationDate( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `componentId` | `number` | Template, Required | The Advanced Billing id of the component | | `allocationId` | `number` | Template, Required | The Advanced Billing id of the allocation | | `body` | [`UpdateAllocationExpirationDate \| undefined`](../../doc/models/update-allocation-expiration-date.md) | Body, Optional | - | @@ -1194,6 +1218,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SubscriptionComponentAllocationError) { + console.log(error.result); + } } } ``` @@ -1232,7 +1259,7 @@ async deletePrepaidUsageAllocation( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `componentId` | `number` | Template, Required | The Advanced Billing id of the component | | `allocationId` | `number` | Template, Required | The Advanced Billing id of the allocation | | `body` | [`CreditSchemeRequest \| undefined`](../../doc/models/credit-scheme-request.md) | Body, Optional | - | @@ -1280,6 +1307,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SubscriptionComponentAllocationError) { + console.log(error.result); + } } } ``` @@ -1407,6 +1437,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/subscription-group-invoice-account.md b/doc/controllers/subscription-group-invoice-account.md index 0e50c04a..47d51c86 100644 --- a/doc/controllers/subscription-group-invoice-account.md +++ b/doc/controllers/subscription-group-invoice-account.md @@ -65,6 +65,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -249,6 +252,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -333,6 +339,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/subscription-group-status.md b/doc/controllers/subscription-group-status.md index b61e115e..6e4aac74 100644 --- a/doc/controllers/subscription-group-status.md +++ b/doc/controllers/subscription-group-status.md @@ -74,6 +74,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -134,6 +137,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -192,6 +198,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -277,6 +286,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/subscription-groups.md b/doc/controllers/subscription-groups.md index b1fd9b94..eb070fff 100644 --- a/doc/controllers/subscription-groups.md +++ b/doc/controllers/subscription-groups.md @@ -95,6 +95,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SubscriptionGroupSignupErrorResponseError) { + console.log(error.result); + } } } ``` @@ -162,6 +165,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SubscriptionGroupCreateErrorResponseError) { + console.log(error.result); + } } } ``` @@ -171,6 +177,7 @@ try { ```json { "subscription_group": { + "uid": "grp_952mvqcnk53wq", "customer_id": 1, "payment_profile": { "id": 1, @@ -475,6 +482,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SubscriptionGroupUpdateErrorResponseError) { + console.log(error.result); + } } } ``` @@ -509,8 +519,8 @@ try { # Delete Subscription Group -Use this endpoint to delete subscription group. -Only groups without members can be deleted +Deletes a subscription group. +Only groups without members can be deleted. ```ts async deleteSubscriptionGroup( @@ -705,7 +715,7 @@ async addSubscriptionToGroup( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`AddSubscriptionToAGroup \| undefined`](../../doc/models/add-subscription-to-a-group.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -797,7 +807,7 @@ async removeSubscriptionFromGroup( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -829,6 +839,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/subscription-invoice-account.md b/doc/controllers/subscription-invoice-account.md index 06431649..0b448871 100644 --- a/doc/controllers/subscription-invoice-account.md +++ b/doc/controllers/subscription-invoice-account.md @@ -34,7 +34,7 @@ async readAccountBalances( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -93,7 +93,7 @@ async createPrepayment( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`CreatePrepaymentRequest \| undefined`](../../doc/models/create-prepayment-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -190,7 +190,7 @@ async listPrepayments( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `page` | `number \| undefined` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

**Constraints**: `>= 1` | | `perPage` | `number \| undefined` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
Use in query `per_page=200`.

**Default**: `20`

**Constraints**: `<= 200` | | `filter` | [`ListPrepaymentsFilter \| undefined`](../../doc/models/list-prepayments-filter.md) | Query, Optional | Filter to use for List Prepayments operations | @@ -282,7 +282,7 @@ async issueServiceCredit( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`IssueServiceCreditRequest \| undefined`](../../doc/models/issue-service-credit-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -363,7 +363,7 @@ async deductServiceCredit( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`DeductServiceCreditRequest \| undefined`](../../doc/models/deduct-service-credit-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -435,7 +435,7 @@ async listServiceCredits( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `page` | `number \| undefined` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

**Constraints**: `>= 1` | | `perPage` | `number \| undefined` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
Use in query `per_page=200`.

**Default**: `20`

**Constraints**: `<= 200` | | `direction` | [`SortingDirection \| undefined`](../../doc/models/sorting-direction.md) | Query, Optional | Controls the order in which results are returned.
Use in query `direction=asc`. | @@ -478,6 +478,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -538,7 +541,7 @@ async refundPrepayment( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `prepaymentId` | `bigint` | Template, Required | id of prepayment | | `body` | [`RefundPrepaymentRequest \| undefined`](../../doc/models/refund-prepayment-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -577,6 +580,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof RefundPrepaymentBaseErrorsResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/subscription-notes.md b/doc/controllers/subscription-notes.md index 86b6df7a..9bb3b2da 100644 --- a/doc/controllers/subscription-notes.md +++ b/doc/controllers/subscription-notes.md @@ -41,7 +41,7 @@ async createSubscriptionNote( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`UpdateSubscriptionNoteRequest \| undefined`](../../doc/models/update-subscription-note-request.md) | Body, Optional | Updatable fields for Subscription Note | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -84,6 +84,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -118,7 +121,7 @@ async listSubscriptionNotes( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `page` | `number \| undefined` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

**Constraints**: `>= 1` | | `perPage` | `number \| undefined` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
Use in query `per_page=200`.

**Default**: `20`

**Constraints**: `<= 200` | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -156,6 +159,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -210,7 +216,7 @@ async readSubscriptionNote( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `noteId` | `number` | Template, Required | The Advanced Billing id of the note | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -285,7 +291,7 @@ async updateSubscriptionNote( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `noteId` | `number` | Template, Required | The Advanced Billing id of the note | | `body` | [`UpdateSubscriptionNoteRequest \| undefined`](../../doc/models/update-subscription-note-request.md) | Body, Optional | Updatable fields for Subscription Note | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -332,6 +338,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -345,7 +354,7 @@ try { # Delete Subscription Note -Use the following method to delete a note for a Subscription. +Deletes a note for a Subscription. ```ts async deleteSubscriptionNote( @@ -359,7 +368,7 @@ async deleteSubscriptionNote( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `noteId` | `number` | Template, Required | The Advanced Billing id of the note | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | diff --git a/doc/controllers/subscription-products.md b/doc/controllers/subscription-products.md index 9bc41d29..de62c657 100644 --- a/doc/controllers/subscription-products.md +++ b/doc/controllers/subscription-products.md @@ -85,7 +85,7 @@ async migrateSubscriptionProduct( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`SubscriptionProductMigrationRequest \| undefined`](../../doc/models/subscription-product-migration-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -131,6 +131,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -286,7 +289,7 @@ async previewSubscriptionProductMigration( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`SubscriptionMigrationPreviewRequest \| undefined`](../../doc/models/subscription-migration-preview-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -331,6 +334,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/subscription-renewals.md b/doc/controllers/subscription-renewals.md new file mode 100644 index 00000000..061ca8f5 --- /dev/null +++ b/doc/controllers/subscription-renewals.md @@ -0,0 +1,1193 @@ +# Subscription Renewals + +```ts +const subscriptionRenewalsController = new SubscriptionRenewalsController(client); +``` + +## Class Name + +`SubscriptionRenewalsController` + +## Methods + +* [Create Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#create-scheduled-renewal-configuration) +* [List Scheduled Renewal Configurations](../../doc/controllers/subscription-renewals.md#list-scheduled-renewal-configurations) +* [Read Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#read-scheduled-renewal-configuration) +* [Update Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#update-scheduled-renewal-configuration) +* [Schedule Scheduled Renewal Lock In](../../doc/controllers/subscription-renewals.md#schedule-scheduled-renewal-lock-in) +* [Lock in Scheduled Renewal Immediately](../../doc/controllers/subscription-renewals.md#lock-in-scheduled-renewal-immediately) +* [Unpublish Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#unpublish-scheduled-renewal-configuration) +* [Cancel Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#cancel-scheduled-renewal-configuration) +* [Create Scheduled Renewal Configuration Item](../../doc/controllers/subscription-renewals.md#create-scheduled-renewal-configuration-item) +* [Update Scheduled Renewal Configuration Item](../../doc/controllers/subscription-renewals.md#update-scheduled-renewal-configuration-item) +* [Delete Scheduled Renewal Configuration Item](../../doc/controllers/subscription-renewals.md#delete-scheduled-renewal-configuration-item) + + +# Create Scheduled Renewal Configuration + +Creates a scheduled renewal configuration for a subscription. The scheduled renewal is based on the subscription’s current product and component setup. + +```ts +async createScheduledRenewalConfiguration( + subscriptionId: number, + body?: ScheduledRenewalConfigurationRequest, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | +| `body` | [`ScheduledRenewalConfigurationRequest \| undefined`](../../doc/models/scheduled-renewal-configuration-request.md) | Body, Optional | - | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md). + +## Example Usage + +```ts +const subscriptionId = 222; + +const body: ScheduledRenewalConfigurationRequest = { + renewalConfiguration: { + startsAt: '2024-12-01T00:00:00Z', + endsAt: '2025-12-01T00:00:00Z', + lockInAt: '2024-11-15T00:00:00Z', + contractId: 222, + }, +}; + +try { + const response = await subscriptionRenewalsController.createScheduledRenewalConfiguration( + subscriptionId, + body + ); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } + } +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2024-12-01T00:00:00Z", + "ends_at": "2025-12-01T00:00:00Z", + "lock_in_at": "2024-11-15T00:00:00Z", + "created_at": "2024-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2024-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio_id-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) | + + +# List Scheduled Renewal Configurations + +Lists scheduled renewal configurations for the subscription and permits an optional status query filter. + +```ts +async listScheduledRenewalConfigurations( + subscriptionId: number, + status?: Status, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | +| `status` | [`Status \| undefined`](../../doc/models/status.md) | Query, Optional | (Optional) Status filter for scheduled renewal configurations. | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ScheduledRenewalConfigurationsResponse`](../../doc/models/scheduled-renewal-configurations-response.md). + +## Example Usage + +```ts +const subscriptionId = 222; + +try { + const response = await subscriptionRenewalsController.listScheduledRenewalConfigurations(subscriptionId); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + } +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configurations": [ + { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2024-12-01T00:00:00Z", + "ends_at": "2025-12-01T00:00:00Z", + "lock_in_at": "2024-11-15T00:00:00Z", + "created_at": "2024-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2024-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } + ] +} +``` + + +# Read Scheduled Renewal Configuration + +Retrieves the configuration settings for the scheduled renewal. + +```ts +async readScheduledRenewalConfiguration( + subscriptionId: number, + id: number, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | +| `id` | `number` | Template, Required | The renewal id. | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md). + +## Example Usage + +```ts +const subscriptionId = 222; + +const id = 112; + +try { + const response = await subscriptionRenewalsController.readScheduledRenewalConfiguration( + subscriptionId, + id + ); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + } +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2024-12-01T00:00:00Z", + "ends_at": "2025-12-01T00:00:00Z", + "lock_in_at": "2024-11-15T00:00:00Z", + "created_at": "2024-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2024-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + + +# Update Scheduled Renewal Configuration + +Updates an existing configuration. + +```ts +async updateScheduledRenewalConfiguration( + subscriptionId: number, + id: number, + body?: ScheduledRenewalConfigurationRequest, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | +| `id` | `number` | Template, Required | The renewal id. | +| `body` | [`ScheduledRenewalConfigurationRequest \| undefined`](../../doc/models/scheduled-renewal-configuration-request.md) | Body, Optional | - | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md). + +## Example Usage + +```ts +const subscriptionId = 222; + +const id = 112; + +const body: ScheduledRenewalConfigurationRequest = { + renewalConfiguration: { + startsAt: '2025-12-01T00:00:00Z', + endsAt: '2026-12-01T00:00:00Z', + lockInAt: '2025-11-15T00:00:00Z', + }, +}; + +try { + const response = await subscriptionRenewalsController.updateScheduledRenewalConfiguration( + subscriptionId, + id, + body + ); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } + } +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) | + + +# Schedule Scheduled Renewal Lock In + +Schedules a future lock-in date for the renewal. + +```ts +async scheduleScheduledRenewalLockIn( + subscriptionId: number, + id: number, + body?: ScheduledRenewalLockInRequest, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | +| `id` | `number` | Template, Required | The renewal id. | +| `body` | [`ScheduledRenewalLockInRequest \| undefined`](../../doc/models/scheduled-renewal-lock-in-request.md) | Body, Optional | - | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md). + +## Example Usage + +```ts +const subscriptionId = 222; + +const id = 112; + +const body: ScheduledRenewalLockInRequest = { + lockInAt: '2025-11-15', +}; + +try { + const response = await subscriptionRenewalsController.scheduleScheduledRenewalLockIn( + subscriptionId, + id, + body + ); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } + } +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) | + + +# Lock in Scheduled Renewal Immediately + +Locks in the renewal immediately. + +```ts +async lockInScheduledRenewalImmediately( + subscriptionId: number, + id: number, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | +| `id` | `number` | Template, Required | The renewal id. | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md). + +## Example Usage + +```ts +const subscriptionId = 222; + +const id = 112; + +try { + const response = await subscriptionRenewalsController.lockInScheduledRenewalImmediately( + subscriptionId, + id + ); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } + } +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 987, + "site_id": 321, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Product", + "price_point_id": 73, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 222, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) | + + +# Unpublish Scheduled Renewal Configuration + +Returns a scheduled renewal configuration to an editable state. + +```ts +async unpublishScheduledRenewalConfiguration( + subscriptionId: number, + id: number, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | +| `id` | `number` | Template, Required | The renewal id. | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md). + +## Example Usage + +```ts +const subscriptionId = 222; + +const id = 112; + +try { + const response = await subscriptionRenewalsController.unpublishScheduledRenewalConfiguration( + subscriptionId, + id + ); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } + } +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 987, + "site_id": 321, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "draft", + "scheduled_renewal_configuration_items": [ + { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Product", + "price_point_id": 73, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 222 + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) | + + +# Cancel Scheduled Renewal Configuration + +Cancels a scheduled renewal configuration. + +```ts +async cancelScheduledRenewalConfiguration( + subscriptionId: number, + id: number, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | +| `id` | `number` | Template, Required | The renewal id. | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md). + +## Example Usage + +```ts +const subscriptionId = 222; + +const id = 112; + +try { + const response = await subscriptionRenewalsController.cancelScheduledRenewalConfiguration( + subscriptionId, + id + ); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } + } +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 987, + "site_id": 321, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "canceled", + "scheduled_renewal_configuration_items": [ + { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Product", + "price_point_id": 73, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 222 + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) | + + +# Create Scheduled Renewal Configuration Item + +Adds product and component line items to the scheduled renewal. + +```ts +async createScheduledRenewalConfigurationItem( + subscriptionId: number, + scheduledRenewalsConfigurationId: number, + body?: ScheduledRenewalConfigurationItemRequest, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | +| `scheduledRenewalsConfigurationId` | `number` | Template, Required | The scheduled renewal configuration id. | +| `body` | [`ScheduledRenewalConfigurationItemRequest \| undefined`](../../doc/models/scheduled-renewal-configuration-item-request.md) | Body, Optional | - | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ScheduledRenewalConfigurationItemResponse`](../../doc/models/scheduled-renewal-configuration-item-response.md). + +## Example Usage + +```ts +const subscriptionId = 222; + +const scheduledRenewalsConfigurationId = 250; + +const body: ScheduledRenewalConfigurationItemRequest = { + renewalConfigurationItem: { + itemType: 'Component', + itemId: 57, + quantity: 1, + customPrice: { + pricingScheme: PricingScheme.Stairstep, + prices: [ + { + startingQuantity: 1, + unitPrice: 5, + endingQuantity: null, + } + ], + }, + }, +}; + +try { + const response = await subscriptionRenewalsController.createScheduledRenewalConfigurationItem( + subscriptionId, + scheduledRenewalsConfigurationId, + body + ); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } + } +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration_item": { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Product", + "item_subclass": "SubscriptionProduct", + "price_point_id": 73, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) | + + +# Update Scheduled Renewal Configuration Item + +Updates an existing configuration item’s pricing and quantity. + +```ts +async updateScheduledRenewalConfigurationItem( + subscriptionId: number, + scheduledRenewalsConfigurationId: number, + id: number, + body?: ScheduledRenewalUpdateRequest, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | +| `scheduledRenewalsConfigurationId` | `number` | Template, Required | The scheduled renewal configuration id. | +| `id` | `number` | Template, Required | The scheduled renewal configuration item id. | +| `body` | [`ScheduledRenewalUpdateRequest \| undefined`](../../doc/models/scheduled-renewal-update-request.md) | Body, Optional | - | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. The `result` property of this instance returns the response data which is of type [`ScheduledRenewalConfigurationItemResponse`](../../doc/models/scheduled-renewal-configuration-item-response.md). + +## Example Usage + +```ts +const subscriptionId = 222; + +const scheduledRenewalsConfigurationId = 250; + +const id = 112; + +const body: ScheduledRenewalUpdateRequest = { + renewalConfigurationItem: { + itemType: 'Component', + itemId: 57, + quantity: 2, + customPrice: { + pricingScheme: PricingScheme.Stairstep, + prices: [ + { + startingQuantity: 1, + unitPrice: 5, + endingQuantity: null, + } + ], + }, + }, +}; + +try { + const response = await subscriptionRenewalsController.updateScheduledRenewalConfigurationItem( + subscriptionId, + scheduledRenewalsConfigurationId, + id, + body + ); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } + } +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration_item": { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Component", + "item_subclass": "SubscriptionComponent", + "price_point_id": 73, + "price_point_type": "ComponentPricePoint", + "quantity": 3, + "decimal_quantity": "3.0", + "created_at": "2025-09-01T12:00:00Z" + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) | + + +# Delete Scheduled Renewal Configuration Item + +Removes an item from the pending renewal configuration. + +```ts +async deleteScheduledRenewalConfigurationItem( + subscriptionId: number, + scheduledRenewalsConfigurationId: number, + id: number, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | +| `scheduledRenewalsConfigurationId` | `number` | Template, Required | The scheduled renewal configuration id. | +| `id` | `number` | Template, Required | The scheduled renewal configuration item id. | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +This method returns an [`ApiResponse`](../../doc/api-response.md) instance. + +## Example Usage + +```ts +const subscriptionId = 222; + +const scheduledRenewalsConfigurationId = 250; + +const id = 112; + +try { + const response = await subscriptionRenewalsController.deleteScheduledRenewalConfigurationItem( + subscriptionId, + scheduledRenewalsConfigurationId, + id + ); + + // Extracting fully parsed response body. + console.log(response.result); + + // Extracting response status code. + console.log(response.statusCode); + // Extracting response headers. + console.log(response.headers); + // Extracting response body of type `string | Stream` + console.log(response.body); +} catch (error) { + if (error instanceof ApiError) { + // Extracting response error status code. + console.log(error.statusCode); + // Extracting response error headers. + console.log(error.headers); + // Extracting response error body of type `string | Stream`. + console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) | + diff --git a/doc/controllers/subscription-status.md b/doc/controllers/subscription-status.md index 51d0c49d..c638a752 100644 --- a/doc/controllers/subscription-status.md +++ b/doc/controllers/subscription-status.md @@ -45,7 +45,7 @@ async retrySubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -77,6 +77,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -226,7 +229,8 @@ try { # Cancel Subscription -The DELETE action causes the cancellation of the Subscription. This means, the method sets the Subscription state to "canceled". +Cancels the Subscription. The Delete method sets the Subscription state to `canceled`. +To cancel the subscription immediately, omit any schedule parameters from the request. To use the schedule options, the Schedule Subscription Cancellation feature must be enabled on your site. ```ts async cancelSubscription( @@ -240,7 +244,7 @@ async cancelSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`CancellationRequest \| undefined`](../../doc/models/cancellation-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -437,8 +441,8 @@ async resumeSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | -| `calendarBillingResumptionCharge` | [`ResumptionCharge \| undefined`](../../doc/models/resumption-charge.md) | Query, Optional | (For calendar billing subscriptions only) The way that the resumed subscription's charge should be handled

**Default**: `ResumptionCharge.Prorated` | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | +| `calendarBillingResumptionCharge` | [`ResumptionCharge \| undefined`](../../doc/models/resumption-charge.md) | Query, Optional | (For calendar billing subscriptions only) The way that the resumed subscription's charge should be handled.

**Default**: `ResumptionCharge.Prorated` | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -470,6 +474,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -610,7 +617,7 @@ async pauseSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`PauseRequest \| undefined`](../../doc/models/pause-request.md) | Body, Optional | Allows to pause a Subscription | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -652,6 +659,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -794,7 +804,7 @@ async updateAutomaticSubscriptionResumption( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`PauseRequest \| undefined`](../../doc/models/pause-request.md) | Body, Optional | Allows to pause a Subscription | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -836,6 +846,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -969,7 +982,7 @@ try { # Reactivate Subscription -Advanced Billing offers the ability to reactivate a previously canceled subscription. For details on how the reactivation works, and how to reactivate subscriptions through the application, see [reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming). +Reactivate a previously canceled subscription. For details on how the reactivation works, and how to reactivate subscriptions through the application, see [reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming). **Note: The term "resume" is used also during another process in Advanced Billing. This occurs when an on-hold subscription is "resumed". This returns the subscription to an active state.** @@ -990,6 +1003,8 @@ If a reactivation with `resume: true` were attempted _before_ what would have be If a reactivation with `resume: true` were attempted _after_ what would have been the next billing date of July 1st, then Advanced Billing would not resume the subscription, and instead it would be reactivated with a new billing period. +If a reactivation with `resume: false`, or where 'resume" is omited were attempted, then Advanced Billing would reactivate the subscription with a new billing period regardless of whether or not resuming the previous billing period were possible. + | Canceled | Reactivation | Resumable? | |---|---|---| | Jun 15 | June 28 | Yes | @@ -1140,7 +1155,7 @@ async reactivateSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`ReactivateSubscriptionRequest \| undefined`](../../doc/models/reactivate-subscription-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -1187,6 +1202,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -1310,11 +1328,7 @@ try { # Initiate Delayed Cancellation -Advanced Billing offers the ability to cancel a subscription at the end of the current billing period. This period is set by its current product. - -Requesting to cancel the subscription at the end of the period sets the `cancel_at_end_of_period` flag to true. - -Note that you cannot set `cancel_at_end_of_period` at subscription creation, or if the subscription is past due. +Cancels a subscription at the end of the current billing period based on the subscription's current product. You cannot set `cancel_at_end_of_period` at subscription creation, or if the subscription is past due. ```ts async initiateDelayedCancellation( @@ -1328,7 +1342,7 @@ async initiateDelayedCancellation( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`CancellationRequest \| undefined`](../../doc/models/cancellation-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -1361,6 +1375,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -1390,7 +1407,7 @@ async cancelDelayedCancellation( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -1456,7 +1473,7 @@ async cancelDunning( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -1488,6 +1505,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -1522,7 +1542,7 @@ Optionally, **you may provide your own custom quantities** for any component to ## Subscription Side Effects -You can request a `POST` to obtain this data from the endpoint without any side effects. Plain and simple, this will preview data, not log any changes against a subscription. +You can request a `POST` to obtain this data from the endpoint without any side effects. This method allows you to preview data, but does not log any changes against a subscription. ```ts async previewRenewal( @@ -1536,7 +1556,7 @@ async previewRenewal( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`RenewalPreviewRequest \| undefined`](../../doc/models/renewal-preview-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -1591,6 +1611,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md index 5af01db5..c9897920 100644 --- a/doc/controllers/subscriptions.md +++ b/doc/controllers/subscriptions.md @@ -104,6 +104,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -256,7 +259,7 @@ try { # List Subscriptions -This method will return an array of subscriptions from a Site. Pay close attention to query string filters and pagination in order to control responses from the server. +returns an array of subscriptions from a Site. Pay close attention to query string filters and pagination in order to control responses from the server. ## Search for a subscription @@ -438,7 +441,7 @@ async updateSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`UpdateSubscriptionRequest \| undefined`](../../doc/models/update-subscription-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -481,6 +484,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -604,7 +610,7 @@ try { # Read Subscription -Use this endpoint to find subscription details. +Retrieves subscription details. ## Self-Service Page token @@ -622,7 +628,7 @@ async readSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `include` | [`SubscriptionInclude[] \| undefined`](../../doc/models/subscription-include.md) | Query, Optional | Allows including additional data in the response. Use in query: `include[]=coupons&include[]=self_service_page_token`. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -841,7 +847,7 @@ async overrideSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`OverrideSubscriptionRequest \| undefined`](../../doc/models/override-subscription-request.md) | Body, Optional | Only these fields are available to be set. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -886,6 +892,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SingleErrorResponseError) { + console.log(error.result); + } } } ``` @@ -978,7 +987,7 @@ async purgeSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `ack` | `number` | Query, Required | id of the customer. | | `cascade` | [`SubscriptionPurgeType[] \| undefined`](../../doc/models/subscription-purge-type.md) | Query, Optional | Options are "customer" or "payment_profile".
Use in query: `cascade[]=customer&cascade[]=payment_profile`. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -1023,6 +1032,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SubscriptionResponseError) { + console.log(error.result); + } } } ``` @@ -1050,7 +1062,7 @@ async updatePrepaidSubscriptionConfiguration( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`UpsertPrepaidConfigurationRequest \| undefined`](../../doc/models/upsert-prepaid-configuration-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -1343,7 +1355,7 @@ async applyCouponsToSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `code` | `string \| undefined` | Query, Optional | A code for the coupon that would be applied to a subscription | | `body` | [`AddCouponsRequest \| undefined`](../../doc/models/add-coupons-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -1388,6 +1400,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SubscriptionAddCouponError) { + console.log(error.result); + } } } ``` @@ -1567,7 +1582,7 @@ async removeCouponFromSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `couponCode` | `string \| undefined` | Query, Optional | The coupon code | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -1600,6 +1615,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof SubscriptionRemoveCouponErrorsError) { + console.log(error.result); + } } } ``` @@ -1675,7 +1693,7 @@ async activateSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription. | | `body` | [`ActivateSubscriptionRequest \| undefined`](../../doc/models/activate-subscription-request.md) | Body, Optional | - | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -1708,6 +1726,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorArrayMapResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/controllers/webhooks.md b/doc/controllers/webhooks.md index b306ac8f..c76cdd82 100644 --- a/doc/controllers/webhooks.md +++ b/doc/controllers/webhooks.md @@ -317,6 +317,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` @@ -488,6 +491,9 @@ try { console.log(error.headers); // Extracting response error body of type `string | Stream`. console.log(error.body); + if (error instanceof ErrorListResponseError) { + console.log(error.result); + } } } ``` diff --git a/doc/environment-based-client-initialization.md b/doc/environment-based-client-initialization.md new file mode 100644 index 00000000..b5f03ce2 --- /dev/null +++ b/doc/environment-based-client-initialization.md @@ -0,0 +1,70 @@ + +# Environment-Based Client Initialization + +The SDK client can be initialized directly from environment variables using the `fromEnvironment` static method available on the `Client` class. This allows you to configure the SDK through environment variables, making it easier to manage different settings across different environments. + +## Node.js Environment + +In Node.js environments, you can use the `dotenv` package to load environment variables from a `.env` file and pass `process.env` to the configuration. + +The `fromEnvironment` method accepts an optional parameter for environment variables. If not provided, it defaults to `process.env`. + +```ts +import * as dotenv from 'dotenv'; +import * as path from 'path'; +import * as fs from 'fs'; +import { Client, Configuration } from '@maxio-com/advanced-billing-sdk'; + +// Optional - Provide absolute path for the .env file +const absolutePath = path.resolve('.env'); + +if (fs.existsSync(absolutePath)) { + // Load environment variables from .env file + dotenv.config({ path: absolutePath, override: true }); +} + +// Initialize client using environment variables +const client = Client.fromEnvironment(process.env); +``` + +## Browser Environment + +In browser environments, you can pass configuration values directly as key-value pairs to the `fromEnvironment` method. Since `process.env` is not available in browsers, environment variables must be passed as an object. + +```ts +import { Client, Configuration } from '@maxio-com/advanced-billing-sdk'; + +const client = Client.fromEnvironment({ + TIMEOUT: '30000', + ENVIRONMENT: 'testing' +}); +``` + +## Example .env File + +```env +# Basic Configuration +TIMEOUT=30000 +ENVIRONMENT=US +SITE=subdomain + +# Authentication Credentials +USERNAME=username +PASSWORD=password + +# Retry Configuration +MAX_NUMBER_OF_RETRIES=3 +RETRY_ON_TIMEOUT=true +RETRY_INTERVAL=10 +MAX_RETRY_WAIT_TIME=120 +RETRY_BACKOFF_FACTOR=2 +HTTP_STATUS_CODES_TO_RETRY=408,413,429,500,502 +HTTP_METHODS_TO_RETRY=GET,PUT,DELETE + +# Proxy Settings +PROXY_ADDRESS=http://localhost:3000 +PROXY_PORT=8080 +PROXY_AUTH_USERNAME=username +PROXY_AUTH_PASSWORD=password +``` + diff --git a/doc/models/activate-event-based-component.md b/doc/models/activate-event-based-component.md index 170e7e78..7c110767 100644 --- a/doc/models/activate-event-based-component.md +++ b/doc/models/activate-event-based-component.md @@ -26,6 +26,7 @@ "pricing_scheme": "stairstep", "interval": 66, "interval_unit": "day", + "list_price_point_id": 174, "prices": [ { "starting_quantity": 242, @@ -37,8 +38,7 @@ "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } } ``` diff --git a/doc/models/allocate-components.md b/doc/models/allocate-components.md index 555530d6..7658ead9 100644 --- a/doc/models/allocate-components.md +++ b/doc/models/allocate-components.md @@ -13,8 +13,8 @@ | `prorationDowngradeScheme` | `string \| undefined` | Optional | - | | `allocations` | [`CreateAllocation[] \| undefined`](../../doc/models/create-allocation.md) | Optional | - | | `accrueCharge` | `boolean \| undefined` | Optional | - | -| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | -| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | +| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | +| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | | `paymentCollectionMethod` | [`CollectionMethod \| undefined`](../../doc/models/collection-method.md) | Optional | (Optional) If not passed, the allocation(s) will use the payment collection method on the subscription | | `initiateDunning` | `boolean \| undefined` | Optional | If true, if the immediate component payment fails, initiate dunning for the subscription.
Otherwise, leave the charges on the subscription to pay for at renewal. | @@ -27,19 +27,19 @@ "allocations": [ { "quantity": 26.48, + "decimal_quantity": "decimal_quantity8", + "previous_quantity": 55.5, + "decimal_previous_quantity": "decimal_previous_quantity2", "component_id": 242, - "memo": "memo6", - "proration_downgrade_scheme": "proration_downgrade_scheme0", - "proration_upgrade_scheme": "proration_upgrade_scheme2", - "accrue_charge": false + "memo": "memo6" }, { "quantity": 26.48, + "decimal_quantity": "decimal_quantity8", + "previous_quantity": 55.5, + "decimal_previous_quantity": "decimal_previous_quantity2", "component_id": 242, - "memo": "memo6", - "proration_downgrade_scheme": "proration_downgrade_scheme0", - "proration_upgrade_scheme": "proration_upgrade_scheme2", - "accrue_charge": false + "memo": "memo6" } ], "accrue_charge": false, diff --git a/doc/models/allocation-preview-item.md b/doc/models/allocation-preview-item.md index a118b660..07b3cbfb 100644 --- a/doc/models/allocation-preview-item.md +++ b/doc/models/allocation-preview-item.md @@ -18,8 +18,8 @@ | `prorationUpgradeScheme` | `string \| undefined` | Optional | - | | `prorationDowngradeScheme` | `string \| undefined` | Optional | - | | `accrueCharge` | `boolean \| undefined` | Optional | - | -| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | -| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | +| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | +| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | | `pricePointId` | `number \| undefined` | Optional | - | | `interval` | `number \| undefined` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | | `intervalUnit` | [`IntervalUnit \| null \| undefined`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. | diff --git a/doc/models/allocation-settings.md b/doc/models/allocation-settings.md index 1488db62..9d9ed0fb 100644 --- a/doc/models/allocation-settings.md +++ b/doc/models/allocation-settings.md @@ -9,8 +9,8 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | -| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | +| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | +| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | | `accrueCharge` | `string \| undefined` | Optional | Either "true" or "false". | ## Example (as JSON) diff --git a/doc/models/allocation.md b/doc/models/allocation.md index 74c7bfea..f557c619 100644 --- a/doc/models/allocation.md +++ b/doc/models/allocation.md @@ -28,8 +28,8 @@ | `previousPricePointId` | `number \| undefined` | Optional | - | | `accrueCharge` | `boolean \| undefined` | Optional | If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal or if capture should be attempted immediately. | | `initiateDunning` | `boolean \| undefined` | Optional | If true, if the immediate component payment fails, initiate dunning for the subscription.
Otherwise, leave the charges on the subscription to pay for at renewal. | -| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | -| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | +| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | +| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | | `payment` | [`PaymentForAllocation \| null \| undefined`](../../doc/models/payment-for-allocation.md) | Optional | - | | `expiresAt` | `string \| undefined` | Optional | - | | `usedQuantity` | `bigint \| undefined` | Optional | - | diff --git a/doc/models/available-actions.md b/doc/models/available-actions.md new file mode 100644 index 00000000..1d52bab1 --- /dev/null +++ b/doc/models/available-actions.md @@ -0,0 +1,24 @@ + +# Available Actions + +## Structure + +`AvailableActions` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `sendEmail` | [`SendEmail \| undefined`](../../doc/models/send-email.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "send_email": { + "can_execute": false, + "url": "url0" + } +} +``` + diff --git a/doc/models/calendar-billing.md b/doc/models/calendar-billing.md index 52f66f59..8bea8c8f 100644 --- a/doc/models/calendar-billing.md +++ b/doc/models/calendar-billing.md @@ -11,14 +11,14 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `snapDay` | [`CalendarBillingSnapDay \| null \| undefined`](../../doc/models/containers/calendar-billing-snap-day.md) | Optional | This is a container for one-of cases. | +| `snapDay` | [`CalendarBillingSnapDay \| undefined`](../../doc/models/containers/calendar-billing-snap-day.md) | Optional | This is a container for one-of cases. | | `calendarBillingFirstCharge` | [`FirstChargeType \| undefined`](../../doc/models/first-charge-type.md) | Optional | - | ## Example (as JSON) ```json { - "snap_day": 28, + "snap_day": 210, "calendar_billing_first_charge": "prorated" } ``` diff --git a/doc/models/cancellation-options.md b/doc/models/cancellation-options.md index 46b10b8e..b46d109f 100644 --- a/doc/models/cancellation-options.md +++ b/doc/models/cancellation-options.md @@ -9,15 +9,21 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `cancellationMessage` | `string \| undefined` | Optional | For your internal use. An indication as to why the subscription is being canceled. | -| `reasonCode` | `string \| undefined` | Optional | The reason code associated with the cancellation. See the list of reason codes associated with your site. | +| `cancellationMessage` | `string \| undefined` | Optional | An indication as to why the subscription is being canceled. For your internal use. | +| `reasonCode` | `string \| undefined` | Optional | The reason code associated with the cancellation. Use the [List Reason Codes](../../doc/controllers/reason-codes.md#list-reason-codes) endpoint to retrieve the reason codes associated with your site. | +| `cancelAtEndOfPeriod` | `boolean \| undefined` | Optional | When true, the subscription is cancelled at the current period end instead of immediately. To use this option, the Schedule Subscription Cancellation feature must be enabled on your site. | +| `scheduledCancellationAt` | `string \| null \| undefined` | Optional | Schedules the cancellation on the provided date. This is option is not applicable for prepaid subscriptions. To use this option, the Schedule Subscription Cancellation feature must be enabled on your site. | +| `refundPrepaymentAccountBalance` | `boolean \| undefined` | Optional | Applies to prepaid subscriptions. When true, which is the default, the remaining prepaid balance is refunded as part of cancellation processing. When false, prepaid balance is not refunded as part of cancellation processing. To use this option, the Schedule Subscription Cancellation feature must be enabled on your site. | ## Example (as JSON) ```json { "cancellation_message": "cancellation_message0", - "reason_code": "reason_code6" + "reason_code": "reason_code6", + "cancel_at_end_of_period": false, + "scheduled_cancellation_at": "2016-03-13T12:52:32.123Z", + "refund_prepayment_account_balance": false } ``` diff --git a/doc/models/cancellation-request.md b/doc/models/cancellation-request.md index 0599f69e..7b229041 100644 --- a/doc/models/cancellation-request.md +++ b/doc/models/cancellation-request.md @@ -17,7 +17,10 @@ { "subscription": { "cancellation_message": "cancellation_message2", - "reason_code": "reason_code8" + "reason_code": "reason_code8", + "cancel_at_end_of_period": false, + "scheduled_cancellation_at": "2016-03-13T12:52:32.123Z", + "refund_prepayment_account_balance": false } } ``` diff --git a/doc/models/clone-component-price-point-request.md b/doc/models/clone-component-price-point-request.md new file mode 100644 index 00000000..ef8f66f3 --- /dev/null +++ b/doc/models/clone-component-price-point-request.md @@ -0,0 +1,24 @@ + +# Clone Component Price Point Request + +## Structure + +`CloneComponentPricePointRequest` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `pricePoint` | [`CloneComponentPricePoint`](../../doc/models/clone-component-price-point.md) | Required | - | + +## Example (as JSON) + +```json +{ + "price_point": { + "name": "name0", + "handle": "handle6" + } +} +``` + diff --git a/doc/models/clone-component-price-point.md b/doc/models/clone-component-price-point.md new file mode 100644 index 00000000..d29c8798 --- /dev/null +++ b/doc/models/clone-component-price-point.md @@ -0,0 +1,23 @@ + +# Clone Component Price Point + +## Structure + +`CloneComponentPricePoint` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `name` | `string` | Required | - | +| `handle` | `string \| undefined` | Optional | - | + +## Example (as JSON) + +```json +{ + "name": "name2", + "handle": "handle8" +} +``` + diff --git a/doc/models/component-custom-price.md b/doc/models/component-custom-price.md index 277aaab1..02313e12 100644 --- a/doc/models/component-custom-price.md +++ b/doc/models/component-custom-price.md @@ -15,7 +15,9 @@ Create or update custom pricing unique to the subscription. Used in place of `pr | `pricingScheme` | [`PricingScheme \| undefined`](../../doc/models/pricing-scheme.md) | Optional | Omit for On/Off components | | `interval` | `number \| undefined` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | | `intervalUnit` | [`IntervalUnit \| null \| undefined`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. | -| `prices` | [`Price[]`](../../doc/models/price.md) | Required | On/off components only need one price bracket starting at 1 | +| `listPricePointId` | `number \| null \| undefined` | Optional | Optional id of the price point to use for list price calculations when
overriding the customer price. | +| `useDefaultListPrice` | `boolean \| undefined` | Optional | When true, list price calculations will continue to use the default price point even when a `custom_price` is supplied. | +| `prices` | [`Price[]`](../../doc/models/price.md) | Required | On/off components only need one price bracket starting at 1. | | `renewPrepaidAllocation` | `boolean \| undefined` | Optional | Applicable only to prepaid usage components. Controls whether the allocated quantity renews each period. | | `rolloverPrepaidRemainder` | `boolean \| undefined` | Optional | Applicable only to prepaid usage components. Controls whether remaining units roll over to the next period. | | `expirationInterval` | `number \| null \| undefined` | Optional | Applicable only when rollover is enabled. Number of `expiration_interval_unit`s after which rollover amounts expire. | @@ -36,7 +38,7 @@ Create or update custom pricing unique to the subscription. Used in place of `pr "pricing_scheme": "stairstep", "interval": 162, "interval_unit": "day", - "renew_prepaid_allocation": false + "list_price_point_id": 146 } ``` diff --git a/doc/models/component-price-point-currency-overage-response.md b/doc/models/component-price-point-currency-overage-response.md new file mode 100644 index 00000000..fd3cae2d --- /dev/null +++ b/doc/models/component-price-point-currency-overage-response.md @@ -0,0 +1,27 @@ + +# Component Price Point Currency Overage Response + +## Structure + +`ComponentPricePointCurrencyOverageResponse` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `pricePoint` | [`CurrencyOveragePrices`](../../doc/models/currency-overage-prices.md) | Required | Extends a component price point with currency overage prices. | + +## Example (as JSON) + +```json +{ + "price_point": { + "id": 248, + "type": "default", + "default": false, + "name": "name0", + "pricing_scheme": "per_unit" + } +} +``` + diff --git a/doc/models/component-price-point.md b/doc/models/component-price-point.md index 449d18f8..c76c7007 100644 --- a/doc/models/component-price-point.md +++ b/doc/models/component-price-point.md @@ -25,7 +25,7 @@ | `taxIncluded` | `boolean \| undefined` | Optional | - | | `interval` | `number \| null \| undefined` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | | `intervalUnit` | [`IntervalUnit \| null \| undefined`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. | -| `currencyPrices` | [`ComponentCurrencyPrice[] \| undefined`](../../doc/models/component-currency-price.md) | Optional | An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. | +| `currencyPrices` | [`ComponentCurrencyPrice[] \| undefined`](../../doc/models/component-currency-price.md) | Optional | An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. The clone endpoint always returns currency prices if they are present. | | `overagePrices` | [`ComponentPrice[] \| undefined`](../../doc/models/component-price.md) | Optional | Applicable only to prepaid usage components. An array of overage price brackets. | | `overagePricingScheme` | [`PricingScheme \| undefined`](../../doc/models/pricing-scheme.md) | Optional | Applicable only to prepaid usage components. Pricing scheme for overage pricing. | | `renewPrepaidAllocation` | `boolean \| undefined` | Optional | Applicable only to prepaid usage components. Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period. | diff --git a/doc/models/component.md b/doc/models/component.md index 8a494256..616710ca 100644 --- a/doc/models/component.md +++ b/doc/models/component.md @@ -31,8 +31,8 @@ | `taxable` | `boolean \| undefined` | Optional | Boolean flag describing whether a component is taxable or not. | | `taxCode` | `string \| null \| undefined` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `recurring` | `boolean \| undefined` | Optional | - | -| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | -| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | +| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | +| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | | `createdAt` | `string \| undefined` | Optional | Timestamp indicating when this component was created | | `updatedAt` | `string \| undefined` | Optional | Timestamp indicating when this component was updated | | `archivedAt` | `string \| null \| undefined` | Optional | Timestamp indicating when this component was archived | diff --git a/doc/models/containers/calendar-billing-snap-day.md b/doc/models/containers/calendar-billing-snap-day.md index 62b5c396..d45b10cd 100644 --- a/doc/models/containers/calendar-billing-snap-day.md +++ b/doc/models/containers/calendar-billing-snap-day.md @@ -10,5 +10,5 @@ | Type | | --- | | `number` | -| [`SnapDay`](../../../doc/models/snap-day.md) | +| `string` | diff --git a/doc/models/containers/clone-component-price-point-component-id.md b/doc/models/containers/clone-component-price-point-component-id.md new file mode 100644 index 00000000..34d53b6b --- /dev/null +++ b/doc/models/containers/clone-component-price-point-component-id.md @@ -0,0 +1,14 @@ + +# Clone Component Price Point Component Id + +## Class Name + +`CloneComponentPricePointComponentId` + +## Cases + +| Type | +| --- | +| `number` | +| `string` | + diff --git a/doc/models/containers/clone-component-price-point-price-point-id.md b/doc/models/containers/clone-component-price-point-price-point-id.md new file mode 100644 index 00000000..54fcd7e6 --- /dev/null +++ b/doc/models/containers/clone-component-price-point-price-point-id.md @@ -0,0 +1,14 @@ + +# Clone Component Price Point Price Point Id + +## Class Name + +`CloneComponentPricePointPricePointId` + +## Cases + +| Type | +| --- | +| `number` | +| `string` | + diff --git a/doc/models/containers/scheduled-renewal-configuration-item-request-renewal-configuration-item.md b/doc/models/containers/scheduled-renewal-configuration-item-request-renewal-configuration-item.md new file mode 100644 index 00000000..a3faa7d0 --- /dev/null +++ b/doc/models/containers/scheduled-renewal-configuration-item-request-renewal-configuration-item.md @@ -0,0 +1,14 @@ + +# Scheduled Renewal Configuration Item Request Renewal Configuration Item + +## Class Name + +`ScheduledRenewalConfigurationItemRequestRenewalConfigurationItem` + +## Cases + +| Type | +| --- | +| [`ScheduledRenewalItemRequestBodyComponent`](../../../doc/models/scheduled-renewal-item-request-body-component.md) | +| [`ScheduledRenewalItemRequestBodyProduct`](../../../doc/models/scheduled-renewal-item-request-body-product.md) | + diff --git a/doc/models/containers/scheduled-renewal-product-price-point-interval.md b/doc/models/containers/scheduled-renewal-product-price-point-interval.md new file mode 100644 index 00000000..17674388 --- /dev/null +++ b/doc/models/containers/scheduled-renewal-product-price-point-interval.md @@ -0,0 +1,14 @@ + +# Scheduled Renewal Product Price Point Interval + +## Class Name + +`ScheduledRenewalProductPricePointInterval` + +## Cases + +| Type | +| --- | +| `string` | +| `number` | + diff --git a/doc/models/containers/scheduled-renewal-product-price-point-price-in-cents.md b/doc/models/containers/scheduled-renewal-product-price-point-price-in-cents.md new file mode 100644 index 00000000..0298f3a0 --- /dev/null +++ b/doc/models/containers/scheduled-renewal-product-price-point-price-in-cents.md @@ -0,0 +1,14 @@ + +# Scheduled Renewal Product Price Point Price in Cents + +## Class Name + +`ScheduledRenewalProductPricePointPriceInCents` + +## Cases + +| Type | +| --- | +| `string` | +| `bigint` | + diff --git a/doc/models/containers/scheduled-renewal-update-request-renewal-configuration-item.md b/doc/models/containers/scheduled-renewal-update-request-renewal-configuration-item.md new file mode 100644 index 00000000..e8d22da8 --- /dev/null +++ b/doc/models/containers/scheduled-renewal-update-request-renewal-configuration-item.md @@ -0,0 +1,14 @@ + +# Scheduled Renewal Update Request Renewal Configuration Item + +## Class Name + +`ScheduledRenewalUpdateRequestRenewalConfigurationItem` + +## Cases + +| Type | +| --- | +| [`ScheduledRenewalItemRequestBodyComponent`](../../../doc/models/scheduled-renewal-item-request-body-component.md) | +| [`ScheduledRenewalItemRequestBodyProduct`](../../../doc/models/scheduled-renewal-item-request-body-product.md) | + diff --git a/doc/models/containers/subscription-snap-day.md b/doc/models/containers/subscription-snap-day.md deleted file mode 100644 index 9f6fb37e..00000000 --- a/doc/models/containers/subscription-snap-day.md +++ /dev/null @@ -1,14 +0,0 @@ - -# Subscription Snap Day - -## Class Name - -`SubscriptionSnapDay` - -## Cases - -| Type | -| --- | -| `number` | -| [`SnapDay`](../../../doc/models/snap-day.md) | - diff --git a/doc/models/containers/update-subscription-snap-day.md b/doc/models/containers/update-subscription-snap-day.md index 65ec6278..1b84f1ac 100644 --- a/doc/models/containers/update-subscription-snap-day.md +++ b/doc/models/containers/update-subscription-snap-day.md @@ -9,6 +9,6 @@ | Type | | --- | +| `string` | | `number` | -| [`SnapDay`](../../../doc/models/snap-day.md) | diff --git a/doc/models/contract.md b/doc/models/contract.md new file mode 100644 index 00000000..fc0f6484 --- /dev/null +++ b/doc/models/contract.md @@ -0,0 +1,34 @@ + +# Contract + +Contract linked to the scheduled renewal configuration. + +## Structure + +`Contract` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `number \| undefined` | Optional | - | +| `maxioId` | `string \| undefined` | Optional | - | +| `number` | `string \| null \| undefined` | Optional | - | +| `register` | [`Register \| undefined`](../../doc/models/register.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "id": 136, + "maxio_id": "maxio_id8", + "number": "number6", + "register": { + "id": 54, + "maxio_id": "maxio_id4", + "name": "name2", + "currency_code": "currency_code2" + } +} +``` + diff --git a/doc/models/create-allocation-request.md b/doc/models/create-allocation-request.md index c76650cf..e94dd765 100644 --- a/doc/models/create-allocation-request.md +++ b/doc/models/create-allocation-request.md @@ -17,11 +17,11 @@ { "allocation": { "quantity": 228.94, + "decimal_quantity": "decimal_quantity6", + "previous_quantity": 254.04, + "decimal_previous_quantity": "decimal_previous_quantity8", "component_id": 8, - "memo": "memo2", - "proration_downgrade_scheme": "proration_downgrade_scheme4", - "proration_upgrade_scheme": "proration_upgrade_scheme6", - "accrue_charge": false + "memo": "memo2" } } ``` diff --git a/doc/models/create-allocation.md b/doc/models/create-allocation.md index 312e6fec..5c7c7e72 100644 --- a/doc/models/create-allocation.md +++ b/doc/models/create-allocation.md @@ -10,27 +10,31 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `quantity` | `number` | Required | The allocated quantity to which to set the line-items allocated quantity. By default, this is an integer. If decimal allocations are enabled for the component, it will be a decimal number. For On/Off components, use 1for on and 0 for off. | -| `componentId` | `number \| undefined` | Optional | (required for the multiple allocations endpoint) The id associated with the component for which the allocation is being made | -| `memo` | `string \| undefined` | Optional | A memo to record along with the allocation | +| `decimalQuantity` | `string \| undefined` | Optional | Decimal representation of the allocated quantity. Only valid when decimal
allocations are enabled for the component. | +| `previousQuantity` | `number \| undefined` | Optional | The quantity that was in effect before this allocation. Responses always
include this value; it may be supplied on preview requests to ensure the
expected change is evaluated. | +| `decimalPreviousQuantity` | `string \| undefined` | Optional | Decimal representation of `previous_quantity`. Only valid when decimal
allocations are enabled for the component. | +| `componentId` | `number \| undefined` | Optional | (required for the multiple allocations endpoint) The id associated with the component for which the allocation is being made. | +| `memo` | `string \| undefined` | Optional | A memo to record along with the allocation. | | `prorationDowngradeScheme` | `string \| undefined` | Optional | The scheme used if the proration is a downgrade. Defaults to the site setting if one is not provided. | | `prorationUpgradeScheme` | `string \| undefined` | Optional | The scheme used if the proration is an upgrade. Defaults to the site setting if one is not provided. | -| `accrueCharge` | `boolean \| undefined` | Optional | If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal or if capture should be attempted immediately. Defaults to the site setting if one is not provided. | -| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | -| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | +| `downgradeCredit` | [`DowngradeCreditCreditType \| null \| undefined`](../../doc/models/downgrade-credit-credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are:

`full` - A full price credit is added for the amount owed.

`prorated` - A prorated credit is added for the amount owed.

`none` - No charge is added. | +| `upgradeCharge` | [`UpgradeChargeCreditType \| null \| undefined`](../../doc/models/upgrade-charge-credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are:

`full` - A charge is added for the full price of the component.

`prorated` - A charge is added for the prorated price of the component change.

`none` - No charge is added. | +| `accrueCharge` | `boolean \| undefined` | Optional | "If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal or if capture should be attempted immediately.

`true` - Attempt to charge the customer at the next renewal.

`false` - Attempt to charge the customer right away. If it fails, the charge will be accrued until the next renewal.

Defaults to the site setting if unspecified in the request. | | `initiateDunning` | `boolean \| undefined` | Optional | If set to true, if the immediate component payment fails, initiate dunning for the subscription.
Otherwise, leave the charges on the subscription to pay for at renewal. Defaults to false. | | `pricePointId` | [`CreateAllocationPricePointId \| null \| undefined`](../../doc/models/containers/create-allocation-price-point-id.md) | Optional | This is a container for one-of cases. | | `billingSchedule` | [`BillingSchedule \| undefined`](../../doc/models/billing-schedule.md) | Optional | This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. This only works for site with Multifrequency enabled. | +| `customPrice` | [`ComponentCustomPrice \| undefined`](../../doc/models/component-custom-price.md) | Optional | Create or update custom pricing unique to the subscription. Used in place of `price_point_id`. | ## Example (as JSON) ```json { "quantity": 8.06, + "decimal_quantity": "decimal_quantity4", + "previous_quantity": 218.92, + "decimal_previous_quantity": "decimal_previous_quantity0", "component_id": 192, - "memo": "memo4", - "proration_downgrade_scheme": "proration_downgrade_scheme2", - "proration_upgrade_scheme": "proration_upgrade_scheme4", - "accrue_charge": false + "memo": "memo4" } ``` diff --git a/doc/models/create-subscription.md b/doc/models/create-subscription.md index 1b7e160e..22801f56 100644 --- a/doc/models/create-subscription.md +++ b/doc/models/create-subscription.md @@ -13,7 +13,7 @@ | `productId` | `number \| undefined` | Optional | The Product ID of the product for which you are creating a subscription. The product ID is not currently published, so we recommend using the API Handle instead. | | `productPricePointHandle` | `string \| undefined` | Optional | The user-friendly API handle of a product's particular price point. | | `productPricePointId` | `number \| undefined` | Optional | The ID of the particular price point on the product. | -| `customPrice` | [`SubscriptionCustomPrice \| undefined`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription | +| `customPrice` | [`SubscriptionCustomPrice \| undefined`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. | | `couponCode` | `string \| undefined` | Optional | (deprecated) The coupon code of the single coupon currently applied to the subscription. See coupon_codes instead as subscriptions can now have more than one coupon. | | `couponCodes` | `string[] \| undefined` | Optional | An array for all the coupons attached to the subscription. | | `paymentCollectionMethod` | [`CollectionMethod \| undefined`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. | diff --git a/doc/models/create-usage-request.md b/doc/models/create-usage-request.md index b73791bf..10fcde84 100644 --- a/doc/models/create-usage-request.md +++ b/doc/models/create-usage-request.md @@ -27,6 +27,7 @@ "pricing_scheme": "stairstep", "interval": 66, "interval_unit": "day", + "list_price_point_id": 174, "prices": [ { "starting_quantity": 242, @@ -38,8 +39,7 @@ "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } } } diff --git a/doc/models/create-usage.md b/doc/models/create-usage.md index c4c00ef4..639e40b5 100644 --- a/doc/models/create-usage.md +++ b/doc/models/create-usage.md @@ -30,6 +30,7 @@ "pricing_scheme": "stairstep", "interval": 66, "interval_unit": "day", + "list_price_point_id": 174, "prices": [ { "starting_quantity": 242, @@ -41,8 +42,7 @@ "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } } ``` diff --git a/doc/models/credit-type.md b/doc/models/credit-type.md index 130b05f6..3fc68dda 100644 --- a/doc/models/credit-type.md +++ b/doc/models/credit-type.md @@ -2,7 +2,6 @@ # Credit Type The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. -Available values: `full`, `prorated`, `none`. ## Enumeration diff --git a/doc/models/currency-overage-prices.md b/doc/models/currency-overage-prices.md new file mode 100644 index 00000000..fcde8c13 --- /dev/null +++ b/doc/models/currency-overage-prices.md @@ -0,0 +1,50 @@ + +# Currency Overage Prices + +Extends a component price point with currency overage prices. + +## Structure + +`CurrencyOveragePrices` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `number \| undefined` | Optional | - | +| `type` | [`PricePointType \| undefined`](../../doc/models/price-point-type.md) | Optional | Price point type. We expose the following types:

1. **default**: a price point that is marked as a default price for a certain product.
2. **custom**: a custom price point.
3. **catalog**: a price point that is **not** marked as a default price for a certain product and is **not** a custom one. | +| `mDefault` | `boolean \| undefined` | Optional | Note: Refer to type attribute instead | +| `name` | `string \| undefined` | Optional | - | +| `pricingScheme` | [`PricingScheme \| undefined`](../../doc/models/pricing-scheme.md) | Optional | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | +| `componentId` | `number \| undefined` | Optional | - | +| `handle` | `string \| null \| undefined` | Optional | - | +| `archivedAt` | `string \| null \| undefined` | Optional | - | +| `createdAt` | `string \| undefined` | Optional | - | +| `updatedAt` | `string \| undefined` | Optional | - | +| `prices` | [`ComponentPrice[] \| undefined`](../../doc/models/component-price.md) | Optional | - | +| `useSiteExchangeRate` | `boolean \| undefined` | Optional | Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site. Defaults to true during creation. | +| `subscriptionId` | `number \| undefined` | Optional | (only used for Custom Pricing - ie. when the price point's type is `custom`) The id of the subscription that the custom price point is for. | +| `taxIncluded` | `boolean \| undefined` | Optional | - | +| `interval` | `number \| null \| undefined` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | +| `intervalUnit` | [`IntervalUnit \| null \| undefined`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. | +| `currencyPrices` | [`ComponentCurrencyPrice[] \| undefined`](../../doc/models/component-currency-price.md) | Optional | An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. The clone endpoint always returns currency prices if they are present. | +| `overagePrices` | [`ComponentPrice[] \| undefined`](../../doc/models/component-price.md) | Optional | Applicable only to prepaid usage components. An array of overage price brackets. | +| `overagePricingScheme` | [`PricingScheme \| undefined`](../../doc/models/pricing-scheme.md) | Optional | Applicable only to prepaid usage components. Pricing scheme for overage pricing. | +| `renewPrepaidAllocation` | `boolean \| undefined` | Optional | Applicable only to prepaid usage components. Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period. | +| `rolloverPrepaidRemainder` | `boolean \| undefined` | Optional | Applicable only to prepaid usage components. Boolean which controls whether or not remaining units should be rolled over to the next period. | +| `expirationInterval` | `number \| null \| undefined` | Optional | Applicable only to prepaid usage components where rollover_prepaid_remainder is true. The number of `expiration_interval_unit`s after which rollover amounts should expire. | +| `expirationIntervalUnit` | [`ExpirationIntervalUnit \| null \| undefined`](../../doc/models/expiration-interval-unit.md) | Optional | Applicable only to prepaid usage components where rollover_prepaid_remainder is true. A string representing the expiration interval unit for this component, either month or day. | +| `currencyOveragePrices` | [`ComponentCurrencyPrice[] \| undefined`](../../doc/models/component-currency-price.md) | Optional | Applicable only to prepaid usage components. An array of currency pricing data for overage prices. | + +## Example (as JSON) + +```json +{ + "id": 50, + "type": "catalog", + "default": false, + "name": "name8", + "pricing_scheme": "stairstep" +} +``` + diff --git a/doc/models/deliver-proforma-invoice-request.md b/doc/models/deliver-proforma-invoice-request.md new file mode 100644 index 00000000..c1c73500 --- /dev/null +++ b/doc/models/deliver-proforma-invoice-request.md @@ -0,0 +1,33 @@ + +# Deliver Proforma Invoice Request + +## Structure + +`DeliverProformaInvoiceRequest` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `recipientEmails` | `string[] \| undefined` | Optional | - | +| `ccRecipientEmails` | `string[] \| undefined` | Optional | - | +| `bccRecipientEmails` | `string[] \| undefined` | Optional | - | + +## Example (as JSON) + +```json +{ + "recipient_emails": [ + "recipient_emails9" + ], + "cc_recipient_emails": [ + "cc_recipient_emails8" + ], + "bcc_recipient_emails": [ + "bcc_recipient_emails2", + "bcc_recipient_emails3", + "bcc_recipient_emails4" + ] +} +``` + diff --git a/doc/models/downgrade-credit-credit-type.md b/doc/models/downgrade-credit-credit-type.md new file mode 100644 index 00000000..3b0e9c92 --- /dev/null +++ b/doc/models/downgrade-credit-credit-type.md @@ -0,0 +1,23 @@ + +# Downgrade Credit Credit Type + +The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are: + +`full` - A full price credit is added for the amount owed. + +`prorated` - A prorated credit is added for the amount owed. + +`none` - No charge is added. + +## Enumeration + +`DowngradeCreditCreditType` + +## Fields + +| Name | +| --- | +| `Full` | +| `Prorated` | +| `None` | + diff --git a/doc/models/on-off-component.md b/doc/models/on-off-component.md index 8649a147..904b30c8 100644 --- a/doc/models/on-off-component.md +++ b/doc/models/on-off-component.md @@ -13,8 +13,8 @@ | `description` | `string \| undefined` | Optional | A description for the component that will be displayed to the user on the hosted signup page. | | `handle` | `string \| undefined` | Optional | A unique identifier for your use that can be used to retrieve this component is subsequent requests. Must start with a letter or number and may only contain lowercase letters, numbers, or the characters '.', ':', '-', or '_'.

**Constraints**: *Pattern*: `^[a-z0-9][a-z0-9\-_:.]*$` | | `taxable` | `boolean \| undefined` | Optional | Boolean flag describing whether a component is taxable or not. | -| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | -| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | +| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | +| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | | `pricePoints` | [`ComponentPricePointItem[] \| undefined`](../../doc/models/component-price-point-item.md) | Optional | - | | `unitPrice` | [`OnOffComponentUnitPrice`](../../doc/models/containers/on-off-component-unit-price.md) | Required | This is a container for one-of cases. | | `taxCode` | `string \| undefined` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | diff --git a/doc/models/prepaid-usage-component.md b/doc/models/prepaid-usage-component.md index 8504bbb8..5d7dcdbd 100644 --- a/doc/models/prepaid-usage-component.md +++ b/doc/models/prepaid-usage-component.md @@ -16,8 +16,8 @@ | `taxable` | `boolean \| undefined` | Optional | Boolean flag describing whether a component is taxable or not. | | `pricingScheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Required | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | | `prices` | [`Price[] \| undefined`](../../doc/models/price.md) | Optional | (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261149166733-Component-Pricing-Schemes#price-bracket-rules) for an overview of how price brackets work for different pricing schemes. | -| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | -| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | +| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | +| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | | `pricePoints` | [`CreatePrepaidUsageComponentPricePoint[] \| undefined`](../../doc/models/create-prepaid-usage-component-price-point.md) | Optional | - | | `unitPrice` | [`PrepaidUsageComponentUnitPrice \| undefined`](../../doc/models/containers/prepaid-usage-component-unit-price.md) | Optional | This is a container for one-of cases. | | `taxCode` | `string \| undefined` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | diff --git a/doc/models/preview-allocations-request.md b/doc/models/preview-allocations-request.md index 93189e82..31185fa3 100644 --- a/doc/models/preview-allocations-request.md +++ b/doc/models/preview-allocations-request.md @@ -11,8 +11,8 @@ | --- | --- | --- | --- | | `allocations` | [`CreateAllocation[]`](../../doc/models/create-allocation.md) | Required | - | | `effectiveProrationDate` | `string \| undefined` | Optional | To calculate proration amounts for a future time. Only within a current subscription period. Only ISO8601 format is supported. | -| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | -| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | +| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | +| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | ## Example (as JSON) @@ -21,11 +21,11 @@ "allocations": [ { "quantity": 26.48, + "decimal_quantity": "decimal_quantity8", + "previous_quantity": 55.5, + "decimal_previous_quantity": "decimal_previous_quantity2", "component_id": 242, - "memo": "memo6", - "proration_downgrade_scheme": "proration_downgrade_scheme0", - "proration_upgrade_scheme": "proration_upgrade_scheme2", - "accrue_charge": false + "memo": "memo6" } ], "effective_proration_date": "2023-12-01", diff --git a/doc/models/product-family.md b/doc/models/product-family.md index 8051ebbb..b11cea81 100644 --- a/doc/models/product-family.md +++ b/doc/models/product-family.md @@ -16,6 +16,7 @@ | `description` | `string \| null \| undefined` | Optional | - | | `createdAt` | `string \| undefined` | Optional | - | | `updatedAt` | `string \| undefined` | Optional | - | +| `archivedAt` | `string \| null \| undefined` | Optional | Timestamp indicating when this product family was archived. `null` if the product family is not archived. | ## Example (as JSON) diff --git a/doc/models/proforma-invoice.md b/doc/models/proforma-invoice.md index 0846fb78..8d5eeb8e 100644 --- a/doc/models/proforma-invoice.md +++ b/doc/models/proforma-invoice.md @@ -45,6 +45,7 @@ | `payments` | [`ProformaInvoicePayment[] \| undefined`](../../doc/models/proforma-invoice-payment.md) | Optional | - | | `customFields` | [`InvoiceCustomField[] \| undefined`](../../doc/models/invoice-custom-field.md) | Optional | - | | `publicUrl` | `string \| null \| undefined` | Optional | - | +| `availableActions` | [`AvailableActions \| undefined`](../../doc/models/available-actions.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/quantity-based-component.md b/doc/models/quantity-based-component.md index c298f256..aee8fcaa 100644 --- a/doc/models/quantity-based-component.md +++ b/doc/models/quantity-based-component.md @@ -16,8 +16,8 @@ | `taxable` | `boolean \| undefined` | Optional | Boolean flag describing whether a component is taxable or not. | | `pricingScheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Required | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | | `prices` | [`Price[] \| undefined`](../../doc/models/price.md) | Optional | (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261149166733-Component-Pricing-Schemes#price-bracket-rules) for an overview of how price brackets work for different pricing schemes. | -| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | -| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | +| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | +| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | | `pricePoints` | [`ComponentPricePointItem[] \| undefined`](../../doc/models/component-price-point-item.md) | Optional | - | | `unitPrice` | [`QuantityBasedComponentUnitPrice \| undefined`](../../doc/models/containers/quantity-based-component-unit-price.md) | Optional | This is a container for one-of cases. | | `taxCode` | `string \| undefined` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | diff --git a/doc/models/reactivate-subscription-request.md b/doc/models/reactivate-subscription-request.md index cdb2a55a..b9ad1300 100644 --- a/doc/models/reactivate-subscription-request.md +++ b/doc/models/reactivate-subscription-request.md @@ -13,7 +13,7 @@ | `includeTrial` | `boolean \| undefined` | Optional | If `true` is sent, the reactivated Subscription will include a trial if one is available. If `false` is sent, the trial period will be ignored. | | `preserveBalance` | `boolean \| undefined` | Optional | If `true` is passed, the existing subscription balance will NOT be cleared/reset before adding the additional reactivation charges. | | `couponCode` | `string \| undefined` | Optional | The coupon code to be applied during reactivation. | -| `useCreditsAndPrepayments` | `boolean \| undefined` | Optional | If true is sent, Chargify will use service credits and prepayments upon reactivation. If false is sent, the service credits and prepayments will be ignored. | +| `useCreditsAndPrepayments` | `boolean \| undefined` | Optional | If true is sent, Advanced Billing will use service credits and prepayments upon reactivation. If false is sent, the service credits and prepayments will be ignored. | | `resume` | [`ReactivateSubscriptionRequestResume \| undefined`](../../doc/models/containers/reactivate-subscription-request-resume.md) | Optional | This is a container for one-of cases. | ## Example (as JSON) diff --git a/doc/models/register.md b/doc/models/register.md new file mode 100644 index 00000000..e9ea60a0 --- /dev/null +++ b/doc/models/register.md @@ -0,0 +1,27 @@ + +# Register + +## Structure + +`Register` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `number \| undefined` | Optional | - | +| `maxioId` | `string \| undefined` | Optional | - | +| `name` | `string \| undefined` | Optional | - | +| `currencyCode` | `string \| undefined` | Optional | The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. | + +## Example (as JSON) + +```json +{ + "id": 90, + "maxio_id": "maxio_id0", + "name": "name6", + "currency_code": "currency_code2" +} +``` + diff --git a/doc/models/scheduled-renewal-component-custom-price.md b/doc/models/scheduled-renewal-component-custom-price.md new file mode 100644 index 00000000..5d6dfbef --- /dev/null +++ b/doc/models/scheduled-renewal-component-custom-price.md @@ -0,0 +1,33 @@ + +# Scheduled Renewal Component Custom Price + +Custom pricing for a component within a scheduled renewal. + +## Structure + +`ScheduledRenewalComponentCustomPrice` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `taxIncluded` | `boolean \| undefined` | Optional | Whether or not the price point includes tax | +| `pricingScheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Required | Omit for On/Off components | +| `prices` | [`Price[]`](../../doc/models/price.md) | Required | On/off components only need one price bracket starting at 1. | + +## Example (as JSON) + +```json +{ + "pricing_scheme": "stairstep", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ], + "tax_included": false +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-item-request.md b/doc/models/scheduled-renewal-configuration-item-request.md new file mode 100644 index 00000000..35f9b0f7 --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-item-request.md @@ -0,0 +1,42 @@ + +# Scheduled Renewal Configuration Item Request + +## Structure + +`ScheduledRenewalConfigurationItemRequest` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `renewalConfigurationItem` | [`ScheduledRenewalConfigurationItemRequestRenewalConfigurationItem`](../../doc/models/containers/scheduled-renewal-configuration-item-request-renewal-configuration-item.md) | Required | This is a container for one-of cases. | + +## Example (as JSON) + +```json +{ + "renewal_configuration_item": { + "item_type": "Component", + "item_id": 108, + "price_point_id": 122, + "quantity": 212, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ] + } + } +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-item-response.md b/doc/models/scheduled-renewal-configuration-item-response.md new file mode 100644 index 00000000..6054157e --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-item-response.md @@ -0,0 +1,27 @@ + +# Scheduled Renewal Configuration Item Response + +## Structure + +`ScheduledRenewalConfigurationItemResponse` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `scheduledRenewalConfigurationItem` | [`ScheduledRenewalConfigurationItem \| undefined`](../../doc/models/scheduled-renewal-configuration-item.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "scheduled_renewal_configuration_item": { + "id": 98, + "subscription_id": 208, + "subscription_renewal_configuration_id": 108, + "item_id": 246, + "item_type": "item_type2" + } +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-item.md b/doc/models/scheduled-renewal-configuration-item.md new file mode 100644 index 00000000..d5613583 --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-item.md @@ -0,0 +1,35 @@ + +# Scheduled Renewal Configuration Item + +## Structure + +`ScheduledRenewalConfigurationItem` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `number \| undefined` | Optional | - | +| `subscriptionId` | `number \| undefined` | Optional | - | +| `subscriptionRenewalConfigurationId` | `number \| undefined` | Optional | - | +| `itemId` | `number \| undefined` | Optional | - | +| `itemType` | `string \| undefined` | Optional | - | +| `itemSubclass` | `string \| undefined` | Optional | - | +| `pricePointId` | `number \| undefined` | Optional | - | +| `pricePointType` | `string \| undefined` | Optional | - | +| `quantity` | `number \| undefined` | Optional | - | +| `decimalQuantity` | `string \| undefined` | Optional | - | +| `createdAt` | `string \| undefined` | Optional | - | + +## Example (as JSON) + +```json +{ + "id": 146, + "subscription_id": 0, + "subscription_renewal_configuration_id": 156, + "item_id": 38, + "item_type": "item_type4" +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-request-body.md b/doc/models/scheduled-renewal-configuration-request-body.md new file mode 100644 index 00000000..5b883954 --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-request-body.md @@ -0,0 +1,29 @@ + +# Scheduled Renewal Configuration Request Body + +## Structure + +`ScheduledRenewalConfigurationRequestBody` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `startsAt` | `string \| undefined` | Optional | (Optional) Start of the renewal term. | +| `endsAt` | `string \| undefined` | Optional | (Optional) End of the renewal term. | +| `lockInAt` | `string \| undefined` | Optional | (Optional) Lock-in date for the renewal. | +| `contractId` | `number \| undefined` | Optional | (Optional) Existing contract to associate with the scheduled renewal. Contracts must be enabled for your site. | +| `createNewContract` | `boolean \| undefined` | Optional | (Optional) Set to true to create a new contract when contracts are enabled. Contracts must be enabled for your site. | + +## Example (as JSON) + +```json +{ + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z", + "lock_in_at": "2016-03-13T12:52:32.123Z", + "contract_id": 110, + "create_new_contract": false +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-request.md b/doc/models/scheduled-renewal-configuration-request.md new file mode 100644 index 00000000..338b5a60 --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-request.md @@ -0,0 +1,27 @@ + +# Scheduled Renewal Configuration Request + +## Structure + +`ScheduledRenewalConfigurationRequest` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `renewalConfiguration` | [`ScheduledRenewalConfigurationRequestBody`](../../doc/models/scheduled-renewal-configuration-request-body.md) | Required | - | + +## Example (as JSON) + +```json +{ + "renewal_configuration": { + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z", + "lock_in_at": "2016-03-13T12:52:32.123Z", + "contract_id": 244, + "create_new_contract": false + } +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-response.md b/doc/models/scheduled-renewal-configuration-response.md new file mode 100644 index 00000000..b034f655 --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-response.md @@ -0,0 +1,27 @@ + +# Scheduled Renewal Configuration Response + +## Structure + +`ScheduledRenewalConfigurationResponse` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `scheduledRenewalConfiguration` | [`ScheduledRenewalConfiguration \| undefined`](../../doc/models/scheduled-renewal-configuration.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "scheduled_renewal_configuration": { + "id": 134, + "site_id": 60, + "subscription_id": 244, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" + } +} +``` + diff --git a/doc/models/scheduled-renewal-configuration.md b/doc/models/scheduled-renewal-configuration.md new file mode 100644 index 00000000..1bafd79c --- /dev/null +++ b/doc/models/scheduled-renewal-configuration.md @@ -0,0 +1,34 @@ + +# Scheduled Renewal Configuration + +## Structure + +`ScheduledRenewalConfiguration` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `number \| undefined` | Optional | ID of the renewal. | +| `siteId` | `number \| undefined` | Optional | ID of the site to which the renewal belongs. | +| `subscriptionId` | `number \| undefined` | Optional | The id of the subscription. | +| `startsAt` | `string \| undefined` | Optional | - | +| `endsAt` | `string \| undefined` | Optional | - | +| `lockInAt` | `string \| undefined` | Optional | - | +| `createdAt` | `string \| undefined` | Optional | - | +| `status` | `string \| undefined` | Optional | - | +| `scheduledRenewalConfigurationItems` | [`ScheduledRenewalConfigurationItem[] \| undefined`](../../doc/models/scheduled-renewal-configuration-item.md) | Optional | - | +| `contract` | [`Contract \| undefined`](../../doc/models/contract.md) | Optional | Contract linked to the scheduled renewal configuration. | + +## Example (as JSON) + +```json +{ + "id": 152, + "site_id": 78, + "subscription_id": 6, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" +} +``` + diff --git a/doc/models/scheduled-renewal-configurations-response.md b/doc/models/scheduled-renewal-configurations-response.md new file mode 100644 index 00000000..7a99d060 --- /dev/null +++ b/doc/models/scheduled-renewal-configurations-response.md @@ -0,0 +1,43 @@ + +# Scheduled Renewal Configurations Response + +## Structure + +`ScheduledRenewalConfigurationsResponse` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `scheduledRenewalConfigurations` | [`ScheduledRenewalConfiguration[] \| undefined`](../../doc/models/scheduled-renewal-configuration.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "scheduled_renewal_configurations": [ + { + "id": 122, + "site_id": 48, + "subscription_id": 232, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" + }, + { + "id": 122, + "site_id": 48, + "subscription_id": 232, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" + }, + { + "id": 122, + "site_id": 48, + "subscription_id": 232, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" + } + ] +} +``` + diff --git a/doc/models/scheduled-renewal-item-request-body-component.md b/doc/models/scheduled-renewal-item-request-body-component.md new file mode 100644 index 00000000..f963c065 --- /dev/null +++ b/doc/models/scheduled-renewal-item-request-body-component.md @@ -0,0 +1,44 @@ + +# Scheduled Renewal Item Request Body Component + +## Structure + +`ScheduledRenewalItemRequestBodyComponent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `itemType` | `string` | Required, Constant | Item type to add. Either Product or Component.

**Value**: `'Component'` | +| `itemId` | `number` | Required | Product or component identifier. | +| `pricePointId` | `number \| undefined` | Optional | Price point identifier. | +| `quantity` | `number \| undefined` | Optional | Optional quantity for the item. | +| `customPrice` | [`ScheduledRenewalComponentCustomPrice \| undefined`](../../doc/models/scheduled-renewal-component-custom-price.md) | Optional | Custom pricing for a component within a scheduled renewal. | + +## Example (as JSON) + +```json +{ + "item_type": "Component", + "item_id": 108, + "price_point_id": 122, + "quantity": 212, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ] + } +} +``` + diff --git a/doc/models/scheduled-renewal-item-request-body-product.md b/doc/models/scheduled-renewal-item-request-body-product.md new file mode 100644 index 00000000..1b97ea3d --- /dev/null +++ b/doc/models/scheduled-renewal-item-request-body-product.md @@ -0,0 +1,38 @@ + +# Scheduled Renewal Item Request Body Product + +## Structure + +`ScheduledRenewalItemRequestBodyProduct` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `itemType` | `string` | Required, Constant | Item type to add. Either Product or Component.

**Value**: `'Product'` | +| `itemId` | `number` | Required | Product or component identifier. | +| `pricePointId` | `number \| undefined` | Optional | Price point identifier. | +| `quantity` | `number \| undefined` | Optional | Optional quantity for the item. | +| `customPrice` | [`ScheduledRenewalProductPricePoint \| undefined`](../../doc/models/scheduled-renewal-product-price-point.md) | Optional | Custom pricing for a product within a scheduled renewal. | + +## Example (as JSON) + +```json +{ + "item_type": "Product", + "item_id": 32, + "price_point_id": 18, + "quantity": 96, + "custom_price": { + "name": "name4", + "handle": "handle0", + "price_in_cents": "String3", + "interval": "String3", + "interval_unit": "day", + "tax_included": false, + "initial_charge_in_cents": 30, + "expiration_interval": 52 + } +} +``` + diff --git a/doc/models/scheduled-renewal-lock-in-request.md b/doc/models/scheduled-renewal-lock-in-request.md new file mode 100644 index 00000000..31e2a115 --- /dev/null +++ b/doc/models/scheduled-renewal-lock-in-request.md @@ -0,0 +1,21 @@ + +# Scheduled Renewal Lock in Request + +## Structure + +`ScheduledRenewalLockInRequest` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `lockInAt` | `string` | Required | Date to lock in the renewal. | + +## Example (as JSON) + +```json +{ + "lock_in_at": "2016-03-13T12:52:32.123Z" +} +``` + diff --git a/doc/models/scheduled-renewal-product-price-point.md b/doc/models/scheduled-renewal-product-price-point.md new file mode 100644 index 00000000..ae6ceb9d --- /dev/null +++ b/doc/models/scheduled-renewal-product-price-point.md @@ -0,0 +1,38 @@ + +# Scheduled Renewal Product Price Point + +Custom pricing for a product within a scheduled renewal. + +## Structure + +`ScheduledRenewalProductPricePoint` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `name` | `string \| undefined` | Optional | (Optional) | +| `handle` | `string \| undefined` | Optional | (Optional) | +| `priceInCents` | [`ScheduledRenewalProductPricePointPriceInCents`](../../doc/models/containers/scheduled-renewal-product-price-point-price-in-cents.md) | Required | This is a container for one-of cases. | +| `interval` | [`ScheduledRenewalProductPricePointInterval`](../../doc/models/containers/scheduled-renewal-product-price-point-interval.md) | Required | This is a container for one-of cases. | +| `intervalUnit` | [`IntervalUnit \| null`](../../doc/models/interval-unit.md) | Required | Required if using `custom_price` attribute. | +| `taxIncluded` | `boolean \| undefined` | Optional | (Optional) | +| `initialChargeInCents` | `bigint \| undefined` | Optional | The product price point initial charge, in integer cents. | +| `expirationInterval` | `number \| undefined` | Optional | The numerical expiration interval. i.e. an expiration_interval of ‘30’ coupled with an expiration_interval_unit of day would mean this product price point would expire after 30 days. | +| `expirationIntervalUnit` | [`ExpirationIntervalUnit \| null \| undefined`](../../doc/models/expiration-interval-unit.md) | Optional | A string representing the expiration interval unit for this product price point, either month, day or never | + +## Example (as JSON) + +```json +{ + "name": "name4", + "handle": "handle0", + "price_in_cents": "String3", + "interval": "String9", + "interval_unit": "day", + "tax_included": false, + "initial_charge_in_cents": 86, + "expiration_interval": 108 +} +``` + diff --git a/doc/models/scheduled-renewal-update-request.md b/doc/models/scheduled-renewal-update-request.md new file mode 100644 index 00000000..077993d8 --- /dev/null +++ b/doc/models/scheduled-renewal-update-request.md @@ -0,0 +1,42 @@ + +# Scheduled Renewal Update Request + +## Structure + +`ScheduledRenewalUpdateRequest` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `renewalConfigurationItem` | [`ScheduledRenewalUpdateRequestRenewalConfigurationItem`](../../doc/models/containers/scheduled-renewal-update-request-renewal-configuration-item.md) | Required | This is a container for one-of cases. | + +## Example (as JSON) + +```json +{ + "renewal_configuration_item": { + "item_type": "Component", + "item_id": 108, + "price_point_id": 122, + "quantity": 212, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ] + } + } +} +``` + diff --git a/doc/models/send-email.md b/doc/models/send-email.md new file mode 100644 index 00000000..cc4d2d26 --- /dev/null +++ b/doc/models/send-email.md @@ -0,0 +1,23 @@ + +# Send Email + +## Structure + +`SendEmail` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `canExecute` | `boolean` | Required | - | +| `url` | `string` | Required | - | + +## Example (as JSON) + +```json +{ + "can_execute": false, + "url": "url2" +} +``` + diff --git a/doc/models/send-invoice-request.md b/doc/models/send-invoice-request.md index 2b86f3fb..65907df8 100644 --- a/doc/models/send-invoice-request.md +++ b/doc/models/send-invoice-request.md @@ -12,6 +12,7 @@ | `recipientEmails` | `string[] \| undefined` | Optional | **Constraints**: *Maximum Items*: `5` | | `ccRecipientEmails` | `string[] \| undefined` | Optional | **Constraints**: *Maximum Items*: `5` | | `bccRecipientEmails` | `string[] \| undefined` | Optional | **Constraints**: *Maximum Items*: `5` | +| `attachmentUrls` | `string[] \| undefined` | Optional | Array of URLs to files to attach to the invoice email. Max 10 files, 10MB each.

**Constraints**: *Maximum Items*: `10` | ## Example (as JSON) @@ -27,6 +28,10 @@ ], "bcc_recipient_emails": [ "bcc_recipient_emails6" + ], + "attachment_urls": [ + "attachment_urls0", + "attachment_urls1" ] } ``` diff --git a/doc/models/snap-day.md b/doc/models/snap-day.md deleted file mode 100644 index 92da90e2..00000000 --- a/doc/models/snap-day.md +++ /dev/null @@ -1,13 +0,0 @@ - -# Snap Day - -## Enumeration - -`SnapDay` - -## Fields - -| Name | -| --- | -| `End` | - diff --git a/doc/models/status.md b/doc/models/status.md new file mode 100644 index 00000000..a7a8dca1 --- /dev/null +++ b/doc/models/status.md @@ -0,0 +1,18 @@ + +# Status + +## Enumeration + +`Status` + +## Fields + +| Name | +| --- | +| `Draft` | +| `Scheduled` | +| `Pending` | +| `Canceled` | +| `Active` | +| `Fulfilled` | + diff --git a/doc/models/subscription-component.md b/doc/models/subscription-component.md index 6e222ccf..803b3b9a 100644 --- a/doc/models/subscription-component.md +++ b/doc/models/subscription-component.md @@ -22,8 +22,8 @@ | `componentHandle` | `string \| null \| undefined` | Optional | - | | `subscriptionId` | `number \| undefined` | Optional | - | | `recurring` | `boolean \| undefined` | Optional | - | -| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | -| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | +| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | +| `downgradeCredit` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | | `archivedAt` | `string \| null \| undefined` | Optional | - | | `pricePointId` | `number \| null \| undefined` | Optional | - | | `pricePointHandle` | `string \| null \| undefined` | Optional | - | diff --git a/doc/models/subscription-custom-price.md b/doc/models/subscription-custom-price.md index b26bec81..c64918cb 100644 --- a/doc/models/subscription-custom-price.md +++ b/doc/models/subscription-custom-price.md @@ -1,7 +1,7 @@ # Subscription Custom Price -(Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription +(Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. ## Structure diff --git a/doc/models/subscription-group-component-custom-price.md b/doc/models/subscription-group-component-custom-price.md index 6b8fc6ed..badf0e64 100644 --- a/doc/models/subscription-group-component-custom-price.md +++ b/doc/models/subscription-group-component-custom-price.md @@ -33,14 +33,14 @@ Used in place of `price_point_id` to define a custom price point unique to the s "pricing_scheme": "stairstep", "interval": 230, "interval_unit": "day", + "list_price_point_id": 10, "prices": [ { "starting_quantity": 242, "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } ] } diff --git a/doc/models/subscription-group-response.md b/doc/models/subscription-group-response.md index 510f6a61..84872a36 100644 --- a/doc/models/subscription-group-response.md +++ b/doc/models/subscription-group-response.md @@ -16,6 +16,7 @@ ```json { "subscription_group": { + "uid": "uid8", "customer_id": 220, "payment_profile": { "id": 44, @@ -27,8 +28,7 @@ "subscription_ids": [ 74, 75 - ], - "created_at": "2016-03-13T12:52:32.123Z" + ] } } ``` diff --git a/doc/models/subscription-group-signup-component.md b/doc/models/subscription-group-signup-component.md index 904ba4a5..0bd62a95 100644 --- a/doc/models/subscription-group-signup-component.md +++ b/doc/models/subscription-group-signup-component.md @@ -43,42 +43,42 @@ "pricing_scheme": "stairstep", "interval": 230, "interval_unit": "day", + "list_price_point_id": 10, "prices": [ { "starting_quantity": 242, "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] }, { "tax_included": false, "pricing_scheme": "stairstep", "interval": 230, "interval_unit": "day", + "list_price_point_id": 10, "prices": [ { "starting_quantity": 242, "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] }, { "tax_included": false, "pricing_scheme": "stairstep", "interval": 230, "interval_unit": "day", + "list_price_point_id": 10, "prices": [ { "starting_quantity": 242, "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } ] } diff --git a/doc/models/subscription-group-signup-item.md b/doc/models/subscription-group-signup-item.md index 0d1e1440..51a692c7 100644 --- a/doc/models/subscription-group-signup-item.md +++ b/doc/models/subscription-group-signup-item.md @@ -19,7 +19,7 @@ | `currency` | `string \| undefined` | Optional | (Optional) If Multi-Currency is enabled and the currency is configured in Chargify, pass it at signup to create a subscription on a non-default currency. Note that you cannot update the currency of an existing subscription. | | `couponCodes` | `string[] \| undefined` | Optional | An array for all the coupons attached to the subscription. | | `components` | [`SubscriptionGroupSignupComponent[] \| undefined`](../../doc/models/subscription-group-signup-component.md) | Optional | - | -| `customPrice` | [`SubscriptionCustomPrice \| undefined`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription | +| `customPrice` | [`SubscriptionCustomPrice \| undefined`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. | | `calendarBilling` | [`CalendarBilling \| undefined`](../../doc/models/calendar-billing.md) | Optional | (Optional). Cannot be used when also specifying next_billing_at | | `metafields` | `Record \| undefined` | Optional | (Optional) A set of key/value pairs representing custom fields and their values. Metafields will be created “on-the-fly” in your site for a given key, if they have not been created yet. | diff --git a/doc/models/subscription-group.md b/doc/models/subscription-group.md index 6ddca2c5..2692cec9 100644 --- a/doc/models/subscription-group.md +++ b/doc/models/subscription-group.md @@ -9,6 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | +| `uid` | `string \| undefined` | Optional | - | | `customerId` | `number \| undefined` | Optional | - | | `paymentProfile` | [`SubscriptionGroupPaymentProfile \| undefined`](../../doc/models/subscription-group-payment-profile.md) | Optional | - | | `paymentCollectionMethod` | [`CollectionMethod \| undefined`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. | @@ -19,6 +20,7 @@ ```json { + "uid": "uid4", "customer_id": 36, "payment_profile": { "id": 44, @@ -31,8 +33,7 @@ 146, 147, 148 - ], - "created_at": "2016-03-13T12:52:32.123Z" + ] } ``` diff --git a/doc/models/subscription-sort.md b/doc/models/subscription-sort.md index cfae8370..7ee76b10 100644 --- a/doc/models/subscription-sort.md +++ b/doc/models/subscription-sort.md @@ -15,4 +15,8 @@ | `NextAssessment` | | `UpdatedAt` | | `CreatedAt` | +| `TotalPayments` | +| `Id` | +| `OpenBalance` | +| `ExpiresAt` | diff --git a/doc/models/subscription.md b/doc/models/subscription.md index 7ad119b0..01fefddd 100644 --- a/doc/models/subscription.md +++ b/doc/models/subscription.md @@ -33,7 +33,7 @@ | `signupRevenue` | `string \| undefined` | Optional | The revenue, formatted as a string of decimal separated dollars and,cents, from the subscription signup ($50.00 would be formatted as,50.00) | | `delayedCancelAt` | `string \| null \| undefined` | Optional | Timestamp for when the subscription is currently set to cancel. | | `couponCode` | `string \| null \| undefined` | Optional | (deprecated) The coupon code of the single coupon currently applied to the subscription. See coupon_codes instead as subscriptions can now have more than one coupon. | -| `snapDay` | [`SubscriptionSnapDay \| null \| undefined`](../../doc/models/containers/subscription-snap-day.md) | Optional | This is a container for one-of cases. | +| `snapDay` | `string \| null \| undefined` | Optional | A day of month that subscription will be processed on. Can be 1 up to 28 or 'end'. | | `paymentCollectionMethod` | [`CollectionMethod \| undefined`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. | | `customer` | [`Customer \| undefined`](../../doc/models/customer.md) | Optional | - | | `product` | [`Product \| undefined`](../../doc/models/product.md) | Optional | - | @@ -46,7 +46,7 @@ | `nextProductHandle` | `string \| null \| undefined` | Optional | If a delayed product change is scheduled, the handle of the product that the subscription will be changed to at the next renewal. | | `couponUseCount` | `number \| null \| undefined` | Optional | (deprecated) How many times the subscription's single coupon has been used. This field has no replacement for multiple coupons. | | `couponUsesAllowed` | `number \| null \| undefined` | Optional | (deprecated) How many times the subscription's single coupon may be used. This field has no replacement for multiple coupons. | -| `reasonCode` | `string \| null \| undefined` | Optional | If the subscription is canceled, this is their churn code. | +| `reasonCode` | `string \| null \| undefined` | Optional | The churn reason code associated to a cancelled subscription. | | `automaticallyResumeAt` | `string \| null \| undefined` | Optional | The date the subscription is scheduled to automatically resume from the on_hold state. | | `couponCodes` | `string[] \| undefined` | Optional | An array for all the coupons attached to the subscription. | | `offerId` | `number \| null \| undefined` | Optional | The ID of the offer associated with the subscription. | @@ -57,7 +57,7 @@ | `nextProductPricePointId` | `number \| null \| undefined` | Optional | If a delayed product change is scheduled, the ID of the product price point that the subscription will be changed to at the next renewal. | | `netTerms` | `number \| null \| undefined` | Optional | On Relationship Invoicing, the number of days before a renewal invoice is due. | | `storedCredentialTransactionId` | `number \| null \| undefined` | Optional | For European sites subject to PSD2 and using 3D Secure, this can be used to reference a previous transaction for the customer. This will ensure the card will be charged successfully at renewal. | -| `reference` | `string \| null \| undefined` | Optional | The reference value (provided by your app) for the subscription itelf. | +| `reference` | `string \| null \| undefined` | Optional | The reference value (provided by your app) for the subscription istelf. | | `onHoldAt` | `string \| null \| undefined` | Optional | The timestamp of the most recent on hold action. | | `prepaidDunning` | `boolean \| undefined` | Optional | Boolean representing whether the subscription is prepaid and currently in dunning. Only returned for Relationship Invoicing sites with the feature enabled | | `coupons` | [`SubscriptionIncludedCoupon[] \| undefined`](../../doc/models/subscription-included-coupon.md) | Optional | Additional coupon data. To use this data you also have to include the following param in the request`include[]=coupons`.
Only in Read Subscription Endpoint. | diff --git a/doc/models/update-component.md b/doc/models/update-component.md index 5f85da5b..64aa6214 100644 --- a/doc/models/update-component.md +++ b/doc/models/update-component.md @@ -17,7 +17,7 @@ | `taxCode` | `string \| null \| undefined` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `itemCategory` | [`ItemCategory \| null \| undefined`](../../doc/models/item-category.md) | Optional | One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other | | `displayOnHostedPage` | `boolean \| undefined` | Optional | - | -| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | +| `upgradeCharge` | [`CreditType \| null \| undefined`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. | ## Example (as JSON) diff --git a/doc/models/update-subscription-component.md b/doc/models/update-subscription-component.md index c9dcc52b..8f18502d 100644 --- a/doc/models/update-subscription-component.md +++ b/doc/models/update-subscription-component.md @@ -22,6 +22,7 @@ "pricing_scheme": "stairstep", "interval": 66, "interval_unit": "day", + "list_price_point_id": 174, "prices": [ { "starting_quantity": 242, @@ -33,8 +34,7 @@ "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } } ``` diff --git a/doc/models/update-subscription.md b/doc/models/update-subscription.md index 730932a1..7d75b31d 100644 --- a/doc/models/update-subscription.md +++ b/doc/models/update-subscription.md @@ -15,7 +15,7 @@ | `productChangeDelayed` | `boolean \| undefined` | Optional | - | | `nextProductId` | `string \| undefined` | Optional | Set to an empty string to cancel a delayed product change. | | `nextProductPricePointId` | `string \| undefined` | Optional | - | -| `snapDay` | [`UpdateSubscriptionSnapDay \| null \| undefined`](../../doc/models/containers/update-subscription-snap-day.md) | Optional | This is a container for one-of cases. | +| `snapDay` | [`UpdateSubscriptionSnapDay \| undefined`](../../doc/models/containers/update-subscription-snap-day.md) | Optional | This is a container for one-of cases. | | `initialBillingAt` | `string \| undefined` | Optional | (Optional) Set this attribute to a future date/time to update a subscription in the Awaiting Signup Date state, to Awaiting Signup. In the Awaiting Signup state, a subscription behaves like any other. It can be canceled, allocated to, or have its billing date changed. etc. When the `initial_billing_at` date hits, the subscription will transition to the expected state. If the product has a trial, the subscription will enter a trial, otherwise it will go active. Setup fees will be respected either before or after the trial, as configured on the price point. If the payment is due at the initial_billing_at and it fails the subscription will be immediately canceled. You can omit the initial_billing_at date to activate the subscription immediately. See the [subscription import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Advanced-Billing-Subscription-Imports#date-format) documentation for more information about Date/Time formats. | | `deferSignup` | `boolean \| undefined` | Optional | (Optional) Set this attribute to true to move the subscription from Awaiting Signup, to Awaiting Signup Date. Use this when you want to update a subscription that has an unknown initial billing date. When the first billing date is known, update a subscription to set the `initial_billing_at` date. The subscription moves to the awaiting signup with a scheduled initial billing date. You can omit the initial_billing_at date to activate the subscription immediately. See [Subscription States](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404222005773-Subscription-States) for more information.

**Default**: `false` | | `nextBillingAt` | `string \| undefined` | Optional | - | @@ -25,7 +25,7 @@ | `netTerms` | [`UpdateSubscriptionNetTerms \| undefined`](../../doc/models/containers/update-subscription-net-terms.md) | Optional | This is a container for one-of cases. | | `storedCredentialTransactionId` | `number \| undefined` | Optional | - | | `reference` | `string \| undefined` | Optional | - | -| `customPrice` | [`SubscriptionCustomPrice \| undefined`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription | +| `customPrice` | [`SubscriptionCustomPrice \| undefined`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. | | `components` | [`UpdateSubscriptionComponent[] \| undefined`](../../doc/models/update-subscription-component.md) | Optional | (Optional) An array of component ids and custom prices to be added to the subscription. | | `dunningCommunicationDelayEnabled` | `boolean \| undefined` | Optional | Enable Communication Delay feature, making sure no communication (email or SMS) is sent to the Customer between 9PM and 8AM in time zone set by the `dunning_communication_delay_time_zone` attribute. | | `dunningCommunicationDelayTimeZone` | `string \| null \| undefined` | Optional | Time zone for the Dunning Communication Delay feature. | diff --git a/doc/models/upgrade-charge-credit-type.md b/doc/models/upgrade-charge-credit-type.md new file mode 100644 index 00000000..477e0590 --- /dev/null +++ b/doc/models/upgrade-charge-credit-type.md @@ -0,0 +1,23 @@ + +# Upgrade Charge Credit Type + +The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are: + +`full` - A charge is added for the full price of the component. + +`prorated` - A charge is added for the prorated price of the component change. + +`none` - No charge is added. + +## Enumeration + +`UpgradeChargeCreditType` + +## Fields + +| Name | +| --- | +| `Full` | +| `Prorated` | +| `None` | + diff --git a/package.json b/package.json index 5fab244a..8469dc40 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "version": "8.0.0", + "version": "9.0.0", "license": "MIT", "sideEffects": false, "main": "dist/cjs/index.js", - "typings": "dist/types/index.d.ts", + "typings": "dist/cjs/types/index.d.ts", "module": "dist/esm/index.js", "files": [ "dist", @@ -13,8 +13,8 @@ "node": ">=14.17.0" }, "scripts": { - "build": "rimraf dist && tsc -p tsconfig.esm.json & tsc -p tsconfig.cjs.json", - "prepare": "rimraf dist && tsc -p tsconfig.esm.json & tsc -p tsconfig.cjs.json", + "build": "rimraf dist && tsc -p tsconfig.esm.json & tsc -p tsconfig.cjs.json && node ./scripts/split-package-json.mjs", + "prepare": "rimraf dist && tsc -p tsconfig.esm.json & tsc -p tsconfig.cjs.json && node ./scripts/split-package-json.mjs", "lint": "eslint **/*.ts --ignore-path .eslintignore", "lint:fix": "eslint **/*.ts --ignore-path .eslintignore --fix" }, @@ -64,5 +64,27 @@ "Subscription", "Payments" ], - "contributors": [] + "contributors": [], + "exports": { + ".": { + "import": { + "types": "./dist/esm/types/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/cjs/types/index.d.ts", + "default": "./dist/cjs/index.js" + } + }, + "./metadata": { + "import": { + "types": "./dist/esm/types/metadata/index.d.ts", + "default": "./dist/esm/metadata/index.js" + }, + "require": { + "types": "./dist/cjs/types/metadata/index.d.ts", + "default": "./dist/cjs/metadata/index.js" + } + } + } } \ No newline at end of file diff --git a/scripts/split-package-json.mjs b/scripts/split-package-json.mjs new file mode 100644 index 00000000..ad64e2cc --- /dev/null +++ b/scripts/split-package-json.mjs @@ -0,0 +1,27 @@ +// Node.js script to add separate package.json files to dist/esm and dist/cjs +// This acts as a hint for Node.js and TypeScript when loading modules(i.e. .js files). + +import { mkdirSync, writeFileSync } from 'fs'; +import { join } from 'path'; + +// Define the target directories and their respective package.json content +const targets = [ + { + dir: join('dist', 'esm'), + content: { type: 'module' } + }, + { + dir: join('dist', 'cjs'), + content: { type: 'commonjs' } + } +]; + +// Ensure each directory exists and write the package.json file +targets.forEach(({ dir, content }) => { + mkdirSync(dir, { recursive: true }); + writeFileSync( + join(dir, 'package.json'), + JSON.stringify(content, null, 2) + '\n', + 'utf8' + ); +}); diff --git a/src/client.ts b/src/client.ts index 78f03f63..80a1e9ed 100644 --- a/src/client.ts +++ b/src/client.ts @@ -51,7 +51,7 @@ export class Client implements ClientInterface { ? this._config.httpClientOptions.timeout : this._config.timeout; this._userAgent = updateUserAgent( - 'AB SDK TypeScript:8.0.0 on OS {os-info}' + 'AB SDK TypeScript:9.0.0 on OS {os-info}' ); this._requestBuilderFactory = createRequestHandlerFactory( (server) => getBaseUri(server, this._config), @@ -82,6 +82,28 @@ export class Client implements ClientInterface { public withConfiguration(config: Partial) { return new Client({ ...this._config, ...config }); } + + /** + * Create a client instance from a JSON configuration string + * @param jsonConfig - JSON string containing the configuration + * @returns A new Client instance + */ + public static fromJsonConfig(jsonConfig: string): Client { + return new Client(Configuration.fromJsonConfig(jsonConfig)); + } + + /** + * Create a client instance from environment variables + * @param envVariables - Optional object containing environment variables + * @returns A new Client instance + */ + public static fromEnvironment( + envVariables?: Record + ): Client { + return new Client( + Configuration.fromEnvironment(envVariables || process.env) + ); + } } function createHttpClientAdapter(client: HttpClient): HttpClientInterface { diff --git a/src/configuration.ts b/src/configuration.ts index ea55259c..63cc0d6f 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -5,6 +5,19 @@ */ import { HttpClientOptions } from './clientAdapter.js'; +import { + anyOf, + array, + boolean, + literal, + number, + object, + optional, + Schema, + string, + stringEnum, + validateAndMap, +} from './schema.js'; /** An interface for all configuration parameters required by the SDK. */ export interface Configuration { @@ -24,3 +37,159 @@ export enum Environment { US = 'US', EU = 'EU', } + +export namespace Configuration { + export function fromJsonConfig(jsonConfig: string): Partial { + const configurationObject = JSON.parse(jsonConfig); + const result = validateAndMap(jsonConfig, configurationObject); + + if (result.errors) { + throw new Error( + 'Invalid configuration provided. Please check the following errors:\n' + + result.errors.map((e: any) => e.message).join('\n') + ); + } + + return result.result; + } + + export function fromEnvironment( + envVariables: Record + ): Partial { + const config: any = {}; + + config.timeout = envVariables.TIMEOUT; + config.environment = envVariables.ENVIRONMENT; + config.site = envVariables.SITE; + + if (envVariables.USERNAME && envVariables.PASSWORD) { + config.basicAuthCredentials = { + username: envVariables.USERNAME, + password: envVariables.PASSWORD, + }; + } + + config.httpClientOptions = { + timeout: envVariables.TIMEOUT, + retryConfig: { + retryOnTimeout: envVariables.RETRY_ON_TIMEOUT, + retryInterval: envVariables.RETRY_INTERVAL, + maxNumberOfRetries: envVariables.MAX_NUMBER_OF_RETRIES, + maximumRetryWaitTime: envVariables.MAX_RETRY_WAIT_TIME, + backoffFactor: envVariables.RETRY_BACKOFF_FACTOR, + httpStatusCodesToRetry: envVariables.HTTP_STATUS_CODES_TO_RETRY?.split( + ',' + ).map((s) => s.trim()), + httpMethodsToRetry: envVariables.HTTP_METHODS_TO_RETRY?.split( + ',' + ).map((s) => s.trim()), + }, + }; + + if (envVariables.PROXY_ADDRESS) { + config.httpClientOptions.proxySettings = { + address: envVariables.PROXY_ADDRESS, + port: envVariables.PROXY_PORT, + }; + + if ( + envVariables.PROXY_AUTH_USERNAME && + envVariables.PROXY_AUTH_PASSWORD + ) { + config.httpClientOptions.proxySettings.auth = { + username: envVariables.PROXY_AUTH_USERNAME, + password: envVariables.PROXY_AUTH_PASSWORD, + }; + } + } + + const result = validateAndMap(config, configurationSchema); + + if (result.errors) { + throw new Error( + 'Invalid configuration provided. Please check the following errors:\n' + + result.errors.map((e: any) => e.message).join('\n') + ); + } + + return result.result; + } +} + +const configurationSchema: Schema> = object({ + timeout: ['timeout', optional(number())], + environment: ['environment', optional(stringEnum(Environment))], + basicAuthCredentials: [ + 'basicAuthCredentials', + optional( + object({ + username: ['username', string()], + password: ['password', string()], + }) + ), + ], + httpClientOptions: [ + 'httpClientOptions', + optional( + object({ + timeout: ['timeout', optional(number())], + retryConfig: [ + 'retryConfig', + optional( + object({ + maxNumberOfRetries: ['maxNumberOfRetries', optional(number())], + retryOnTimeout: ['retryOnTimeout', optional(boolean())], + retryInterval: ['retryInterval', optional(number())], + maximumRetryWaitTime: [ + 'maximumRetryWaitTime', + optional(number()), + ], + backoffFactor: ['backoffFactor', optional(number())], + httpStatusCodesToRetry: [ + 'httpStatusCodesToRetry', + optional(array(number())), + ], + httpMethodsToRetry: [ + 'httpMethodsToRetry', + optional( + array( + anyOf([ + literal('GET'), + literal('DELETE'), + literal('HEAD'), + literal('OPTIONS'), + literal('POST'), + literal('PUT'), + literal('PATCH'), + literal('LINK'), + literal('UNLINK'), + ]) + ) + ), + ], + }) + ), + ], + proxySettings: [ + 'proxySettings', + optional( + object({ + address: ['address', string()], + port: ['port', optional(number())], + auth: [ + 'auth', + optional( + object({ + username: ['username', string()], + password: ['password', string()], + }) + ), + ], + }) + ), + ], + }) + ), + ], + site: ['site', optional(string())], +}); diff --git a/src/controllers/advanceInvoiceController.ts b/src/controllers/advanceInvoiceController.ts index 605c0d37..9cbd756f 100644 --- a/src/controllers/advanceInvoiceController.ts +++ b/src/controllers/advanceInvoiceController.ts @@ -34,7 +34,7 @@ export class AdvanceInvoiceController extends BaseController { * advance invoice before using this endpoint to generate it. * * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -66,7 +66,7 @@ export class AdvanceInvoiceController extends BaseController { * Once an advance invoice has been generated for a subscription's upcoming renewal, it can be viewed * through this endpoint. There can only be one advance invoice per subscription per billing cycle. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @return Response from the API call */ async readAdvanceInvoice( @@ -89,7 +89,7 @@ export class AdvanceInvoiceController extends BaseController { * cause any prepayments and credits that were applied to the invoice to be returned to the * subscription. For a full overview of the impact of voiding, [see our help docs]($m/Invoice). * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ diff --git a/src/controllers/componentPricePointsController.ts b/src/controllers/componentPricePointsController.ts index 5d65babc..4085b88e 100644 --- a/src/controllers/componentPricePointsController.ts +++ b/src/controllers/componentPricePointsController.ts @@ -5,10 +5,18 @@ */ import { ApiResponse, commaPrefix, RequestOptions } from '../core.js'; +import { + CloneComponentPricePointRequest, + cloneComponentPricePointRequestSchema, +} from '../models/cloneComponentPricePointRequest.js'; import { ComponentCurrencyPricesResponse, componentCurrencyPricesResponseSchema, } from '../models/componentCurrencyPricesResponse.js'; +import { + ComponentPricePointCurrencyOverageResponse, + componentPricePointCurrencyOverageResponseSchema, +} from '../models/componentPricePointCurrencyOverageResponse.js'; import { ComponentPricePointResponse, componentPricePointResponseSchema, @@ -29,6 +37,14 @@ import { ArchiveComponentPricePointPricePointId, archiveComponentPricePointPricePointIdSchema, } from '../models/containers/archiveComponentPricePointPricePointId.js'; +import { + CloneComponentPricePointComponentId, + cloneComponentPricePointComponentIdSchema, +} from '../models/containers/cloneComponentPricePointComponentId.js'; +import { + CloneComponentPricePointPricePointId, + cloneComponentPricePointPricePointIdSchema, +} from '../models/containers/cloneComponentPricePointPricePointId.js'; import { ReadComponentPricePointComponentId, readComponentPricePointComponentIdSchema, @@ -87,6 +103,7 @@ import { } from '../models/updateCurrencyPricesRequest.js'; import { array, boolean, number, optional, string } from '../schema.js'; import { BaseController } from './baseController.js'; +import { ApiError } from '@apimatic/core'; import { ErrorArrayMapResponseError } from '../errors/errorArrayMapResponseError.js'; import { ErrorListResponseError } from '../errors/errorListResponseError.js'; @@ -242,6 +259,57 @@ export class ComponentPricePointsController extends BaseController { return req.callAsJson(componentPricePointsResponseSchema, requestOptions); } + /** + * Clones a component price point. Custom price points (tied to a specific subscription) cannot be + * cloned. The following attributes are copied from the source price point: + * - Pricing scheme + * - All price tiers (with starting/ending quantities and unit prices) + * - Tax included setting + * - Currency prices (if definitive pricing is set) + * - Overage pricing (for prepaid usage components) + * - Interval settings (if multi-frequency is enabled) + * - Event-based billing segments (if applicable) + * + * @param componentId The id or handle of the component. When using the + * handle, it must be prefixed with `handle:`. + * Example: `123` for an integer ID, or `handle: + * example-product-handle` for a string handle. + * @param pricePointId The id or handle of the price point. When using + * the handle, it must be prefixed with `handle:`. + * Example: `123` for an integer ID, or `handle: + * example-price_point-handle` for a string handle. + * @param body + * @return Response from the API call + */ + async cloneComponentPricePoint( + componentId: CloneComponentPricePointComponentId, + pricePointId: CloneComponentPricePointPricePointId, + body?: CloneComponentPricePointRequest, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('POST'); + const mapped = req.prepareArgs({ + componentId: [componentId, cloneComponentPricePointComponentIdSchema], + pricePointId: [pricePointId, cloneComponentPricePointPricePointIdSchema], + body: [body, optional(cloneComponentPricePointRequestSchema)], + }); + req.header('Content-Type', 'application/json'); + req.json(mapped.body); + req.appendTemplatePath`/components/${mapped.componentId}/price_points/${mapped.pricePointId}/clone.json`; + req.throwOn(404, ApiError, true, "Not Found:'{$response.body}'"); + req.throwOn( + 422, + ErrorListResponseError, + true, + "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'." + ); + req.authenticate([{ basicAuth: true }]); + return req.callAsJson( + componentPricePointCurrencyOverageResponseSchema, + requestOptions + ); + } + /** * When updating a price point, prices can be updated as well by creating new prices or editing / * removing existing ones. @@ -309,7 +377,7 @@ export class ComponentPricePointsController extends BaseController { pricePointId: ReadComponentPricePointPricePointId, currencyPrices?: boolean, requestOptions?: RequestOptions - ): Promise> { + ): Promise> { const req = this.createRequest('GET'); const mapped = req.prepareArgs({ componentId: [componentId, readComponentPricePointComponentIdSchema], @@ -319,7 +387,10 @@ export class ComponentPricePointsController extends BaseController { req.query('currency_prices', mapped.currencyPrices, commaPrefix); req.appendTemplatePath`/components/${mapped.componentId}/price_points/${mapped.pricePointId}.json`; req.authenticate([{ basicAuth: true }]); - return req.callAsJson(componentPricePointResponseSchema, requestOptions); + return req.callAsJson( + componentPricePointCurrencyOverageResponseSchema, + requestOptions + ); } /** diff --git a/src/controllers/eventsController.ts b/src/controllers/eventsController.ts index 5eb4763d..bef5be55 100644 --- a/src/controllers/eventsController.ts +++ b/src/controllers/eventsController.ts @@ -196,7 +196,7 @@ export class EventsController extends BaseController { * While some events share the same schema for `event_specific_data`, others may not include it at all. * For precise mappings from key to event_specific_data, refer to [Event]($m/Event). * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param page Result records are organized in pages. By default, the first page of results * is displayed. The page parameter specifies a page number of results to fetch. * You can start navigating through the pages to consume the results. You do diff --git a/src/controllers/invoicesController.ts b/src/controllers/invoicesController.ts index caa1d2cd..fd05e9b1 100644 --- a/src/controllers/invoicesController.ts +++ b/src/controllers/invoicesController.ts @@ -622,7 +622,7 @@ export class InvoicesController extends BaseController { * * Only ungrouped or primary subscriptions may be paid using the "bulk" payment request. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -989,7 +989,7 @@ export class InvoicesController extends BaseController { * * By default, invoices will be created with open status. Possible alternative is `draft`. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -1022,6 +1022,10 @@ export class InvoicesController extends BaseController { * supports email delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy * (bcc) recipients. * + * **File Attachments**: You can attach files to invoice emails using `attachment_urls[]` parameter by + * providing URLs to the files you want to attach. When using attachments, the request must use + * `multipart/form-data` content type. Max 10 files, 10MB per file. + * * If no recipient email addresses are specified in the request, then the subscription's default email * configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will * be delivered to the subscription's customer email address. @@ -1130,9 +1134,9 @@ export class InvoicesController extends BaseController { } /** - * This endpoint allows you to issue an invoice that is in "pending" status. For example, you can issue - * an invoice that was created when allocating new quantity on a component and using "accrue charges" - * option. + * This endpoint allows you to issue an invoice that is in "pending" or "draft" status. For example, + * you can issue an invoice that was created when allocating new quantity on a component and using + * "accrue charges" option. * * You cannot issue a pending child invoice that was created for a member subscription in a group. * diff --git a/src/controllers/paymentProfilesController.ts b/src/controllers/paymentProfilesController.ts index 342bb455..da6fff3b 100644 --- a/src/controllers/paymentProfilesController.ts +++ b/src/controllers/paymentProfilesController.ts @@ -396,7 +396,7 @@ export class PaymentProfilesController extends BaseController { } /** - * This will delete a payment profile belonging to the customer on the subscription. + * Deletes a payment profile belonging to the customer on the subscription. * * + If the customer has multiple subscriptions, the payment profile will be removed from all of them. * @@ -406,7 +406,7 @@ export class PaymentProfilesController extends BaseController { * the Admin UI and use the “Add New Credit Card” or “Make Active Payment Method” link, (depending on * whether there are other cards present). * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param paymentProfileId The Chargify id of the payment profile * @return Response from the API call */ @@ -458,7 +458,7 @@ export class PaymentProfilesController extends BaseController { } /** - * This will delete a Payment Profile belonging to a Subscription Group. + * Deletes a Payment Profile belonging to a Subscription Group. * * **Note**: If the Payment Profile belongs to multiple Subscription Groups and/or Subscriptions, it * will be removed from all of them. @@ -489,7 +489,7 @@ export class PaymentProfilesController extends BaseController { * You must elect to change the existing payment profile to a new payment profile ID in order to * receive a satisfactory response from this endpoint. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param paymentProfileId The Chargify id of the payment profile * @return Response from the API call */ @@ -598,7 +598,7 @@ export class PaymentProfilesController extends BaseController { * These error responses are designed to prevent excessive or invalid requests, and to provide clear * and helpful information to users who encounter errors during the request process. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @return Response from the API call */ async sendRequestUpdatePaymentEmail( diff --git a/src/controllers/proformaInvoicesController.ts b/src/controllers/proformaInvoicesController.ts index 1d352702..93a4f259 100644 --- a/src/controllers/proformaInvoicesController.ts +++ b/src/controllers/proformaInvoicesController.ts @@ -13,6 +13,10 @@ import { CreateSubscriptionRequest, createSubscriptionRequestSchema, } from '../models/createSubscriptionRequest.js'; +import { + DeliverProformaInvoiceRequest, + deliverProformaInvoiceRequestSchema, +} from '../models/deliverProformaInvoiceRequest.js'; import { Direction, directionSchema } from '../models/direction.js'; import { ListProformaInvoicesResponse, @@ -171,7 +175,7 @@ export class ProformaInvoicesController extends BaseController { * Proforma invoices are only available on Relationship Invoicing sites. To create a proforma invoice, * the subscription must not be in a group, must not be prepaid, and must be in a live state. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @return Response from the API call */ async createProformaInvoice( @@ -198,7 +202,7 @@ export class ProformaInvoicesController extends BaseController { * breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, or `custom_fields`. To * include breakdowns, pass the specific field as a key in the query with a value set to `true`. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param startDate The beginning date range for the invoice's Due Date, in the YYYY- * MM-DD format. * @param endDate The ending date range for the invoice's Due Date, in the YYYY-MM- @@ -290,6 +294,44 @@ export class ProformaInvoicesController extends BaseController { return req.callAsJson(listProformaInvoicesResponseSchema, requestOptions); } + /** + * Allows for proforma invoices to be programmatically delivered via email. Supports email + * delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients. + * + * If `recipient_emails` is omitted, the system will fall back to the primary recipient derived from + * the invoice or + * subscription. At least one recipient must be present, either via the request body or via this + * default behavior, so an + * empty body may still succeed when defaults are available. + * + * @param proformaInvoiceUid The uid of the proforma invoice + * @param body + * @return Response from the API call + */ + async deliverProformaInvoice( + proformaInvoiceUid: string, + body?: DeliverProformaInvoiceRequest, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('POST'); + const mapped = req.prepareArgs({ + proformaInvoiceUid: [proformaInvoiceUid, string()], + body: [body, optional(deliverProformaInvoiceRequestSchema)], + }); + req.header('Content-Type', 'application/json'); + req.json(mapped.body); + req.appendTemplatePath`/proforma_invoices/${mapped.proformaInvoiceUid}/deliveries.json`; + req.throwOn(404, ApiError, true, "Not Found:'{$response.body}'"); + req.throwOn( + 422, + ErrorListResponseError, + true, + "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'." + ); + req.authenticate([{ basicAuth: true }]); + return req.callAsJson(proformaInvoiceSchema, requestOptions); + } + /** * This endpoint will void a proforma invoice that has the status "draft". * @@ -349,7 +391,7 @@ export class ProformaInvoicesController extends BaseController { * Alternatively, if you have some proforma invoices already, you may make a preview call to determine * whether any billing information for the subscription's upcoming renewal has changed. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @return Response from the API call */ async previewProformaInvoice( diff --git a/src/controllers/subscriptionComponentsController.ts b/src/controllers/subscriptionComponentsController.ts index 64f4f433..49758506 100644 --- a/src/controllers/subscriptionComponentsController.ts +++ b/src/controllers/subscriptionComponentsController.ts @@ -115,7 +115,7 @@ export class SubscriptionComponentsController extends BaseController { /** * This request will list information regarding a specific component owned by a subscription. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param componentId The Advanced Billing id of the component. Alternatively, the component's handle * prefixed by `handle:` * @return Response from the API call @@ -144,7 +144,7 @@ export class SubscriptionComponentsController extends BaseController { * When requesting to list components for a given subscription, if the subscription contains * **archived** components they will be listed in the server response. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param dateField The type of filter you'd like to apply to * your search. Use in query * `date_field=updated_at`. @@ -276,7 +276,7 @@ export class SubscriptionComponentsController extends BaseController { * 3. `"_default"` string, which will reset the price point to the component's current default price * point. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -312,7 +312,7 @@ export class SubscriptionComponentsController extends BaseController { * **Note**: this will update the price point for all of the subscription's components, even ones that * have not been allocated yet. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @return Response from the API call */ async bulkResetSubscriptionComponentsPricePoints( @@ -329,55 +329,18 @@ export class SubscriptionComponentsController extends BaseController { } /** - * This endpoint creates a new allocation, setting the current allocated quantity for the Component and - * recording a memo. + * Creates an allocation, sets the current allocated quantity for the component, and records a memo. + * Allocations can only be updated for Quantity, On/Off, and Prepaid Components. * - * **Notice**: Allocations can only be updated for Quantity, On/Off, and Prepaid Components. + * When creating an allocation via the API, you can pass the `upgrade_charge`, `downgrade_credit`, and + * `accrue_charge` to be applied. * - * ## Allocations Documentation - * - * Full documentation on how to record Allocations in the Advanced Billing UI can be located - * [here](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview). - * It is focused on how allocations operate within the Advanced Billing UI.It goes into greater detail - * on how the user interface will react when recording allocations. - * - * This documentation also goes into greater detail on how proration is taken into consideration when - * applying component allocations. - * - * ## Proration Schemes - * - * Changing the allocated quantity of a component mid-period can result in either a Charge or Credit - * being applied to the subscription. When creating an allocation via the API, you can pass the - * `upgrade_charge`, `downgrade_credit`, and `accrue_charge` to be applied. - * - * **Notice:** These proration and accural fields will be ignored for Prepaid Components since this + * > **Note:** These proration and accural fields are ignored for Prepaid Components since this * component type always generate charges immediately without proration. * - * For background information on prorated components and upgrade/downgrade schemes, see [Setting - * Component Allocations.](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component- - * Allocations-Proration). - * See the tables below for valid values. - * - * | upgrade_charge | Definition                                                        | - * |----------------|-------------------------------------------------------------------| - * | `full`         | A charge is added for the full price of the component.            | - * | `prorated`     | A charge is added for the prorated price of the component change. | - * | `none`         | No charge is added.                                               | - * - * | downgrade_credit | Definition                                        | - * |------------------|---------------------------------------------------| - * | `full`           | A full price credit is added for the amount owed. | - * | `prorated`       | A prorated credit is added for the amount owed.   | - * | `none`           | No charge is added.                               | - * - * | accrue_charge | Definition - *                       | - * |---------------|------------------------------------------------------------------------------------ - * ------------------------| - * | `true`        | Attempt to charge the customer at next renewal. - * | - * | `false`       | Attempt to charge the customer right away. If it fails, the charge will be accrued - * until the next renewal. | + * For information on prorated components and upgrade/downgrade schemes, see [Setting Component + * Allocations.](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations- + * Proration) * * ### Order of Resolution for upgrade_charge and downgrade_credit * @@ -394,10 +357,13 @@ export class SubscriptionComponentsController extends BaseController { * 2. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component- * Allocations-Proration#proration-schemes) * - * **NOTE: Proration uses the current price of the component as well as the current tax rates. Changes - * to either may cause the prorated charge/credit to be wrong.** + * > **Note:** Proration uses the current price of the component as well as the current tax rates. + * Changes to either may cause the prorated charge/credit to be wrong. + * + * For more informaiton see the [Component Allocations](https://maxio.zendesk.com/hc/en- + * us/articles/24251883961485-Component-Allocations-Overview) product Documentation. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param componentId The Advanced Billing id of the component * @param body * @return Response from the API call @@ -435,23 +401,7 @@ export class SubscriptionComponentsController extends BaseController { * When a subscription's on/off component has been toggled to on (`1`) or off (`0`), usage will be * logged in this response. * - * ## Querying data via Advanced Billing gem - * - * You can also query the current quantity via the [official Advanced Billing Gem.](http://github. - * com/chargify/chargify_api_ares) - * - * ```# First way - * component = Chargify::Subscription::Component.find(1, :params => {:subscription_id => 7}) - * puts component.allocated_quantity - * # => 23 - * - * # Second way - * component = Chargify::Subscription.find(7).component(1) - * puts component.allocated_quantity - * # => 23 - * ``` - * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param componentId The Advanced Billing id of the component * @param page Result records are organized in pages. By default, the first page of results is * displayed. The page parameter specifies a page number of results to fetch. You @@ -487,16 +437,34 @@ export class SubscriptionComponentsController extends BaseController { } /** - * Creates multiple allocations, setting the current allocated quantity for each of the components and - * recording a memo. The charges and/or credits that are created will be rolled up into a single total - * which is used to determine whether this is an upgrade or a downgrade. Be aware of the Order of - * Resolutions explained below in determining the proration scheme. + * Creates multiple allocations, sets the current allocated quantity for each of the components, and + * recording a memo. A `component_id` is required for each allocation. + * + * The charges and/or credits that are created will be rolled up into a single total which is used to + * determine whether this is an upgrade or a downgrade. + * + * ### Order of Resolution for upgrade_charge and downgrade_credit + * + * 1. Per allocation in API call (within a single allocation of the `allocations` array) + * 2. [Component-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251883961485- + * Component-Allocations-Overview) + * 3. Allocation API call top level (outside of the `allocations` array) + * 4. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component- + * Allocations-Proration#proration-schemes) + * + * ### Order of Resolution for accrue charge + * + * 1. Allocation API call top level (outside of the `allocations` array) + * 2. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component- + * Allocations-Proration#proration-schemes) * - * A `component_id` is required for each allocation. + * > **Note:** Proration uses the current price of the component as well as the current tax rates. + * Changes to either may cause the prorated charge/credit to be wrong. * - * This endpoint only responds to JSON. It is not available for XML. + * For more informaiton see the [Component Allocations](https://maxio.zendesk.com/hc/en- + * us/articles/24251883961485-Component-Allocations-Overview) product Documentation. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -538,7 +506,7 @@ export class SubscriptionComponentsController extends BaseController { * * See example below for Fine-Grained Component Control response. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -583,7 +551,7 @@ export class SubscriptionComponentsController extends BaseController { * - An expiration date can be changed towards the past (essentially expiring it) up to the * subscription's current period beginning date. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param componentId The Advanced Billing id of the component * @param allocationId The Advanced Billing id of the allocation * @param body @@ -635,7 +603,7 @@ export class SubscriptionComponentsController extends BaseController { * 3. `refund`: The allocation will be destroyed and the balances will be updated and a refund will be * issued along with a Credit Note. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param componentId The Advanced Billing id of the component * @param allocationId The Advanced Billing id of the allocation * @param body diff --git a/src/controllers/subscriptionGroupsController.ts b/src/controllers/subscriptionGroupsController.ts index bf03f371..00cfd5d9 100644 --- a/src/controllers/subscriptionGroupsController.ts +++ b/src/controllers/subscriptionGroupsController.ts @@ -250,8 +250,8 @@ export class SubscriptionGroupsController extends BaseController { } /** - * Use this endpoint to delete subscription group. - * Only groups without members can be deleted + * Deletes a subscription group. + * Only groups without members can be deleted. * * @param uid The uid of the subscription group * @return Response from the API call @@ -323,7 +323,7 @@ export class SubscriptionGroupsController extends BaseController { * docs/d571659cf0f24-create-subscription#subscription-in-a-subscription-group) * * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -350,7 +350,7 @@ export class SubscriptionGroupsController extends BaseController { * //maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays#customer- * hierarchies) features, it is possible to remove existing subscription from subscription group. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @return Response from the API call */ async removeSubscriptionFromGroup( diff --git a/src/controllers/subscriptionInvoiceAccountController.ts b/src/controllers/subscriptionInvoiceAccountController.ts index 04d73000..abe6f3f4 100644 --- a/src/controllers/subscriptionInvoiceAccountController.ts +++ b/src/controllers/subscriptionInvoiceAccountController.ts @@ -61,7 +61,7 @@ export class SubscriptionInvoiceAccountController extends BaseController { * Returns the `balance_in_cents` of the Subscription's Pending Discount, Service Credit, and * Prepayment accounts, as well as the sum of the Subscription's open, payable invoices. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @return Response from the API call */ async readAccountBalances( @@ -90,7 +90,7 @@ export class SubscriptionInvoiceAccountController extends BaseController { * Note that passing `amount_in_cents` is now allowed. * * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -120,7 +120,7 @@ export class SubscriptionInvoiceAccountController extends BaseController { /** * This request will list a subscription's prepayments. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param page Result records are organized in pages. By default, the * first page of results is displayed. The page parameter * specifies a page number of results to fetch. You can start @@ -170,7 +170,7 @@ export class SubscriptionInvoiceAccountController extends BaseController { * Credit will be added to the subscription in the amount specified in the request body. The credit is * subsequently applied to the next generated invoice. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -201,7 +201,7 @@ export class SubscriptionInvoiceAccountController extends BaseController { * Credit will be removed from the subscription in the amount specified in the request body. The credit * amount being deducted must be equal to or less than the current credit balance. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -231,7 +231,7 @@ export class SubscriptionInvoiceAccountController extends BaseController { /** * This request will list a subscription's service credits. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param page Result records are organized in pages. By default, the first page of * results is displayed. The page parameter specifies a page number of * results to fetch. You can start navigating through the pages to consume @@ -283,7 +283,7 @@ export class SubscriptionInvoiceAccountController extends BaseController { * The amount may be passed either as a decimal, with `amount`, or an integer in cents, with * `amount_in_cents`. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param prepaymentId id of prepayment * @param body * @return Response from the API call diff --git a/src/controllers/subscriptionNotesController.ts b/src/controllers/subscriptionNotesController.ts index 2b5922e6..2069fb86 100644 --- a/src/controllers/subscriptionNotesController.ts +++ b/src/controllers/subscriptionNotesController.ts @@ -30,7 +30,7 @@ export class SubscriptionNotesController extends BaseController { * Full documentation on how to use Notes in the Advanced Billing UI can be located [here](https: * //maxio.zendesk.com/hc/en-us/articles/24251712214413-Subscription-Summary-Overview). * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -61,7 +61,7 @@ export class SubscriptionNotesController extends BaseController { * Use this method to retrieve a list of Notes associated with a Subscription. The response will be an * array of Notes. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param page Result records are organized in pages. By default, the first page of results is * displayed. The page parameter specifies a page number of results to fetch. You * can start navigating through the pages to consume the results. You do this by @@ -111,7 +111,7 @@ export class SubscriptionNotesController extends BaseController { * Once you have obtained the ID of the note you wish to read, use this method to show a particular * note attached to a subscription. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param noteId The Advanced Billing id of the note * @return Response from the API call */ @@ -133,7 +133,7 @@ export class SubscriptionNotesController extends BaseController { /** * Use the following method to update a note for a Subscription. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param noteId The Advanced Billing id of the note * @param body * @return Response from the API call @@ -164,9 +164,9 @@ export class SubscriptionNotesController extends BaseController { } /** - * Use the following method to delete a note for a Subscription. + * Deletes a note for a Subscription. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param noteId The Advanced Billing id of the note * @return Response from the API call */ diff --git a/src/controllers/subscriptionProductsController.ts b/src/controllers/subscriptionProductsController.ts index 30327a2b..14459418 100644 --- a/src/controllers/subscriptionProductsController.ts +++ b/src/controllers/subscriptionProductsController.ts @@ -122,7 +122,7 @@ export class SubscriptionProductsController extends BaseController { * 8. Optionally, you can use the applied "msg" param in the `redirect_url` to determine whether it was * successful or not. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -158,7 +158,7 @@ export class SubscriptionProductsController extends BaseController { * This will calculate the prorated adjustment, charge, payment and credit applied values assuming the * migration is done at that date in the future as opposed to right now. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ diff --git a/src/controllers/subscriptionRenewalsController.ts b/src/controllers/subscriptionRenewalsController.ts new file mode 100644 index 00000000..544afba1 --- /dev/null +++ b/src/controllers/subscriptionRenewalsController.ts @@ -0,0 +1,368 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { ApiResponse, commaPrefix, RequestOptions } from '../core.js'; +import { + ScheduledRenewalConfigurationItemRequest, + scheduledRenewalConfigurationItemRequestSchema, +} from '../models/scheduledRenewalConfigurationItemRequest.js'; +import { + ScheduledRenewalConfigurationItemResponse, + scheduledRenewalConfigurationItemResponseSchema, +} from '../models/scheduledRenewalConfigurationItemResponse.js'; +import { + ScheduledRenewalConfigurationRequest, + scheduledRenewalConfigurationRequestSchema, +} from '../models/scheduledRenewalConfigurationRequest.js'; +import { + ScheduledRenewalConfigurationResponse, + scheduledRenewalConfigurationResponseSchema, +} from '../models/scheduledRenewalConfigurationResponse.js'; +import { + ScheduledRenewalConfigurationsResponse, + scheduledRenewalConfigurationsResponseSchema, +} from '../models/scheduledRenewalConfigurationsResponse.js'; +import { + ScheduledRenewalLockInRequest, + scheduledRenewalLockInRequestSchema, +} from '../models/scheduledRenewalLockInRequest.js'; +import { + ScheduledRenewalUpdateRequest, + scheduledRenewalUpdateRequestSchema, +} from '../models/scheduledRenewalUpdateRequest.js'; +import { Status, statusSchema } from '../models/status.js'; +import { number, optional } from '../schema.js'; +import { BaseController } from './baseController.js'; +import { ErrorListResponseError } from '../errors/errorListResponseError.js'; + +export class SubscriptionRenewalsController extends BaseController { + /** + * Creates a scheduled renewal configuration for a subscription. The scheduled renewal is based on the + * subscription’s current product and component setup. + * + * @param subscriptionId The Chargify id of the subscription. + * @param body + * @return Response from the API call + */ + async createScheduledRenewalConfiguration( + subscriptionId: number, + body?: ScheduledRenewalConfigurationRequest, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('POST'); + const mapped = req.prepareArgs({ + subscriptionId: [subscriptionId, number()], + body: [body, optional(scheduledRenewalConfigurationRequestSchema)], + }); + req.header('Content-Type', 'application/json'); + req.json(mapped.body); + req.appendTemplatePath`/subscriptions/${mapped.subscriptionId}/scheduled_renewals.json`; + req.throwOn(422, ErrorListResponseError, 'Unprocessable Entity (WebDAV)'); + req.authenticate([{ basicAuth: true }]); + return req.callAsJson( + scheduledRenewalConfigurationResponseSchema, + requestOptions + ); + } + + /** + * Lists scheduled renewal configurations for the subscription and permits an optional status query + * filter. + * + * @param subscriptionId The Chargify id of the subscription. + * @param status (Optional) Status filter for scheduled renewal configurations. + * @return Response from the API call + */ + async listScheduledRenewalConfigurations( + subscriptionId: number, + status?: Status, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('GET'); + const mapped = req.prepareArgs({ + subscriptionId: [subscriptionId, number()], + status: [status, optional(statusSchema)], + }); + req.query('status', mapped.status, commaPrefix); + req.appendTemplatePath`/subscriptions/${mapped.subscriptionId}/scheduled_renewals.json`; + req.authenticate([{ basicAuth: true }]); + return req.callAsJson( + scheduledRenewalConfigurationsResponseSchema, + requestOptions + ); + } + + /** + * Retrieves the configuration settings for the scheduled renewal. + * + * @param subscriptionId The Chargify id of the subscription. + * @param id The renewal id. + * @return Response from the API call + */ + async readScheduledRenewalConfiguration( + subscriptionId: number, + id: number, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('GET'); + const mapped = req.prepareArgs({ + subscriptionId: [subscriptionId, number()], + id: [id, number()], + }); + req.appendTemplatePath`/subscriptions/${mapped.subscriptionId}/scheduled_renewals/${mapped.id}.json`; + req.authenticate([{ basicAuth: true }]); + return req.callAsJson( + scheduledRenewalConfigurationResponseSchema, + requestOptions + ); + } + + /** + * Updates an existing configuration. + * + * @param subscriptionId The Chargify id of the subscription. + * @param id The renewal id. + * @param body + * @return Response from the API call + */ + async updateScheduledRenewalConfiguration( + subscriptionId: number, + id: number, + body?: ScheduledRenewalConfigurationRequest, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('PUT'); + const mapped = req.prepareArgs({ + subscriptionId: [subscriptionId, number()], + id: [id, number()], + body: [body, optional(scheduledRenewalConfigurationRequestSchema)], + }); + req.header('Content-Type', 'application/json'); + req.json(mapped.body); + req.appendTemplatePath`/subscriptions/${mapped.subscriptionId}/scheduled_renewals/${mapped.id}.json`; + req.throwOn(422, ErrorListResponseError, 'Unprocessable Entity (WebDAV)'); + req.authenticate([{ basicAuth: true }]); + return req.callAsJson( + scheduledRenewalConfigurationResponseSchema, + requestOptions + ); + } + + /** + * Schedules a future lock-in date for the renewal. + * + * @param subscriptionId The Chargify id of the subscription. + * @param id The renewal id. + * @param body + * @return Response from the API call + */ + async scheduleScheduledRenewalLockIn( + subscriptionId: number, + id: number, + body?: ScheduledRenewalLockInRequest, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('PUT'); + const mapped = req.prepareArgs({ + subscriptionId: [subscriptionId, number()], + id: [id, number()], + body: [body, optional(scheduledRenewalLockInRequestSchema)], + }); + req.header('Content-Type', 'application/json'); + req.json(mapped.body); + req.appendTemplatePath`/subscriptions/${mapped.subscriptionId}/scheduled_renewals/${mapped.id}/schedule_lock_in.json`; + req.throwOn(422, ErrorListResponseError, 'Unprocessable Entity (WebDAV)'); + req.authenticate([{ basicAuth: true }]); + return req.callAsJson( + scheduledRenewalConfigurationResponseSchema, + requestOptions + ); + } + + /** + * Locks in the renewal immediately. + * + * @param subscriptionId The Chargify id of the subscription. + * @param id The renewal id. + * @return Response from the API call + */ + async lockInScheduledRenewalImmediately( + subscriptionId: number, + id: number, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('PUT'); + const mapped = req.prepareArgs({ + subscriptionId: [subscriptionId, number()], + id: [id, number()], + }); + req.appendTemplatePath`/subscriptions/${mapped.subscriptionId}/scheduled_renewals/${mapped.id}/immediate_lock_in.json`; + req.throwOn(422, ErrorListResponseError, 'Unprocessable Entity (WebDAV)'); + req.authenticate([{ basicAuth: true }]); + return req.callAsJson( + scheduledRenewalConfigurationResponseSchema, + requestOptions + ); + } + + /** + * Returns a scheduled renewal configuration to an editable state. + * + * @param subscriptionId The Chargify id of the subscription. + * @param id The renewal id. + * @return Response from the API call + */ + async unpublishScheduledRenewalConfiguration( + subscriptionId: number, + id: number, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('PUT'); + const mapped = req.prepareArgs({ + subscriptionId: [subscriptionId, number()], + id: [id, number()], + }); + req.appendTemplatePath`/subscriptions/${mapped.subscriptionId}/scheduled_renewals/${mapped.id}/unpublish.json`; + req.throwOn(422, ErrorListResponseError, 'Unprocessable Entity (WebDAV)'); + req.authenticate([{ basicAuth: true }]); + return req.callAsJson( + scheduledRenewalConfigurationResponseSchema, + requestOptions + ); + } + + /** + * Cancels a scheduled renewal configuration. + * + * @param subscriptionId The Chargify id of the subscription. + * @param id The renewal id. + * @return Response from the API call + */ + async cancelScheduledRenewalConfiguration( + subscriptionId: number, + id: number, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('PUT'); + const mapped = req.prepareArgs({ + subscriptionId: [subscriptionId, number()], + id: [id, number()], + }); + req.appendTemplatePath`/subscriptions/${mapped.subscriptionId}/scheduled_renewals/${mapped.id}/cancel.json`; + req.throwOn(422, ErrorListResponseError, 'Unprocessable Entity (WebDAV)'); + req.authenticate([{ basicAuth: true }]); + return req.callAsJson( + scheduledRenewalConfigurationResponseSchema, + requestOptions + ); + } + + /** + * Adds product and component line items to the scheduled renewal. + * + * @param subscriptionId The Chargify id of + * the subscription. + * @param scheduledRenewalsConfigurationId The scheduled + * renewal + * configuration id. + * @param body + * @return Response from the API call + */ + async createScheduledRenewalConfigurationItem( + subscriptionId: number, + scheduledRenewalsConfigurationId: number, + body?: ScheduledRenewalConfigurationItemRequest, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('POST'); + const mapped = req.prepareArgs({ + subscriptionId: [subscriptionId, number()], + scheduledRenewalsConfigurationId: [ + scheduledRenewalsConfigurationId, + number(), + ], + body: [body, optional(scheduledRenewalConfigurationItemRequestSchema)], + }); + req.header('Content-Type', 'application/json'); + req.json(mapped.body); + req.appendTemplatePath`/subscriptions/${mapped.subscriptionId}/scheduled_renewals/${mapped.scheduledRenewalsConfigurationId}/configuration_items.json`; + req.throwOn(422, ErrorListResponseError, 'Unprocessable Entity (WebDAV)'); + req.authenticate([{ basicAuth: true }]); + return req.callAsJson( + scheduledRenewalConfigurationItemResponseSchema, + requestOptions + ); + } + + /** + * Updates an existing configuration item’s pricing and quantity. + * + * @param subscriptionId The Chargify id of the + * subscription. + * @param scheduledRenewalsConfigurationId The scheduled renewal + * configuration id. + * @param id The scheduled renewal + * configuration item id. + * @param body + * @return Response from the API call + */ + async updateScheduledRenewalConfigurationItem( + subscriptionId: number, + scheduledRenewalsConfigurationId: number, + id: number, + body?: ScheduledRenewalUpdateRequest, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('PUT'); + const mapped = req.prepareArgs({ + subscriptionId: [subscriptionId, number()], + scheduledRenewalsConfigurationId: [ + scheduledRenewalsConfigurationId, + number(), + ], + id: [id, number()], + body: [body, optional(scheduledRenewalUpdateRequestSchema)], + }); + req.header('Content-Type', 'application/json'); + req.json(mapped.body); + req.appendTemplatePath`/subscriptions/${mapped.subscriptionId}/scheduled_renewals/${mapped.scheduledRenewalsConfigurationId}/configuration_items/${mapped.id}.json`; + req.throwOn(422, ErrorListResponseError, 'Unprocessable Entity (WebDAV)'); + req.authenticate([{ basicAuth: true }]); + return req.callAsJson( + scheduledRenewalConfigurationItemResponseSchema, + requestOptions + ); + } + + /** + * Removes an item from the pending renewal configuration. + * + * @param subscriptionId The Chargify id of the subscription. + * @param scheduledRenewalsConfigurationId The scheduled renewal configuration id. + * @param id The scheduled renewal configuration item id. + * @return Response from the API call + */ + async deleteScheduledRenewalConfigurationItem( + subscriptionId: number, + scheduledRenewalsConfigurationId: number, + id: number, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('DELETE'); + const mapped = req.prepareArgs({ + subscriptionId: [subscriptionId, number()], + scheduledRenewalsConfigurationId: [ + scheduledRenewalsConfigurationId, + number(), + ], + id: [id, number()], + }); + req.appendTemplatePath`/subscriptions/${mapped.subscriptionId}/scheduled_renewals/${mapped.scheduledRenewalsConfigurationId}/configuration_items/${mapped.id}.json`; + req.throwOn(422, ErrorListResponseError, 'Unprocessable Entity (WebDAV)'); + req.authenticate([{ basicAuth: true }]); + return req.call(requestOptions); + } +} diff --git a/src/controllers/subscriptionStatusController.ts b/src/controllers/subscriptionStatusController.ts index 0af38416..2a827c63 100644 --- a/src/controllers/subscriptionStatusController.ts +++ b/src/controllers/subscriptionStatusController.ts @@ -52,7 +52,7 @@ export class SubscriptionStatusController extends BaseController { * * The response will be `422 "Unprocessable Entity`. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @return Response from the API call */ async retrySubscription( @@ -75,10 +75,11 @@ export class SubscriptionStatusController extends BaseController { } /** - * The DELETE action causes the cancellation of the Subscription. This means, the method sets the - * Subscription state to "canceled". + * Cancels the Subscription. The Delete method sets the Subscription state to `canceled`. + * To cancel the subscription immediately, omit any schedule parameters from the request. To use the + * schedule options, the Schedule Subscription Cancellation feature must be enabled on your site. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -111,10 +112,10 @@ export class SubscriptionStatusController extends BaseController { * subscription will return to active and will renew on that date. Otherwise, it will behave like a * reactivation, setting the billing date to 'now' and charging the subscriber. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param calendarBillingResumptionCharge (For calendar billing subscriptions only) The * way that the resumed subscription's charge should - * be handled + * be handled. * @return Response from the API call */ async resumeSubscription( @@ -153,7 +154,7 @@ export class SubscriptionStatusController extends BaseController { * * You may not place a subscription on hold if the `next_billing_at` date is within 24 hours. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -192,7 +193,7 @@ export class SubscriptionStatusController extends BaseController { * Alternately, you can change the `automatically_resume_at` to `null` if you would like the * subscription to not have a resume date. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -220,9 +221,9 @@ export class SubscriptionStatusController extends BaseController { } /** - * Advanced Billing offers the ability to reactivate a previously canceled subscription. For details on - * how the reactivation works, and how to reactivate subscriptions through the application, see - * [reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming). + * Reactivate a previously canceled subscription. For details on how the reactivation works, and how to + * reactivate subscriptions through the application, see [reactivation](https://maxio.zendesk.com/hc/en- + * us/articles/24252109503629-Reactivating-and-Resuming). * * **Note: The term "resume" is used also during another process in Advanced Billing. This occurs when * an on-hold subscription is "resumed". This returns the subscription to an active state.** @@ -252,6 +253,10 @@ export class SubscriptionStatusController extends BaseController { * date of July 1st, then Advanced Billing would not resume the subscription, and instead it would be * reactivated with a new billing period. * + * If a reactivation with `resume: false`, or where 'resume" is omited were attempted, then Advanced + * Billing would reactivate the subscription with a new billing period regardless of whether or not + * resuming the previous billing period were possible. + * * | Canceled | Reactivation | Resumable? | * |---|---|---| * | Jun 15 | June 28 | Yes | @@ -390,7 +395,7 @@ export class SubscriptionStatusController extends BaseController { * + The next billing date should not have changed * + Any product-related charges should have been collected * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -418,16 +423,11 @@ export class SubscriptionStatusController extends BaseController { } /** - * Advanced Billing offers the ability to cancel a subscription at the end of the current billing - * period. This period is set by its current product. - * - * Requesting to cancel the subscription at the end of the period sets the `cancel_at_end_of_period` - * flag to true. - * - * Note that you cannot set `cancel_at_end_of_period` at subscription creation, or if the subscription + * Cancels a subscription at the end of the current billing period based on the subscription's current + * product. You cannot set `cancel_at_end_of_period` at subscription creation, or if the subscription * is past due. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -463,7 +463,7 @@ export class SubscriptionStatusController extends BaseController { * This endpoint is idempotent. If the subscription was not set to cancel in the future, removing the * delayed cancellation has no effect and the call will be successful. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @return Response from the API call */ async cancelDelayedCancellation( @@ -484,7 +484,7 @@ export class SubscriptionStatusController extends BaseController { * If a subscription is currently in dunning, the subscription will be set to active and the active * Dunner will be resolved. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @return Response from the API call */ async cancelDunning( @@ -538,10 +538,10 @@ export class SubscriptionStatusController extends BaseController { * * ## Subscription Side Effects * - * You can request a `POST` to obtain this data from the endpoint without any side effects. Plain and - * simple, this will preview data, not log any changes against a subscription. + * You can request a `POST` to obtain this data from the endpoint without any side effects. This method + * allows you to preview data, but does not log any changes against a subscription. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ diff --git a/src/controllers/subscriptionsController.ts b/src/controllers/subscriptionsController.ts index cf0caaa2..34054afe 100644 --- a/src/controllers/subscriptionsController.ts +++ b/src/controllers/subscriptionsController.ts @@ -141,8 +141,8 @@ export class SubscriptionsController extends BaseController { } /** - * This method will return an array of subscriptions from a Site. Pay close attention to query string - * filters and pagination in order to control responses from the server. + * returns an array of subscriptions from a Site. Pay close attention to query string filters and + * pagination in order to control responses from the server. * * ## Search for a subscription * @@ -382,7 +382,7 @@ export class SubscriptionsController extends BaseController { * `snap_day`will will reset to 'null on the next billing cycle. This is because a product change is * instantanous and only affects the product associated with a subscription. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -410,14 +410,14 @@ export class SubscriptionsController extends BaseController { } /** - * Use this endpoint to find subscription details. + * Retrieves subscription details. * * ## Self-Service Page token * * Self-Service Page token for the subscription is not returned by default. If this information is * desired, the include[]=self_service_page_token parameter must be provided with the request. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param include Allows including additional data in the response. Use in query: * `include[]=coupons&include[]=self_service_page_token`. * @return Response from the API call @@ -473,7 +473,7 @@ export class SubscriptionsController extends BaseController { * If unpermitted parameters are sent, a 400 HTTP response is sent along with a string giving the * reason for the problem. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body Only these fields are available to be set. * @return Response from the API call */ @@ -534,7 +534,7 @@ export class SubscriptionsController extends BaseController { * * The query params will be: `?ack={customer_id}&cascade[]=customer&cascade[]=payment_profile` * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param ack id of the customer. * @param cascade Options are "customer" or "payment_profile". Use in query: * `cascade[]=customer&cascade[]=payment_profile`. @@ -568,7 +568,7 @@ export class SubscriptionsController extends BaseController { /** * Use this endpoint to update a subscription's prepaid configuration. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ @@ -666,7 +666,7 @@ export class SubscriptionsController extends BaseController { * the request body parameters as described below. When passing in request body parameters, the list of * coupon codes will simply be added to any existing list of codes on the subscription. * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param code A code for the coupon that would be applied to a subscription * @param body * @return Response from the API call @@ -704,7 +704,7 @@ export class SubscriptionsController extends BaseController { * documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and- * Subscriptions#removing-a-coupon) * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param couponCode The coupon code * @return Response from the API call */ @@ -787,7 +787,7 @@ export class SubscriptionsController extends BaseController { * the invoice back to the subscription. * * - * @param subscriptionId The Chargify id of the subscription + * @param subscriptionId The Chargify id of the subscription. * @param body * @return Response from the API call */ diff --git a/src/index.ts b/src/index.ts index 461e05f6..3387d2e6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -46,6 +46,7 @@ export * from './controllers/subscriptionGroupsController.js'; export * from './controllers/subscriptionInvoiceAccountController.js'; export * from './controllers/subscriptionNotesController.js'; export * from './controllers/subscriptionProductsController.js'; +export * from './controllers/subscriptionRenewalsController.js'; export * from './controllers/subscriptionStatusController.js'; export * from './controllers/subscriptionsController.js'; export * from './controllers/webhooksController.js'; @@ -106,6 +107,7 @@ export type { ApplyPaymentEventData } from './models/applyPaymentEventData.js'; export type { AttributeError } from './models/attributeError.js'; export { AutoInvite } from './models/autoInvite.js'; export type { AutoResume } from './models/autoResume.js'; +export type { AvailableActions } from './models/availableActions.js'; export type { BackportInvoiceEvent } from './models/backportInvoiceEvent.js'; export type { BankAccountAttributes } from './models/bankAccountAttributes.js'; export { BankAccountHolderType } from './models/bankAccountHolderType.js'; @@ -146,6 +148,8 @@ export type { ChangeInvoiceStatusEventData } from './models/changeInvoiceStatusE export { ChargebackStatus } from './models/chargebackStatus.js'; export type { ChargifyEBB } from './models/chargifyEBB.js'; export { CleanupScope } from './models/cleanupScope.js'; +export type { CloneComponentPricePoint } from './models/cloneComponentPricePoint.js'; +export type { CloneComponentPricePointRequest } from './models/cloneComponentPricePointRequest.js'; export { CollectionMethod } from './models/collectionMethod.js'; export type { Component } from './models/component.js'; export type { ComponentAllocationChange } from './models/componentAllocationChange.js'; @@ -159,6 +163,7 @@ export { ComponentKind } from './models/componentKind.js'; export type { ComponentPrice } from './models/componentPrice.js'; export type { ComponentPricePoint } from './models/componentPricePoint.js'; export type { ComponentPricePointAssignment } from './models/componentPricePointAssignment.js'; +export type { ComponentPricePointCurrencyOverageResponse } from './models/componentPricePointCurrencyOverageResponse.js'; export type { ComponentPricePointErrorItem } from './models/componentPricePointErrorItem.js'; export type { ComponentPricePointItem } from './models/componentPricePointItem.js'; export type { ComponentPricePointResponse } from './models/componentPricePointResponse.js'; @@ -166,6 +171,7 @@ export type { ComponentPricePointsResponse } from './models/componentPricePoints export type { ComponentResponse } from './models/componentResponse.js'; export { CompoundingStrategy } from './models/compoundingStrategy.js'; export type { ConsolidatedInvoice } from './models/consolidatedInvoice.js'; +export type { Contract } from './models/contract.js'; export type { CountResponse } from './models/countResponse.js'; export type { Coupon } from './models/coupon.js'; export type { CouponCurrency } from './models/couponCurrency.js'; @@ -255,6 +261,7 @@ export { CreditNoteStatus } from './models/creditNoteStatus.js'; export { CreditScheme } from './models/creditScheme.js'; export type { CreditSchemeRequest } from './models/creditSchemeRequest.js'; export { CreditType } from './models/creditType.js'; +export type { CurrencyOveragePrices } from './models/currencyOveragePrices.js'; export type { CurrencyPrice } from './models/currencyPrice.js'; export { CurrencyPriceRole } from './models/currencyPriceRole.js'; export type { CurrencyPricesResponse } from './models/currencyPricesResponse.js'; @@ -275,8 +282,10 @@ export type { DeductServiceCredit } from './models/deductServiceCredit.js'; export type { DeductServiceCreditRequest } from './models/deductServiceCreditRequest.js'; export type { DelayedCancellationResponse } from './models/delayedCancellationResponse.js'; export type { DeleteSubscriptionGroupResponse } from './models/deleteSubscriptionGroupResponse.js'; +export type { DeliverProformaInvoiceRequest } from './models/deliverProformaInvoiceRequest.js'; export { Direction } from './models/direction.js'; export { DiscountType } from './models/discountType.js'; +export { DowngradeCreditCreditType } from './models/downgradeCreditCreditType.js'; export type { DunnerData } from './models/dunnerData.js'; export type { DunningStepData } from './models/dunningStepData.js'; export type { DunningStepReached } from './models/dunningStepReached.js'; @@ -505,6 +514,7 @@ export type { RefundPrepayment } from './models/refundPrepayment.js'; export type { RefundPrepaymentBaseRefundError } from './models/refundPrepaymentBaseRefundError.js'; export type { RefundPrepaymentRequest } from './models/refundPrepaymentRequest.js'; export type { RefundSuccess } from './models/refundSuccess.js'; +export type { Register } from './models/register.js'; export type { RemovePaymentEvent } from './models/removePaymentEvent.js'; export type { RemovePaymentEventData } from './models/removePaymentEventData.js'; export type { RenewalPreview } from './models/renewalPreview.js'; @@ -524,9 +534,24 @@ export type { SaleRep } from './models/saleRep.js'; export type { SaleRepItemMrr } from './models/saleRepItemMrr.js'; export type { SaleRepSettings } from './models/saleRepSettings.js'; export type { SaleRepSubscription } from './models/saleRepSubscription.js'; +export type { ScheduledRenewalComponentCustomPrice } from './models/scheduledRenewalComponentCustomPrice.js'; +export type { ScheduledRenewalConfiguration } from './models/scheduledRenewalConfiguration.js'; +export type { ScheduledRenewalConfigurationItem } from './models/scheduledRenewalConfigurationItem.js'; +export type { ScheduledRenewalConfigurationItemRequest } from './models/scheduledRenewalConfigurationItemRequest.js'; +export type { ScheduledRenewalConfigurationItemResponse } from './models/scheduledRenewalConfigurationItemResponse.js'; +export type { ScheduledRenewalConfigurationRequest } from './models/scheduledRenewalConfigurationRequest.js'; +export type { ScheduledRenewalConfigurationRequestBody } from './models/scheduledRenewalConfigurationRequestBody.js'; +export type { ScheduledRenewalConfigurationResponse } from './models/scheduledRenewalConfigurationResponse.js'; +export type { ScheduledRenewalConfigurationsResponse } from './models/scheduledRenewalConfigurationsResponse.js'; +export type { ScheduledRenewalItemRequestBodyComponent } from './models/scheduledRenewalItemRequestBodyComponent.js'; +export type { ScheduledRenewalItemRequestBodyProduct } from './models/scheduledRenewalItemRequestBodyProduct.js'; +export type { ScheduledRenewalLockInRequest } from './models/scheduledRenewalLockInRequest.js'; +export type { ScheduledRenewalProductPricePoint } from './models/scheduledRenewalProductPricePoint.js'; +export type { ScheduledRenewalUpdateRequest } from './models/scheduledRenewalUpdateRequest.js'; export type { Segment } from './models/segment.js'; export type { SegmentPrice } from './models/segmentPrice.js'; export type { SegmentResponse } from './models/segmentResponse.js'; +export type { SendEmail } from './models/sendEmail.js'; export type { SendInvoiceRequest } from './models/sendInvoiceRequest.js'; export type { ServiceCredit } from './models/serviceCredit.js'; export type { ServiceCredit1 } from './models/serviceCredit1.js'; @@ -538,8 +563,8 @@ export type { Site } from './models/site.js'; export type { SiteResponse } from './models/siteResponse.js'; export type { SiteStatistics } from './models/siteStatistics.js'; export type { SiteSummary } from './models/siteSummary.js'; -export { SnapDay } from './models/snapDay.js'; export { SortingDirection } from './models/sortingDirection.js'; +export { Status } from './models/status.js'; export type { Subscription } from './models/subscription.js'; export type { SubscriptionComponent } from './models/subscriptionComponent.js'; export type { SubscriptionComponentAllocationErrorItem } from './models/subscriptionComponentAllocationErrorItem.js'; @@ -634,6 +659,7 @@ export type { UpdateSubscriptionGroupRequest } from './models/updateSubscription export type { UpdateSubscriptionNote } from './models/updateSubscriptionNote.js'; export type { UpdateSubscriptionNoteRequest } from './models/updateSubscriptionNoteRequest.js'; export type { UpdateSubscriptionRequest } from './models/updateSubscriptionRequest.js'; +export { UpgradeChargeCreditType } from './models/upgradeChargeCreditType.js'; export type { UpsertPrepaidConfiguration } from './models/upsertPrepaidConfiguration.js'; export type { UpsertPrepaidConfigurationRequest } from './models/upsertPrepaidConfigurationRequest.js'; export type { Usage } from './models/usage.js'; @@ -658,6 +684,8 @@ export * from './models/containers/archiveComponentPricePointPricePointId.js'; export * from './models/containers/archiveProductPricePointPricePointId.js'; export * from './models/containers/archiveProductPricePointProductId.js'; export * from './models/containers/calendarBillingSnapDay.js'; +export * from './models/containers/cloneComponentPricePointComponentId.js'; +export * from './models/containers/cloneComponentPricePointPricePointId.js'; export * from './models/containers/componentAllocationChangeAllocatedQuantity.js'; export * from './models/containers/componentPricePointAssignmentPricePoint.js'; export * from './models/containers/couponPayloadPercentage.js'; @@ -721,6 +749,10 @@ export * from './models/containers/refundInvoiceRequestRefund.js'; export * from './models/containers/refundPrepaymentAmount.js'; export * from './models/containers/renewalPreviewComponentComponentId.js'; export * from './models/containers/renewalPreviewComponentPricePointId.js'; +export * from './models/containers/scheduledRenewalConfigurationItemRequestRenewalConfigurationItem.js'; +export * from './models/containers/scheduledRenewalProductPricePointInterval.js'; +export * from './models/containers/scheduledRenewalProductPricePointPriceInCents.js'; +export * from './models/containers/scheduledRenewalUpdateRequestRenewalConfigurationItem.js'; export * from './models/containers/segmentSegmentProperty1Value.js'; export * from './models/containers/segmentSegmentProperty2Value.js'; export * from './models/containers/segmentSegmentProperty3Value.js'; @@ -740,7 +772,6 @@ export * from './models/containers/subscriptionGroupSignupComponentAllocatedQuan export * from './models/containers/subscriptionGroupSignupComponentComponentId.js'; export * from './models/containers/subscriptionGroupSignupComponentPricePointId.js'; export * from './models/containers/subscriptionGroupSignupComponentUnitBalance.js'; -export * from './models/containers/subscriptionSnapDay.js'; export * from './models/containers/updateComponentPricePointComponentId.js'; export * from './models/containers/updateComponentPricePointPricePointId.js'; export * from './models/containers/updateMetafieldsRequestMetafields.js'; diff --git a/src/models/allocateComponents.ts b/src/models/allocateComponents.ts index 79d0d2cd..2d606723 100644 --- a/src/models/allocateComponents.ts +++ b/src/models/allocateComponents.ts @@ -29,15 +29,9 @@ export interface AllocateComponents { prorationDowngradeScheme?: string; allocations?: CreateAllocation[]; accrueCharge?: boolean; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ upgradeCharge?: CreditType | null; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ downgradeCredit?: CreditType | null; /** (Optional) If not passed, the allocation(s) will use the payment collection method on the subscription */ paymentCollectionMethod?: CollectionMethod; diff --git a/src/models/allocation.ts b/src/models/allocation.ts index 3f8ce13f..261ce0ab 100644 --- a/src/models/allocation.ts +++ b/src/models/allocation.ts @@ -68,15 +68,9 @@ export interface Allocation { * Otherwise, leave the charges on the subscription to pay for at renewal. */ initiateDunning?: boolean; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ upgradeCharge?: CreditType | null; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ downgradeCredit?: CreditType | null; payment?: PaymentForAllocation | null; expiresAt?: string; diff --git a/src/models/allocationPreviewItem.ts b/src/models/allocationPreviewItem.ts index 4ffb44b0..5e59f991 100644 --- a/src/models/allocationPreviewItem.ts +++ b/src/models/allocationPreviewItem.ts @@ -35,15 +35,9 @@ export interface AllocationPreviewItem { prorationUpgradeScheme?: string; prorationDowngradeScheme?: string; accrueCharge?: boolean; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ upgradeCharge?: CreditType | null; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ downgradeCredit?: CreditType | null; pricePointId?: number; /** The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. */ diff --git a/src/models/allocationSettings.ts b/src/models/allocationSettings.ts index 9833df87..856386a5 100644 --- a/src/models/allocationSettings.ts +++ b/src/models/allocationSettings.ts @@ -14,15 +14,9 @@ import { import { CreditType, creditTypeSchema } from './creditType.js'; export interface AllocationSettings { - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ upgradeCharge?: CreditType | null; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ downgradeCredit?: CreditType | null; /** Either "true" or "false". */ accrueCharge?: string; diff --git a/src/models/availableActions.ts b/src/models/availableActions.ts new file mode 100644 index 00000000..4d49cbd1 --- /dev/null +++ b/src/models/availableActions.ts @@ -0,0 +1,17 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { expandoObject, lazy, optional, Schema } from '../schema.js'; +import { SendEmail, sendEmailSchema } from './sendEmail.js'; + +export interface AvailableActions { + sendEmail?: SendEmail; + [key: string]: unknown; +} + +export const availableActionsSchema: Schema = lazy(() => + expandoObject({ sendEmail: ['send_email', optional(sendEmailSchema)] }) +); diff --git a/src/models/calendarBilling.ts b/src/models/calendarBilling.ts index f3a6d8f6..731d9058 100644 --- a/src/models/calendarBilling.ts +++ b/src/models/calendarBilling.ts @@ -4,7 +4,7 @@ * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). */ -import { expandoObject, lazy, nullable, optional, Schema } from '../schema.js'; +import { expandoObject, lazy, optional, Schema } from '../schema.js'; import { CalendarBillingSnapDay, calendarBillingSnapDaySchema, @@ -14,14 +14,14 @@ import { FirstChargeType, firstChargeTypeSchema } from './firstChargeType.js'; /** (Optional). Cannot be used when also specifying next_billing_at */ export interface CalendarBilling { /** A day of month that subscription will be processed on. Can be 1 up to 28 or 'end'. */ - snapDay?: CalendarBillingSnapDay | null; + snapDay?: CalendarBillingSnapDay; calendarBillingFirstCharge?: FirstChargeType; [key: string]: unknown; } export const calendarBillingSchema: Schema = lazy(() => expandoObject({ - snapDay: ['snap_day', optional(nullable(calendarBillingSnapDaySchema))], + snapDay: ['snap_day', optional(calendarBillingSnapDaySchema)], calendarBillingFirstCharge: [ 'calendar_billing_first_charge', optional(firstChargeTypeSchema), diff --git a/src/models/cancellationOptions.ts b/src/models/cancellationOptions.ts index 588a0680..c13944c0 100644 --- a/src/models/cancellationOptions.ts +++ b/src/models/cancellationOptions.ts @@ -4,13 +4,26 @@ * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). */ -import { expandoObject, optional, Schema, string } from '../schema.js'; +import { + boolean, + expandoObject, + nullable, + optional, + Schema, + string, +} from '../schema.js'; export interface CancellationOptions { - /** For your internal use. An indication as to why the subscription is being canceled. */ + /** An indication as to why the subscription is being canceled. For your internal use. */ cancellationMessage?: string; - /** The reason code associated with the cancellation. See the list of reason codes associated with your site. */ + /** The reason code associated with the cancellation. Use the [List Reason Codes]($e/Reason%20Codes/listReasonCodes) endpoint to retrieve the reason codes associated with your site. */ reasonCode?: string; + /** When true, the subscription is cancelled at the current period end instead of immediately. To use this option, the Schedule Subscription Cancellation feature must be enabled on your site. */ + cancelAtEndOfPeriod?: boolean; + /** Schedules the cancellation on the provided date. This is option is not applicable for prepaid subscriptions. To use this option, the Schedule Subscription Cancellation feature must be enabled on your site. */ + scheduledCancellationAt?: string | null; + /** Applies to prepaid subscriptions. When true, which is the default, the remaining prepaid balance is refunded as part of cancellation processing. When false, prepaid balance is not refunded as part of cancellation processing. To use this option, the Schedule Subscription Cancellation feature must be enabled on your site. */ + refundPrepaymentAccountBalance?: boolean; [key: string]: unknown; } @@ -18,5 +31,14 @@ export const cancellationOptionsSchema: Schema = expandoObj { cancellationMessage: ['cancellation_message', optional(string())], reasonCode: ['reason_code', optional(string())], + cancelAtEndOfPeriod: ['cancel_at_end_of_period', optional(boolean())], + scheduledCancellationAt: [ + 'scheduled_cancellation_at', + optional(nullable(string())), + ], + refundPrepaymentAccountBalance: [ + 'refund_prepayment_account_balance', + optional(boolean()), + ], } ); diff --git a/src/models/cloneComponentPricePoint.ts b/src/models/cloneComponentPricePoint.ts new file mode 100644 index 00000000..fb296192 --- /dev/null +++ b/src/models/cloneComponentPricePoint.ts @@ -0,0 +1,17 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { expandoObject, optional, Schema, string } from '../schema.js'; + +export interface CloneComponentPricePoint { + name: string; + handle?: string; + [key: string]: unknown; +} + +export const cloneComponentPricePointSchema: Schema = expandoObject( + { name: ['name', string()], handle: ['handle', optional(string())] } +); diff --git a/src/models/cloneComponentPricePointRequest.ts b/src/models/cloneComponentPricePointRequest.ts new file mode 100644 index 00000000..0af7bef4 --- /dev/null +++ b/src/models/cloneComponentPricePointRequest.ts @@ -0,0 +1,23 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { expandoObject, lazy, Schema } from '../schema.js'; +import { + CloneComponentPricePoint, + cloneComponentPricePointSchema, +} from './cloneComponentPricePoint.js'; + +export interface CloneComponentPricePointRequest { + pricePoint: CloneComponentPricePoint; + [key: string]: unknown; +} + +export const cloneComponentPricePointRequestSchema: Schema = lazy( + () => + expandoObject({ + pricePoint: ['price_point', cloneComponentPricePointSchema], + }) +); diff --git a/src/models/component.ts b/src/models/component.ts index 73fccc47..a24e20d8 100644 --- a/src/models/component.ts +++ b/src/models/component.ts @@ -64,15 +64,9 @@ export interface Component { /** A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. */ taxCode?: string | null; recurring?: boolean; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ upgradeCharge?: CreditType | null; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ downgradeCredit?: CreditType | null; /** Timestamp indicating when this component was created */ createdAt?: string; diff --git a/src/models/componentCustomPrice.ts b/src/models/componentCustomPrice.ts index 0cd390f2..b937c54c 100644 --- a/src/models/componentCustomPrice.ts +++ b/src/models/componentCustomPrice.ts @@ -32,7 +32,14 @@ export interface ComponentCustomPrice { interval?: number; /** A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. */ intervalUnit?: IntervalUnit | null; - /** On/off components only need one price bracket starting at 1 */ + /** + * Optional id of the price point to use for list price calculations when + * overriding the customer price. + */ + listPricePointId?: number | null; + /** When true, list price calculations will continue to use the default price point even when a `custom_price` is supplied. */ + useDefaultListPrice?: boolean; + /** On/off components only need one price bracket starting at 1. */ prices: Price[]; /** Applicable only to prepaid usage components. Controls whether the allocated quantity renews each period. */ renewPrepaidAllocation?: boolean; @@ -52,6 +59,8 @@ export const componentCustomPriceSchema: Schema = lazy( pricingScheme: ['pricing_scheme', optional(pricingSchemeSchema)], interval: ['interval', optional(number())], intervalUnit: ['interval_unit', optional(nullable(intervalUnitSchema))], + listPricePointId: ['list_price_point_id', optional(nullable(number()))], + useDefaultListPrice: ['use_default_list_price', optional(boolean())], prices: ['prices', array(priceSchema)], renewPrepaidAllocation: ['renew_prepaid_allocation', optional(boolean())], rolloverPrepaidRemainder: [ diff --git a/src/models/componentPricePoint.ts b/src/models/componentPricePoint.ts index c4053872..6b86a276 100644 --- a/src/models/componentPricePoint.ts +++ b/src/models/componentPricePoint.ts @@ -57,7 +57,7 @@ export interface ComponentPricePoint { interval?: number | null; /** A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. */ intervalUnit?: IntervalUnit | null; - /** An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. */ + /** An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. The clone endpoint always returns currency prices if they are present. */ currencyPrices?: ComponentCurrencyPrice[]; /** Applicable only to prepaid usage components. An array of overage price brackets. */ overagePrices?: ComponentPrice[]; diff --git a/src/models/componentPricePointCurrencyOverageResponse.ts b/src/models/componentPricePointCurrencyOverageResponse.ts new file mode 100644 index 00000000..5708334d --- /dev/null +++ b/src/models/componentPricePointCurrencyOverageResponse.ts @@ -0,0 +1,22 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { expandoObject, lazy, Schema } from '../schema.js'; +import { + CurrencyOveragePrices, + currencyOveragePricesSchema, +} from './currencyOveragePrices.js'; + +export interface ComponentPricePointCurrencyOverageResponse { + /** Extends a component price point with currency overage prices. */ + pricePoint: CurrencyOveragePrices; + [key: string]: unknown; +} + +export const componentPricePointCurrencyOverageResponseSchema: Schema = lazy( + () => + expandoObject({ pricePoint: ['price_point', currencyOveragePricesSchema] }) +); diff --git a/src/models/containers/calendarBillingSnapDay.ts b/src/models/containers/calendarBillingSnapDay.ts index 783bd0ad..04f4f203 100644 --- a/src/models/containers/calendarBillingSnapDay.ts +++ b/src/models/containers/calendarBillingSnapDay.ts @@ -4,19 +4,13 @@ * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). */ -import { - isMappedValueValidForSchema, - number, - oneOf, - Schema, -} from '../../schema.js'; -import { SnapDay, snapDaySchema } from '../snapDay.js'; +import { number, oneOf, Schema, string } from '../../schema.js'; /** This is a container type for one-of types. */ -export type CalendarBillingSnapDay = number | SnapDay; +export type CalendarBillingSnapDay = number | string; export const calendarBillingSnapDaySchema: Schema = oneOf( - [number(), snapDaySchema] + [number(), string()] ); export namespace CalendarBillingSnapDay { @@ -30,11 +24,11 @@ export namespace CalendarBillingSnapDay { } /** - * Validation method to narrow down union type to SnapDay type case. + * Validation method to narrow down union type to string type case. * - * This is SnapDay case. + * This is String case. */ - export function isSnapDay(value: unknown): value is SnapDay { - return isMappedValueValidForSchema(value, snapDaySchema); + export function isString(value: unknown): value is string { + return typeof value === 'string'; } } diff --git a/src/models/containers/cloneComponentPricePointComponentId.ts b/src/models/containers/cloneComponentPricePointComponentId.ts new file mode 100644 index 00000000..88da3e71 --- /dev/null +++ b/src/models/containers/cloneComponentPricePointComponentId.ts @@ -0,0 +1,34 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { number, oneOf, Schema, string } from '../../schema.js'; + +/** This is a container type for one-of types. */ +export type CloneComponentPricePointComponentId = number | string; + +export const cloneComponentPricePointComponentIdSchema: Schema = oneOf( + [number(), string()] +); + +export namespace CloneComponentPricePointComponentId { + /** + * Validation method to narrow down union type to number type case. + * + * This is Number case. + */ + export function isNumber(value: unknown): value is number { + return typeof value === 'number'; + } + + /** + * Validation method to narrow down union type to string type case. + * + * This is String case. + */ + export function isString(value: unknown): value is string { + return typeof value === 'string'; + } +} diff --git a/src/models/containers/cloneComponentPricePointPricePointId.ts b/src/models/containers/cloneComponentPricePointPricePointId.ts new file mode 100644 index 00000000..579ddc51 --- /dev/null +++ b/src/models/containers/cloneComponentPricePointPricePointId.ts @@ -0,0 +1,34 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { number, oneOf, Schema, string } from '../../schema.js'; + +/** This is a container type for one-of types. */ +export type CloneComponentPricePointPricePointId = number | string; + +export const cloneComponentPricePointPricePointIdSchema: Schema = oneOf( + [number(), string()] +); + +export namespace CloneComponentPricePointPricePointId { + /** + * Validation method to narrow down union type to number type case. + * + * This is Number case. + */ + export function isNumber(value: unknown): value is number { + return typeof value === 'number'; + } + + /** + * Validation method to narrow down union type to string type case. + * + * This is String case. + */ + export function isString(value: unknown): value is string { + return typeof value === 'string'; + } +} diff --git a/src/models/containers/scheduledRenewalConfigurationItemRequestRenewalConfigurationItem.ts b/src/models/containers/scheduledRenewalConfigurationItemRequestRenewalConfigurationItem.ts new file mode 100644 index 00000000..ef35ae87 --- /dev/null +++ b/src/models/containers/scheduledRenewalConfigurationItemRequestRenewalConfigurationItem.ts @@ -0,0 +1,63 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { + isMappedValueValidForSchema, + lazy, + oneOf, + Schema, +} from '../../schema.js'; +import { + ScheduledRenewalItemRequestBodyComponent, + scheduledRenewalItemRequestBodyComponentSchema, +} from '../scheduledRenewalItemRequestBodyComponent.js'; +import { + ScheduledRenewalItemRequestBodyProduct, + scheduledRenewalItemRequestBodyProductSchema, +} from '../scheduledRenewalItemRequestBodyProduct.js'; + +/** This is a container type for one-of types. */ +export type ScheduledRenewalConfigurationItemRequestRenewalConfigurationItem = + | ScheduledRenewalItemRequestBodyComponent + | ScheduledRenewalItemRequestBodyProduct; + +export const scheduledRenewalConfigurationItemRequestRenewalConfigurationItemSchema: Schema = lazy( + () => + oneOf([ + scheduledRenewalItemRequestBodyComponentSchema, + scheduledRenewalItemRequestBodyProductSchema, + ]) +); + +export namespace ScheduledRenewalConfigurationItemRequestRenewalConfigurationItem { + /** + * Validation method to narrow down union type to ScheduledRenewalItemRequestBodyComponent type case. + * + * This is Scheduled Renewal Item Request Body Component case. + */ + export function isScheduledRenewalItemRequestBodyComponent( + value: unknown + ): value is ScheduledRenewalItemRequestBodyComponent { + return isMappedValueValidForSchema( + value, + scheduledRenewalItemRequestBodyComponentSchema + ); + } + + /** + * Validation method to narrow down union type to ScheduledRenewalItemRequestBodyProduct type case. + * + * This is Scheduled Renewal Item Request Body Product case. + */ + export function isScheduledRenewalItemRequestBodyProduct( + value: unknown + ): value is ScheduledRenewalItemRequestBodyProduct { + return isMappedValueValidForSchema( + value, + scheduledRenewalItemRequestBodyProductSchema + ); + } +} diff --git a/src/models/containers/scheduledRenewalProductPricePointInterval.ts b/src/models/containers/scheduledRenewalProductPricePointInterval.ts new file mode 100644 index 00000000..dc566d0f --- /dev/null +++ b/src/models/containers/scheduledRenewalProductPricePointInterval.ts @@ -0,0 +1,34 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { number, oneOf, Schema, string } from '../../schema.js'; + +/** This is a container type for one-of types. */ +export type ScheduledRenewalProductPricePointInterval = string | number; + +export const scheduledRenewalProductPricePointIntervalSchema: Schema = oneOf( + [string(), number()] +); + +export namespace ScheduledRenewalProductPricePointInterval { + /** + * Validation method to narrow down union type to string type case. + * + * This is String case. + */ + export function isString(value: unknown): value is string { + return typeof value === 'string'; + } + + /** + * Validation method to narrow down union type to number type case. + * + * This is Number case. + */ + export function isNumber(value: unknown): value is number { + return typeof value === 'number'; + } +} diff --git a/src/models/containers/scheduledRenewalProductPricePointPriceInCents.ts b/src/models/containers/scheduledRenewalProductPricePointPriceInCents.ts new file mode 100644 index 00000000..ef5d7b53 --- /dev/null +++ b/src/models/containers/scheduledRenewalProductPricePointPriceInCents.ts @@ -0,0 +1,34 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { bigint, oneOf, Schema, string } from '../../schema.js'; + +/** This is a container type for one-of types. */ +export type ScheduledRenewalProductPricePointPriceInCents = string | bigint; + +export const scheduledRenewalProductPricePointPriceInCentsSchema: Schema = oneOf( + [string(), bigint()] +); + +export namespace ScheduledRenewalProductPricePointPriceInCents { + /** + * Validation method to narrow down union type to string type case. + * + * This is String case. + */ + export function isString(value: unknown): value is string { + return typeof value === 'string'; + } + + /** + * Validation method to narrow down union type to bigint type case. + * + * This is Long case. + */ + export function isBigint(value: unknown): value is bigint { + return typeof value === 'bigint'; + } +} diff --git a/src/models/containers/scheduledRenewalUpdateRequestRenewalConfigurationItem.ts b/src/models/containers/scheduledRenewalUpdateRequestRenewalConfigurationItem.ts new file mode 100644 index 00000000..d5d4362c --- /dev/null +++ b/src/models/containers/scheduledRenewalUpdateRequestRenewalConfigurationItem.ts @@ -0,0 +1,63 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { + isMappedValueValidForSchema, + lazy, + oneOf, + Schema, +} from '../../schema.js'; +import { + ScheduledRenewalItemRequestBodyComponent, + scheduledRenewalItemRequestBodyComponentSchema, +} from '../scheduledRenewalItemRequestBodyComponent.js'; +import { + ScheduledRenewalItemRequestBodyProduct, + scheduledRenewalItemRequestBodyProductSchema, +} from '../scheduledRenewalItemRequestBodyProduct.js'; + +/** This is a container type for one-of types. */ +export type ScheduledRenewalUpdateRequestRenewalConfigurationItem = + | ScheduledRenewalItemRequestBodyComponent + | ScheduledRenewalItemRequestBodyProduct; + +export const scheduledRenewalUpdateRequestRenewalConfigurationItemSchema: Schema = lazy( + () => + oneOf([ + scheduledRenewalItemRequestBodyComponentSchema, + scheduledRenewalItemRequestBodyProductSchema, + ]) +); + +export namespace ScheduledRenewalUpdateRequestRenewalConfigurationItem { + /** + * Validation method to narrow down union type to ScheduledRenewalItemRequestBodyComponent type case. + * + * This is Scheduled Renewal Item Request Body Component case. + */ + export function isScheduledRenewalItemRequestBodyComponent( + value: unknown + ): value is ScheduledRenewalItemRequestBodyComponent { + return isMappedValueValidForSchema( + value, + scheduledRenewalItemRequestBodyComponentSchema + ); + } + + /** + * Validation method to narrow down union type to ScheduledRenewalItemRequestBodyProduct type case. + * + * This is Scheduled Renewal Item Request Body Product case. + */ + export function isScheduledRenewalItemRequestBodyProduct( + value: unknown + ): value is ScheduledRenewalItemRequestBodyProduct { + return isMappedValueValidForSchema( + value, + scheduledRenewalItemRequestBodyProductSchema + ); + } +} diff --git a/src/models/containers/subscriptionSnapDay.ts b/src/models/containers/subscriptionSnapDay.ts deleted file mode 100644 index 2404b221..00000000 --- a/src/models/containers/subscriptionSnapDay.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * AdvancedBilling - * - * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -import { - isMappedValueValidForSchema, - number, - oneOf, - Schema, -} from '../../schema.js'; -import { SnapDay, snapDaySchema } from '../snapDay.js'; - -/** This is a container type for one-of types. */ -export type SubscriptionSnapDay = number | SnapDay; - -export const subscriptionSnapDaySchema: Schema = oneOf([ - number(), - snapDaySchema, -]); - -export namespace SubscriptionSnapDay { - /** - * Validation method to narrow down union type to number type case. - * - * This is Number case. - */ - export function isNumber(value: unknown): value is number { - return typeof value === 'number'; - } - - /** - * Validation method to narrow down union type to SnapDay type case. - * - * This is SnapDay case. - */ - export function isSnapDay(value: unknown): value is SnapDay { - return isMappedValueValidForSchema(value, snapDaySchema); - } -} diff --git a/src/models/containers/updateSubscriptionSnapDay.ts b/src/models/containers/updateSubscriptionSnapDay.ts index 2d7aa7bb..9b519606 100644 --- a/src/models/containers/updateSubscriptionSnapDay.ts +++ b/src/models/containers/updateSubscriptionSnapDay.ts @@ -4,37 +4,31 @@ * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). */ -import { - isMappedValueValidForSchema, - number, - oneOf, - Schema, -} from '../../schema.js'; -import { SnapDay, snapDaySchema } from '../snapDay.js'; +import { number, oneOf, Schema, string } from '../../schema.js'; /** This is a container type for one-of types. */ -export type UpdateSubscriptionSnapDay = number | SnapDay; +export type UpdateSubscriptionSnapDay = string | number; export const updateSubscriptionSnapDaySchema: Schema = oneOf( - [number(), snapDaySchema] + [string(), number()] ); export namespace UpdateSubscriptionSnapDay { /** - * Validation method to narrow down union type to number type case. + * Validation method to narrow down union type to string type case. * - * This is Number case. + * This is String case. */ - export function isNumber(value: unknown): value is number { - return typeof value === 'number'; + export function isString(value: unknown): value is string { + return typeof value === 'string'; } /** - * Validation method to narrow down union type to SnapDay type case. + * Validation method to narrow down union type to number type case. * - * This is SnapDay case. + * This is Number case. */ - export function isSnapDay(value: unknown): value is SnapDay { - return isMappedValueValidForSchema(value, snapDaySchema); + export function isNumber(value: unknown): value is number { + return typeof value === 'number'; } } diff --git a/src/models/contract.ts b/src/models/contract.ts new file mode 100644 index 00000000..19ab5c38 --- /dev/null +++ b/src/models/contract.ts @@ -0,0 +1,34 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { + expandoObject, + lazy, + nullable, + number, + optional, + Schema, + string, +} from '../schema.js'; +import { Register, registerSchema } from './register.js'; + +/** Contract linked to the scheduled renewal configuration. */ +export interface Contract { + id?: number; + maxioId?: string; + number?: string | null; + register?: Register; + [key: string]: unknown; +} + +export const contractSchema: Schema = lazy(() => + expandoObject({ + id: ['id', optional(number())], + maxioId: ['maxio_id', optional(string())], + number: ['number', optional(nullable(string()))], + register: ['register', optional(registerSchema)], + }) +); diff --git a/src/models/createAllocation.ts b/src/models/createAllocation.ts index 4e47a0fa..0afb9d8a 100644 --- a/src/models/createAllocation.ts +++ b/src/models/createAllocation.ts @@ -15,35 +15,71 @@ import { string, } from '../schema.js'; import { BillingSchedule, billingScheduleSchema } from './billingSchedule.js'; +import { + ComponentCustomPrice, + componentCustomPriceSchema, +} from './componentCustomPrice.js'; import { CreateAllocationPricePointId, createAllocationPricePointIdSchema, } from './containers/createAllocationPricePointId.js'; -import { CreditType, creditTypeSchema } from './creditType.js'; +import { + DowngradeCreditCreditType, + downgradeCreditCreditTypeSchema, +} from './downgradeCreditCreditType.js'; +import { + UpgradeChargeCreditType, + upgradeChargeCreditTypeSchema, +} from './upgradeChargeCreditType.js'; export interface CreateAllocation { /** The allocated quantity to which to set the line-items allocated quantity. By default, this is an integer. If decimal allocations are enabled for the component, it will be a decimal number. For On/Off components, use 1for on and 0 for off. */ quantity: number; - /** (required for the multiple allocations endpoint) The id associated with the component for which the allocation is being made */ + /** + * Decimal representation of the allocated quantity. Only valid when decimal + * allocations are enabled for the component. + */ + decimalQuantity?: string; + /** + * The quantity that was in effect before this allocation. Responses always + * include this value; it may be supplied on preview requests to ensure the + * expected change is evaluated. + */ + previousQuantity?: number; + /** + * Decimal representation of `previous_quantity`. Only valid when decimal + * allocations are enabled for the component. + */ + decimalPreviousQuantity?: string; + /** (required for the multiple allocations endpoint) The id associated with the component for which the allocation is being made. */ componentId?: number; - /** A memo to record along with the allocation */ + /** A memo to record along with the allocation. */ memo?: string; /** The scheme used if the proration is a downgrade. Defaults to the site setting if one is not provided. */ prorationDowngradeScheme?: string; /** The scheme used if the proration is an upgrade. Defaults to the site setting if one is not provided. */ prorationUpgradeScheme?: string; - /** If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal or if capture should be attempted immediately. Defaults to the site setting if one is not provided. */ - accrueCharge?: boolean; /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. + * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are: + * `full` - A full price credit is added for the amount owed. + * `prorated` - A prorated credit is added for the amount owed. + * `none` - No charge is added. */ - downgradeCredit?: CreditType | null; + downgradeCredit?: DowngradeCreditCreditType | null; /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. + * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are: + * `full` - A charge is added for the full price of the component. + * `prorated` - A charge is added for the prorated price of the component change. + * `none` - No charge is added. */ - upgradeCharge?: CreditType | null; + upgradeCharge?: UpgradeChargeCreditType | null; + /** + * "If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal or if capture should be attempted immediately. + * `true` - Attempt to charge the customer at the next renewal. + * `false` - Attempt to charge the customer right away. If it fails, the charge will be accrued until the next renewal. + * Defaults to the site setting if unspecified in the request. + */ + accrueCharge?: boolean; /** * If set to true, if the immediate component payment fails, initiate dunning for the subscription. * Otherwise, leave the charges on the subscription to pay for at renewal. Defaults to false. @@ -53,12 +89,17 @@ export interface CreateAllocation { pricePointId?: CreateAllocationPricePointId | null; /** This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. This only works for site with Multifrequency enabled. */ billingSchedule?: BillingSchedule; + /** Create or update custom pricing unique to the subscription. Used in place of `price_point_id`. */ + customPrice?: ComponentCustomPrice; [key: string]: unknown; } export const createAllocationSchema: Schema = lazy(() => expandoObject({ quantity: ['quantity', number()], + decimalQuantity: ['decimal_quantity', optional(string())], + previousQuantity: ['previous_quantity', optional(number())], + decimalPreviousQuantity: ['decimal_previous_quantity', optional(string())], componentId: ['component_id', optional(number())], memo: ['memo', optional(string())], prorationDowngradeScheme: [ @@ -66,14 +107,21 @@ export const createAllocationSchema: Schema = lazy(() => optional(string()), ], prorationUpgradeScheme: ['proration_upgrade_scheme', optional(string())], + downgradeCredit: [ + 'downgrade_credit', + optional(nullable(downgradeCreditCreditTypeSchema)), + ], + upgradeCharge: [ + 'upgrade_charge', + optional(nullable(upgradeChargeCreditTypeSchema)), + ], accrueCharge: ['accrue_charge', optional(boolean())], - downgradeCredit: ['downgrade_credit', optional(nullable(creditTypeSchema))], - upgradeCharge: ['upgrade_charge', optional(nullable(creditTypeSchema))], initiateDunning: ['initiate_dunning', optional(boolean())], pricePointId: [ 'price_point_id', optional(nullable(createAllocationPricePointIdSchema)), ], billingSchedule: ['billing_schedule', optional(billingScheduleSchema)], + customPrice: ['custom_price', optional(componentCustomPriceSchema)], }) ); diff --git a/src/models/createSubscription.ts b/src/models/createSubscription.ts index 7b54ff46..521dc55f 100644 --- a/src/models/createSubscription.ts +++ b/src/models/createSubscription.ts @@ -65,7 +65,7 @@ export interface CreateSubscription { productPricePointHandle?: string; /** The ID of the particular price point on the product. */ productPricePointId?: number; - /** (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription */ + /** (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. */ customPrice?: SubscriptionCustomPrice; /** (deprecated) The coupon code of the single coupon currently applied to the subscription. See coupon_codes instead as subscriptions can now have more than one coupon. */ couponCode?: string; diff --git a/src/models/currencyOveragePrices.ts b/src/models/currencyOveragePrices.ts new file mode 100644 index 00000000..e4eb907f --- /dev/null +++ b/src/models/currencyOveragePrices.ts @@ -0,0 +1,123 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { + array, + boolean, + expandoObject, + lazy, + nullable, + number, + optional, + Schema, + string, +} from '../schema.js'; +import { + ComponentCurrencyPrice, + componentCurrencyPriceSchema, +} from './componentCurrencyPrice.js'; +import { ComponentPrice, componentPriceSchema } from './componentPrice.js'; +import { + ExpirationIntervalUnit, + expirationIntervalUnitSchema, +} from './expirationIntervalUnit.js'; +import { IntervalUnit, intervalUnitSchema } from './intervalUnit.js'; +import { PricePointType, pricePointTypeSchema } from './pricePointType.js'; +import { PricingScheme, pricingSchemeSchema } from './pricingScheme.js'; + +/** Extends a component price point with currency overage prices. */ +export interface CurrencyOveragePrices { + id?: number; + /** + * Price point type. We expose the following types: + * 1. **default**: a price point that is marked as a default price for a certain product. + * 2. **custom**: a custom price point. + * 3. **catalog**: a price point that is **not** marked as a default price for a certain product and is **not** a custom one. + */ + type?: PricePointType; + /** Note: Refer to type attribute instead */ + mDefault?: boolean; + name?: string; + /** The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. */ + pricingScheme?: PricingScheme; + componentId?: number; + handle?: string | null; + archivedAt?: string | null; + createdAt?: string; + updatedAt?: string; + prices?: ComponentPrice[]; + /** Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site. Defaults to true during creation. */ + useSiteExchangeRate?: boolean; + /** (only used for Custom Pricing - ie. when the price point's type is `custom`) The id of the subscription that the custom price point is for. */ + subscriptionId?: number; + taxIncluded?: boolean; + /** The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. */ + interval?: number | null; + /** A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. */ + intervalUnit?: IntervalUnit | null; + /** An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. The clone endpoint always returns currency prices if they are present. */ + currencyPrices?: ComponentCurrencyPrice[]; + /** Applicable only to prepaid usage components. An array of overage price brackets. */ + overagePrices?: ComponentPrice[]; + /** Applicable only to prepaid usage components. Pricing scheme for overage pricing. */ + overagePricingScheme?: PricingScheme; + /** Applicable only to prepaid usage components. Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period. */ + renewPrepaidAllocation?: boolean; + /** Applicable only to prepaid usage components. Boolean which controls whether or not remaining units should be rolled over to the next period. */ + rolloverPrepaidRemainder?: boolean; + /** Applicable only to prepaid usage components where rollover_prepaid_remainder is true. The number of `expiration_interval_unit`s after which rollover amounts should expire. */ + expirationInterval?: number | null; + /** Applicable only to prepaid usage components where rollover_prepaid_remainder is true. A string representing the expiration interval unit for this component, either month or day. */ + expirationIntervalUnit?: ExpirationIntervalUnit | null; + /** Applicable only to prepaid usage components. An array of currency pricing data for overage prices. */ + currencyOveragePrices?: ComponentCurrencyPrice[]; + [key: string]: unknown; +} + +export const currencyOveragePricesSchema: Schema = lazy( + () => + expandoObject({ + id: ['id', optional(number())], + type: ['type', optional(pricePointTypeSchema)], + mDefault: ['default', optional(boolean())], + name: ['name', optional(string())], + pricingScheme: ['pricing_scheme', optional(pricingSchemeSchema)], + componentId: ['component_id', optional(number())], + handle: ['handle', optional(nullable(string()))], + archivedAt: ['archived_at', optional(nullable(string()))], + createdAt: ['created_at', optional(string())], + updatedAt: ['updated_at', optional(string())], + prices: ['prices', optional(array(componentPriceSchema))], + useSiteExchangeRate: ['use_site_exchange_rate', optional(boolean())], + subscriptionId: ['subscription_id', optional(number())], + taxIncluded: ['tax_included', optional(boolean())], + interval: ['interval', optional(nullable(number()))], + intervalUnit: ['interval_unit', optional(nullable(intervalUnitSchema))], + currencyPrices: [ + 'currency_prices', + optional(array(componentCurrencyPriceSchema)), + ], + overagePrices: ['overage_prices', optional(array(componentPriceSchema))], + overagePricingScheme: [ + 'overage_pricing_scheme', + optional(pricingSchemeSchema), + ], + renewPrepaidAllocation: ['renew_prepaid_allocation', optional(boolean())], + rolloverPrepaidRemainder: [ + 'rollover_prepaid_remainder', + optional(boolean()), + ], + expirationInterval: ['expiration_interval', optional(nullable(number()))], + expirationIntervalUnit: [ + 'expiration_interval_unit', + optional(nullable(expirationIntervalUnitSchema)), + ], + currencyOveragePrices: [ + 'currency_overage_prices', + optional(array(componentCurrencyPriceSchema)), + ], + }) +); diff --git a/src/models/deliverProformaInvoiceRequest.ts b/src/models/deliverProformaInvoiceRequest.ts new file mode 100644 index 00000000..e4e04db4 --- /dev/null +++ b/src/models/deliverProformaInvoiceRequest.ts @@ -0,0 +1,22 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { array, expandoObject, optional, Schema, string } from '../schema.js'; + +export interface DeliverProformaInvoiceRequest { + recipientEmails?: string[]; + ccRecipientEmails?: string[]; + bccRecipientEmails?: string[]; + [key: string]: unknown; +} + +export const deliverProformaInvoiceRequestSchema: Schema = expandoObject( + { + recipientEmails: ['recipient_emails', optional(array(string()))], + ccRecipientEmails: ['cc_recipient_emails', optional(array(string()))], + bccRecipientEmails: ['bcc_recipient_emails', optional(array(string()))], + } +); diff --git a/src/models/downgradeCreditCreditType.ts b/src/models/downgradeCreditCreditType.ts new file mode 100644 index 00000000..8eeba793 --- /dev/null +++ b/src/models/downgradeCreditCreditType.ts @@ -0,0 +1,23 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { Schema, stringEnum } from '../schema.js'; + +/** + * Enum for DowngradeCreditCreditType + */ +export enum DowngradeCreditCreditType { + Full = 'full', + Prorated = 'prorated', + None = 'none', +} + +/** + * Schema for DowngradeCreditCreditType + */ +export const downgradeCreditCreditTypeSchema: Schema = stringEnum( + DowngradeCreditCreditType +); diff --git a/src/models/onOffComponent.ts b/src/models/onOffComponent.ts index 43539b93..66ff213b 100644 --- a/src/models/onOffComponent.ts +++ b/src/models/onOffComponent.ts @@ -35,15 +35,9 @@ export interface OnOffComponent { handle?: string; /** Boolean flag describing whether a component is taxable or not. */ taxable?: boolean; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ upgradeCharge?: CreditType | null; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ downgradeCredit?: CreditType | null; pricePoints?: ComponentPricePointItem[]; /** This is the amount that the customer will be charged when they turn the component on for the subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 */ diff --git a/src/models/prepaidUsageComponent.ts b/src/models/prepaidUsageComponent.ts index fddaefc4..a6ee619a 100644 --- a/src/models/prepaidUsageComponent.ts +++ b/src/models/prepaidUsageComponent.ts @@ -47,15 +47,9 @@ export interface PrepaidUsageComponent { pricingScheme: PricingScheme; /** (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261149166733-Component-Pricing-Schemes#price-bracket-rules) for an overview of how price brackets work for different pricing schemes. */ prices?: Price[]; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ upgradeCharge?: CreditType | null; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ downgradeCredit?: CreditType | null; pricePoints?: CreatePrepaidUsageComponentPricePoint[]; /** The amount the customer will be charged per unit when the pricing scheme is “per_unit”. For On/Off Components, this is the amount that the customer will be charged when they turn the component on for the subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 */ diff --git a/src/models/previewAllocationsRequest.ts b/src/models/previewAllocationsRequest.ts index 6cb80a87..0bc0b923 100644 --- a/src/models/previewAllocationsRequest.ts +++ b/src/models/previewAllocationsRequest.ts @@ -23,15 +23,9 @@ export interface PreviewAllocationsRequest { allocations: CreateAllocation[]; /** To calculate proration amounts for a future time. Only within a current subscription period. Only ISO8601 format is supported. */ effectiveProrationDate?: string; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ upgradeCharge?: CreditType | null; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ downgradeCredit?: CreditType | null; [key: string]: unknown; } diff --git a/src/models/productFamily.ts b/src/models/productFamily.ts index 5f39e632..b2043ab9 100644 --- a/src/models/productFamily.ts +++ b/src/models/productFamily.ts @@ -21,6 +21,8 @@ export interface ProductFamily { description?: string | null; createdAt?: string; updatedAt?: string; + /** Timestamp indicating when this product family was archived. `null` if the product family is not archived. */ + archivedAt?: string | null; [key: string]: unknown; } @@ -32,4 +34,5 @@ export const productFamilySchema: Schema = expandoObject({ description: ['description', optional(nullable(string()))], createdAt: ['created_at', optional(string())], updatedAt: ['updated_at', optional(string())], + archivedAt: ['archived_at', optional(nullable(string()))], }); diff --git a/src/models/proformaInvoice.ts b/src/models/proformaInvoice.ts index 0b486e71..5be37917 100644 --- a/src/models/proformaInvoice.ts +++ b/src/models/proformaInvoice.ts @@ -14,6 +14,10 @@ import { Schema, string, } from '../schema.js'; +import { + AvailableActions, + availableActionsSchema, +} from './availableActions.js'; import { CollectionMethod, collectionMethodSchema, @@ -104,6 +108,7 @@ export interface ProformaInvoice { payments?: ProformaInvoicePayment[]; customFields?: InvoiceCustomField[]; publicUrl?: string | null; + availableActions?: AvailableActions; [key: string]: unknown; } @@ -148,5 +153,6 @@ export const proformaInvoiceSchema: Schema = lazy(() => payments: ['payments', optional(array(proformaInvoicePaymentSchema))], customFields: ['custom_fields', optional(array(invoiceCustomFieldSchema))], publicUrl: ['public_url', optional(nullable(string()))], + availableActions: ['available_actions', optional(availableActionsSchema)], }) ); diff --git a/src/models/quantityBasedComponent.ts b/src/models/quantityBasedComponent.ts index 9fa488b7..5d86dff4 100644 --- a/src/models/quantityBasedComponent.ts +++ b/src/models/quantityBasedComponent.ts @@ -43,15 +43,9 @@ export interface QuantityBasedComponent { pricingScheme: PricingScheme; /** (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261149166733-Component-Pricing-Schemes#price-bracket-rules) for an overview of how price brackets work for different pricing schemes. */ prices?: Price[]; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ upgradeCharge?: CreditType | null; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ downgradeCredit?: CreditType | null; pricePoints?: ComponentPricePointItem[]; /** The amount the customer will be charged per unit when the pricing scheme is “per_unit”. For On/Off Components, this is the amount that the customer will be charged when they turn the component on for the subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 */ diff --git a/src/models/reactivateSubscriptionRequest.ts b/src/models/reactivateSubscriptionRequest.ts index 1aac50c5..3444efe0 100644 --- a/src/models/reactivateSubscriptionRequest.ts +++ b/src/models/reactivateSubscriptionRequest.ts @@ -30,9 +30,9 @@ export interface ReactivateSubscriptionRequest { preserveBalance?: boolean; /** The coupon code to be applied during reactivation. */ couponCode?: string; - /** If true is sent, Chargify will use service credits and prepayments upon reactivation. If false is sent, the service credits and prepayments will be ignored. */ + /** If true is sent, Advanced Billing will use service credits and prepayments upon reactivation. If false is sent, the service credits and prepayments will be ignored. */ useCreditsAndPrepayments?: boolean; - /** If `true`, Chargify will attempt to resume the subscription's billing period. if not resumable, the subscription will be reactivated with a new billing period. If `false`: Chargify will only attempt to reactivate the subscription. */ + /** If `true`, Advanced Billing will attempt to resume the subscription's billing period. If not resumable, the subscription will be reactivated with a new billing period. If `false` or omitted, Advanced Billing will only attempt to reactivate the subscription with a new billing period, regardless of whether or not the subscription is resumable. */ resume?: ReactivateSubscriptionRequestResume; [key: string]: unknown; } diff --git a/src/models/register.ts b/src/models/register.ts new file mode 100644 index 00000000..08b727c6 --- /dev/null +++ b/src/models/register.ts @@ -0,0 +1,23 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { expandoObject, number, optional, Schema, string } from '../schema.js'; + +export interface Register { + id?: number; + maxioId?: string; + name?: string; + /** The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. */ + currencyCode?: string; + [key: string]: unknown; +} + +export const registerSchema: Schema = expandoObject({ + id: ['id', optional(number())], + maxioId: ['maxio_id', optional(string())], + name: ['name', optional(string())], + currencyCode: ['currency_code', optional(string())], +}); diff --git a/src/models/scheduledRenewalComponentCustomPrice.ts b/src/models/scheduledRenewalComponentCustomPrice.ts new file mode 100644 index 00000000..860dc25a --- /dev/null +++ b/src/models/scheduledRenewalComponentCustomPrice.ts @@ -0,0 +1,36 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { + array, + boolean, + expandoObject, + lazy, + optional, + Schema, +} from '../schema.js'; +import { Price, priceSchema } from './price.js'; +import { PricingScheme, pricingSchemeSchema } from './pricingScheme.js'; + +/** Custom pricing for a component within a scheduled renewal. */ +export interface ScheduledRenewalComponentCustomPrice { + /** Whether or not the price point includes tax */ + taxIncluded?: boolean; + /** Omit for On/Off components */ + pricingScheme: PricingScheme; + /** On/off components only need one price bracket starting at 1. */ + prices: Price[]; + [key: string]: unknown; +} + +export const scheduledRenewalComponentCustomPriceSchema: Schema = lazy( + () => + expandoObject({ + taxIncluded: ['tax_included', optional(boolean())], + pricingScheme: ['pricing_scheme', pricingSchemeSchema], + prices: ['prices', array(priceSchema)], + }) +); diff --git a/src/models/scheduledRenewalConfiguration.ts b/src/models/scheduledRenewalConfiguration.ts new file mode 100644 index 00000000..5a5c4899 --- /dev/null +++ b/src/models/scheduledRenewalConfiguration.ts @@ -0,0 +1,57 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { + array, + expandoObject, + lazy, + number, + optional, + Schema, + string, +} from '../schema.js'; +import { Contract, contractSchema } from './contract.js'; +import { + ScheduledRenewalConfigurationItem, + scheduledRenewalConfigurationItemSchema, +} from './scheduledRenewalConfigurationItem.js'; + +export interface ScheduledRenewalConfiguration { + /** ID of the renewal. */ + id?: number; + /** ID of the site to which the renewal belongs. */ + siteId?: number; + /** The id of the subscription. */ + subscriptionId?: number; + startsAt?: string; + endsAt?: string; + lockInAt?: string; + createdAt?: string; + status?: string; + scheduledRenewalConfigurationItems?: ScheduledRenewalConfigurationItem[]; + /** Contract linked to the scheduled renewal configuration. */ + contract?: Contract; + [key: string]: unknown; +} + +export const scheduledRenewalConfigurationSchema: Schema = lazy( + () => + expandoObject({ + id: ['id', optional(number())], + siteId: ['site_id', optional(number())], + subscriptionId: ['subscription_id', optional(number())], + startsAt: ['starts_at', optional(string())], + endsAt: ['ends_at', optional(string())], + lockInAt: ['lock_in_at', optional(string())], + createdAt: ['created_at', optional(string())], + status: ['status', optional(string())], + scheduledRenewalConfigurationItems: [ + 'scheduled_renewal_configuration_items', + optional(array(scheduledRenewalConfigurationItemSchema)), + ], + contract: ['contract', optional(contractSchema)], + }) +); diff --git a/src/models/scheduledRenewalConfigurationItem.ts b/src/models/scheduledRenewalConfigurationItem.ts new file mode 100644 index 00000000..6bdaff63 --- /dev/null +++ b/src/models/scheduledRenewalConfigurationItem.ts @@ -0,0 +1,41 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { expandoObject, number, optional, Schema, string } from '../schema.js'; + +export interface ScheduledRenewalConfigurationItem { + id?: number; + subscriptionId?: number; + subscriptionRenewalConfigurationId?: number; + itemId?: number; + itemType?: string; + itemSubclass?: string; + pricePointId?: number; + pricePointType?: string; + quantity?: number; + decimalQuantity?: string; + createdAt?: string; + [key: string]: unknown; +} + +export const scheduledRenewalConfigurationItemSchema: Schema = expandoObject( + { + id: ['id', optional(number())], + subscriptionId: ['subscription_id', optional(number())], + subscriptionRenewalConfigurationId: [ + 'subscription_renewal_configuration_id', + optional(number()), + ], + itemId: ['item_id', optional(number())], + itemType: ['item_type', optional(string())], + itemSubclass: ['item_subclass', optional(string())], + pricePointId: ['price_point_id', optional(number())], + pricePointType: ['price_point_type', optional(string())], + quantity: ['quantity', optional(number())], + decimalQuantity: ['decimal_quantity', optional(string())], + createdAt: ['created_at', optional(string())], + } +); diff --git a/src/models/scheduledRenewalConfigurationItemRequest.ts b/src/models/scheduledRenewalConfigurationItemRequest.ts new file mode 100644 index 00000000..245027bc --- /dev/null +++ b/src/models/scheduledRenewalConfigurationItemRequest.ts @@ -0,0 +1,26 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { expandoObject, lazy, Schema } from '../schema.js'; +import { + ScheduledRenewalConfigurationItemRequestRenewalConfigurationItem, + scheduledRenewalConfigurationItemRequestRenewalConfigurationItemSchema, +} from './containers/scheduledRenewalConfigurationItemRequestRenewalConfigurationItem.js'; + +export interface ScheduledRenewalConfigurationItemRequest { + renewalConfigurationItem: ScheduledRenewalConfigurationItemRequestRenewalConfigurationItem; + [key: string]: unknown; +} + +export const scheduledRenewalConfigurationItemRequestSchema: Schema = lazy( + () => + expandoObject({ + renewalConfigurationItem: [ + 'renewal_configuration_item', + scheduledRenewalConfigurationItemRequestRenewalConfigurationItemSchema, + ], + }) +); diff --git a/src/models/scheduledRenewalConfigurationItemResponse.ts b/src/models/scheduledRenewalConfigurationItemResponse.ts new file mode 100644 index 00000000..9fd69807 --- /dev/null +++ b/src/models/scheduledRenewalConfigurationItemResponse.ts @@ -0,0 +1,26 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { expandoObject, lazy, optional, Schema } from '../schema.js'; +import { + ScheduledRenewalConfigurationItem, + scheduledRenewalConfigurationItemSchema, +} from './scheduledRenewalConfigurationItem.js'; + +export interface ScheduledRenewalConfigurationItemResponse { + scheduledRenewalConfigurationItem?: ScheduledRenewalConfigurationItem; + [key: string]: unknown; +} + +export const scheduledRenewalConfigurationItemResponseSchema: Schema = lazy( + () => + expandoObject({ + scheduledRenewalConfigurationItem: [ + 'scheduled_renewal_configuration_item', + optional(scheduledRenewalConfigurationItemSchema), + ], + }) +); diff --git a/src/models/scheduledRenewalConfigurationRequest.ts b/src/models/scheduledRenewalConfigurationRequest.ts new file mode 100644 index 00000000..3b473a7d --- /dev/null +++ b/src/models/scheduledRenewalConfigurationRequest.ts @@ -0,0 +1,26 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { expandoObject, lazy, Schema } from '../schema.js'; +import { + ScheduledRenewalConfigurationRequestBody, + scheduledRenewalConfigurationRequestBodySchema, +} from './scheduledRenewalConfigurationRequestBody.js'; + +export interface ScheduledRenewalConfigurationRequest { + renewalConfiguration: ScheduledRenewalConfigurationRequestBody; + [key: string]: unknown; +} + +export const scheduledRenewalConfigurationRequestSchema: Schema = lazy( + () => + expandoObject({ + renewalConfiguration: [ + 'renewal_configuration', + scheduledRenewalConfigurationRequestBodySchema, + ], + }) +); diff --git a/src/models/scheduledRenewalConfigurationRequestBody.ts b/src/models/scheduledRenewalConfigurationRequestBody.ts new file mode 100644 index 00000000..2559a0ee --- /dev/null +++ b/src/models/scheduledRenewalConfigurationRequestBody.ts @@ -0,0 +1,38 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { + boolean, + expandoObject, + number, + optional, + Schema, + string, +} from '../schema.js'; + +export interface ScheduledRenewalConfigurationRequestBody { + /** (Optional) Start of the renewal term. */ + startsAt?: string; + /** (Optional) End of the renewal term. */ + endsAt?: string; + /** (Optional) Lock-in date for the renewal. */ + lockInAt?: string; + /** (Optional) Existing contract to associate with the scheduled renewal. Contracts must be enabled for your site. */ + contractId?: number; + /** (Optional) Set to true to create a new contract when contracts are enabled. Contracts must be enabled for your site. */ + createNewContract?: boolean; + [key: string]: unknown; +} + +export const scheduledRenewalConfigurationRequestBodySchema: Schema = expandoObject( + { + startsAt: ['starts_at', optional(string())], + endsAt: ['ends_at', optional(string())], + lockInAt: ['lock_in_at', optional(string())], + contractId: ['contract_id', optional(number())], + createNewContract: ['create_new_contract', optional(boolean())], + } +); diff --git a/src/models/scheduledRenewalConfigurationResponse.ts b/src/models/scheduledRenewalConfigurationResponse.ts new file mode 100644 index 00000000..28381be6 --- /dev/null +++ b/src/models/scheduledRenewalConfigurationResponse.ts @@ -0,0 +1,26 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { expandoObject, lazy, optional, Schema } from '../schema.js'; +import { + ScheduledRenewalConfiguration, + scheduledRenewalConfigurationSchema, +} from './scheduledRenewalConfiguration.js'; + +export interface ScheduledRenewalConfigurationResponse { + scheduledRenewalConfiguration?: ScheduledRenewalConfiguration; + [key: string]: unknown; +} + +export const scheduledRenewalConfigurationResponseSchema: Schema = lazy( + () => + expandoObject({ + scheduledRenewalConfiguration: [ + 'scheduled_renewal_configuration', + optional(scheduledRenewalConfigurationSchema), + ], + }) +); diff --git a/src/models/scheduledRenewalConfigurationsResponse.ts b/src/models/scheduledRenewalConfigurationsResponse.ts new file mode 100644 index 00000000..48071517 --- /dev/null +++ b/src/models/scheduledRenewalConfigurationsResponse.ts @@ -0,0 +1,26 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { array, expandoObject, lazy, optional, Schema } from '../schema.js'; +import { + ScheduledRenewalConfiguration, + scheduledRenewalConfigurationSchema, +} from './scheduledRenewalConfiguration.js'; + +export interface ScheduledRenewalConfigurationsResponse { + scheduledRenewalConfigurations?: ScheduledRenewalConfiguration[]; + [key: string]: unknown; +} + +export const scheduledRenewalConfigurationsResponseSchema: Schema = lazy( + () => + expandoObject({ + scheduledRenewalConfigurations: [ + 'scheduled_renewal_configurations', + optional(array(scheduledRenewalConfigurationSchema)), + ], + }) +); diff --git a/src/models/scheduledRenewalItemRequestBodyComponent.ts b/src/models/scheduledRenewalItemRequestBodyComponent.ts new file mode 100644 index 00000000..b4f976fc --- /dev/null +++ b/src/models/scheduledRenewalItemRequestBodyComponent.ts @@ -0,0 +1,46 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { + expandoObject, + lazy, + number, + optional, + Schema, + string, +} from '../schema.js'; +import { + ScheduledRenewalComponentCustomPrice, + scheduledRenewalComponentCustomPriceSchema, +} from './scheduledRenewalComponentCustomPrice.js'; + +export interface ScheduledRenewalItemRequestBodyComponent { + /** Item type to add. Either Product or Component. */ + itemType: string; + /** Product or component identifier. */ + itemId: number; + /** Price point identifier. */ + pricePointId?: number; + /** Optional quantity for the item. */ + quantity?: number; + /** Custom pricing for a component within a scheduled renewal. */ + customPrice?: ScheduledRenewalComponentCustomPrice; + [key: string]: unknown; +} + +export const scheduledRenewalItemRequestBodyComponentSchema: Schema = lazy( + () => + expandoObject({ + itemType: ['item_type', string()], + itemId: ['item_id', number()], + pricePointId: ['price_point_id', optional(number())], + quantity: ['quantity', optional(number())], + customPrice: [ + 'custom_price', + optional(scheduledRenewalComponentCustomPriceSchema), + ], + }) +); diff --git a/src/models/scheduledRenewalItemRequestBodyProduct.ts b/src/models/scheduledRenewalItemRequestBodyProduct.ts new file mode 100644 index 00000000..09ec0370 --- /dev/null +++ b/src/models/scheduledRenewalItemRequestBodyProduct.ts @@ -0,0 +1,46 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { + expandoObject, + lazy, + number, + optional, + Schema, + string, +} from '../schema.js'; +import { + ScheduledRenewalProductPricePoint, + scheduledRenewalProductPricePointSchema, +} from './scheduledRenewalProductPricePoint.js'; + +export interface ScheduledRenewalItemRequestBodyProduct { + /** Item type to add. Either Product or Component. */ + itemType: string; + /** Product or component identifier. */ + itemId: number; + /** Price point identifier. */ + pricePointId?: number; + /** Optional quantity for the item. */ + quantity?: number; + /** Custom pricing for a product within a scheduled renewal. */ + customPrice?: ScheduledRenewalProductPricePoint; + [key: string]: unknown; +} + +export const scheduledRenewalItemRequestBodyProductSchema: Schema = lazy( + () => + expandoObject({ + itemType: ['item_type', string()], + itemId: ['item_id', number()], + pricePointId: ['price_point_id', optional(number())], + quantity: ['quantity', optional(number())], + customPrice: [ + 'custom_price', + optional(scheduledRenewalProductPricePointSchema), + ], + }) +); diff --git a/src/models/scheduledRenewalLockInRequest.ts b/src/models/scheduledRenewalLockInRequest.ts new file mode 100644 index 00000000..338c3672 --- /dev/null +++ b/src/models/scheduledRenewalLockInRequest.ts @@ -0,0 +1,17 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { expandoObject, Schema, string } from '../schema.js'; + +export interface ScheduledRenewalLockInRequest { + /** Date to lock in the renewal. */ + lockInAt: string; + [key: string]: unknown; +} + +export const scheduledRenewalLockInRequestSchema: Schema = expandoObject( + { lockInAt: ['lock_in_at', string()] } +); diff --git a/src/models/scheduledRenewalProductPricePoint.ts b/src/models/scheduledRenewalProductPricePoint.ts new file mode 100644 index 00000000..993ce068 --- /dev/null +++ b/src/models/scheduledRenewalProductPricePoint.ts @@ -0,0 +1,74 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { + bigint, + boolean, + expandoObject, + lazy, + nullable, + number, + optional, + Schema, + string, +} from '../schema.js'; +import { + ScheduledRenewalProductPricePointInterval, + scheduledRenewalProductPricePointIntervalSchema, +} from './containers/scheduledRenewalProductPricePointInterval.js'; +import { + ScheduledRenewalProductPricePointPriceInCents, + scheduledRenewalProductPricePointPriceInCentsSchema, +} from './containers/scheduledRenewalProductPricePointPriceInCents.js'; +import { + ExpirationIntervalUnit, + expirationIntervalUnitSchema, +} from './expirationIntervalUnit.js'; +import { IntervalUnit, intervalUnitSchema } from './intervalUnit.js'; + +/** Custom pricing for a product within a scheduled renewal. */ +export interface ScheduledRenewalProductPricePoint { + /** (Optional) */ + name?: string; + /** (Optional) */ + handle?: string; + /** Required if using `custom_price` attribute. */ + priceInCents: ScheduledRenewalProductPricePointPriceInCents; + /** Required if using `custom_price` attribute. */ + interval: ScheduledRenewalProductPricePointInterval; + /** Required if using `custom_price` attribute. */ + intervalUnit: IntervalUnit | null; + /** (Optional) */ + taxIncluded?: boolean; + /** The product price point initial charge, in integer cents. */ + initialChargeInCents?: bigint; + /** The numerical expiration interval. i.e. an expiration_interval of ‘30’ coupled with an expiration_interval_unit of day would mean this product price point would expire after 30 days. */ + expirationInterval?: number; + /** A string representing the expiration interval unit for this product price point, either month, day or never */ + expirationIntervalUnit?: ExpirationIntervalUnit | null; + [key: string]: unknown; +} + +export const scheduledRenewalProductPricePointSchema: Schema = lazy( + () => + expandoObject({ + name: ['name', optional(string())], + handle: ['handle', optional(string())], + priceInCents: [ + 'price_in_cents', + scheduledRenewalProductPricePointPriceInCentsSchema, + ], + interval: ['interval', scheduledRenewalProductPricePointIntervalSchema], + intervalUnit: ['interval_unit', nullable(intervalUnitSchema)], + taxIncluded: ['tax_included', optional(boolean())], + initialChargeInCents: ['initial_charge_in_cents', optional(bigint())], + expirationInterval: ['expiration_interval', optional(number())], + expirationIntervalUnit: [ + 'expiration_interval_unit', + optional(nullable(expirationIntervalUnitSchema)), + ], + }) +); diff --git a/src/models/scheduledRenewalUpdateRequest.ts b/src/models/scheduledRenewalUpdateRequest.ts new file mode 100644 index 00000000..4a05e97e --- /dev/null +++ b/src/models/scheduledRenewalUpdateRequest.ts @@ -0,0 +1,26 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { expandoObject, lazy, Schema } from '../schema.js'; +import { + ScheduledRenewalUpdateRequestRenewalConfigurationItem, + scheduledRenewalUpdateRequestRenewalConfigurationItemSchema, +} from './containers/scheduledRenewalUpdateRequestRenewalConfigurationItem.js'; + +export interface ScheduledRenewalUpdateRequest { + renewalConfigurationItem: ScheduledRenewalUpdateRequestRenewalConfigurationItem; + [key: string]: unknown; +} + +export const scheduledRenewalUpdateRequestSchema: Schema = lazy( + () => + expandoObject({ + renewalConfigurationItem: [ + 'renewal_configuration_item', + scheduledRenewalUpdateRequestRenewalConfigurationItemSchema, + ], + }) +); diff --git a/src/models/sendEmail.ts b/src/models/sendEmail.ts new file mode 100644 index 00000000..024e2932 --- /dev/null +++ b/src/models/sendEmail.ts @@ -0,0 +1,18 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { boolean, expandoObject, Schema, string } from '../schema.js'; + +export interface SendEmail { + canExecute: boolean; + url: string; + [key: string]: unknown; +} + +export const sendEmailSchema: Schema = expandoObject({ + canExecute: ['can_execute', boolean()], + url: ['url', string()], +}); diff --git a/src/models/sendInvoiceRequest.ts b/src/models/sendInvoiceRequest.ts index 3c43bdd7..05282097 100644 --- a/src/models/sendInvoiceRequest.ts +++ b/src/models/sendInvoiceRequest.ts @@ -10,6 +10,8 @@ export interface SendInvoiceRequest { recipientEmails?: string[]; ccRecipientEmails?: string[]; bccRecipientEmails?: string[]; + /** Array of URLs to files to attach to the invoice email. Max 10 files, 10MB each. */ + attachmentUrls?: string[]; [key: string]: unknown; } @@ -18,5 +20,6 @@ export const sendInvoiceRequestSchema: Schema = expandoObjec recipientEmails: ['recipient_emails', optional(array(string()))], ccRecipientEmails: ['cc_recipient_emails', optional(array(string()))], bccRecipientEmails: ['bcc_recipient_emails', optional(array(string()))], + attachmentUrls: ['attachment_urls', optional(array(string()))], } ); diff --git a/src/models/snapDay.ts b/src/models/snapDay.ts deleted file mode 100644 index 2f8f35e4..00000000 --- a/src/models/snapDay.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * AdvancedBilling - * - * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -import { Schema, stringEnum } from '../schema.js'; - -/** - * Enum for SnapDay - */ -export enum SnapDay { - End = 'end', -} - -/** - * Schema for SnapDay - */ -export const snapDaySchema: Schema = stringEnum(SnapDay); diff --git a/src/models/status.ts b/src/models/status.ts new file mode 100644 index 00000000..66a1fd3e --- /dev/null +++ b/src/models/status.ts @@ -0,0 +1,24 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { Schema, stringEnum } from '../schema.js'; + +/** + * Enum for Status + */ +export enum Status { + Draft = 'draft', + Scheduled = 'scheduled', + Pending = 'pending', + Canceled = 'canceled', + Active = 'active', + Fulfilled = 'fulfilled', +} + +/** + * Schema for Status + */ +export const statusSchema: Schema = stringEnum(Status); diff --git a/src/models/subscription.ts b/src/models/subscription.ts index 442d86e3..cdfef020 100644 --- a/src/models/subscription.ts +++ b/src/models/subscription.ts @@ -28,10 +28,6 @@ import { CollectionMethod, collectionMethodSchema, } from './collectionMethod.js'; -import { - SubscriptionSnapDay, - subscriptionSnapDaySchema, -} from './containers/subscriptionSnapDay.js'; import { CreditCardPaymentProfile, creditCardPaymentProfileSchema, @@ -126,8 +122,8 @@ export interface Subscription { delayedCancelAt?: string | null; /** (deprecated) The coupon code of the single coupon currently applied to the subscription. See coupon_codes instead as subscriptions can now have more than one coupon. */ couponCode?: string | null; - /** The day of the month that the subscription will charge according to calendar billing rules, if used. */ - snapDay?: SubscriptionSnapDay | null; + /** A day of month that subscription will be processed on. Can be 1 up to 28 or 'end'. */ + snapDay?: string | null; /** The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. */ paymentCollectionMethod?: CollectionMethod; customer?: Customer; @@ -147,7 +143,7 @@ export interface Subscription { couponUseCount?: number | null; /** (deprecated) How many times the subscription's single coupon may be used. This field has no replacement for multiple coupons. */ couponUsesAllowed?: number | null; - /** If the subscription is canceled, this is their churn code. */ + /** The churn reason code associated to a cancelled subscription. */ reasonCode?: string | null; /** The date the subscription is scheduled to automatically resume from the on_hold state. */ automaticallyResumeAt?: string | null; @@ -174,7 +170,7 @@ export interface Subscription { netTerms?: number | null; /** For European sites subject to PSD2 and using 3D Secure, this can be used to reference a previous transaction for the customer. This will ensure the card will be charged successfully at renewal. */ storedCredentialTransactionId?: number | null; - /** The reference value (provided by your app) for the subscription itelf. */ + /** The reference value (provided by your app) for the subscription istelf. */ reference?: string | null; /** The timestamp of the most recent on hold action. */ onHoldAt?: string | null; @@ -239,7 +235,7 @@ export const subscriptionSchema: Schema = lazy(() => signupRevenue: ['signup_revenue', optional(string())], delayedCancelAt: ['delayed_cancel_at', optional(nullable(string()))], couponCode: ['coupon_code', optional(nullable(string()))], - snapDay: ['snap_day', optional(nullable(subscriptionSnapDaySchema))], + snapDay: ['snap_day', optional(nullable(string()))], paymentCollectionMethod: [ 'payment_collection_method', optional(collectionMethodSchema), diff --git a/src/models/subscriptionComponent.ts b/src/models/subscriptionComponent.ts index b2a789d2..fdcd7b77 100644 --- a/src/models/subscriptionComponent.ts +++ b/src/models/subscriptionComponent.ts @@ -47,15 +47,9 @@ export interface SubscriptionComponent { componentHandle?: string | null; subscriptionId?: number; recurring?: boolean; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ upgradeCharge?: CreditType | null; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ downgradeCredit?: CreditType | null; archivedAt?: string | null; pricePointId?: number | null; diff --git a/src/models/subscriptionCustomPrice.ts b/src/models/subscriptionCustomPrice.ts index 8046c1da..7f8d0686 100644 --- a/src/models/subscriptionCustomPrice.ts +++ b/src/models/subscriptionCustomPrice.ts @@ -44,7 +44,7 @@ import { import { IntervalUnit, intervalUnitSchema } from './intervalUnit.js'; import { TrialType, trialTypeSchema } from './trialType.js'; -/** (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription */ +/** (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. */ export interface SubscriptionCustomPrice { /** (Optional) */ name?: string; diff --git a/src/models/subscriptionGroup.ts b/src/models/subscriptionGroup.ts index 759d46ed..1abb9360 100644 --- a/src/models/subscriptionGroup.ts +++ b/src/models/subscriptionGroup.ts @@ -23,6 +23,7 @@ import { } from './subscriptionGroupPaymentProfile.js'; export interface SubscriptionGroup { + uid?: string; customerId?: number; paymentProfile?: SubscriptionGroupPaymentProfile; /** The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. */ @@ -34,6 +35,7 @@ export interface SubscriptionGroup { export const subscriptionGroupSchema: Schema = lazy(() => expandoObject({ + uid: ['uid', optional(string())], customerId: ['customer_id', optional(number())], paymentProfile: [ 'payment_profile', diff --git a/src/models/subscriptionGroupSignupItem.ts b/src/models/subscriptionGroupSignupItem.ts index 09dbcb06..286ecafc 100644 --- a/src/models/subscriptionGroupSignupItem.ts +++ b/src/models/subscriptionGroupSignupItem.ts @@ -45,7 +45,7 @@ export interface SubscriptionGroupSignupItem { /** An array for all the coupons attached to the subscription. */ couponCodes?: string[]; components?: SubscriptionGroupSignupComponent[]; - /** (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription */ + /** (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. */ customPrice?: SubscriptionCustomPrice; /** (Optional). Cannot be used when also specifying next_billing_at */ calendarBilling?: CalendarBilling; diff --git a/src/models/subscriptionSort.ts b/src/models/subscriptionSort.ts index 850f10e0..54352ff8 100644 --- a/src/models/subscriptionSort.ts +++ b/src/models/subscriptionSort.ts @@ -16,6 +16,10 @@ export enum SubscriptionSort { NextAssessment = 'next_assessment', UpdatedAt = 'updated_at', CreatedAt = 'created_at', + TotalPayments = 'total_payments', + Id = 'id', + OpenBalance = 'open_balance', + ExpiresAt = 'expires_at', } /** diff --git a/src/models/updateComponent.ts b/src/models/updateComponent.ts index bf8f3695..f98a7179 100644 --- a/src/models/updateComponent.ts +++ b/src/models/updateComponent.ts @@ -29,10 +29,7 @@ export interface UpdateComponent { /** One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other */ itemCategory?: ItemCategory | null; displayOnHostedPage?: boolean; - /** - * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. - * Available values: `full`, `prorated`, `none`. - */ + /** The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. */ upgradeCharge?: CreditType | null; [key: string]: unknown; } diff --git a/src/models/updateSubscription.ts b/src/models/updateSubscription.ts index 00aadc3c..a5ec31f5 100644 --- a/src/models/updateSubscription.ts +++ b/src/models/updateSubscription.ts @@ -46,8 +46,8 @@ export interface UpdateSubscription { /** Set to an empty string to cancel a delayed product change. */ nextProductId?: string; nextProductPricePointId?: string; - /** Use for subscriptions with product eligible for calendar billing only. Value can be 1-28 or 'end'. */ - snapDay?: UpdateSubscriptionSnapDay | null; + /** A day of month that subscription will be processed on. Can be 1 up to 28 or 'end'. */ + snapDay?: UpdateSubscriptionSnapDay; /** (Optional) Set this attribute to a future date/time to update a subscription in the Awaiting Signup Date state, to Awaiting Signup. In the Awaiting Signup state, a subscription behaves like any other. It can be canceled, allocated to, or have its billing date changed. etc. When the `initial_billing_at` date hits, the subscription will transition to the expected state. If the product has a trial, the subscription will enter a trial, otherwise it will go active. Setup fees will be respected either before or after the trial, as configured on the price point. If the payment is due at the initial_billing_at and it fails the subscription will be immediately canceled. You can omit the initial_billing_at date to activate the subscription immediately. See the [subscription import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Advanced-Billing-Subscription-Imports#date-format) documentation for more information about Date/Time formats. */ initialBillingAt?: string; /** (Optional) Set this attribute to true to move the subscription from Awaiting Signup, to Awaiting Signup Date. Use this when you want to update a subscription that has an unknown initial billing date. When the first billing date is known, update a subscription to set the `initial_billing_at` date. The subscription moves to the awaiting signup with a scheduled initial billing date. You can omit the initial_billing_at date to activate the subscription immediately. See [Subscription States](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404222005773-Subscription-States) for more information. */ @@ -60,7 +60,7 @@ export interface UpdateSubscription { netTerms?: UpdateSubscriptionNetTerms; storedCredentialTransactionId?: number; reference?: string; - /** (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription */ + /** (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. */ customPrice?: SubscriptionCustomPrice; /** (Optional) An array of component ids and custom prices to be added to the subscription. */ components?: UpdateSubscriptionComponent[]; @@ -89,7 +89,7 @@ export const updateSubscriptionSchema: Schema = lazy(() => 'next_product_price_point_id', optional(string()), ], - snapDay: ['snap_day', optional(nullable(updateSubscriptionSnapDaySchema))], + snapDay: ['snap_day', optional(updateSubscriptionSnapDaySchema)], initialBillingAt: ['initial_billing_at', optional(string())], deferSignup: ['defer_signup', optional(boolean())], nextBillingAt: ['next_billing_at', optional(string())], diff --git a/src/models/upgradeChargeCreditType.ts b/src/models/upgradeChargeCreditType.ts new file mode 100644 index 00000000..a6fbaa27 --- /dev/null +++ b/src/models/upgradeChargeCreditType.ts @@ -0,0 +1,23 @@ +/** + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +import { Schema, stringEnum } from '../schema.js'; + +/** + * Enum for UpgradeChargeCreditType + */ +export enum UpgradeChargeCreditType { + Full = 'full', + Prorated = 'prorated', + None = 'none', +} + +/** + * Schema for UpgradeChargeCreditType + */ +export const upgradeChargeCreditTypeSchema: Schema = stringEnum( + UpgradeChargeCreditType +); diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json index 3459ff47..db8f062b 100644 --- a/tsconfig.cjs.json +++ b/tsconfig.cjs.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "CommonJS", "outDir": "dist/cjs", - "declarationDir": "dist/types" + "declarationDir": "dist/cjs/types" } } diff --git a/tsconfig.esm.json b/tsconfig.esm.json index 2da6959d..eb544319 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -4,8 +4,7 @@ "module": "esnext", "lib": ["esnext"], "outDir": "dist/esm", - "declarationDir": "dist/types", + "declarationDir": "dist/esm/types", "target": "ES2017" } } -