Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions lib/recurly.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2800,6 +2800,18 @@ export declare class UniqueCouponCodeParams {

}

export declare class UniqueCouponCodeGenerationResponse {
/**
* Object type
*/
object?: string | null;
/**
* An array containing the newly generated unique coupon codes.
*/
uniqueCouponCodes?: UniqueCouponCode[] | null;

}

export declare class UniqueCouponCode {
/**
* Unique Coupon Code ID
Expand Down Expand Up @@ -5081,6 +5093,14 @@ export interface CouponBulkCreate {

}

export interface CouponBulkCreateSync {
/**
* The quantity of unique coupon codes to generate. A bulk coupon can have up to 100,000 unique codes (or your site's configured limit).
*/
numberOfUniqueCodes?: number | null;

}

export interface GeneralLedgerAccountCreate {
/**
* Unique code to identify the ledger account. Each code must start with a letter or number. The following special characters are allowed: `-_.,:`
Expand Down Expand Up @@ -7631,6 +7651,16 @@ export declare class Client {
* @return {Promise<Account>} An account.
*/
deactivateAccount(accountId: string): Promise<Account>;
/**
* Redact an account (GDPR Right to Erasure)
*
* API docs: https://developers.recurly.com/api/v2021-02-25#operation/redact_account
*
*
* @param {string} accountId - Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`.
* @return {Promise<Account>} Account has been accepted for redaction and will be processed asynchronously.
*/
redactAccount(accountId: string): Promise<Account>;
/**
* Fetch an account's acquisition data
*
Expand Down Expand Up @@ -8969,6 +8999,17 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`.

*/
generateUniqueCouponCodes(couponId: string, body: CouponBulkCreate): Promise<UniqueCouponCodeParams>;
/**
* Generate unique coupon codes synchronously
*
* API docs: https://developers.recurly.com/api/v2021-02-25#operation/generate_unique_coupon_codes_sync
*
*
* @param {string} couponId - Coupon ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-10off`.
* @param {CouponBulkCreateSync} body - The object representing the JSON request to send to the server. It should conform to the schema of {CouponBulkCreateSync}
* @return {Promise<UniqueCouponCodeGenerationResponse>} The newly generated unique coupon codes.
*/
generateUniqueCouponCodesSync(couponId: string, body: CouponBulkCreateSync): Promise<UniqueCouponCodeGenerationResponse>;
/**
* Restore an inactive coupon
*
Expand Down
31 changes: 31 additions & 0 deletions lib/recurly/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,21 @@ class Client extends BaseClient {
return this._makeRequest('DELETE', path, null, options)
}

/**
* Redact an account (GDPR Right to Erasure)
*
* API docs: {@link https://developers.recurly.com/api/v2021-02-25#operation/redact_account}
*
*
* @param {string} accountId - Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`.
* @return {Promise<Account>} Account has been accepted for redaction and will be processed asynchronously.
*/
async redactAccount (accountId, options = {}) {
let path = '/accounts/{account_id}/redact'
path = this._interpolatePath(path, { 'account_id': accountId })
return this._makeRequest('PUT', path, null, options)
}

/**
* Fetch an account's acquisition data
*
Expand Down Expand Up @@ -1889,6 +1904,22 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`.
return this._makeRequest('POST', path, body, options)
}

/**
* Generate unique coupon codes synchronously
*
* API docs: {@link https://developers.recurly.com/api/v2021-02-25#operation/generate_unique_coupon_codes_sync}
*
*
* @param {string} couponId - Coupon ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-10off`.
* @param {CouponBulkCreateSync} body - The object representing the JSON request to send to the server. It should conform to the schema of {CouponBulkCreateSync}
* @return {Promise<UniqueCouponCodeGenerationResponse>} The newly generated unique coupon codes.
*/
async generateUniqueCouponCodesSync (couponId, body, options = {}) {
let path = '/coupons/{coupon_id}/generate_sync'
path = this._interpolatePath(path, { 'coupon_id': couponId })
return this._makeRequest('POST', path, body, options)
}

/**
* Restore an inactive coupon
*
Expand Down
27 changes: 27 additions & 0 deletions lib/recurly/resources/UniqueCouponCodeGenerationResponse.js
Original file line number Diff line number Diff line change
@@ -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')

/**
* UniqueCouponCodeGenerationResponse
* @typedef {Object} UniqueCouponCodeGenerationResponse
* @prop {string} object - Object type
* @prop {Array.<UniqueCouponCode>} uniqueCouponCodes - An array containing the newly generated unique coupon codes.
*/
class UniqueCouponCodeGenerationResponse extends Resource {
static getSchema () {
return {
object: String,
uniqueCouponCodes: ['UniqueCouponCode']
}
}
}

module.exports = UniqueCouponCodeGenerationResponse
1 change: 1 addition & 0 deletions lib/recurly/resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ module.exports.SubscriptionChangeBillingInfo = require('./SubscriptionChangeBill
module.exports.SubscriptionRampIntervalResponse = require('./SubscriptionRampIntervalResponse')
module.exports.CreditApplicationPolicy = require('./CreditApplicationPolicy')
module.exports.UniqueCouponCodeParams = require('./UniqueCouponCodeParams')
module.exports.UniqueCouponCodeGenerationResponse = require('./UniqueCouponCodeGenerationResponse')
module.exports.UniqueCouponCode = require('./UniqueCouponCode')
module.exports.CustomFieldDefinition = require('./CustomFieldDefinition')
module.exports.GeneralLedgerAccount = require('./GeneralLedgerAccount')
Expand Down
129 changes: 128 additions & 1 deletion openapi/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,45 @@ paths:
not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected
Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Deactivated
Account: %s\", account.Id)"
"/accounts/{account_id}/redact":
parameters:
- "$ref": "#/components/parameters/account_id"
put:
tags:
- account
operationId: redact_account
summary: Redact an account (GDPR Right to Erasure)
description: Permanently and irreversibly removes all personally identifiable
information (PII) from an account to fulfill a data subject's right to erasure
under GDPR and similar privacy regulations (e.g. CCPA). This includes billing
information, shipping addresses, and transaction details such as names, email
addresses, and payment card data. The underlying account and transaction records
are retained for financial and audit purposes, but all personal data fields
are cleared. The account must have no active subscriptions, uninvoiced charges,
or partially paid invoices before it can be redacted. Redaction is processed
asynchronously and cannot be undone.
responses:
'200':
description: Account has been accepted for redaction and will be processed
asynchronously.
content:
application/json:
schema:
"$ref": "#/components/schemas/Account"
'422':
description: Account cannot be redacted. Common reasons include active subscriptions,
uninvoiced charges, or partially paid invoices.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
default:
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples: []
"/accounts/{account_id}/acquisition":
parameters:
- "$ref": "#/components/parameters/account_id"
Expand Down Expand Up @@ -6505,6 +6544,55 @@ paths:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples: []
"/coupons/{coupon_id}/generate_sync":
post:
tags:
- unique_coupon_code
operationId: generate_unique_coupon_codes_sync
summary: Generate unique coupon codes synchronously
description: Generates up to 200 unique coupon codes for a bulk coupon and returns
them directly in the response. For larger batches, use the asynchronous generate
endpoint instead.
parameters:
- "$ref": "#/components/parameters/coupon_id"
requestBody:
content:
application/json:
schema:
"$ref": "#/components/schemas/CouponBulkCreateSync"
required: true
responses:
'200':
description: The newly generated unique coupon codes.
content:
application/json:
schema:
"$ref": "#/components/schemas/UniqueCouponCodeGenerationResponse"
'400':
description: Invalid or unpermitted parameter.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
'404':
description: Incorrect site or coupon ID.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
'422':
description: Unprocessable entity.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
default:
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples: []
"/coupons/{coupon_id}/restore":
put:
tags:
Expand Down Expand Up @@ -19841,6 +19929,18 @@ components:
description: The quantity of unique coupon codes to generate. A bulk coupon
can have up to 100,000 unique codes (or your site's configured limit).
minimum: 1
CouponBulkCreateSync:
type: object
properties:
number_of_unique_codes:
type: integer
title: Number of unique codes
description: The quantity of unique coupon codes to generate. A bulk coupon
can have up to 100,000 unique codes (or your site's configured limit).
minimum: 1
maximum: 200
required:
- number_of_unique_codes
CouponMini:
type: object
properties:
Expand Down Expand Up @@ -25251,7 +25351,20 @@ components:
transactions where fraud checks have already been performed on the
initial transaction. Note that not all gateways support this feature.
For Stripe, this skips Radar fraud rules; for Adyen, this skips
Risk checks.
skip_recurly_fraud:
type: boolean
title: Skip Recurly Fraud
description: When set to `true`, skips Recurly's fraud detection checks
for this transaction, including Kount and IP-based fraud screening.
Does not affect gateway-level fraud checks. Use `skip_all_fraud`
to skip all fraud checks.
skip_all_fraud:
type: boolean
title: Skip All Fraud
description: When set to `true`, skips all fraud checks for this transaction,
including both gateway-level fraud checks and Recurly's fraud detection
services. This is useful for trusted transactions where fraud screening
is not required.
customer_notes:
type: string
title: Customer notes
Expand Down Expand Up @@ -25839,6 +25952,20 @@ components:
type: string
format: date-time
description: When the external product was updated in Recurly.
UniqueCouponCodeGenerationResponse:
type: object
properties:
object:
type: string
title: Object type
readOnly: true
unique_coupon_codes:
type: array
title: Unique coupon codes
description: An array containing the newly generated unique coupon codes.
maxItems: 200
items:
"$ref": "#/components/schemas/UniqueCouponCode"
ExternalSubscription:
type: object
description: Subscription from an external resource such as Apple App Store
Expand Down
Loading