diff --git a/lib/recurly.d.ts b/lib/recurly.d.ts index 123b3733..7009d258 100644 --- a/lib/recurly.d.ts +++ b/lib/recurly.d.ts @@ -701,10 +701,18 @@ export declare class Transaction { * Account mini details */ account?: AccountMini | null; + /** + * Must be sent for one-time transactions in order to provide context on which entity is submitting the transaction to ensure proper fraud checks are observed, such as 3DS. If the customer is in session, send `customer`. If this is a merchant initiated one-time transaction, send `merchant`. + */ + indicator?: string | null; /** * Invoice mini details */ invoice?: InvoiceMini | null; + /** + * This conditional parameter is useful for merchants in specific industries who need to submit one-time Merchant Initiated transactions in specific cases. Not all gateways support these methods, but will support a generic one-time Merchant Initiated transaction. Only use this if the initiator value is "merchant". Otherwise, it will be ignored. - Incremental: Send `incremental` with an additional purchase if the original authorization amount is not sufficient to cover the costs of your service or product. For example, if the customer adds goods or services or there are additional expenses. - No Show: Send `no_show` if you charge customers a fee due to an agreed-upon cancellation policy in your industry. - Resubmission: Send `resubmission` if you need to attempt collection on a declined transaction. You may also use the force collection behavior which has the same effect. - Service Extension: Send `service_extension` if you are in a service industry and the customer has increased/extended their service in some way. For example: adding a day onto a car rental agreement. - Split Shipment: Send `split_shipment` if you sell physical product and need to split up a shipment into multiple transactions when the customer is no longer in session. - Top Up: Send `top_up` if you process one-time transactions based on a pre-arranged agreement with your customer where there is a pre-arranged account balance that needs maintaining. For example, if the customer has agreed to maintain an account balance of 30.00 and their current balance is 20.00, the MIT amount would be at least 10.00 to meet that 30.00 threshold. + */ + merchantReasonCode?: string | null; /** * Invoice mini details */ @@ -2246,6 +2254,10 @@ export declare class Subscription { * The invoice ID of the latest invoice created for an active subscription. */ activeInvoiceId?: string | null; + /** + * The ID of the business entity associated with the subscription. This will be `null` if the subscription relies on resolving the business entity during renewal. + */ + businessEntityId?: string | null; /** * Whether the subscription was started with a gift certificate. */ @@ -2409,6 +2421,10 @@ export declare class SubscriptionChange { * Invoice Collection */ invoiceCollection?: InvoiceCollection | null; + /** + * Business entity details + */ + businessEntity?: BusinessEntityMini | null; /** * 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. */ @@ -2592,6 +2608,26 @@ export declare class SubscriptionAddOnPercentageTier { } +export declare class BusinessEntityMini { + /** + * 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; + +} + export declare class SubscriptionChangeBillingInfo { /** * A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge. @@ -4079,7 +4115,7 @@ export interface ExternalAccountCreate { */ externalAccountCode?: string | null; /** - * Represents the connection type. `AppleAppStore` or `GooglePlayStore` + * Represents the connection type. One of the connection types of your enabled App Connectors */ externalConnectionType?: string | null; @@ -4428,7 +4464,7 @@ export interface ExternalAccountUpdate { */ externalAccountCode?: string | null; /** - * Represents the connection type. `AppleAppStore` or `GooglePlayStore` + * Represents the connection type. One of the connection types of your enabled App Connectors */ externalConnectionType?: string | null; @@ -4439,6 +4475,14 @@ export interface InvoiceCreate { * 3-letter ISO 4217 currency code. */ currency?: string | null; + /** + * The `business_entity_id` is the value that represents a specific business entity for an end customer which will be assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. + */ + businessEntityId?: string | null; + /** + * The `business_entity_code` is the value that represents a specific business entity for an end customer which will be assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. + */ + businessEntityCode?: string | null; /** * 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. */ @@ -4978,7 +5022,14 @@ export interface ExternalProductReferenceBase { * A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. */ referenceCode?: string | null; - externalConnectionType?: string | null; + /** + * Represents the connection type. One of the connection types of your enabled App Connectors + */ + externalConnectionType?: ExternalProductReferenceConnectionType | null; + +} + +export interface ExternalProductReferenceConnectionType { } @@ -4995,7 +5046,129 @@ export interface ExternalProductReferenceCreate { * A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. */ referenceCode?: string | null; - externalConnectionType?: string | null; + /** + * Represents the connection type. One of the connection types of your enabled App Connectors + */ + externalConnectionType?: ExternalProductReferenceConnectionType | null; + +} + +export interface ExternalSubscriptionCreate { + account?: AccountExternalSubscription | null; + externalProductReference?: ExternalProductReferenceCreate | null; + /** + * Id of the subscription in the external system, i.e. Apple App Store or Google Play Store. + */ + externalId?: string | null; + /** + * When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade. + */ + lastPurchased?: Date | null; + /** + * An indication of whether or not the external subscription will auto-renew at the expiration date. + */ + autoRenew?: boolean | null; + /** + * External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused. + */ + state?: string | null; + /** + * Identifier of the app that generated the external subscription. + */ + appIdentifier?: string | null; + /** + * An indication of the quantity of a subscribed item's quantity. + */ + quantity?: number | null; + /** + * When the external subscription was activated in the external platform. + */ + activatedAt?: Date | null; + /** + * When the external subscription expires in the external platform. + */ + expiresAt?: Date | null; + /** + * When the external subscription trial period started in the external platform. + */ + trialStartedAt?: Date | null; + /** + * When the external subscription trial period ends in the external platform. + */ + trialEndsAt?: Date | null; + /** + * An indication of whether or not the external subscription was being created by a historical data import. + */ + imported?: boolean | null; + +} + +export interface AccountExternalSubscription { + /** + * The account code of a new or existing account to be used when creating the external subscription. + */ + accountCode?: string | null; + +} + +export interface ExternalSubscriptionUpdate { + externalProductReference?: ExternalProductReferenceUpdate | null; + /** + * Id of the subscription in the external system, i.e. Apple App Store or Google Play Store. + */ + externalId?: string | null; + /** + * When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade. + */ + lastPurchased?: Date | null; + /** + * An indication of whether or not the external subscription will auto-renew at the expiration date. + */ + autoRenew?: boolean | null; + /** + * External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused. + */ + state?: string | null; + /** + * Identifier of the app that generated the external subscription. + */ + appIdentifier?: string | null; + /** + * An indication of the quantity of a subscribed item's quantity. + */ + quantity?: number | null; + /** + * When the external subscription was activated in the external platform. + */ + activatedAt?: Date | null; + /** + * When the external subscription expires in the external platform. + */ + expiresAt?: Date | null; + /** + * When the external subscription trial period started in the external platform. + */ + trialStartedAt?: Date | null; + /** + * When the external subscription trial period ends in the external platform. + */ + trialEndsAt?: Date | null; + /** + * An indication of whether or not the external subscription was being created by a historical data import. + */ + imported?: boolean | null; + +} + +export interface ExternalProductReferenceUpdate { + /** + * A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. + */ + referenceCode?: string | null; + /** + * Represents the connection type. One of the connection types of your enabled App Connectors + */ + externalConnectionType?: ExternalProductReferenceConnectionType | null; } @@ -5865,6 +6038,14 @@ export interface SubscriptionCreate { * You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. */ planId?: string | null; + /** + * The `business_entity_id` is the value that represents a specific business entity for an end customer. When `business_entity_id` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. + */ + businessEntityId?: string | null; + /** + * The `business_entity_code` is the value that represents a specific business entity for an end customer. When `business_entity_code` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. + */ + businessEntityCode?: string | null; account?: AccountCreate | null; /** * 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. @@ -6196,6 +6377,14 @@ export interface SubscriptionChangeCreate { * If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. */ planCode?: string | null; + /** + * The `business_entity_id` is the value that represents a specific business entity for an end customer. When `business_entity_id` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. Only allowed if the `timeframe` is not `now`. + */ + businessEntityId?: string | null; + /** + * The `business_entity_code` is the value that represents a specific business entity for an end customer. When `business_entity_code` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. Only allowed if the `timeframe` is not `now`. + */ + businessEntityCode?: string | null; /** * Optionally, sets custom pricing for the subscription, overriding the plan's default unit amount. The subscription's current currency will be used. */ @@ -6375,6 +6564,14 @@ export interface PurchaseCreate { * 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. */ billingInfoId?: string | null; + /** + * The `business_entity_id` is the value that represents a specific business entity for an end customer. When `business_entity_id` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. + */ + businessEntityId?: string | null; + /** + * The `business_entity_code` is the value that represents a specific business entity for an end customer. When `business_entity_code` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. + */ + businessEntityCode?: string | null; /** * Must be set to manual in order to preview a purchase for an Account that does not have payment information associated with the Billing Info. */ @@ -6395,6 +6592,10 @@ export interface PurchaseCreate { * Terms and conditions to be put on the purchase invoice. */ termsAndConditions?: string | null; + /** + * (Transaction Data, Card on File) - Options for flagging transactions as Customer or Merchant Initiated Unscheduled. + */ + transaction?: object | null; /** * Customer notes */ @@ -8859,7 +9060,17 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`. */ deactivateExternalProductExternalProductReference(externalProductId: string, externalProductReferenceId: string): Promise; /** - * List a site's external subscriptions + * Create an external subscription + * + * API docs: https://developers.recurly.com/api/v2021-02-25#operation/create_external_subscription + * + * + * @param {ExternalSubscriptionCreate} body - The object representing the JSON request to send to the server. It should conform to the schema of {ExternalSubscriptionCreate} + * @return {Promise} Returns the external subscription + */ + createExternalSubscription(body: ExternalSubscriptionCreate): Promise; + /** + * List the external subscriptions on a site * * API docs: https://developers.recurly.com/api/v2021-02-25#operation/list_external_subscriptions * @@ -8883,6 +9094,19 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`. * @return {Promise} Settings for an external subscription. */ getExternalSubscription(externalSubscriptionId: string): Promise; + /** + * Update an external subscription + * + * API docs: https://developers.recurly.com/api/v2021-02-25#operation/put_external_subscription + * + * + * @param {string} externalSubscriptionId - External subscription id + * @param {Object} options - Optional configurations for the request + * @param {Object} options.params - The optional url parameters for this request. + * @param {ExternalSubscriptionUpdate} options.params.body - The object representing the JSON request to send to the server. It should conform to the schema of {ExternalSubscriptionUpdate} + * @return {Promise} Settings for an external subscription. + */ + putExternalSubscription(externalSubscriptionId: string, options?: object): Promise; /** * List the external invoices on an external subscription * diff --git a/lib/recurly/Client.js b/lib/recurly/Client.js index 0943c3da..64dcd3be 100644 --- a/lib/recurly/Client.js +++ b/lib/recurly/Client.js @@ -2592,7 +2592,22 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`. } /** - * List a site's external subscriptions + * Create an external subscription + * + * API docs: {@link https://developers.recurly.com/api/v2021-02-25#operation/create_external_subscription} + * + * + * @param {ExternalSubscriptionCreate} body - The object representing the JSON request to send to the server. It should conform to the schema of {ExternalSubscriptionCreate} + * @return {Promise} Returns the external subscription + */ + async createExternalSubscription (body, options = {}) { + let path = '/external_subscriptions' + path = this._interpolatePath(path) + return this._makeRequest('POST', path, body, options) + } + + /** + * List the external subscriptions on a site * * API docs: {@link https://developers.recurly.com/api/v2021-02-25#operation/list_external_subscriptions} * @@ -2626,6 +2641,25 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`. return this._makeRequest('GET', path, null, options) } + /** + * Update an external subscription + * + * API docs: {@link https://developers.recurly.com/api/v2021-02-25#operation/put_external_subscription} + * + * + * @param {string} externalSubscriptionId - External subscription id + * @param {Object} options - Optional configurations for the request + * @param {Object} options.params - The optional url parameters for this request. + * @param {ExternalSubscriptionUpdate} options.body - The object representing the JSON request to send to the server. It should conform to the schema of {ExternalSubscriptionUpdate} + * @return {Promise} Settings for an external subscription. + */ + async putExternalSubscription (externalSubscriptionId, options = {}) { + const body = options['body'] + let path = '/external_subscriptions/{external_subscription_id}' + path = this._interpolatePath(path, { 'external_subscription_id': externalSubscriptionId }) + return this._makeRequest('PUT', path, body, options) + } + /** * List the external invoices on an external subscription * diff --git a/lib/recurly/resources/BusinessEntityMini.js b/lib/recurly/resources/BusinessEntityMini.js new file mode 100644 index 00000000..d800bd96 --- /dev/null +++ b/lib/recurly/resources/BusinessEntityMini.js @@ -0,0 +1,31 @@ +/* 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') + +/** + * BusinessEntityMini + * @typedef {Object} BusinessEntityMini + * @prop {string} code - The entity code of the business entity. + * @prop {string} id - Business entity ID + * @prop {string} name - This name describes your business entity and will appear on the invoice. + * @prop {string} object - Object type + */ +class BusinessEntityMini extends Resource { + static getSchema () { + return { + code: String, + id: String, + name: String, + object: String + } + } +} + +module.exports = BusinessEntityMini diff --git a/lib/recurly/resources/Subscription.js b/lib/recurly/resources/Subscription.js index a367bbb2..229601c2 100644 --- a/lib/recurly/resources/Subscription.js +++ b/lib/recurly/resources/Subscription.js @@ -21,6 +21,7 @@ const Resource = require('../Resource') * @prop {boolean} autoRenew - Whether the subscription renews at the end of its term. * @prop {Date} bankAccountAuthorizedAt - Recurring subscriptions paid with ACH will have this attribute set. This timestamp is used for alerting customers to reauthorize in 3 years in accordance with NACHA rules. If a subscription becomes inactive or the billing info is no longer a bank account, this timestamp is cleared. * @prop {string} billingInfoId - Billing Info ID. + * @prop {string} businessEntityId - The ID of the business entity associated with the subscription. This will be `null` if the subscription relies on resolving the business entity during renewal. * @prop {Date} canceledAt - Canceled at * @prop {string} collectionMethod - Collection method * @prop {Date} convertedAt - When the subscription was converted from a gift card. @@ -78,6 +79,7 @@ class Subscription extends Resource { autoRenew: Boolean, bankAccountAuthorizedAt: Date, billingInfoId: String, + businessEntityId: String, canceledAt: Date, collectionMethod: String, convertedAt: Date, diff --git a/lib/recurly/resources/SubscriptionChange.js b/lib/recurly/resources/SubscriptionChange.js index 36a92d78..84f341a8 100644 --- a/lib/recurly/resources/SubscriptionChange.js +++ b/lib/recurly/resources/SubscriptionChange.js @@ -16,6 +16,7 @@ const Resource = require('../Resource') * @prop {boolean} activated - Returns `true` if the subscription change is activated. * @prop {Array.} addOns - These add-ons will be used when the subscription renews. * @prop {SubscriptionChangeBillingInfo} billingInfo - Accept nested attributes for three_d_secure_action_result_token_id + * @prop {BusinessEntityMini} businessEntity - Business entity details * @prop {Date} createdAt - Created at * @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 - Deleted at @@ -39,6 +40,7 @@ class SubscriptionChange extends Resource { activated: Boolean, addOns: ['SubscriptionAddOn'], billingInfo: 'SubscriptionChangeBillingInfo', + businessEntity: 'BusinessEntityMini', createdAt: Date, customFields: ['CustomField'], deletedAt: Date, diff --git a/lib/recurly/resources/Transaction.js b/lib/recurly/resources/Transaction.js index e05167a7..a7bce714 100644 --- a/lib/recurly/resources/Transaction.js +++ b/lib/recurly/resources/Transaction.js @@ -33,9 +33,11 @@ const Resource = require('../Resource') * @prop {number} gatewayResponseTime - Time, in seconds, for gateway to process the transaction. * @prop {Object} gatewayResponseValues - The values in this field will vary from gateway to gateway. * @prop {string} id - Transaction ID + * @prop {string} indicator - Must be sent for one-time transactions in order to provide context on which entity is submitting the transaction to ensure proper fraud checks are observed, such as 3DS. If the customer is in session, send `customer`. If this is a merchant initiated one-time transaction, send `merchant`. * @prop {InvoiceMini} invoice - Invoice mini details * @prop {string} ipAddressCountry - Origin IP address country, 2-letter ISO 3166-1 alpha-2 code, if known by Recurly. * @prop {string} ipAddressV4 - IP address provided when the billing information was collected: - When the customer enters billing information into the Recurly.js or Hosted Payment Pages, Recurly records the IP address. - When the merchant enters billing information using the API, the merchant may provide an IP address. - When the merchant enters billing information using the UI, no IP address is recorded. + * @prop {string} merchantReasonCode - This conditional parameter is useful for merchants in specific industries who need to submit one-time Merchant Initiated transactions in specific cases. Not all gateways support these methods, but will support a generic one-time Merchant Initiated transaction. Only use this if the initiator value is "merchant". Otherwise, it will be ignored. - Incremental: Send `incremental` with an additional purchase if the original authorization amount is not sufficient to cover the costs of your service or product. For example, if the customer adds goods or services or there are additional expenses. - No Show: Send `no_show` if you charge customers a fee due to an agreed-upon cancellation policy in your industry. - Resubmission: Send `resubmission` if you need to attempt collection on a declined transaction. You may also use the force collection behavior which has the same effect. - Service Extension: Send `service_extension` if you are in a service industry and the customer has increased/extended their service in some way. For example: adding a day onto a car rental agreement. - Split Shipment: Send `split_shipment` if you sell physical product and need to split up a shipment into multiple transactions when the customer is no longer in session. - Top Up: Send `top_up` if you process one-time transactions based on a pre-arranged agreement with your customer where there is a pre-arranged account balance that needs maintaining. For example, if the customer has agreed to maintain an account balance of 30.00 and their current balance is 20.00, the MIT amount would be at least 10.00 to meet that 30.00 threshold. * @prop {string} object - Object type * @prop {string} origin - Describes how the transaction was triggered. * @prop {string} originalTransactionId - If this transaction is a refund (`type=refund`), this will be the ID of the original transaction on the invoice being refunded. @@ -78,9 +80,11 @@ class Transaction extends Resource { gatewayResponseTime: Number, gatewayResponseValues: Object, id: String, + indicator: String, invoice: 'InvoiceMini', ipAddressCountry: String, ipAddressV4: String, + merchantReasonCode: String, object: String, origin: String, originalTransactionId: String, diff --git a/lib/recurly/resources/index.js b/lib/recurly/resources/index.js index 07514917..bd9ab80a 100644 --- a/lib/recurly/resources/index.js +++ b/lib/recurly/resources/index.js @@ -64,6 +64,7 @@ module.exports.SubscriptionAddOn = require('./SubscriptionAddOn') module.exports.AddOnMini = require('./AddOnMini') module.exports.SubscriptionAddOnTier = require('./SubscriptionAddOnTier') module.exports.SubscriptionAddOnPercentageTier = require('./SubscriptionAddOnPercentageTier') +module.exports.BusinessEntityMini = require('./BusinessEntityMini') module.exports.SubscriptionChangeBillingInfo = require('./SubscriptionChangeBillingInfo') module.exports.SubscriptionRampIntervalResponse = require('./SubscriptionRampIntervalResponse') module.exports.UniqueCouponCodeParams = require('./UniqueCouponCodeParams') diff --git a/openapi/api.yaml b/openapi/api.yaml index bcad8e35..460dd35f 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -8198,11 +8198,49 @@ paths: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_subscriptions": + post: + tags: + - external_subscriptions + operationId: create_external_subscription + summary: Create an external subscription + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalSubscriptionCreate" + required: true + responses: + '201': + description: Returns the external subscription + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalSubscription" + '400': + description: Bad request; perhaps missing or invalid parameters. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '404': + description: External subscription cannot be completed for the specified + reason. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] get: tags: - external_subscriptions operationId: list_external_subscriptions - summary: List a site's external subscriptions + summary: List the external subscriptions on a site description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: @@ -8228,9 +8266,9 @@ paths: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_subscriptions/{external_subscription_id}": - parameters: - - "$ref": "#/components/parameters/external_subscription_id_fetch" get: + parameters: + - "$ref": "#/components/parameters/external_subscription_id_fetch" tags: - external_subscriptions operationId: get_external_subscription @@ -8262,6 +8300,52 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] + put: + parameters: + - "$ref": "#/components/parameters/external_subscription_id" + tags: + - external_subscriptions + operationId: put_external_subscription + summary: Update an external subscription + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalSubscriptionUpdate" + required: false + responses: + '200': + description: Settings for an external subscription. + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalSubscription" + '400': + description: Bad request; perhaps missing or invalid parameters. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '404': + description: Incorrect site or external subscription ID. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '422': + description: Validation error with external resource connection or feature + flag. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] "/external_subscriptions/{external_subscription_id}/external_invoices": parameters: - "$ref": "#/components/parameters/external_subscription_id" @@ -20294,6 +20378,22 @@ components: title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 + business_entity_id: + type: string + title: Business Entity ID + description: The `business_entity_id` is the value that represents a specific + business entity for an end customer which will be assigned to the invoice. + Available when the `Multiple Business Entities` feature is enabled. If + both `business_entity_id` and `business_entity_code` are present, `business_entity_id` + will be used. + business_entity_code: + type: string + title: Business Entity Code + description: The `business_entity_code` is the value that represents a specific + business entity for an end customer which will be assigned to the invoice. + Available when the `Multiple Business Entities` feature is enabled. If + both `business_entity_id` and `business_entity_code` are present, `business_entity_id` + will be used. collection_method: title: Collection method description: An automatic invoice means a corresponding transaction is run @@ -22820,6 +22920,13 @@ components: subscription. maxLength: 13 readOnly: true + business_entity_id: + type: string + title: Business Entity ID + description: The ID of the business entity associated with the subscription. + This will be `null` if the subscription relies on resolving the business + entity during renewal. + maxLength: 13 started_with_gift: type: boolean default: false @@ -23186,6 +23293,9 @@ components: invoice_collection: title: Invoice Collection "$ref": "#/components/schemas/InvoiceCollection" + business_entity: + title: Business Entity + "$ref": "#/components/schemas/BusinessEntityMini" custom_fields: "$ref": "#/components/schemas/CustomFields" created_at: @@ -23251,6 +23361,26 @@ components: maxLength: 50 description: If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. + business_entity_id: + type: string + title: Business Entity ID + description: The `business_entity_id` is the value that represents a specific + business entity for an end customer. When `business_entity_id` is used + to assign a business entity to the subscription, all future billing events + for the subscription will bill to the specified business entity. Available + when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` + and `business_entity_code` are present, `business_entity_id` will be used. + Only allowed if the `timeframe` is not `now`. + business_entity_code: + type: string + title: Business Entity Code + description: The `business_entity_code` is the value that represents a specific + business entity for an end customer. When `business_entity_code` is used + to assign a business entity to the subscription, all future billing events + for the subscription will bill to the specified business entity. Available + when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` + and `business_entity_code` are present, `business_entity_id` will be used. + Only allowed if the `timeframe` is not `now`. unit_amount: type: number format: float @@ -23399,6 +23529,24 @@ components: maxLength: 13 description: You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. + business_entity_id: + type: string + title: Business Entity ID + description: The `business_entity_id` is the value that represents a specific + business entity for an end customer. When `business_entity_id` is used + to assign a business entity to the subscription, all future billing events + for the subscription will bill to the specified business entity. Available + when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` + and `business_entity_code` are present, `business_entity_id` will be used. + business_entity_code: + type: string + title: Business Entity Code + description: The `business_entity_code` is the value that represents a specific + business entity for an end customer. When `business_entity_code` is used + to assign a business entity to the subscription, all future billing events + for the subscription will bill to the specified business entity. Available + when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` + and `business_entity_code` are present, `business_entity_id` will be used. account: "$ref": "#/components/schemas/AccountCreate" billing_info_id: @@ -24023,8 +24171,12 @@ components: maxLength: 13 account: "$ref": "#/components/schemas/AccountMini" + indicator: + "$ref": "#/components/schemas/TransactionIndicatorEnum" invoice: "$ref": "#/components/schemas/InvoiceMini" + merchant_reason_code: + "$ref": "#/components/schemas/TransactionMerchantReasonCodeEnum" voided_by_invoice: "$ref": "#/components/schemas/InvoiceMini" subscription_ids: @@ -24511,6 +24663,24 @@ components: 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. + business_entity_id: + type: string + title: Business Entity ID + description: The `business_entity_id` is the value that represents a specific + business entity for an end customer. When `business_entity_id` is used + to assign a business entity to the subscription, all future billing events + for the subscription will bill to the specified business entity. Available + when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` + and `business_entity_code` are present, `business_entity_id` will be used. + business_entity_code: + type: string + title: Business Entity Code + description: The `business_entity_code` is the value that represents a specific + business entity for an end customer. When `business_entity_code` is used + to assign a business entity to the subscription, all future billing events + for the subscription will bill to the specified business entity. Available + when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` + and `business_entity_code` are present, `business_entity_id` will be used. collection_method: title: Collection method description: Must be set to manual in order to preview a purchase for an @@ -24552,6 +24722,17 @@ components: type: string title: Terms and conditions description: Terms and conditions to be put on the purchase invoice. + transaction: + type: object + description: "(Transaction Data, Card on File) - Options for flagging transactions + as Customer or Merchant Initiated Unscheduled." + allOf: + - type: object + properties: + indicator: + "$ref": "#/components/schemas/Transaction/properties/indicator" + merchant_reason_code: + "$ref": "#/components/schemas/Transaction/properties/merchant_reason_code" customer_notes: type: string title: Customer notes @@ -24807,6 +24988,38 @@ components: type: string format: date-time description: Time the object was last updated + ExternalChargeCreate: + type: object + properties: + currency: + type: string + title: Currency + description: 3-letter ISO 4217 currency code. + maxLength: 3 + unit_amount: + type: string + format: decimal + quantity: + type: integer + description: + type: string + external_product_reference: + "$ref": "#/components/schemas/ExternalProductReferenceCreate" + required: + - quantity + - currency + - unit_amount + AccountExternalSubscription: + allOf: + - type: object + properties: + account_code: + type: string + description: The account code of a new or existing account to be used + when creating the external subscription. + maxLength: 50 + required: + - account_code ExternalPaymentPhase: type: object description: Details of payments in the lifecycle of a subscription from an @@ -24974,7 +25187,7 @@ components: Google Play Store. maxLength: 255 external_connection_type: - "$ref": "#/components/schemas/ExternalProductReferenceConnectionTypeEnum" + "$ref": "#/components/schemas/ExternalProductReferenceConnectionType" ExternalProductReferenceCollection: type: object properties: @@ -25001,11 +25214,10 @@ components: ExternalProductReferenceUpdate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" - ExternalProductReferenceConnectionTypeEnum: + ExternalProductReferenceConnectionType: type: string - enum: - - apple_app_store - - google_play_store + description: Represents the connection type. One of the connection types of + your enabled App Connectors ExternalAccountList: type: object properties: @@ -25031,7 +25243,8 @@ components: description: Represents the account code for the external account. external_connection_type: type: string - description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` + description: Represents the connection type. One of the connection types + of your enabled App Connectors required: - external_account_code - external_connection_type @@ -25043,7 +25256,8 @@ components: description: Represents the account code for the external account. external_connection_type: type: string - description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` + description: Represents the connection type. One of the connection types + of your enabled App Connectors ExternalAccount: type: object title: External Account @@ -25217,6 +25431,91 @@ components: format: date-time title: Updated at description: When the external subscription was updated in Recurly. + ExternalSubscriptionBase: + type: object + properties: + external_id: + type: string + title: External Id + description: Id of the subscription in the external system, i.e. Apple App + Store or Google Play Store. + last_purchased: + type: string + format: date-time + title: Last purchased + description: When a new billing event occurred on the external subscription + in conjunction with a recent billing period, reactivation or upgrade/downgrade. + auto_renew: + type: boolean + title: Auto-renew + description: An indication of whether or not the external subscription will + auto-renew at the expiration date. + default: false + state: + type: string + description: External subscriptions can be active, canceled, expired, past_due, + voided, revoked, or paused. + default: active + app_identifier: + type: string + title: App identifier + description: Identifier of the app that generated the external subscription. + quantity: + type: integer + title: Quantity + description: An indication of the quantity of a subscribed item's quantity. + default: 1 + minimum: 0 + activated_at: + type: string + format: date-time + title: Activated at + description: When the external subscription was activated in the external + platform. + expires_at: + type: string + format: date-time + title: Expires at + description: When the external subscription expires in the external platform. + trial_started_at: + type: string + format: date-time + title: Trial started at + description: When the external subscription trial period started in the + external platform. + trial_ends_at: + type: string + format: date-time + title: Trial ends at + description: When the external subscription trial period ends in the external + platform. + imported: + type: boolean + title: Import + description: An indication of whether or not the external subscription was + being created by a historical data import. + default: false + ExternalSubscriptionCreate: + allOf: + - type: object + properties: + account: + "$ref": "#/components/schemas/AccountExternalSubscription" + external_product_reference: + "$ref": "#/components/schemas/ExternalProductReferenceCreate" + - "$ref": "#/components/schemas/ExternalSubscriptionBase" + required: + - external_id + - quantity + - activated_at + - expires_at + ExternalSubscriptionUpdate: + allOf: + - type: object + properties: + external_product_reference: + "$ref": "#/components/schemas/ExternalProductReferenceUpdate" + - "$ref": "#/components/schemas/ExternalSubscriptionBase" ExternalSubscriptionList: type: object properties: @@ -25282,6 +25581,86 @@ components: format: date-time title: Updated at description: When the external invoice was updated in Recurly. + ExternalPaymentPhaseBase: + type: object + properties: + started_at: + type: string + format: date-time + title: Started At + ends_at: + type: string + format: date-time + title: Ends At + starting_billing_period_index: + type: integer + title: Starting Billing Period Index + ending_billing_period_index: + type: integer + title: Ending Billing Period Index + offer_type: + type: string + title: Offer Type + description: Type of discount offer given, e.g. "FREE_TRIAL" + offer_name: + type: string + title: Offer Name + description: Name of the discount offer given, e.g. "introductory" + period_count: + type: integer + title: Period Count + description: Number of billing periods + period_length: + type: string + title: Period Length + description: Billing cycle length + amount: + type: string + format: decimal + title: Amount + minimum: 0 + description: Allows up to 9 decimal places + currency: + type: string + title: Currency + description: 3-letter ISO 4217 currency code. + maxLength: 3 + ExternalInvoiceCreate: + type: object + properties: + external_id: + type: string + description: An identifier which associates the external invoice to a corresponding + object in an external platform. + state: + "$ref": "#/components/schemas/ExternalInvoiceStateEnum" + total: + type: string + format: decimal + currency: + type: string + title: Currency + description: 3-letter ISO 4217 currency code. + maxLength: 3 + purchased_at: + type: string + format: date-time + description: When the invoice was created in the external platform. + line_items: + type: array + items: + "$ref": "#/components/schemas/ExternalChargeCreate" + external_payment_phase: + "$ref": "#/components/schemas/ExternalPaymentPhaseBase" + external_payment_phase_id: + type: string + description: External payment phase ID, e.g. `a34ypb2ef9w1`. + required: + - external_id + - state + - total + - currency + - purchased_at ExternalInvoiceList: type: object properties: @@ -25584,6 +25963,30 @@ components: format: date-time title: Last updated at readOnly: true + BusinessEntityMini: + type: object + description: Business entity details + properties: + id: + title: Business entity ID + type: string + maxLength: 13 + readOnly: true + object: + title: Object type + type: string + readOnly: true + code: + title: Business entity code + type: string + maxLength: 50 + description: The entity code of the business entity. + name: + type: string + title: Name + description: This name describes your business entity and will appear on + the invoice. + maxLength: 255 GiftCardList: type: object properties: @@ -26907,3 +27310,32 @@ components: enum: - destination - origin + TransactionMerchantReasonCodeEnum: + type: string + default: none + description: | + This conditional parameter is useful for merchants in specific industries who need to submit one-time Merchant Initiated transactions in specific cases. + Not all gateways support these methods, but will support a generic one-time Merchant Initiated transaction. + Only use this if the initiator value is "merchant". Otherwise, it will be ignored. + - Incremental: Send `incremental` with an additional purchase if the original authorization amount is not sufficient to cover the costs of your service or product. For example, if the customer adds goods or services or there are additional expenses. + - No Show: Send `no_show` if you charge customers a fee due to an agreed-upon cancellation policy in your industry. + - Resubmission: Send `resubmission` if you need to attempt collection on a declined transaction. You may also use the force collection behavior which has the same effect. + - Service Extension: Send `service_extension` if you are in a service industry and the customer has increased/extended their service in some way. For example: adding a day onto a car rental agreement. + - Split Shipment: Send `split_shipment` if you sell physical product and need to split up a shipment into multiple transactions when the customer is no longer in session. + - Top Up: Send `top_up` if you process one-time transactions based on a pre-arranged agreement with your customer where there is a pre-arranged account balance that needs maintaining. For example, if the customer has agreed to maintain an account balance of 30.00 and their current balance is 20.00, the MIT amount would be at least 10.00 to meet that 30.00 threshold. + enum: + - incremental + - no_show + - resubmission + - service_extension + - split_shipment + - top_up + TransactionIndicatorEnum: + type: string + description: Must be sent for one-time transactions in order to provide context + on which entity is submitting the transaction to ensure proper fraud checks + are observed, such as 3DS. If the customer is in session, send `customer`. + If this is a merchant initiated one-time transaction, send `merchant`. + enum: + - customer + - merchant diff --git a/package-lock.json b/package-lock.json index 2f1e177b..918c29e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "recurly", - "version": "4.56.0", + "version": "4.57.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "recurly", - "version": "4.56.0", + "version": "4.57.0", "license": "MIT", "devDependencies": { "@types/node": "^12.11.1",