Skip to content

Commit

Permalink
Merge pull request #309 from recurly/v3-v2021-02-25-5146870733
Browse files Browse the repository at this point in the history
Generated Latest Changes for v2021-02-25 (Multiple Business Entities)
  • Loading branch information
csampson authored Jun 1, 2023
2 parents 47dbb7f + f9c509f commit cda7e00
Show file tree
Hide file tree
Showing 8 changed files with 460 additions and 2 deletions.
129 changes: 129 additions & 0 deletions lib/recurly.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ export declare class Account {
* 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.
*/
email?: string | null;
/**
* Unique ID to identify the business entity assigned to the account. Available when the `Multiple Business Entities` feature is enabled.
*/
overrideBusinessEntityId?: string | null;
/**
* Used to determine the language and locale of emails sent on behalf of the merchant to the customer.
*/
Expand Down Expand Up @@ -1484,6 +1488,10 @@ export declare class Invoice {
* Last communication attempt.
*/
finalDunningEvent?: boolean | null;
/**
* Unique ID to identify the business entity assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled.
*/
businessEntityId?: string | null;

}

Expand Down Expand Up @@ -3448,6 +3456,54 @@ export declare class GrantedBy {

}

export declare class BusinessEntity {
/**
* Business entity ID
*/
id?: string | null;
/**
* Object type
*/
object?: string | null;
/**
* The entity code of the business entity.
*/
code?: string | null;
/**
* This name describes your business entity and will appear on the invoice.
*/
name?: string | null;
/**
* Address information for the business entity that will appear on the invoice.
*/
invoiceDisplayAddress?: Address | null;
/**
* Address information for the business entity that will be used for calculating taxes.
*/
taxAddress?: Address | null;
/**
* VAT number for the customer used on the invoice.
*/
defaultVatNumber?: string | null;
/**
* Registration number for the customer used on the invoice.
*/
defaultRegistrationNumber?: string | null;
/**
* List of countries for which the business entity will be used.
*/
subscriberLocationCountries?: string[] | null;
/**
* Created at
*/
createdAt?: Date | null;
/**
* Last updated at
*/
updatedAt?: Date | null;

}

export declare class GiftCard {
/**
* Gift card ID
Expand Down Expand Up @@ -3615,6 +3671,10 @@ export interface AccountCreate {
* 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.
*/
exemptionCertificate?: string | null;
/**
* Unique ID to identify the business entity assigned to the account. Available when the `Multiple Business Entities` feature is enabled.
*/
overrideBusinessEntityId?: string | null;
/**
* The account code of the parent account to be associated with this account. Passing an empty value removes any existing parent association from this account. If both `parent_account_code` and `parent_account_id` are passed, the non-blank value in `parent_account_id` will be used. Only one level of parent child relationship is allowed. You cannot assign a parent account that itself has a parent account.
*/
Expand Down Expand Up @@ -3940,6 +4000,10 @@ export interface AccountUpdate {
* 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.
*/
exemptionCertificate?: string | null;
/**
* Unique ID to identify the business entity assigned to the account. Available when the `Multiple Business Entities` feature is enabled.
*/
overrideBusinessEntityId?: string | null;
/**
* The account code of the parent account to be associated with this account. Passing an empty value removes any existing parent association from this account. If both `parent_account_code` and `parent_account_id` are passed, the non-blank value in `parent_account_id` will be used. Only one level of parent child relationship is allowed. You cannot assign a parent account that itself has a parent account.
*/
Expand Down Expand Up @@ -5822,6 +5886,10 @@ export interface AccountPurchase {
* 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.
*/
exemptionCertificate?: string | null;
/**
* Unique ID to identify the business entity assigned to the account. Available when the `Multiple Business Entities` feature is enabled.
*/
overrideBusinessEntityId?: string | null;
/**
* The account code of the parent account to be associated with this account. Passing an empty value removes any existing parent association from this account. If both `parent_account_code` and `parent_account_id` are passed, the non-blank value in `parent_account_id` will be used. Only one level of parent child relationship is allowed. You cannot assign a parent account that itself has a parent account.
*/
Expand Down Expand Up @@ -10174,6 +10242,25 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`.
* @return {Pager<ExternalSubscription>} A list of the the external_subscriptions on an account.
*/
listAccountExternalSubscriptions(accountId: string, options?: object): Pager<ExternalSubscription>;
/**
* Fetch a business entity
*
* API docs: https://developers.recurly.com/api/v2021-02-25#operation/get_business_entity
*
*
* @param {string} businessEntityId - Business Entity ID. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-entity1`.
* @return {Promise<BusinessEntity>} Business entity details
*/
getBusinessEntity(businessEntityId: string): Promise<BusinessEntity>;
/**
* List business entities
*
* API docs: https://developers.recurly.com/api/v2021-02-25#operation/list_business_entities
*
*
* @return {Pager<BusinessEntity>} List of all business entities on your site.
*/
listBusinessEntities(options?: object): Pager<BusinessEntity>;
/**
* List gift cards
*
Expand Down Expand Up @@ -10224,6 +10311,48 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`.
* @return {Promise<GiftCard>} Redeems and returns the gift card
*/
redeemGiftCard(redemptionCode: string, body: GiftCardRedeem): Promise<GiftCard>;
/**
* List a business entity's invoices
*
* API docs: https://developers.recurly.com/api/v2021-02-25#operation/list_business_entity_invoices
*
*
* @param {string} businessEntityId - Business Entity ID. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-entity1`.
* @param {Object} options - Optional configurations for the request
* @param {Object} options.params - The optional url parameters for this request.
* @param {string[]} options.params.ids - Filter results by their IDs. Up to 200 IDs can be passed at once using
* commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`.
*
* **Important notes:**
*
* * The `ids` parameter cannot be used with any other ordering or filtering
* parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc)
* * Invalid or unknown IDs will be ignored, so you should check that the
* results correspond to your request.
* * Records are returned in an arbitrary order. Since results are all
* returned at once you can sort the records yourself.
*
* @param {number} options.params.limit - Limit number of records 1-200.
* @param {string} options.params.order - Sort order.
* @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.
*
* @param {Date} options.params.beginTime - Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`.
* **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
*
* @param {Date} options.params.endTime - Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`.
* **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
*
* @param {string} options.params.type - Filter by type when:
* - `type=charge`, only charge invoices will be returned.
* - `type=credit`, only credit invoices will be returned.
* - `type=non-legacy`, only charge and credit invoices will be returned.
* - `type=legacy`, only legacy invoices will be returned.
*
* @return {Pager<Invoice>} A list of the business entity's invoices.
*/
listBusinessEntityInvoices(businessEntityId: string, options?: object): Pager<Invoice>;

}

Expand Down
76 changes: 76 additions & 0 deletions lib/recurly/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -4949,6 +4949,35 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`.
return new Pager(this, path, options)
}

/**
* Fetch a business entity
*
* API docs: {@link https://developers.recurly.com/api/v2021-02-25#operation/get_business_entity}
*
*
* @param {string} businessEntityId - Business Entity ID. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-entity1`.
* @return {Promise<BusinessEntity>} Business entity details
*/
async getBusinessEntity (businessEntityId, options = {}) {
let path = '/business_entities/{business_entity_id}'
path = this._interpolatePath(path, { 'business_entity_id': businessEntityId })
return this._makeRequest('GET', path, null, options)
}

/**
* List business entities
*
* API docs: {@link https://developers.recurly.com/api/v2021-02-25#operation/list_business_entities}
*
*
* @return {Pager<BusinessEntity>} List of all business entities on your site.
*/
listBusinessEntities (options = {}) {
let path = '/business_entities'
path = this._interpolatePath(path)
return new Pager(this, path, options)
}

/**
* List gift cards
*
Expand Down Expand Up @@ -5023,6 +5052,53 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`.
path = this._interpolatePath(path, { 'redemption_code': redemptionCode })
return this._makeRequest('POST', path, body, options)
}

/**
* List a business entity's invoices
*
* API docs: {@link https://developers.recurly.com/api/v2021-02-25#operation/list_business_entity_invoices}
*
*
* @param {string} businessEntityId - Business Entity ID. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-entity1`.
* @param {Object} options - Optional configurations for the request
* @param {Object} options.params - The optional url parameters for this request.
* @param {Array.<string>} options.params.ids - Filter results by their IDs. Up to 200 IDs can be passed at once using
* commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`.
*
* **Important notes:**
*
* * The `ids` parameter cannot be used with any other ordering or filtering
* parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc)
* * Invalid or unknown IDs will be ignored, so you should check that the
* results correspond to your request.
* * Records are returned in an arbitrary order. Since results are all
* returned at once you can sort the records yourself.
*
* @param {number} options.params.limit - Limit number of records 1-200.
* @param {string} options.params.order - Sort order.
* @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.
*
* @param {Date} options.params.beginTime - Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`.
* **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
*
* @param {Date} options.params.endTime - Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`.
* **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
*
* @param {string} options.params.type - Filter by type when:
* - `type=charge`, only charge invoices will be returned.
* - `type=credit`, only credit invoices will be returned.
* - `type=non-legacy`, only charge and credit invoices will be returned.
* - `type=legacy`, only legacy invoices will be returned.
*
* @return {Pager<Invoice>} A list of the business entity's invoices.
*/
listBusinessEntityInvoices (businessEntityId, options = {}) {
let path = '/business_entities/{business_entity_id}/invoices'
path = this._interpolatePath(path, { 'business_entity_id': businessEntityId })
return new Pager(this, path, 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 @@ -37,6 +37,7 @@ const Resource = require('../Resource')
* @prop {string} invoiceTemplateId - Unique ID to identify an invoice template. Available when the site is on a Pro or Enterprise plan. Used to specify if a non-default invoice template will be used to generate invoices for the account. For sites without multiple invoice templates enabled, the default template will always be used.
* @prop {string} lastName
* @prop {string} object - Object type
* @prop {string} overrideBusinessEntityId - Unique ID to identify the business entity assigned to the account. Available when the `Multiple Business Entities` feature is enabled.
* @prop {string} parentAccountId - The UUID of the parent account associated with this account.
* @prop {string} preferredLocale - Used to determine the language and locale of emails sent on behalf of the merchant to the customer.
* @prop {string} preferredTimeZone - The [IANA time zone name](https://docs.recurly.com/docs/email-time-zones-and-time-stamps#supported-api-iana-time-zone-names) used to determine the time zone of emails sent on behalf of the merchant to the customer.
Expand Down Expand Up @@ -75,6 +76,7 @@ class Account extends Resource {
invoiceTemplateId: String,
lastName: String,
object: String,
overrideBusinessEntityId: String,
parentAccountId: String,
preferredLocale: String,
preferredTimeZone: String,
Expand Down
45 changes: 45 additions & 0 deletions lib/recurly/resources/BusinessEntity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* 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')

/**
* BusinessEntity
* @typedef {Object} BusinessEntity
* @prop {string} code - The entity code of the business entity.
* @prop {Date} createdAt - Created at
* @prop {string} defaultRegistrationNumber - Registration number for the customer used on the invoice.
* @prop {string} defaultVatNumber - VAT number for the customer used on the invoice.
* @prop {string} id - Business entity ID
* @prop {Address} invoiceDisplayAddress - Address information for the business entity that will appear on the invoice.
* @prop {string} name - This name describes your business entity and will appear on the invoice.
* @prop {string} object - Object type
* @prop {Array.<string>} subscriberLocationCountries - List of countries for which the business entity will be used.
* @prop {Address} taxAddress - Address information for the business entity that will be used for calculating taxes.
* @prop {Date} updatedAt - Last updated at
*/
class BusinessEntity extends Resource {
static getSchema () {
return {
code: String,
createdAt: Date,
defaultRegistrationNumber: String,
defaultVatNumber: String,
id: String,
invoiceDisplayAddress: 'Address',
name: String,
object: String,
subscriberLocationCountries: Array,
taxAddress: 'Address',
updatedAt: Date
}
}
}

module.exports = BusinessEntity
2 changes: 2 additions & 0 deletions lib/recurly/resources/Invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const Resource = require('../Resource')
* @prop {InvoiceAddress} address
* @prop {number} balance - The outstanding balance remaining on this invoice.
* @prop {string} billingInfoId - The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature.
* @prop {string} businessEntityId - Unique ID to identify the business entity assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled.
* @prop {Date} closedAt - Date invoice was marked paid or failed.
* @prop {string} collectionMethod - An automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment.
* @prop {Date} createdAt - Created at
Expand Down Expand Up @@ -61,6 +62,7 @@ class Invoice extends Resource {
address: 'InvoiceAddress',
balance: Number,
billingInfoId: String,
businessEntityId: String,
closedAt: Date,
collectionMethod: String,
createdAt: Date,
Expand Down
1 change: 1 addition & 0 deletions lib/recurly/resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,6 @@ module.exports.Entitlements = require('./Entitlements')
module.exports.Entitlement = require('./Entitlement')
module.exports.CustomerPermission = require('./CustomerPermission')
module.exports.GrantedBy = require('./GrantedBy')
module.exports.BusinessEntity = require('./BusinessEntity')
module.exports.GiftCard = require('./GiftCard')
module.exports.GiftCardDelivery = require('./GiftCardDelivery')
Loading

0 comments on commit cda7e00

Please sign in to comment.