Skip to content

Commit

Permalink
Merge pull request #215 from recurly/v3-v2021-02-25-1630516702
Browse files Browse the repository at this point in the history
Generated Latest Changes for v2021-02-25 (Dunning Campaigns feature)
  • Loading branch information
amandamfielding authored Sep 1, 2021
2 parents d24df17 + ed9a2d5 commit d0b156a
Show file tree
Hide file tree
Showing 13 changed files with 727 additions and 2 deletions.
200 changes: 200 additions & 0 deletions lib/recurly.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/**
Expand Down Expand Up @@ -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;

}

Expand Down Expand Up @@ -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;

}

Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
/**
Expand Down Expand Up @@ -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;
/**
Expand Down Expand Up @@ -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;

}

Expand Down Expand Up @@ -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;

}

Expand Down Expand Up @@ -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;
/**
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -8407,6 +8572,41 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`.
* @return {Promise<ExportFiles>} Returns a list of export files to download.
*/
getExportFiles(exportDate: string): Promise<ExportFiles>;
/**
* 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<DunningCampaign>} A list of the the dunning_campaigns on an account.
*/
listDunningCampaigns(options?: object): Pager<DunningCampaign>;
/**
* 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<DunningCampaign>} Settings for a dunning campaign.
*/
getDunningCampaign(dunningCampaignId: string): Promise<DunningCampaign>;
/**
* 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<DunningCampaignsBulkUpdateResponse>} A list of updated plans.
*/
putDunningCampaignBulkUpdate(body: DunningCampaignsBulkUpdate): Promise<DunningCampaignsBulkUpdateResponse>;

}

Expand Down
50 changes: 50 additions & 0 deletions lib/recurly/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<DunningCampaign>} 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<DunningCampaign>} 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<DunningCampaignsBulkUpdateResponse>} 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
2 changes: 2 additions & 0 deletions lib/recurly/resources/Account.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const Resource = require('../Resource')
* @prop {Date} createdAt - When the account was created.
* @prop {Array.<CustomField>} 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
Expand Down Expand Up @@ -55,6 +56,7 @@ class Account extends Resource {
createdAt: Date,
customFields: ['CustomField'],
deletedAt: Date,
dunningCampaignId: String,
email: String,
exemptionCertificate: String,
firstName: String,
Expand Down
2 changes: 2 additions & 0 deletions lib/recurly/resources/AccountMini.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,6 +29,7 @@ class AccountMini extends Resource {
billTo: String,
code: String,
company: String,
dunningCampaignId: String,
email: String,
firstName: String,
id: String,
Expand Down
Loading

0 comments on commit d0b156a

Please sign in to comment.