diff --git a/lib/recurly.d.ts b/lib/recurly.d.ts index f031fe4c..bcbeb24e 100644 --- a/lib/recurly.d.ts +++ b/lib/recurly.d.ts @@ -201,6 +201,10 @@ export declare class Account { * An enumerable describing the billing behavior of the account, specifically whether the account is self-paying or will rely on the parent account to pay. */ billTo?: string | null; + /** + * Unique ID to identify a dunning campaign. Available when the Dunning Campaigns feature is enabled. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. + */ + dunningCampaignId?: string | null; address?: Address | null; billingInfo?: BillingInfo | null; /** @@ -518,6 +522,10 @@ export declare class AccountMini { company?: string | null; parentAccountId?: string | null; billTo?: string | null; + /** + * Unique ID to identify a dunning campaign. Available when the Dunning Campaigns feature is enabled. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. + */ + dunningCampaignId?: string | null; } @@ -1219,6 +1227,10 @@ export declare class Invoice { * Date invoice was marked paid or failed. */ closedAt?: Date | null; + /** + * Unique ID to identify the dunning campaign used when dunning the invoice. Available when the Dunning Campaigns feature is enabled. For sites without multiple dunning campaigns enabled, this will always be the default dunning campaign. + */ + dunningCampaignId?: string | null; } @@ -2361,6 +2373,10 @@ export declare class Plan { * Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. */ allowAnyItemOnSubscriptions?: boolean | null; + /** + * Unique ID to identify a dunning campaign. Available when the Dunning Campaigns feature is enabled. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. + */ + dunningCampaignId?: string | null; /** * Created at */ @@ -2710,6 +2726,123 @@ export declare class ExportFile { } +export declare class DunningCampaign { + id?: string | null; + /** + * Object type + */ + object?: string | null; + /** + * Campaign code. + */ + code?: string | null; + /** + * Campaign name. + */ + name?: string | null; + /** + * Campaign description. + */ + description?: string | null; + /** + * Whether or not this is the default campaign for accounts or plans without an assigned dunning campaign. + */ + defaultCampaign?: boolean | null; + /** + * Dunning Cycle settings. + */ + dunningCycles?: DunningCycle[] | null; + /** + * When the current campaign was created in Recurly. + */ + createdAt?: Date | null; + /** + * When the current campaign was updated in Recurly. + */ + updatedAt?: Date | null; + /** + * When the current campaign was deleted in Recurly. + */ + deletedAt?: Date | null; + +} + +export declare class DunningCycle { + /** + * The type of invoice this cycle applies to. + */ + type?: string | null; + /** + * Whether the dunning settings will be applied to manual trials. Only applies to trial cycles. + */ + appliesToManualTrial?: boolean | null; + /** + * The number of days after a transaction failure before the first dunning email is sent. + */ + firstCommunicationInterval?: number | null; + /** + * Whether or not to send an extra email immediately to customers whose initial payment attempt fails with either a hard decline or invalid billing info. + */ + sendImmediatelyOnHardDecline?: boolean | null; + /** + * Dunning intervals. + */ + intervals?: DunningInterval[] | null; + /** + * Whether the subscription(s) should be cancelled at the end of the dunning cycle. + */ + expireSubscription?: boolean | null; + /** + * Whether the invoice should be failed at the end of the dunning cycle. + */ + failInvoice?: boolean | null; + /** + * The number of days between the first dunning email being sent and the end of the dunning cycle. + */ + totalDunningDays?: number | null; + /** + * The number of days between a transaction failure and the end of the dunning cycle. + */ + totalRecyclingDays?: number | null; + /** + * Current campaign version. + */ + version?: number | null; + /** + * When the current settings were created in Recurly. + */ + createdAt?: Date | null; + /** + * When the current settings were updated in Recurly. + */ + updatedAt?: Date | null; + +} + +export declare class DunningInterval { + /** + * Number of days before sending the next email. + */ + days?: number | null; + /** + * Email template being used. + */ + emailTemplate?: string | null; + +} + +export declare class DunningCampaignsBulkUpdateResponse { + /** + * Object type + */ + object?: string | null; + /** + * An array containing all of the `Plan` resources that have been updated. + */ + plans?: Plan[] | null; + +} + export interface Empty { @@ -2777,6 +2910,10 @@ export interface AccountCreate { * An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. */ transactionType?: string | null; + /** + * Unique ID to identify a dunning campaign. Available when the Dunning Campaigns feature is enabled. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. + */ + dunningCampaignId?: string | null; address?: Address | null; billingInfo?: BillingInfoCreate | null; /** @@ -3029,6 +3166,10 @@ export interface AccountUpdate { * An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. */ transactionType?: string | null; + /** + * Unique ID to identify a dunning campaign. Available when the Dunning Campaigns feature is enabled. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. + */ + dunningCampaignId?: string | null; address?: Address | null; billingInfo?: BillingInfoCreate | null; /** @@ -3754,6 +3895,10 @@ export interface PlanCreate { * Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. */ allowAnyItemOnSubscriptions?: boolean | null; + /** + * Unique ID to identify a dunning campaign. Available when the Dunning Campaigns feature is enabled. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. + */ + dunningCampaignId?: string | null; } @@ -4010,6 +4155,10 @@ export interface PlanUpdate { * Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. */ allowAnyItemOnSubscriptions?: boolean | null; + /** + * Unique ID to identify a dunning campaign. Available when the Dunning Campaigns feature is enabled. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. + */ + dunningCampaignId?: string | null; } @@ -4652,6 +4801,10 @@ export interface AccountPurchase { * An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. */ transactionType?: string | null; + /** + * Unique ID to identify a dunning campaign. Available when the Dunning Campaigns feature is enabled. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. + */ + dunningCampaignId?: string | null; address?: Address | null; billingInfo?: BillingInfoCreate | null; /** @@ -4766,6 +4919,18 @@ export interface SubscriptionShippingPurchase { } +export interface DunningCampaignsBulkUpdate { + /** + * List of `plan_codes` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_ids` is present. + */ + planCodes?: string[] | null; + /** + * List of `plan_ids` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_codes` is present. + */ + planIds?: string[] | null; + +} + export declare class Client { constructor(apiKey: string); @@ -8407,6 +8572,41 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`. * @return {Promise} Returns a list of export files to download. */ getExportFiles(exportDate: string): Promise; + /** + * Show the dunning campaigns for a site + * + * API docs: https://developers.recurly.com/api/v2021-02-25#operation/list_dunning_campaigns + * + * + * @param {Object} options - Optional configurations for the request + * @param {Object} options.params - The optional url parameters for this request. + * @param {string} options.params.sort - Sort field. You *really* only want to sort by `updated_at` in ascending + * order. In descending order updated records will move behind the cursor and could + * prevent some records from being returned. + * + * @return {Pager} A list of the the dunning_campaigns on an account. + */ + listDunningCampaigns(options?: object): Pager; + /** + * Show the settings for a dunning campaign + * + * API docs: https://developers.recurly.com/api/v2021-02-25#operation/get_dunning_campaign + * + * + * @param {string} dunningCampaignId - Dunning Campaign ID, e.g. `e28zov4fw0v2`. + * @return {Promise} Settings for a dunning campaign. + */ + getDunningCampaign(dunningCampaignId: string): Promise; + /** + * Assign a dunning campaign to multiple plans + * + * API docs: https://developers.recurly.com/api/v2021-02-25#operation/put_dunning_campaign_bulk_update + * + * + * @param {DunningCampaignsBulkUpdate} body - The object representing the JSON request to send to the server. It should conform to the schema of {DunningCampaignsBulkUpdate} + * @return {Promise} A list of updated plans. + */ + putDunningCampaignBulkUpdate(body: DunningCampaignsBulkUpdate): Promise; } diff --git a/lib/recurly/Client.js b/lib/recurly/Client.js index 8a92ef41..9c6d5d8f 100644 --- a/lib/recurly/Client.js +++ b/lib/recurly/Client.js @@ -4314,6 +4314,56 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`. path = this._interpolatePath(path, { 'export_date': exportDate }) return this._makeRequest('GET', path, null, options) } + + /** + * Show the dunning campaigns for a site + * + * API docs: {@link https://developers.recurly.com/api/v2021-02-25#operation/list_dunning_campaigns} + * + * + * @param {Object} options - Optional configurations for the request + * @param {Object} options.params - The optional url parameters for this request. + * @param {string} options.params.sort - Sort field. You *really* only want to sort by `updated_at` in ascending + * order. In descending order updated records will move behind the cursor and could + * prevent some records from being returned. + * + * @return {Pager} A list of the the dunning_campaigns on an account. + */ + listDunningCampaigns (options = {}) { + let path = '/dunning_campaigns' + path = this._interpolatePath(path) + return new Pager(this, path, options) + } + + /** + * Show the settings for a dunning campaign + * + * API docs: {@link https://developers.recurly.com/api/v2021-02-25#operation/get_dunning_campaign} + * + * + * @param {string} dunningCampaignId - Dunning Campaign ID, e.g. `e28zov4fw0v2`. + * @return {Promise} Settings for a dunning campaign. + */ + async getDunningCampaign (dunningCampaignId, options = {}) { + let path = '/dunning_campaigns/{dunning_campaign_id}' + path = this._interpolatePath(path, { 'dunning_campaign_id': dunningCampaignId }) + return this._makeRequest('GET', path, null, options) + } + + /** + * Assign a dunning campaign to multiple plans + * + * API docs: {@link https://developers.recurly.com/api/v2021-02-25#operation/put_dunning_campaign_bulk_update} + * + * + * @param {DunningCampaignsBulkUpdate} body - The object representing the JSON request to send to the server. It should conform to the schema of {DunningCampaignsBulkUpdate} + * @return {Promise} A list of updated plans. + */ + async putDunningCampaignBulkUpdate (body, options = {}) { + let path = '/dunning_campaigns/{dunning_campaign_id}/bulk_update' + path = this._interpolatePath(path) + return this._makeRequest('PUT', path, body, options) + } } module.exports = Client diff --git a/lib/recurly/resources/Account.js b/lib/recurly/resources/Account.js index ce91ef03..e5be6c43 100644 --- a/lib/recurly/resources/Account.js +++ b/lib/recurly/resources/Account.js @@ -21,6 +21,7 @@ const Resource = require('../Resource') * @prop {Date} createdAt - When the account was created. * @prop {Array.} customFields - The custom fields will only be altered when they are included in a request. Sending an empty array will not remove any existing values. To remove a field send the name with a null or empty value. * @prop {Date} deletedAt - If present, when the account was last marked inactive. + * @prop {string} dunningCampaignId - Unique ID to identify a dunning campaign. Available when the Dunning Campaigns feature is enabled. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. * @prop {string} email - The email address used for communicating with this customer. The customer will also use this email address to log into your hosted account management pages. This value does not need to be unique. * @prop {string} exemptionCertificate - The tax exemption certificate number for the account. If the merchant has an integration for the Vertex tax provider, this optional value will be sent in any tax calculation requests for the account. * @prop {string} firstName @@ -55,6 +56,7 @@ class Account extends Resource { createdAt: Date, customFields: ['CustomField'], deletedAt: Date, + dunningCampaignId: String, email: String, exemptionCertificate: String, firstName: String, diff --git a/lib/recurly/resources/AccountMini.js b/lib/recurly/resources/AccountMini.js index 41cacd81..d1b63eae 100644 --- a/lib/recurly/resources/AccountMini.js +++ b/lib/recurly/resources/AccountMini.js @@ -15,6 +15,7 @@ const Resource = require('../Resource') * @prop {string} billTo * @prop {string} code - The unique identifier of the account. * @prop {string} company + * @prop {string} dunningCampaignId - Unique ID to identify a dunning campaign. Available when the Dunning Campaigns feature is enabled. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. * @prop {string} email - The email address used for communicating with this customer. * @prop {string} firstName * @prop {string} id @@ -28,6 +29,7 @@ class AccountMini extends Resource { billTo: String, code: String, company: String, + dunningCampaignId: String, email: String, firstName: String, id: String, diff --git a/lib/recurly/resources/DunningCampaign.js b/lib/recurly/resources/DunningCampaign.js new file mode 100644 index 00000000..c6c826f7 --- /dev/null +++ b/lib/recurly/resources/DunningCampaign.js @@ -0,0 +1,43 @@ +/* istanbul ignore file */ +/** + * This file is automatically created by Recurly's OpenAPI generation process + * and thus any edits you make by hand will be lost. If you wish to make a + * change to this file, please create a Github issue explaining the changes you + * need and we will usher them to the appropriate places. + */ +'use strict' + +const Resource = require('../Resource') + +/** + * DunningCampaign + * @typedef {Object} DunningCampaign + * @prop {string} code - Campaign code. + * @prop {Date} createdAt - When the current campaign was created in Recurly. + * @prop {boolean} defaultCampaign - Whether or not this is the default campaign for accounts or plans without an assigned dunning campaign. + * @prop {Date} deletedAt - When the current campaign was deleted in Recurly. + * @prop {string} description - Campaign description. + * @prop {Array.} dunningCycles - Dunning Cycle settings. + * @prop {string} id + * @prop {string} name - Campaign name. + * @prop {string} object - Object type + * @prop {Date} updatedAt - When the current campaign was updated in Recurly. + */ +class DunningCampaign extends Resource { + static getSchema () { + return { + code: String, + createdAt: Date, + defaultCampaign: Boolean, + deletedAt: Date, + description: String, + dunningCycles: ['DunningCycle'], + id: String, + name: String, + object: String, + updatedAt: Date + } + } +} + +module.exports = DunningCampaign diff --git a/lib/recurly/resources/DunningCampaignsBulkUpdateResponse.js b/lib/recurly/resources/DunningCampaignsBulkUpdateResponse.js new file mode 100644 index 00000000..e72ef148 --- /dev/null +++ b/lib/recurly/resources/DunningCampaignsBulkUpdateResponse.js @@ -0,0 +1,27 @@ +/* istanbul ignore file */ +/** + * This file is automatically created by Recurly's OpenAPI generation process + * and thus any edits you make by hand will be lost. If you wish to make a + * change to this file, please create a Github issue explaining the changes you + * need and we will usher them to the appropriate places. + */ +'use strict' + +const Resource = require('../Resource') + +/** + * DunningCampaignsBulkUpdateResponse + * @typedef {Object} DunningCampaignsBulkUpdateResponse + * @prop {string} object - Object type + * @prop {Array.} plans - An array containing all of the `Plan` resources that have been updated. + */ +class DunningCampaignsBulkUpdateResponse extends Resource { + static getSchema () { + return { + object: String, + plans: ['Plan'] + } + } +} + +module.exports = DunningCampaignsBulkUpdateResponse diff --git a/lib/recurly/resources/DunningCycle.js b/lib/recurly/resources/DunningCycle.js new file mode 100644 index 00000000..1ee4753b --- /dev/null +++ b/lib/recurly/resources/DunningCycle.js @@ -0,0 +1,47 @@ +/* istanbul ignore file */ +/** + * This file is automatically created by Recurly's OpenAPI generation process + * and thus any edits you make by hand will be lost. If you wish to make a + * change to this file, please create a Github issue explaining the changes you + * need and we will usher them to the appropriate places. + */ +'use strict' + +const Resource = require('../Resource') + +/** + * DunningCycle + * @typedef {Object} DunningCycle + * @prop {boolean} appliesToManualTrial - Whether the dunning settings will be applied to manual trials. Only applies to trial cycles. + * @prop {Date} createdAt - When the current settings were created in Recurly. + * @prop {boolean} expireSubscription - Whether the subscription(s) should be cancelled at the end of the dunning cycle. + * @prop {boolean} failInvoice - Whether the invoice should be failed at the end of the dunning cycle. + * @prop {number} firstCommunicationInterval - The number of days after a transaction failure before the first dunning email is sent. + * @prop {Array.} intervals - Dunning intervals. + * @prop {boolean} sendImmediatelyOnHardDecline - Whether or not to send an extra email immediately to customers whose initial payment attempt fails with either a hard decline or invalid billing info. + * @prop {number} totalDunningDays - The number of days between the first dunning email being sent and the end of the dunning cycle. + * @prop {number} totalRecyclingDays - The number of days between a transaction failure and the end of the dunning cycle. + * @prop {string} type - The type of invoice this cycle applies to. + * @prop {Date} updatedAt - When the current settings were updated in Recurly. + * @prop {number} version - Current campaign version. + */ +class DunningCycle extends Resource { + static getSchema () { + return { + appliesToManualTrial: Boolean, + createdAt: Date, + expireSubscription: Boolean, + failInvoice: Boolean, + firstCommunicationInterval: Number, + intervals: ['DunningInterval'], + sendImmediatelyOnHardDecline: Boolean, + totalDunningDays: Number, + totalRecyclingDays: Number, + type: String, + updatedAt: Date, + version: Number + } + } +} + +module.exports = DunningCycle diff --git a/lib/recurly/resources/DunningInterval.js b/lib/recurly/resources/DunningInterval.js new file mode 100644 index 00000000..f60809ca --- /dev/null +++ b/lib/recurly/resources/DunningInterval.js @@ -0,0 +1,27 @@ +/* istanbul ignore file */ +/** + * This file is automatically created by Recurly's OpenAPI generation process + * and thus any edits you make by hand will be lost. If you wish to make a + * change to this file, please create a Github issue explaining the changes you + * need and we will usher them to the appropriate places. + */ +'use strict' + +const Resource = require('../Resource') + +/** + * DunningInterval + * @typedef {Object} DunningInterval + * @prop {number} days - Number of days before sending the next email. + * @prop {string} emailTemplate - Email template being used. + */ +class DunningInterval extends Resource { + static getSchema () { + return { + days: Number, + emailTemplate: String + } + } +} + +module.exports = DunningInterval diff --git a/lib/recurly/resources/Invoice.js b/lib/recurly/resources/Invoice.js index 4b8dee46..531b1ad9 100644 --- a/lib/recurly/resources/Invoice.js +++ b/lib/recurly/resources/Invoice.js @@ -24,6 +24,7 @@ const Resource = require('../Resource') * @prop {string} customerNotes - This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. * @prop {number} discount - Total discounts applied to this invoice. * @prop {Date} dueAt - Date invoice is due. This is the date the net terms are reached. + * @prop {string} dunningCampaignId - Unique ID to identify the dunning campaign used when dunning the invoice. Available when the Dunning Campaigns feature is enabled. For sites without multiple dunning campaigns enabled, this will always be the default dunning campaign. * @prop {boolean} hasMoreLineItems - Identifies if the invoice has more line items than are returned in `line_items`. If `has_more_line_items` is `true`, then a request needs to be made to the `list_invoice_line_items` endpoint. * @prop {string} id - Invoice ID * @prop {Array.} lineItems - Line Items @@ -64,6 +65,7 @@ class Invoice extends Resource { customerNotes: String, discount: Number, dueAt: Date, + dunningCampaignId: String, hasMoreLineItems: Boolean, id: String, lineItems: ['LineItem'], diff --git a/lib/recurly/resources/Plan.js b/lib/recurly/resources/Plan.js index f98f08b3..14713a57 100644 --- a/lib/recurly/resources/Plan.js +++ b/lib/recurly/resources/Plan.js @@ -22,6 +22,7 @@ const Resource = require('../Resource') * @prop {Array.} currencies - Pricing * @prop {Date} deletedAt - Deleted at * @prop {string} description - Optional description, not displayed. + * @prop {string} dunningCampaignId - Unique ID to identify a dunning campaign. Available when the Dunning Campaigns feature is enabled. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. * @prop {PlanHostedPages} hostedPages - Hosted pages settings * @prop {string} id - Plan ID * @prop {number} intervalLength - Length of the plan's billing interval in `interval_unit`. @@ -53,6 +54,7 @@ class Plan extends Resource { currencies: ['PlanPricing'], deletedAt: Date, description: String, + dunningCampaignId: String, hostedPages: 'PlanHostedPages', id: String, intervalLength: Number, diff --git a/lib/recurly/resources/index.js b/lib/recurly/resources/index.js index 2b6ea4df..12f02d3d 100644 --- a/lib/recurly/resources/index.js +++ b/lib/recurly/resources/index.js @@ -74,3 +74,7 @@ module.exports.Usage = require('./Usage') module.exports.ExportDates = require('./ExportDates') module.exports.ExportFiles = require('./ExportFiles') module.exports.ExportFile = require('./ExportFile') +module.exports.DunningCampaign = require('./DunningCampaign') +module.exports.DunningCycle = require('./DunningCycle') +module.exports.DunningInterval = require('./DunningInterval') +module.exports.DunningCampaignsBulkUpdateResponse = require('./DunningCampaignsBulkUpdateResponse') diff --git a/openapi/api.yaml b/openapi/api.yaml index 87aa1ae1..554267c3 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -219,6 +219,7 @@ x-tagGroups: - site - custom_field_definition - shipping_method + - dunning_campaigns tags: - name: site x-displayName: Site @@ -332,6 +333,9 @@ tags: - name: automated_exports x-displayName: Automated Exports description: Automated exports of customer data. +- name: dunning_campaigns + x-displayName: Dunning Campaigns + description: Settings used when attempting to dun customers whose payments are declined. paths: "/sites": get: @@ -14432,6 +14436,107 @@ paths: err.(*recurly.Error); ok {\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfor _, file := range exportFiles.Files {\n\tfmt.Println(\"Export file download URL: \", file.Href)\n}" + "/dunning_campaigns": + get: + tags: + - dunning_campaigns + operationId: list_dunning_campaigns + summary: Show the dunning campaigns for a site + description: See the [Pagination Guide](/guides/pagination.html) to learn how + to use pagination in the API and Client Libraries. + parameters: + - "$ref": "#/components/parameters/sort_dates" + responses: + '200': + description: A list of the the dunning_campaigns on an account. + content: + application/json: + schema: + "$ref": "#/components/schemas/DunningCampaignList" + '404': + description: Incorrect site. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] + "/dunning_campaigns/{dunning_campaign_id}": + parameters: + - "$ref": "#/components/parameters/dunning_campaign_id" + get: + tags: + - dunning_campaigns + operationId: get_dunning_campaign + summary: Show the settings for a dunning campaign + responses: + '200': + description: Settings for a dunning campaign. + content: + application/json: + schema: + "$ref": "#/components/schemas/DunningCampaign" + '400': + description: Bad request; perhaps missing or invalid parameters. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '404': + description: Incorrect site or campaign ID. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] + "/dunning_campaigns/{dunning_campaign_id}/bulk_update": + put: + tags: + - dunning_campaigns + operationId: put_dunning_campaign_bulk_update + summary: Assign a dunning campaign to multiple plans + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/DunningCampaignsBulkUpdate" + responses: + '200': + description: A list of updated plans. + content: + application/json: + schema: + "$ref": "#/components/schemas/DunningCampaignsBulkUpdateResponse" + '400': + description: Bad request; perhaps missing or invalid parameters. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '404': + description: Incorrect site or campaign ID. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] servers: - url: https://v3.recurly.com components: @@ -14575,6 +14680,13 @@ components: required: true schema: type: string + dunning_campaign_id: + name: dunning_campaign_id + in: path + description: Dunning Campaign ID, e.g. `e28zov4fw0v2`. + required: true + schema: + type: string ids: name: ids in: query @@ -15324,6 +15436,14 @@ components: created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" + dunning_campaign_id: + type: string + title: Dunning Campaign ID + description: Unique ID to identify a dunning campaign. Available when the + Dunning Campaigns feature is enabled. Used to specify if a non-default + dunning campaign should be assigned to this account. For sites without + multiple dunning campaigns enabled, the default dunning campaign will + always be used. address: "$ref": "#/components/schemas/Address" billing_info: @@ -15394,6 +15514,14 @@ components: specifically whether the account is self-paying or will rely on the parent account to pay. "$ref": "#/components/schemas/BillToEnum" + dunning_campaign_id: + type: string + title: Dunning Campaign ID + description: Unique ID to identify a dunning campaign. Available when the + Dunning Campaigns feature is enabled. Used to specify if a non-default + dunning campaign should be assigned to this account. For sites without + multiple dunning campaigns enabled, the default dunning campaign will + always be used. address: "$ref": "#/components/schemas/Address" billing_info: @@ -15459,6 +15587,14 @@ components: bill_to: type: string maxLength: 6 + dunning_campaign_id: + type: string + title: Dunning Campaign ID + description: Unique ID to identify a dunning campaign. Available when the + Dunning Campaigns feature is enabled. Used to specify if a non-default + dunning campaign should be assigned to this account. For sites without + multiple dunning campaigns enabled, the default dunning campaign will + always be used. AccountBalance: type: object properties: @@ -17375,6 +17511,13 @@ components: format: date-time title: Closed at description: Date invoice was marked paid or failed. + dunning_campaign_id: + type: string + title: Dunning Campaign ID + description: Unique ID to identify the dunning campaign used when dunning + the invoice. Available when the Dunning Campaigns feature is enabled. + For sites without multiple dunning campaigns enabled, this will always + be the default dunning campaign. InvoiceCreate: type: object properties: @@ -18287,6 +18430,14 @@ components: Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. + dunning_campaign_id: + type: string + title: Dunning Campaign ID + description: Unique ID to identify a dunning campaign. Available when the + Dunning Campaigns feature is enabled. Used to specify if a non-default + dunning campaign should be assigned to this plan. For sites without multiple + dunning campaigns enabled, the default dunning campaign will always be + used. created_at: type: string format: date-time @@ -18443,6 +18594,14 @@ components: Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. + dunning_campaign_id: + type: string + title: Dunning Campaign ID + description: Unique ID to identify a dunning campaign. Available when the + Dunning Campaigns feature is enabled. Used to specify if a non-default + dunning campaign should be assigned to this plan. For sites without multiple + dunning campaigns enabled, the default dunning campaign will always be + used. required: - code - name @@ -18619,6 +18778,14 @@ components: Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. + dunning_campaign_id: + type: string + title: Dunning Campaign ID + description: Unique ID to identify a dunning campaign. Available when the + Dunning Campaigns feature is enabled. Used to specify if a non-default + dunning campaign should be assigned to this plan. For sites without multiple + dunning campaigns enabled, the default dunning campaign will always be + used. AddOnPricing: type: object properties: @@ -20803,6 +20970,150 @@ components: required: - currency - account + DunningCampaign: + type: object + description: Settings for a dunning campaign. + properties: + id: + type: string + object: + type: string + title: Object type + code: + type: string + description: Campaign code. + name: + type: string + description: Campaign name. + description: + type: string + description: Campaign description. + default_campaign: + type: boolean + description: Whether or not this is the default campaign for accounts or + plans without an assigned dunning campaign. + dunning_cycles: + type: array + description: Dunning Cycle settings. + items: + "$ref": "#/components/schemas/DunningCycle" + created_at: + type: string + format: date-time + description: When the current campaign was created in Recurly. + updated_at: + type: string + format: date-time + description: When the current campaign was updated in Recurly. + deleted_at: + type: string + format: date-time + description: When the current campaign was deleted in Recurly. + DunningCampaignList: + type: object + properties: + object: + type: string + title: Object type + description: Will always be List. + has_more: + type: boolean + description: Indicates there are more results on subsequent pages. + next: + type: string + description: Path to subsequent page of results. + data: + type: array + items: + "$ref": "#/components/schemas/DunningCampaign" + DunningCycle: + type: object + properties: + type: + "$ref": "#/components/schemas/DunningCycleTypeEnum" + applies_to_manual_trial: + type: boolean + description: Whether the dunning settings will be applied to manual trials. + Only applies to trial cycles. + first_communication_interval: + type: integer + description: The number of days after a transaction failure before the first + dunning email is sent. + send_immediately_on_hard_decline: + type: boolean + description: Whether or not to send an extra email immediately to customers + whose initial payment attempt fails with either a hard decline or invalid + billing info. + intervals: + type: array + description: Dunning intervals. + items: + "$ref": "#/components/schemas/DunningInterval" + expire_subscription: + type: boolean + description: Whether the subscription(s) should be cancelled at the end + of the dunning cycle. + fail_invoice: + type: boolean + description: Whether the invoice should be failed at the end of the dunning + cycle. + total_dunning_days: + type: integer + description: The number of days between the first dunning email being sent + and the end of the dunning cycle. + total_recycling_days: + type: integer + description: The number of days between a transaction failure and the end + of the dunning cycle. + version: + type: integer + description: Current campaign version. + created_at: + type: string + format: date-time + description: When the current settings were created in Recurly. + updated_at: + type: string + format: date-time + description: When the current settings were updated in Recurly. + DunningInterval: + properties: + days: + type: integer + description: Number of days before sending the next email. + email_template: + type: string + description: Email template being used. + DunningCampaignsBulkUpdate: + properties: + plan_codes: + type: array + maxItems: 200 + description: List of `plan_codes` associated with the Plans for which the + dunning campaign should be updated. Required unless `plan_ids` is present. + items: + type: string + plan_ids: + type: array + maxItems: 200 + description: List of `plan_ids` associated with the Plans for which the + dunning campaign should be updated. Required unless `plan_codes` is present. + items: + type: string + DunningCampaignsBulkUpdateResponse: + properties: + object: + type: string + title: Object type + readOnly: true + plans: + type: array + title: Plans + description: An array containing all of the `Plan` resources that have been + updated. + maxItems: 200 + items: + "$ref": "#/components/schemas/Plan" PaymentMethod: properties: object: @@ -21442,6 +21753,7 @@ components: - Union Pay - Unknown - Visa + - Tarjeta Naranja AccountTypeEnum: type: string enum: @@ -21655,3 +21967,10 @@ components: enum: - cpf - cuit + DunningCycleTypeEnum: + type: string + description: The type of invoice this cycle applies to. + enum: + - automatic + - manual + - trial diff --git a/package-lock.json b/package-lock.json index 91fb3fe9..fdb4d37b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "recurly", - "version": "4.6.0", + "version": "4.7.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "recurly", - "version": "4.6.0", + "version": "4.7.0", "license": "MIT", "devDependencies": { "@types/node": "^12.11.1",