From 914938f972de034d4ed54a894c95c8fbadfc2fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20Rodr=C3=ADguez?= <127134616+armando-rodriguez-cko@users.noreply.github.com> Date: Fri, 13 Nov 2026 10:41:40 +0100 Subject: [PATCH 1/2] fix(client): security hardening Follow-up hardening of path parameters. Reported internally. --- src/services/utils.js | 13 ++++++++++--- test/services/path-segments-unit.js | 9 +++++---- test/services/utils.js | 15 ++++++++++++--- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/services/utils.js b/src/services/utils.js index 9d6864d8..d48a93f4 100644 --- a/src/services/utils.js +++ b/src/services/utils.js @@ -32,13 +32,16 @@ export const buildQueryParams = (path, params) => { * Encode a caller-supplied value as a single path segment. * * The value is converted to a string and encoded with encodeURIComponent, so characters such as - * "/", "?", "#", "%" and "\" are percent-encoded. Values that encoding leaves unchanged and that - * are not valid segments ("." and "..") are rejected, as are undefined, null and empty values. + * "?", "#" and "%" are percent-encoded. "/", "\" and ASCII control characters are rejected rather + * than encoded, because the API decodes "%2F" and "%5C" back into separators. Values that encoding + * leaves unchanged and that are not valid segments ("." and "..") are rejected, as are undefined, + * null and empty values. * * @param {*} value The value to place in the path, such as an id. * @param {string} name The parameter name, used in the error message. * @return {string} The encoded segment. - * @throws {ValueError} If the value is undefined, null, empty, "." or "..". + * @throws {ValueError} If the value is undefined, null, empty, "." or "..", or contains "/", "\" + * or an ASCII control character. */ export const encodePathSegment = (value, name) => { const segment = value === undefined || value === null ? '' : String(value); @@ -47,5 +50,9 @@ export const encodePathSegment = (value, name) => { throw new ValueError(`Invalid ${name}: must not be undefined, null, empty, "." or "..".`); } + if (/[/\\\u0000-\u001f\u007f]/.test(segment)) { + throw new ValueError(`Invalid ${name}: must not contain "/", "\\" or ASCII control characters.`); + } + return encodeURIComponent(segment); }; diff --git a/test/services/path-segments-unit.js b/test/services/path-segments-unit.js index b30036fa..3a4d1af9 100644 --- a/test/services/path-segments-unit.js +++ b/test/services/path-segments-unit.js @@ -61,10 +61,11 @@ const SK = 'sk_sbox_o2nulev2arguvyf6w7sc5fkznas'; const VALID = 'abc_123'; // Values with reserved characters, which the SDK percent-encodes. -const RESERVED = ['../x', '%2e%2e/x', '..\\x', 'a?b', 'a#b']; +const RESERVED = ['%2e%2e', 'a?b', 'a#b', 'a b']; -// encodeURIComponent leaves "." and ".." unchanged, so these are rejected before any request is sent. -const REJECTED = ['..', '.', '', undefined, null]; +// "." and ".." (left unchanged by encodeURIComponent), empty values, and "/", "\\" and ASCII control +// characters (the API decodes %2F and %5C back into separators) are rejected before any request is sent. +const REJECTED = ['..', '.', '', undefined, null, '../x', '%2e%2e/x', '..\\x', 'a\u0000b', 'a\u007fb']; // One row per SDK method that puts a caller value in the request path: the endpoint class, the // method, the arguments with every path value set to v, and the path sent for a valid id. @@ -322,7 +323,7 @@ describe('Path segments - caller values are encoded', () => { } }); - it(`${label} rejects ., .., empty, undefined and null without sending a request`, async () => { + it(`${label} rejects ., .., empty, undefined, null, separators and control characters without sending a request`, async () => { for (const value of REJECTED) { let error; try { diff --git a/test/services/utils.js b/test/services/utils.js index 378d1c61..bb233d37 100644 --- a/test/services/utils.js +++ b/test/services/utils.js @@ -39,9 +39,7 @@ describe('Service Utils - encodePathSegment', () => { // Values with reserved characters, which the SDK percent-encodes. [ - ['../x', '..%2Fx'], - ['%2e%2e/x', '%252e%252e%2Fx'], - ['..\\x', '..%5Cx'], + ['%2e%2e', '%252e%252e'], ['a?b', 'a%3Fb'], ['a#b', 'a%23b'], ].forEach(([value, expected]) => { @@ -50,6 +48,17 @@ describe('Service Utils - encodePathSegment', () => { }); }); + // The API decodes %2F and %5C back into separators, so "/", "\\" and ASCII control + // characters are refused instead of encoded. + ['../x', '%2e%2e/x', 'x/y', '..\\x', 'a\\b', 'a\u0000b', 'a\nb', 'a\u001fb', 'a\u007fb'].forEach((value) => { + it(`rejects ${JSON.stringify(value)}`, () => { + expect(() => encodePathSegment(value, 'id')).to.throw( + ValueError, + 'Invalid id: must not contain "/", "\\" or ASCII control characters.' + ); + }); + }); + // encodeURIComponent leaves "." and ".." unchanged, so they are rejected. [undefined, null, '', '.', '..'].forEach((value) => { it(`rejects ${JSON.stringify(value) ?? 'undefined'}`, () => { From 831721527275ba0e6278f4b92c0000064d5832df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20Rodr=C3=ADguez?= <127134616+armando-rodriguez-cko@users.noreply.github.com> Date: Tue, 17 Nov 2026 13:30:47 +0100 Subject: [PATCH 2/2] fix(client): security hardening Security hardening and input validation in request path building. --- README.md | 8 ++- src/api/apm-specific/baloto.js | 6 ++- src/api/apm-specific/boleto.js | 6 ++- src/api/apm-specific/fawry.js | 6 ++- src/api/apm-specific/klarna.js | 9 ++-- src/api/apm-specific/oxxo.js | 6 ++- src/api/apm-specific/pagofacil.js | 6 ++- src/api/apm-specific/rapipago.js | 6 ++- src/api/apm-specific/sepa.js | 12 +++-- src/api/balances/balances.js | 6 ++- .../compliance-requests.js | 6 ++- src/api/customers/customers.js | 12 +++-- src/api/disputes/disputes.js | 27 ++++++---- src/api/events/events.js | 12 +++-- src/api/files/files.js | 3 +- src/api/forward/forward.js | 9 ++-- src/api/google-pay/google-pay.js | 9 ++-- src/api/hosted-payments/hosted-payments.js | 3 +- .../address-document-verifications.js | 23 ++++++--- src/api/identities/aml-screenings.js | 3 +- src/api/identities/applicants.js | 9 ++-- src/api/identities/face-authentications.js | 18 ++++--- .../identities/id-document-verifications.js | 21 +++++--- src/api/identities/identity-verifications.js | 21 +++++--- src/api/instruments/instruments.js | 15 ++++-- src/api/inventory/inventory.js | 24 ++++++--- src/api/issuing/cardholders.js | 9 ++-- src/api/issuing/cards.js | 30 +++++++---- src/api/issuing/control-groups.js | 6 ++- src/api/issuing/control-profiles.js | 15 ++++-- src/api/issuing/controls.js | 9 ++-- src/api/issuing/digital-cards.js | 3 +- src/api/issuing/disputes.js | 15 ++++-- src/api/issuing/simulate.js | 12 +++-- src/api/issuing/transactions.js | 3 +- src/api/network-tokens/network-tokens.js | 9 ++-- .../onboarding-simulator.js | 9 ++-- src/api/payment-contexts/payment-contexts.js | 3 +- src/api/payment-sessions/payment-sessions.js | 3 +- src/api/payment-setups/payment-setups.js | 9 ++-- src/api/payments-links/payments-links.js | 3 +- src/api/payments/payments.js | 24 ++++++--- src/api/platforms/entity-requirements.js | 9 ++-- src/api/platforms/files.js | 6 ++- src/api/platforms/payment-instruments.js | 15 ++++-- src/api/platforms/payout-schedules.js | 6 ++- src/api/platforms/reserve-rules.js | 12 +++-- src/api/platforms/subentity.js | 12 +++-- src/api/reconciliation/reconciliation.js | 12 +++-- src/api/reports/reports.js | 6 ++- src/api/sessions/sessions.js | 12 +++-- src/api/tokens/tokens.js | 3 +- src/api/transfers/transfers.js | 3 +- src/api/webhooks/webhooks.js | 12 +++-- src/api/workflows/workflows.js | 51 ++++++++++++------- src/services/utils.js | 29 ++++++++--- test/services/path-segments-unit.js | 22 ++++++-- test/services/utils.js | 30 +++++++++-- 58 files changed, 473 insertions(+), 215 deletions(-) diff --git a/README.md b/README.md index e16c7501..606ea499 100644 --- a/README.md +++ b/README.md @@ -498,7 +498,13 @@ Here you have all the possible SDK specific errors: | BadGateway | 502 | undefined | | ValidationError | 422 | object | | TooManyRequestsError | 429 | object/undefined | -| ValueError | 429 | string describing error | +| ValueError | - | string describing error | + +Identifiers passed to client methods (for example a payment id) are sent as single, percent-encoded path +segments: pass them unencoded. A `ValueError` is thrown before any request is sent when an identifier is +`undefined`, `null`, empty, `.` or `..`, contains text that is not valid (an unpaired surrogate), or contains +`/`, `\` or an ASCII control character (U+0000 to U+001F, U+007F). To retrieve a customer whose email contains +`/` or `\`, use the customer's ID. # :white_check_mark: Testing diff --git a/src/api/apm-specific/baloto.js b/src/api/apm-specific/baloto.js index 1ed9af0c..b686f416 100644 --- a/src/api/apm-specific/baloto.js +++ b/src/api/apm-specific/baloto.js @@ -28,7 +28,8 @@ export default class Baloto { * @param {string} id Payment id. * @memberof Baloto * @return {Promise} A promise to the Baloto response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async succeed(id) { try { @@ -51,7 +52,8 @@ export default class Baloto { * @param {string} id Payment id. * @memberof Baloto * @return {Promise} A promise to the Baloto response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async expire(id) { try { diff --git a/src/api/apm-specific/boleto.js b/src/api/apm-specific/boleto.js index 713eab3a..d763d22d 100644 --- a/src/api/apm-specific/boleto.js +++ b/src/api/apm-specific/boleto.js @@ -28,7 +28,8 @@ export default class Boleto { * @param {string} id Payment id. * @memberof Boleto * @return {Promise} A promise to the Boleto response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async succeed(id) { try { @@ -51,7 +52,8 @@ export default class Boleto { * @param {string} id Payment id. * @memberof Boleto * @return {Promise} A promise to the Boleto response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async expire(id) { try { diff --git a/src/api/apm-specific/fawry.js b/src/api/apm-specific/fawry.js index 73dc3899..e095f831 100644 --- a/src/api/apm-specific/fawry.js +++ b/src/api/apm-specific/fawry.js @@ -28,7 +28,8 @@ export default class Fawry { * @param {string} reference Reference. * @memberof Fawry * @return {Promise} A promise to the Fawry response. - * @throws {ValueError} If reference is undefined, null, empty, "." or "..". + * @throws {ValueError} If reference is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async approve(reference) { try { @@ -51,7 +52,8 @@ export default class Fawry { * @param {string} reference Reference. * @memberof Fawry * @return {Promise} A promise to the Fawry response. - * @throws {ValueError} If reference is undefined, null, empty, "." or "..". + * @throws {ValueError} If reference is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async cancel(reference) { try { diff --git a/src/api/apm-specific/klarna.js b/src/api/apm-specific/klarna.js index 4370a1cf..a2966174 100644 --- a/src/api/apm-specific/klarna.js +++ b/src/api/apm-specific/klarna.js @@ -50,7 +50,8 @@ export default class Klarna { * * @param {string} id Session id. * @return {Promise} A promise to the Klarna response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getSession(id) { const url = this.config.host.includes('sandbox') @@ -70,7 +71,8 @@ export default class Klarna { * @param {string} id Payment id. * @param {Object} body Capture details. * @return {Promise} A promise to the Klarna response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async capture(id, body) { const url = this.config.host.includes('sandbox') @@ -96,7 +98,8 @@ export default class Klarna { * @param {string} id Payment id. * @param {Object} [body] Void details. * @return {Promise} A promise to the Klarna response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async void(id, body) { const url = this.config.host.includes('sandbox') diff --git a/src/api/apm-specific/oxxo.js b/src/api/apm-specific/oxxo.js index c57468a7..d15145ec 100644 --- a/src/api/apm-specific/oxxo.js +++ b/src/api/apm-specific/oxxo.js @@ -28,7 +28,8 @@ export default class Oxxo { * @param {string} id Payment id. * @memberof Oxxo * @return {Promise} A promise to the Oxxo response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async succeed(id) { try { @@ -51,7 +52,8 @@ export default class Oxxo { * @param {string} id Payment id. * @memberof Oxxo * @return {Promise} A promise to the Oxxo response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async expire(id) { try { diff --git a/src/api/apm-specific/pagofacil.js b/src/api/apm-specific/pagofacil.js index d6fc72ff..2fa796e3 100644 --- a/src/api/apm-specific/pagofacil.js +++ b/src/api/apm-specific/pagofacil.js @@ -28,7 +28,8 @@ export default class PagoFacil { * @param {string} id Payment id. * @memberof PagoFacil * @return {Promise} A promise to the PagoFacil response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async succeed(id) { try { @@ -51,7 +52,8 @@ export default class PagoFacil { * @param {string} id Payment id. * @memberof PagoFacil * @return {Promise} A promise to the PagoFacil response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async expire(id) { try { diff --git a/src/api/apm-specific/rapipago.js b/src/api/apm-specific/rapipago.js index bd76b9e9..4f54771f 100644 --- a/src/api/apm-specific/rapipago.js +++ b/src/api/apm-specific/rapipago.js @@ -28,7 +28,8 @@ export default class Rapipago { * @param {string} id Payment id. * @memberof Rapipago * @return {Promise} A promise to the Rapipago response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async succeed(id) { try { @@ -51,7 +52,8 @@ export default class Rapipago { * @param {string} id Payment id. * @memberof Rapipago * @return {Promise} A promise to the Rapipago response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async expire(id) { try { diff --git a/src/api/apm-specific/sepa.js b/src/api/apm-specific/sepa.js index a9674dea..801dfed9 100644 --- a/src/api/apm-specific/sepa.js +++ b/src/api/apm-specific/sepa.js @@ -25,7 +25,8 @@ export default class Sepa { * * @param {string} id Source id * @return {Promise} A promise to the Sepa response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getMandate(id) { const url = this.config.host.includes('sandbox') @@ -44,7 +45,8 @@ export default class Sepa { * * @param {string} id Source id * @return {Promise} A promise to the Sepa response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async cancelMandate(id) { const url = this.config.host.includes('sandbox') @@ -64,7 +66,8 @@ export default class Sepa { * * @param {string} id Source id * @return {Promise} A promise to the Sepa response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getPPROMandate(id) { const url = this.config.host.includes('sandbox') @@ -83,7 +86,8 @@ export default class Sepa { * * @param {string} id Source id * @return {Promise} A promise to the Sepa response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async cancelPPROMandate(id) { const url = this.config.host.includes('sandbox') diff --git a/src/api/balances/balances.js b/src/api/balances/balances.js index 8dd35f5c..d7b64cd1 100644 --- a/src/api/balances/balances.js +++ b/src/api/balances/balances.js @@ -38,7 +38,8 @@ export default class Balances { * that point in time. Forwarded verbatim as the `balancesAt` (camelCase) * query parameter, as defined in swagger. * @return {Promise} A promise to the balances response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async retrieve(id, options) { try { @@ -113,7 +114,8 @@ export default class Balances { * @param {string} currencyAccountId The ID of the sub-account to retrieve top-up * instructions for. * @return {Promise} A promise to the top-up instructions response. - * @throws {ValueError} If entityId or currencyAccountId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId or currencyAccountId is undefined, null, empty, "." or "..", + * or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async retrieveTopUpInstructions(entityId, currencyAccountId) { try { diff --git a/src/api/compliance-requests/compliance-requests.js b/src/api/compliance-requests/compliance-requests.js index 806821bd..442d51f6 100644 --- a/src/api/compliance-requests/compliance-requests.js +++ b/src/api/compliance-requests/compliance-requests.js @@ -22,7 +22,8 @@ export default class ComplianceRequests { * @memberof ComplianceRequests * @param {string} paymentId The payment id whose compliance request to fetch. * @return {Promise} A promise to the compliance request response. - * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..". + * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getComplianceRequest(paymentId) { try { @@ -49,7 +50,8 @@ export default class ComplianceRequests { * @param {string} paymentId The payment id whose compliance request to respond to. * @param {Object} body Compliance response body. * @return {Promise} A promise to the response. - * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..". + * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async respondToComplianceRequest(paymentId, body) { try { diff --git a/src/api/customers/customers.js b/src/api/customers/customers.js index 614bd966..745f2ddc 100644 --- a/src/api/customers/customers.js +++ b/src/api/customers/customers.js @@ -42,9 +42,11 @@ export default class Customers { * Get a customer * * @memberof Customers - * @param {string} id Customer id. + * @param {string} id The customer's ID or email. An email that contains "/" or "\" is rejected + * before any request is sent: use the customer's ID instead. * @return {Promise} A promise to the customer details response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async get(id) { try { @@ -67,7 +69,8 @@ export default class Customers { * @param {string} id Customer id. * @param {Object} body Customer object body. * @return {Promise} A promise to the request customer response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async update(id, body) { try { @@ -94,7 +97,8 @@ export default class Customers { * @memberof Customers * @param {string} id Customer id. * @return {Promise} A promise to the customer response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async delete(id) { try { diff --git a/src/api/disputes/disputes.js b/src/api/disputes/disputes.js index ea7e86d4..cc9b4210 100644 --- a/src/api/disputes/disputes.js +++ b/src/api/disputes/disputes.js @@ -47,7 +47,8 @@ export default class Disputes { * @memberof Disputes * @param {string} disputeId Dispute id. * @return {Promise} A promise to the dispute response. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getDetails(disputeId) { try { @@ -69,7 +70,8 @@ export default class Disputes { * @memberof Disputes * @param {string} disputeId Dispute id. * @return {Promise} A promise to the dispute response. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async accept(disputeId) { try { @@ -98,7 +100,8 @@ export default class Disputes { * @param {string} disputeId Dispute id. * @param {Object} body Evidence * @return {Promise} A promise to the dispute response. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async provideEvidence(disputeId, body) { try { @@ -121,7 +124,8 @@ export default class Disputes { * @memberof Disputes * @param {string} disputeId Dispute id. * @return {Promise} A promise to the dispute response. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getEvidence(disputeId) { try { @@ -145,7 +149,8 @@ export default class Disputes { * @memberof Disputes * @param {string} disputeId Dispute id. * @return {Promise} A promise to the dispute response. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async submit(disputeId) { try { @@ -169,7 +174,8 @@ export default class Disputes { * @memberof Disputes * @param {string} disputeId Dispute id. * @return {Promise} A promise to the compiled submitted evidence response. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getCompiledSubmittedEvidence(disputeId) { try { @@ -192,7 +198,8 @@ export default class Disputes { * @memberof Disputes * @param {string} disputeId Dispute id. * @return {Promise} A promise to the dispute scheme files response. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getDisputeSchemeFiles(disputeId) { try { @@ -216,7 +223,8 @@ export default class Disputes { * @memberof Disputes * @param {string} disputeId Dispute id. * @return {Promise} A promise that resolves when evidence is submitted successfully (204 No Content). - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async submitArbitrationEvidence(disputeId) { try { @@ -244,7 +252,8 @@ export default class Disputes { * @memberof Disputes * @param {string} disputeId Dispute id. * @return {Promise} A promise to the compiled submitted arbitration evidence response. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getCompiledSubmittedArbitrationEvidence(disputeId) { try { diff --git a/src/api/events/events.js b/src/api/events/events.js index d001989f..241873d4 100644 --- a/src/api/events/events.js +++ b/src/api/events/events.js @@ -72,7 +72,8 @@ export default class Events { * @memberof Events * @param {string} eventId Event id. * @return {Promise} A promise to the request event response. - * @throws {ValueError} If eventId is undefined, null, empty, "." or "..". + * @throws {ValueError} If eventId is undefined, null, empty, "." or "..", or contains "/", "\", + * an ASCII control character or an unpaired surrogate. */ async retrieveEvent(eventId) { try { @@ -95,7 +96,8 @@ export default class Events { * @memberof Events * @param {Object} body Event request body. * @return {Promise} A promise to the request event notifications response. - * @throws {ValueError} If body.eventId or body.notificationId is undefined, null, empty, "." or "..". + * @throws {ValueError} If body.eventId or body.notificationId is undefined, null, empty, "." or + * "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async retrieveEventNotification(body) { try { @@ -118,7 +120,8 @@ export default class Events { * @memberof Events * @param {Object} body Event request body. * @return {Promise} A promise to the retry event response. - * @throws {ValueError} If body.eventId or body.webhookId is undefined, null, empty, "." or "..". + * @throws {ValueError} If body.eventId or body.webhookId is undefined, null, empty, "." or + * "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async retry(body) { try { @@ -141,7 +144,8 @@ export default class Events { * @memberof Events * @param {string} eventId Event id. * @return {Promise} A promise to the retry events response. - * @throws {ValueError} If eventId is undefined, null, empty, "." or "..". + * @throws {ValueError} If eventId is undefined, null, empty, "." or "..", or contains "/", "\", + * an ASCII control character or an unpaired surrogate. */ async retryAll(eventId) { try { diff --git a/src/api/files/files.js b/src/api/files/files.js index a346cbb3..5dcdaca5 100644 --- a/src/api/files/files.js +++ b/src/api/files/files.js @@ -64,7 +64,8 @@ export default class Files { * @memberof Files * @param {string} fileId Files id. * @return {Promise} A promise to the files response. - * @throws {ValueError} If fileId is undefined, null, empty, "." or "..". + * @throws {ValueError} If fileId is undefined, null, empty, "." or "..", or contains "/", "\", + * an ASCII control character or an unpaired surrogate. */ async getFile(fileId) { try { diff --git a/src/api/forward/forward.js b/src/api/forward/forward.js index 4b7b749a..e5d79358 100644 --- a/src/api/forward/forward.js +++ b/src/api/forward/forward.js @@ -48,7 +48,8 @@ export default class Forward { * @memberof Forward * @param {string} id The unique identifier of the forward request * @return {Promise} A promise to the forward request details - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async get(id) { try { @@ -122,7 +123,8 @@ export default class Forward { * @param {string} name The secret name * @param {Object} body Update body with value and/or entity_id * @return {Promise} A promise to the updated secret metadata with incremented version - * @throws {ValueError} If name is undefined, null, empty, "." or "..". + * @throws {ValueError} If name is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async updateSecret(name, body) { try { @@ -145,7 +147,8 @@ export default class Forward { * @memberof Forward * @param {string} name The secret name to delete * @return {Promise} A promise to the deletion response - * @throws {ValueError} If name is undefined, null, empty, "." or "..". + * @throws {ValueError} If name is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async deleteSecret(name) { try { diff --git a/src/api/google-pay/google-pay.js b/src/api/google-pay/google-pay.js index ee89e581..f0257423 100644 --- a/src/api/google-pay/google-pay.js +++ b/src/api/google-pay/google-pay.js @@ -54,7 +54,8 @@ export default class GooglePay { * @param {string} entityId The enrolled entity id. * @param {Object} body { web_domain: string } per swagger `GooglePayRegisterDomainRequest`. * @return {Promise} A promise that resolves on success. - * @throws {ValueError} If entityId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async registerDomain(entityId, body) { try { @@ -77,7 +78,8 @@ export default class GooglePay { * @memberof GooglePay * @param {string} entityId The enrolled entity id. * @return {Promise} A promise to the registered-domains response. - * @throws {ValueError} If entityId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getRegisteredDomains(entityId) { try { @@ -99,7 +101,8 @@ export default class GooglePay { * @memberof GooglePay * @param {string} entityId The enrolled entity id. * @return {Promise} A promise to the enrollment-state response. - * @throws {ValueError} If entityId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getEnrollmentState(entityId) { try { diff --git a/src/api/hosted-payments/hosted-payments.js b/src/api/hosted-payments/hosted-payments.js index 748de9fe..c2bac310 100644 --- a/src/api/hosted-payments/hosted-payments.js +++ b/src/api/hosted-payments/hosted-payments.js @@ -77,7 +77,8 @@ export default class HostedPayments { * @memberof HostedPayments * @param {string} id - Hosted payment id * @return {Promise} A promise to the Hosted Payment response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async get(id) { try { diff --git a/src/api/identities/address-document-verifications.js b/src/api/identities/address-document-verifications.js index c203fb29..54759f4f 100644 --- a/src/api/identities/address-document-verifications.js +++ b/src/api/identities/address-document-verifications.js @@ -51,7 +51,8 @@ export default class AddressDocumentVerifications { * @method getAddressDocumentVerification * @param {string} address_document_verification_id - The address document verification's unique identifier * @returns {Promise} A promise to the Get an address document verification response - * @throws {ValueError} If address_document_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If address_document_verification_id is undefined, null, empty, "." or + * "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getAddressDocumentVerification(address_document_verification_id) { try { @@ -78,7 +79,8 @@ export default class AddressDocumentVerifications { * @param {number} [params.skip] - The number of attempts to skip. Defaults to 0 * @param {number} [params.limit] - The maximum number of attempts to return. Defaults to 10 * @returns {Promise} A promise to the Get address document verification attempts response - * @throws {ValueError} If address_document_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If address_document_verification_id is undefined, null, empty, "." or + * "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async listAttempts(address_document_verification_id, params) { try { @@ -106,7 +108,9 @@ export default class AddressDocumentVerifications { * @param {string} address_document_verification_id - The address document verification's unique identifier * @param {string} attempt_id - The attempt's unique identifier * @returns {Promise} A promise to the Get an address document verification attempt response - * @throws {ValueError} If address_document_verification_id or attempt_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If address_document_verification_id or attempt_id is undefined, null, + * empty, "." or "..", or contains "/", "\", an ASCII control character or an unpaired + * surrogate. */ async getAttempt(address_document_verification_id, attempt_id) { try { @@ -130,7 +134,8 @@ export default class AddressDocumentVerifications { * @method anonymizeAddressDocumentVerification * @param {string} address_document_verification_id - The address document verification's unique identifier * @returns {Promise} A promise to the Anonymize an address document verification response - * @throws {ValueError} If address_document_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If address_document_verification_id is undefined, null, empty, "." or + * "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async anonymizeAddressDocumentVerification(address_document_verification_id) { try { @@ -155,7 +160,8 @@ export default class AddressDocumentVerifications { * @param {string} address_document_verification_id - The address document verification's unique identifier * @param {Object} body - Request body * @returns {Promise} A promise to the Create an address document verification attempt response - * @throws {ValueError} If address_document_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If address_document_verification_id is undefined, null, empty, "." or + * "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async createAttempt(address_document_verification_id, body) { try { @@ -180,7 +186,8 @@ export default class AddressDocumentVerifications { * @method getPDFReport * @param {string} address_document_verification_id - The address document verification's unique identifier * @returns {Promise} A promise to the Get address document verification report response - * @throws {ValueError} If address_document_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If address_document_verification_id is undefined, null, empty, "." or + * "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getPDFReport(address_document_verification_id) { try { @@ -209,7 +216,9 @@ export default class AddressDocumentVerifications { * @param {number} [params.skip] - The number of assets to skip. Defaults to 0 * @param {number} [params.limit] - The maximum number of assets to return. Defaults to 10 * @returns {Promise} A promise to the Get address document verification attempt assets response - * @throws {ValueError} If address_document_verification_id or attempt_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If address_document_verification_id or attempt_id is undefined, null, + * empty, "." or "..", or contains "/", "\", an ASCII control character or an unpaired + * surrogate. */ async getAttemptAssets(address_document_verification_id, attempt_id, params) { try { diff --git a/src/api/identities/aml-screenings.js b/src/api/identities/aml-screenings.js index b45085b5..82da7698 100644 --- a/src/api/identities/aml-screenings.js +++ b/src/api/identities/aml-screenings.js @@ -46,7 +46,8 @@ export default class AMLScreenings { * @method getAMLScreening * @param {string} aml_screening_id - The AML screening's unique identifier * @returns {Promise} A promise to the Get an AML screening response - * @throws {ValueError} If aml_screening_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If aml_screening_id is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async getAMLScreening(aml_screening_id) { try { diff --git a/src/api/identities/applicants.js b/src/api/identities/applicants.js index 5083d9ab..afe86036 100644 --- a/src/api/identities/applicants.js +++ b/src/api/identities/applicants.js @@ -46,7 +46,8 @@ export default class Applicants { * @method getApplicant * @param {string} applicantId - The applicant profile's unique identifier * @returns {Promise} A promise to the Get an applicant response - * @throws {ValueError} If applicantId is undefined, null, empty, "." or "..". + * @throws {ValueError} If applicantId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getApplicant(applicantId) { try { @@ -70,7 +71,8 @@ export default class Applicants { * @param {string} applicantId - The applicant profile's unique identifier * @param {Object} body - Request body * @returns {Promise} A promise to the Update an applicant response - * @throws {ValueError} If applicantId is undefined, null, empty, "." or "..". + * @throws {ValueError} If applicantId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async updateApplicant(applicantId, body) { try { @@ -94,7 +96,8 @@ export default class Applicants { * @method anonymizeApplicant * @param {string} applicantId - The applicant profile's unique identifier * @returns {Promise} A promise to the Anonymize an applicant response - * @throws {ValueError} If applicantId is undefined, null, empty, "." or "..". + * @throws {ValueError} If applicantId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async anonymizeApplicant(applicantId) { try { diff --git a/src/api/identities/face-authentications.js b/src/api/identities/face-authentications.js index c9a09218..9b19e3c4 100644 --- a/src/api/identities/face-authentications.js +++ b/src/api/identities/face-authentications.js @@ -50,7 +50,8 @@ export default class FaceAuthentications { * @method getFaceAuthentication * @param {string} face_authentication_id - The face authentication's unique identifier * @returns {Promise} A promise to the Get a face authentication response - * @throws {ValueError} If face_authentication_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If face_authentication_id is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getFaceAuthentication(face_authentication_id) { try { @@ -77,7 +78,8 @@ export default class FaceAuthentications { * @param {number} [params.skip] - The number of attempts to skip. Defaults to 0 * @param {number} [params.limit] - The maximum number of attempts to return. Defaults to 10 * @returns {Promise} A promise to the Get face authentication attempts response - * @throws {ValueError} If face_authentication_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If face_authentication_id is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async listAttempts(face_authentication_id, params) { try { @@ -105,7 +107,8 @@ export default class FaceAuthentications { * @param {string} face_authentication_id - The face authentication's unique identifier * @param {string} attempt_id - The attempt's unique identifier * @returns {Promise} A promise to the Get a face authentication attempt response - * @throws {ValueError} If face_authentication_id or attempt_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If face_authentication_id or attempt_id is undefined, null, empty, "." + * or "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getAttempt(face_authentication_id, attempt_id) { try { @@ -133,7 +136,8 @@ export default class FaceAuthentications { * @param {number} [params.skip] - The number of assets to skip. Defaults to 0 * @param {number} [params.limit] - The maximum number of assets to return. Defaults to 10 * @returns {Promise} A promise to the Get face authentication attempt assets response - * @throws {ValueError} If face_authentication_id or attempt_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If face_authentication_id or attempt_id is undefined, null, empty, "." + * or "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getAttemptAssets(face_authentication_id, attempt_id, params) { try { @@ -162,7 +166,8 @@ export default class FaceAuthentications { * @param {string} face_authentication_id - The face authentication's unique identifier * @param {Object} body - Request body * @returns {Promise} A promise to the Create a face authentication attempt response - * @throws {ValueError} If face_authentication_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If face_authentication_id is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async createAttempt(face_authentication_id, body) { try { @@ -187,7 +192,8 @@ export default class FaceAuthentications { * @method anonymizeFaceAuthentication * @param {string} face_authentication_id - The face authentication's unique identifier * @returns {Promise} A promise to the Anonymize a face authentication response - * @throws {ValueError} If face_authentication_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If face_authentication_id is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async anonymizeFaceAuthentication(face_authentication_id) { try { diff --git a/src/api/identities/id-document-verifications.js b/src/api/identities/id-document-verifications.js index 3c8ee4f3..b05e73b8 100644 --- a/src/api/identities/id-document-verifications.js +++ b/src/api/identities/id-document-verifications.js @@ -51,7 +51,8 @@ export default class IDDocumentVerifications { * @method getIDDocumentVerification * @param {string} id_document_verification_id - The ID document verification's unique identifier * @returns {Promise} A promise to the Get an ID document verification response - * @throws {ValueError} If id_document_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id_document_verification_id is undefined, null, empty, "." or "..", + * or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getIDDocumentVerification(id_document_verification_id) { try { @@ -78,7 +79,8 @@ export default class IDDocumentVerifications { * @param {number} [params.skip] - The number of attempts to skip. Defaults to 0 * @param {number} [params.limit] - The maximum number of attempts to return. Defaults to 10 * @returns {Promise} A promise to the Get ID document verification attempts response - * @throws {ValueError} If id_document_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id_document_verification_id is undefined, null, empty, "." or "..", + * or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async listAttempts(id_document_verification_id, params) { try { @@ -106,7 +108,8 @@ export default class IDDocumentVerifications { * @param {string} id_document_verification_id - The ID document verification's unique identifier * @param {string} attempt_id - The attempt's unique identifier * @returns {Promise} A promise to the Get an ID document verification attempt response - * @throws {ValueError} If id_document_verification_id or attempt_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id_document_verification_id or attempt_id is undefined, null, empty, + * "." or "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getAttempt(id_document_verification_id, attempt_id) { try { @@ -130,7 +133,8 @@ export default class IDDocumentVerifications { * @method anonymizeIDDocumentVerification * @param {string} id_document_verification_id - The ID document verification's unique identifier * @returns {Promise} A promise to the Anonymize an ID document verification response - * @throws {ValueError} If id_document_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id_document_verification_id is undefined, null, empty, "." or "..", + * or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async anonymizeIDDocumentVerification(id_document_verification_id) { try { @@ -156,7 +160,8 @@ export default class IDDocumentVerifications { * @param {string} id_document_verification_id - The ID document verification's unique identifier * @param {Object} body - Request body * @returns {Promise} A promise to the Create an ID document verification attempt response - * @throws {ValueError} If id_document_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id_document_verification_id is undefined, null, empty, "." or "..", + * or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async createAttempt(id_document_verification_id, body) { try { @@ -182,7 +187,8 @@ export default class IDDocumentVerifications { * @method getPDFReport * @param {string} id_document_verification_id - The ID document verification's unique identifier * @returns {Promise} A promise to the Get ID document verification report response - * @throws {ValueError} If id_document_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id_document_verification_id is undefined, null, empty, "." or "..", + * or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getPDFReport(id_document_verification_id) { try { @@ -211,7 +217,8 @@ export default class IDDocumentVerifications { * @param {number} [params.skip] - The number of assets to skip. Defaults to 0 * @param {number} [params.limit] - The maximum number of assets to return. Defaults to 10 * @returns {Promise} A promise to the Get ID document verification attempt assets response - * @throws {ValueError} If id_document_verification_id or attempt_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id_document_verification_id or attempt_id is undefined, null, empty, + * "." or "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getAttemptAssets(id_document_verification_id, attempt_id, params) { try { diff --git a/src/api/identities/identity-verifications.js b/src/api/identities/identity-verifications.js index 24c9345d..539d30b9 100644 --- a/src/api/identities/identity-verifications.js +++ b/src/api/identities/identity-verifications.js @@ -76,7 +76,8 @@ export default class IdentityVerifications { * @method getIdentityVerification * @param {string} identity_verification_id - The identity verification's unique identifier * @returns {Promise} A promise to the Get an identity verification response - * @throws {ValueError} If identity_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If identity_verification_id is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getIdentityVerification(identity_verification_id) { try { @@ -100,7 +101,8 @@ export default class IdentityVerifications { * @method anonymizeIdentityVerification * @param {string} identity_verification_id - The identity verification's unique identifier * @returns {Promise} A promise to the Anonymize an identity verification response - * @throws {ValueError} If identity_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If identity_verification_id is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async anonymizeIdentityVerification(identity_verification_id) { try { @@ -125,7 +127,8 @@ export default class IdentityVerifications { * @param {string} identity_verification_id - The identity verification's unique identifier * @param {Object} body - Request body * @returns {Promise} A promise to the Create an identity verification attempt response - * @throws {ValueError} If identity_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If identity_verification_id is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async createAttempt(identity_verification_id, body) { try { @@ -153,7 +156,8 @@ export default class IdentityVerifications { * @param {number} [params.skip] - The number of attempts to skip. Defaults to 0 * @param {number} [params.limit] - The maximum number of attempts to return. Defaults to 10 * @returns {Promise} A promise to the Get identity verification attempts response - * @throws {ValueError} If identity_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If identity_verification_id is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async listAttempts(identity_verification_id, params) { try { @@ -181,7 +185,8 @@ export default class IdentityVerifications { * @param {string} identity_verification_id - The identity verification's unique identifier * @param {string} attempt_id - The attempt's unique identifier * @returns {Promise} A promise to the Get an identity verification attempt response - * @throws {ValueError} If identity_verification_id or attempt_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If identity_verification_id or attempt_id is undefined, null, empty, "." + * or "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getAttempt(identity_verification_id, attempt_id) { try { @@ -210,7 +215,8 @@ export default class IdentityVerifications { * @param {number} [params.skip] - The number of assets to skip. Defaults to 0 * @param {number} [params.limit] - The maximum number of assets to return. Defaults to 10 * @returns {Promise} A promise to the Get identity verification attempt assets response - * @throws {ValueError} If identity_verification_id or attempt_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If identity_verification_id or attempt_id is undefined, null, empty, "." + * or "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getAttemptAssets(identity_verification_id, attempt_id, params) { try { @@ -240,7 +246,8 @@ export default class IdentityVerifications { * @param {string} identity_verification_id - The identity verification's unique identifier * @returns {Promise} A promise to the Get identity verification report response, * carrying `pdf_report`, the pre-signed URL to the PDF - * @throws {ValueError} If identity_verification_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If identity_verification_id is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getPDFReport(identity_verification_id) { try { diff --git a/src/api/instruments/instruments.js b/src/api/instruments/instruments.js index 8339b6d7..a3e90d93 100644 --- a/src/api/instruments/instruments.js +++ b/src/api/instruments/instruments.js @@ -129,7 +129,8 @@ export default class Instruments { * @memberof Instruments * @param {string} id Instrument id. * @return {Promise} A promise to the instrument response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async get(id) { try { @@ -179,7 +180,8 @@ export default class Instruments { * @param {string} id Instrument id. * @param {Object} body Instruments request body. * @return {Promise} A promise to the instrument response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async update(id, body) { try { @@ -202,7 +204,8 @@ export default class Instruments { * @memberof Instruments * @param {string} id Instrument id. * @return {Promise} A promise to the instrument response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async delete(id) { try { @@ -230,7 +233,8 @@ export default class Instruments { * @memberof Instruments * @param {string} id Instrument id (pattern: ^(src_)[a-z0-9]{26}$). * @return {Promise} A promise to the revoke response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async revoke(id) { try { @@ -268,7 +272,8 @@ export default class Instruments { * @param {string} [query.accountHolderType] individual | corporate | government. * @param {string} [query.paymentNetwork] local | sepa | fps | ach | fedwire | swift. * @return {Promise} A promise to the bank account field response. - * @throws {ValueError} If country or currency is undefined, null, empty, "." or "..". + * @throws {ValueError} If country or currency is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getBankAccountFieldFormatting(country, currency, query) { try { diff --git a/src/api/inventory/inventory.js b/src/api/inventory/inventory.js index 79b9fc38..c10701d0 100644 --- a/src/api/inventory/inventory.js +++ b/src/api/inventory/inventory.js @@ -134,7 +134,8 @@ export default class Inventory { * @memberof Inventory * @param {string} id Reservation id. * @return {Promise} A promise to the InventoryReservation response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getInventoryReservation(id) { try { @@ -157,7 +158,8 @@ export default class Inventory { * @memberof Inventory * @param {string} id Reservation id. * @return {Promise} A promise to the InventoryReservation response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async commitInventoryReservation(id) { try { @@ -180,7 +182,8 @@ export default class Inventory { * @memberof Inventory * @param {string} id Reservation id. * @return {Promise} A promise to the InventoryReservation response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async releaseInventoryReservation(id) { try { @@ -213,7 +216,8 @@ export default class Inventory { * @param {string} [options.expand] Set to `'product'` to embed the variant's * product knowledge in the response. * @return {Promise} A promise to the InventoryLevels response. - * @throws {ValueError} If variantId is undefined, null, empty, "." or "..". + * @throws {ValueError} If variantId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getInventoryLevels(variantId, options) { try { @@ -251,7 +255,8 @@ export default class Inventory { * @param {number} [body.safety_stock] Buffer withheld from sale. * @param {string} [body.reason] Free-text reason for the ledger. * @return {Promise} A promise to the InventoryLevels response. - * @throws {ValueError} If variantId is undefined, null, empty, "." or "..". + * @throws {ValueError} If variantId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async setInventoryLevels(variantId, body) { try { @@ -291,7 +296,8 @@ export default class Inventory { * @memberof Inventory * @param {string} variantId Variant id (max 128 chars). * @return {Promise} A promise to the InventoryProductKnowledge response. - * @throws {ValueError} If variantId is undefined, null, empty, "." or "..". + * @throws {ValueError} If variantId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getInventoryProduct(variantId) { try { @@ -327,7 +333,8 @@ export default class Inventory { * @param {string} body.product_url Product page URL. [Required] max 2048 chars. * @param {string} body.image_url Product image URL. [Required] max 2048 chars. * @return {Promise} A promise to the InventoryProductKnowledge response. - * @throws {ValueError} If variantId is undefined, null, empty, "." or "..". + * @throws {ValueError} If variantId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async setInventoryProduct(variantId, body) { try { @@ -351,7 +358,8 @@ export default class Inventory { * @memberof Inventory * @param {string} variantId Variant id (max 128 chars). * @return {Promise} A promise that resolves to an empty object on success. - * @throws {ValueError} If variantId is undefined, null, empty, "." or "..". + * @throws {ValueError} If variantId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async deleteInventoryProduct(variantId) { try { diff --git a/src/api/issuing/cardholders.js b/src/api/issuing/cardholders.js index 98b0258c..2490f544 100644 --- a/src/api/issuing/cardholders.js +++ b/src/api/issuing/cardholders.js @@ -46,7 +46,8 @@ export default class Cardholders { * @memberof Cardholders * @param {string} id Cardholder id. * @return {Promise} A promise to the cardholder details response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getCardholder(id) { try { @@ -69,7 +70,8 @@ export default class Cardholders { * @param {string} id Cardholder id. * @param {Object} body Cardholder params to update. * @return {Promise} A promise to the cardholder update response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async updateCardholder(id, body) { try { @@ -92,7 +94,8 @@ export default class Cardholders { * @memberof Cardholders * @param {string} id Cardholder id. * @return {Promise} A promise to the cardholder details response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getCardholderCards(id) { try { diff --git a/src/api/issuing/cards.js b/src/api/issuing/cards.js index 66e5cf4a..cb09e9a0 100644 --- a/src/api/issuing/cards.js +++ b/src/api/issuing/cards.js @@ -65,7 +65,8 @@ export default class Cards { * @memberof Cards * @param {string} id Card id. * @return {Promise} A promise to the card details response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getCardDetails(id) { try { @@ -126,7 +127,8 @@ export default class Cards { * `scheduled_revocation_date`), `scheduled_activation_date`, `last_activated_on`, * `root_card_id`, `parent_card_id`, `scheme`, `created_date`, `last_modified_date`, `_links` * and, for virtual cards only (`type` is `virtual`), `is_single_use`. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async updateCard(id, body, headers) { try { @@ -154,7 +156,8 @@ export default class Cards { * @param {string} id Card id. * @param {Object} body 3DS enrollment params. * @return {Promise} A promise to the card response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async enrollThreeDS(id, body) { try { @@ -178,7 +181,8 @@ export default class Cards { * @param {string} id Card id. * @param {Object} body 3DS enrollment params. * @return {Promise} A promise to the card response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async updateThreeDS(id, body) { try { @@ -201,7 +205,8 @@ export default class Cards { * @memberof Cards * @param {string} id Card id. * @return {Promise} A promise to the card response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getThreeDSDetails(id) { try { @@ -226,7 +231,8 @@ export default class Cards { * @memberof Cards * @param {string} id Card id. * @return {Promise} A promise to the card response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async activateCard(id) { try { @@ -249,7 +255,8 @@ export default class Cards { * @param {string} id Card id. * @param {Object} body Card params. * @return {Promise} A promise to the card response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getCardCredentials(id, body) { try { @@ -272,7 +279,8 @@ export default class Cards { * @param {string} id Card id. * @param {Object} body Card renewal params. * @return {Promise} A promise to the card renewal response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async renewCard(id, body) { try { @@ -298,7 +306,8 @@ export default class Cards { * without a body. * @param {string} [body.reason] Optional reason: `expired`, `reported_lost` or `reported_stolen`. * @return {Promise} A promise to the revoke-card response, carrying `_links`. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async revokeCard(id, body) { try { @@ -324,7 +333,8 @@ export default class Cards { * without a body. * @param {string} [body.reason] Optional reason: `suspected_lost` or `suspected_stolen`. * @return {Promise} A promise to the suspend-card response, carrying `_links`. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async suspendCard(id, body) { try { diff --git a/src/api/issuing/control-groups.js b/src/api/issuing/control-groups.js index a60ad13c..e1437e8f 100644 --- a/src/api/issuing/control-groups.js +++ b/src/api/issuing/control-groups.js @@ -66,7 +66,8 @@ export default class ControlGroups { * @memberof ControlGroups * @param {string} controlGroupId The control group ID. * @return {Promise} A promise to the control group details. - * @throws {ValueError} If controlGroupId is undefined, null, empty, "." or "..". + * @throws {ValueError} If controlGroupId is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async getControlGroup(controlGroupId) { try { @@ -90,7 +91,8 @@ export default class ControlGroups { * @memberof ControlGroups * @param {string} controlGroupId The control group ID. * @return {Promise} A promise to the deletion response. - * @throws {ValueError} If controlGroupId is undefined, null, empty, "." or "..". + * @throws {ValueError} If controlGroupId is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async deleteControlGroup(controlGroupId) { try { diff --git a/src/api/issuing/control-profiles.js b/src/api/issuing/control-profiles.js index 8d6af341..1a5b8db8 100644 --- a/src/api/issuing/control-profiles.js +++ b/src/api/issuing/control-profiles.js @@ -68,7 +68,8 @@ export default class ControlProfiles { * @memberof ControlProfiles * @param {string} controlProfileId The control profile ID. * @return {Promise} A promise to the control profile details. - * @throws {ValueError} If controlProfileId is undefined, null, empty, "." or "..". + * @throws {ValueError} If controlProfileId is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async getControlProfile(controlProfileId) { try { @@ -92,7 +93,8 @@ export default class ControlProfiles { * @param {string} controlProfileId The control profile ID. * @param {Object} body Control profile update params. * @return {Promise} A promise to the control profile response. - * @throws {ValueError} If controlProfileId is undefined, null, empty, "." or "..". + * @throws {ValueError} If controlProfileId is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async updateControlProfile(controlProfileId, body) { try { @@ -116,7 +118,8 @@ export default class ControlProfiles { * @memberof ControlProfiles * @param {string} controlProfileId The control profile ID. * @return {Promise} A promise to the deletion response. - * @throws {ValueError} If controlProfileId is undefined, null, empty, "." or "..". + * @throws {ValueError} If controlProfileId is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async deleteControlProfile(controlProfileId) { try { @@ -140,7 +143,8 @@ export default class ControlProfiles { * @param {string} controlProfileId The control profile ID. * @param {string} targetId The target ID to add to control profile. * @return {Promise} A promise to the response. - * @throws {ValueError} If controlProfileId or targetId is undefined, null, empty, "." or "..". + * @throws {ValueError} If controlProfileId or targetId is undefined, null, empty, "." or "..", + * or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async addTargetToControlProfile(controlProfileId, targetId) { try { @@ -164,7 +168,8 @@ export default class ControlProfiles { * @param {string} controlProfileId The control profile ID. * @param {string} targetId The target ID to remove from control profile. * @return {Promise} A promise to the response. - * @throws {ValueError} If controlProfileId or targetId is undefined, null, empty, "." or "..". + * @throws {ValueError} If controlProfileId or targetId is undefined, null, empty, "." or "..", + * or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async removeTargetFromControlProfile(controlProfileId, targetId) { try { diff --git a/src/api/issuing/controls.js b/src/api/issuing/controls.js index 543f3a3c..f728b97a 100644 --- a/src/api/issuing/controls.js +++ b/src/api/issuing/controls.js @@ -138,7 +138,8 @@ export default class Controls { * @memberof Controls * @param {string} id Card control id. * @return {Promise} A promise to the control details. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getCardControlDetails(id) { try { @@ -161,7 +162,8 @@ export default class Controls { * @param {string} id Card control id. * @param {Object} body Card control params. * @return {Promise} A promise to the updated control. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async updateCardControl(id, body) { try { @@ -184,7 +186,8 @@ export default class Controls { * @memberof Controls * @param {string} id Card control id. * @return {Promise} A promise to the removed control id. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async deleteCardControl(id) { try { diff --git a/src/api/issuing/digital-cards.js b/src/api/issuing/digital-cards.js index 05603e3e..0d100d4e 100644 --- a/src/api/issuing/digital-cards.js +++ b/src/api/issuing/digital-cards.js @@ -24,7 +24,8 @@ export default class DigitalCards { * @memberof DigitalCards * @param {string} digitalCardId The digital card ID. * @return {Promise} A promise to the digital card details. - * @throws {ValueError} If digitalCardId is undefined, null, empty, "." or "..". + * @throws {ValueError} If digitalCardId is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async getDigitalCard(digitalCardId) { try { diff --git a/src/api/issuing/disputes.js b/src/api/issuing/disputes.js index 558cdbbf..bb404888 100644 --- a/src/api/issuing/disputes.js +++ b/src/api/issuing/disputes.js @@ -56,7 +56,8 @@ export default class Disputes { * @memberof Disputes * @param {string} disputeId The dispute ID. * @return {Promise} A promise to the dispute details. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getDispute(disputeId) { try { @@ -80,7 +81,8 @@ export default class Disputes { * @memberof Disputes * @param {string} disputeId The dispute ID. * @return {Promise} A promise to the cancellation response. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async cancelDispute(disputeId) { try { @@ -105,7 +107,8 @@ export default class Disputes { * @param {Object} [body] Escalation request params. Provide `fraud_details` * when the dispute reason code is fraud-related. * @return {Promise} A promise to the escalation response. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async escalateDispute(disputeId, body) { try { @@ -134,7 +137,8 @@ export default class Disputes { * `evidence`, `fraud_details`, `reason_change_justification`, * `action_response`). * @return {Promise} A promise to the dispute response. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async amendDispute(disputeId, body) { try { @@ -162,7 +166,8 @@ export default class Disputes { * @param {string} disputeId The dispute ID. * @param {Object} [body] Submission request params. * @return {Promise} A promise to the submission response. - * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..". + * @throws {ValueError} If disputeId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async submitDispute(disputeId, body) { try { diff --git a/src/api/issuing/simulate.js b/src/api/issuing/simulate.js index f207df63..1218a8c1 100644 --- a/src/api/issuing/simulate.js +++ b/src/api/issuing/simulate.js @@ -52,7 +52,8 @@ export default class Simulate { * @param {String} id transaction ID. * @param {Object} body Amount. * @return {Promise} A promise to the simulation response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async simulateIncrement(id, body) { try { @@ -76,7 +77,8 @@ export default class Simulate { * @param {String} id transaction ID. * @param {Object} body Amount. * @return {Promise} A promise to the simulation response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async simulateClearing(id, body) { try { @@ -100,7 +102,8 @@ export default class Simulate { * @param {String} id transaction ID. * @param {Object} body Refund amount and params. * @return {Promise} A promise to the simulation response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async simulateRefund(id, body) { try { @@ -124,7 +127,8 @@ export default class Simulate { * @param {String} id transaction ID. * @param {Object} body Amount. * @return {Promise} A promise to the simulation response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async simulateReversal(id, body) { try { diff --git a/src/api/issuing/transactions.js b/src/api/issuing/transactions.js index 9f1e7852..b20f276e 100644 --- a/src/api/issuing/transactions.js +++ b/src/api/issuing/transactions.js @@ -43,7 +43,8 @@ export default class Transactions { * @memberof Transactions * @param {string} transactionId The transaction ID. * @return {Promise} A promise to the transaction details. - * @throws {ValueError} If transactionId is undefined, null, empty, "." or "..". + * @throws {ValueError} If transactionId is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async getTransactionById(transactionId) { try { diff --git a/src/api/network-tokens/network-tokens.js b/src/api/network-tokens/network-tokens.js index eb1c5586..e7590374 100644 --- a/src/api/network-tokens/network-tokens.js +++ b/src/api/network-tokens/network-tokens.js @@ -49,7 +49,8 @@ export default class NetworkTokens { * @memberof NetworkTokens * @param {string} network_token_id - The network token ID * @returns {Promise} A promise to the Get Network Token response - * @throws {ValueError} If network_token_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If network_token_id is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async getNetworkToken(network_token_id) { try { @@ -74,7 +75,8 @@ export default class NetworkTokens { * @param {string} network_token_id - The network token ID * @param {Object} body - Request body containing transaction_type * @returns {Promise} A promise to the Request a cryptogram response - * @throws {ValueError} If network_token_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If network_token_id is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async provisionCryptogram(network_token_id, body) { try { @@ -100,7 +102,8 @@ export default class NetworkTokens { * @memberof NetworkTokens * @param {string} network_token_id - Unique token ID assigned by Checkout.com for each token * @returns {Promise} A promise to the Delete Network Token response - * @throws {ValueError} If network_token_id is undefined, null, empty, "." or "..". + * @throws {ValueError} If network_token_id is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async deleteNetworkToken(network_token_id) { try { diff --git a/src/api/onboarding-simulator/onboarding-simulator.js b/src/api/onboarding-simulator/onboarding-simulator.js index 5a82ce55..dc2c4551 100644 --- a/src/api/onboarding-simulator/onboarding-simulator.js +++ b/src/api/onboarding-simulator/onboarding-simulator.js @@ -67,7 +67,8 @@ export default class OnboardingSimulator { * @param {string} entityId The sub-entity id. * @param {Object} body { field_names: string[] } * @return {Promise} A promise to the simulation response. - * @throws {ValueError} If entityId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async setRequirementsDue(entityId, body) { try { @@ -91,7 +92,8 @@ export default class OnboardingSimulator { * @param {string} entityId The sub-entity id. * @param {string} scenarioId The scenario id to execute. * @return {Promise} A promise to the simulation response. - * @throws {ValueError} If entityId or scenarioId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId or scenarioId is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async runScenario(entityId, scenarioId) { try { @@ -114,7 +116,8 @@ export default class OnboardingSimulator { * @param {string} entityId The sub-entity id. * @param {Object} body { status: string, ... } (see swagger SimulatorSetStatusRequest). * @return {Promise} A promise to the simulation response. - * @throws {ValueError} If entityId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async setEntityStatus(entityId, body) { try { diff --git a/src/api/payment-contexts/payment-contexts.js b/src/api/payment-contexts/payment-contexts.js index 06bb79bd..8249cf03 100644 --- a/src/api/payment-contexts/payment-contexts.js +++ b/src/api/payment-contexts/payment-contexts.js @@ -87,7 +87,8 @@ export default class PaymentContexts { * @memberof PaymentContexts * @param {string} id /^(pay|sid)_(\w{26})$/ The payment or payment session identifier. * @return {Promise} A promise to the get payment context response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async get(id) { try { diff --git a/src/api/payment-sessions/payment-sessions.js b/src/api/payment-sessions/payment-sessions.js index cfc412c0..bca4d381 100644 --- a/src/api/payment-sessions/payment-sessions.js +++ b/src/api/payment-sessions/payment-sessions.js @@ -92,7 +92,8 @@ export default class PaymentSessions { * @param {string} id The payment session ID. * @param {object} body PaymentSessions Request body. * @return {Promise} A promise to payment context response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async submit(id, body) { try { diff --git a/src/api/payment-setups/payment-setups.js b/src/api/payment-setups/payment-setups.js index 49c89545..c2f693aa 100644 --- a/src/api/payment-setups/payment-setups.js +++ b/src/api/payment-setups/payment-setups.js @@ -231,7 +231,8 @@ export default class PaymentSetups { * @param {string} id - The unique identifier of the Payment Setup to update. * @param {Object} body - Request body * @returns {Promise} A promise to the Update a Payment Setup response - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async updateAPaymentSetup(id, body) { try { @@ -337,7 +338,8 @@ export default class PaymentSetups { * @memberof PaymentSetups * @param {string} id - The unique identifier of the Payment Setup to retrieve. * @returns {Promise} A promise to the Get a Payment Setup response - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getAPaymentSetup(id) { try { @@ -390,7 +392,8 @@ export default class PaymentSetups { * @param {string} id - The unique identifier of the Payment Setup. * @param {string} payment_method_name - The name of the payment method to process the payment with (e.g. "tabby", "klarna", "card", "cashapp", "tamara"). * @returns {Promise} A promise to the Confirm a Payment Setup response - * @throws {ValueError} If id or payment_method_name is undefined, null, empty, "." or "..". + * @throws {ValueError} If id or payment_method_name is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async confirmAPaymentSetup(id, payment_method_name) { try { diff --git a/src/api/payments-links/payments-links.js b/src/api/payments-links/payments-links.js index 20091366..5c8703d2 100644 --- a/src/api/payments-links/payments-links.js +++ b/src/api/payments-links/payments-links.js @@ -78,7 +78,8 @@ export default class PaymentLinks { * @memberof PaymentLinks * @param {string} id * @return {Promise} A promise to the Payment Link response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async get(id) { try { diff --git a/src/api/payments/payments.js b/src/api/payments/payments.js index 008c0008..a452424a 100644 --- a/src/api/payments/payments.js +++ b/src/api/payments/payments.js @@ -224,7 +224,8 @@ export default class Payments { * @memberof Payments * @param {string} id /^(pay|sid)_(\w{26})$/ The payment or payment session identifier. * @return {Promise} A promise to the get payment response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async get(id) { try { @@ -247,7 +248,8 @@ export default class Payments { * @memberof Payments * @param {string} id /^(pay)_(\w{26})$/ The payment identifier. * @return {Promise} A promise to the getActions response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getActions(id) { try { @@ -272,7 +274,8 @@ export default class Payments { * @param {Object} body Payment Request body. * @param {string} [idempotencyKey] Idempotency Key. * @return {Promise} A promise to the getActions response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async increment(id, body, idempotencyKey) { try { @@ -299,7 +302,8 @@ export default class Payments { * @param {Object} body Payment Request body. * @param {string} [idempotencyKey] Idempotency Key. * @return {Promise} A promise to the getActions response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async cancelScheduledRetry(id, body, idempotencyKey) { try { @@ -325,7 +329,8 @@ export default class Payments { * @param {Object} [body] Capture request body. * @param {string} [idempotencyKey] Idempotency Key. * @return {Promise} A promise to the capture response. - * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..". + * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async capture(paymentId, body, idempotencyKey) { try { @@ -351,7 +356,8 @@ export default class Payments { * @param {Object} [body] Refund request body. * @param {string} [idempotencyKey] Idempotency Key. * @return {Promise} A promise to the refund response. - * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..". + * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async refund(paymentId, body, idempotencyKey) { try { @@ -380,7 +386,8 @@ export default class Payments { * @param {Object} [body] Reverse request body. * @param {string} [idempotencyKey] Idempotency Key. * @return {Promise} A promise to the reverse response. - * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..". + * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async reverse(paymentId, body, idempotencyKey) { try { @@ -407,7 +414,8 @@ export default class Payments { * @param {number} [body.amount] The amount to void, in the minor currency unit (min 0, max 9999999999). If not specified, the full payment amount is voided. * @param {string} [idempotencyKey] Idempotency Key. * @return {Promise} A promise to the void response. - * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..". + * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async void(paymentId, body, idempotencyKey) { try { diff --git a/src/api/platforms/entity-requirements.js b/src/api/platforms/entity-requirements.js index 7b44aa68..fe76acb0 100644 --- a/src/api/platforms/entity-requirements.js +++ b/src/api/platforms/entity-requirements.js @@ -26,7 +26,8 @@ export default class EntityRequirements { * @param {string} entityId The sub-entity id. * @param {string} [schemaVersion='3.0'] Schema version to use (1.0, 2.0, or 3.0). * @return {Promise} A promise to the requirements list response. - * @throws {ValueError} If entityId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getEntityRequirements(entityId, schemaVersion) { try { @@ -49,7 +50,8 @@ export default class EntityRequirements { * @param {string} entityId The sub-entity id. * @param {string} requirementId The requirement id. * @return {Promise} A promise to the requirement details response. - * @throws {ValueError} If entityId or requirementId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId or requirementId is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getEntityRequirementDetails(entityId, requirementId) { try { @@ -74,7 +76,8 @@ export default class EntityRequirements { * @param {Object} body { value: ... } — concrete shape defined by the * requirement's `_schema` returned from {@link getEntityRequirementDetails}. * @return {Promise} A promise to the update response. - * @throws {ValueError} If entityId or requirementId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId or requirementId is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async updateEntityRequirement(entityId, requirementId, body) { try { diff --git a/src/api/platforms/files.js b/src/api/platforms/files.js index 4173e251..1c7781f2 100644 --- a/src/api/platforms/files.js +++ b/src/api/platforms/files.js @@ -72,7 +72,8 @@ export default class PlatformFiles { * @param {Object} body The body; body.purpose is the purpose of the file upload, one of the * values above. * @returns {Promise} A promise to the file id and upload link. - * @throws {ValueError} If entityId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async uploadAFile(entityId, body) { try { @@ -98,7 +99,8 @@ export default class PlatformFiles { * @returns {Promise} A promise to the file's id, status, status_reasons, size, * mime_type, uploaded_on, purpose and _links (download, the link to fetch the content, and * self). - * @throws {ValueError} If entityId or fileId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId or fileId is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async retrieveAFile(entityId, fileId) { try { diff --git a/src/api/platforms/payment-instruments.js b/src/api/platforms/payment-instruments.js index 7f8f0a8b..962c5254 100644 --- a/src/api/platforms/payment-instruments.js +++ b/src/api/platforms/payment-instruments.js @@ -25,7 +25,8 @@ export default class PaymentInstruments { * @param {string} entityId The sub-entity's ID. * @param {string} id The payment instrument's ID. * @return {Promise} A promise to the Platforms response. - * @throws {ValueError} If entityId or id is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId or id is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async getPaymentInstrumentDetails(entityId, id) { try { @@ -59,7 +60,8 @@ export default class PaymentInstruments { * @param {string} id Payment instrument's id. * @param {Object} body The update, as described above. * @return {Promise} A promise to the Platforms response: the instrument id and _links. - * @throws {ValueError} If entityId or id is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId or id is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async updatePaymentInstrumentDetails(entityId, id, body) { try { @@ -83,7 +85,8 @@ export default class PaymentInstruments { * @param {string} id Sub-entity id. * @param {Object} body Platforms request body. * @return {Promise} A promise to the Platforms response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async createPaymentInstrument(id, body) { try { @@ -116,7 +119,8 @@ export default class PaymentInstruments { * @param {string} id Sub-entity id. * @param {Object} body Platforms request body. * @return {Promise} A promise to the Platforms response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async addPaymentInstrument(id, body) { try { @@ -139,7 +143,8 @@ export default class PaymentInstruments { * @param {string} id The sub-entity's ID. * @param {string} [status] The status of your sub-entity's payment instrument. * @return {Promise} A promise to the Platforms response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async queryPaymentInstruments(id, status) { try { diff --git a/src/api/platforms/payout-schedules.js b/src/api/platforms/payout-schedules.js index 04658309..78df122d 100644 --- a/src/api/platforms/payout-schedules.js +++ b/src/api/platforms/payout-schedules.js @@ -34,7 +34,8 @@ export default class PayoutSchedules { * * @param {string} id The sub-entity's ID. * @return {Promise} A promise to the Platforms response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async retrieveSubEntityPayoutSchedule(id) { try { @@ -69,7 +70,8 @@ export default class PayoutSchedules { * @param {string} id The sub-entity's ID. * @param {Object} body Platforms request body. * @return {Promise} A promise to the Platforms response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async updateSubEntityPayoutSchedule(id, body) { try { diff --git a/src/api/platforms/reserve-rules.js b/src/api/platforms/reserve-rules.js index 1045e5a2..a61c43cc 100644 --- a/src/api/platforms/reserve-rules.js +++ b/src/api/platforms/reserve-rules.js @@ -24,7 +24,8 @@ export default class ReserveRules { * @param {string} entityId The sub-entity's ID. * @param {string} id The reserve rule ID. * @return {Promise} A promise to the Platforms response (includes headers for ETag). - * @throws {ValueError} If entityId or id is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId or id is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async getReserveRuleDetails(entityId, id) { try { @@ -52,7 +53,8 @@ export default class ReserveRules { * @param {Object} body The body to be sent. * @param {string} ifMatch Identifies a specific version of a reserve rule to update (e.g. Y3Y9MCZydj0w). * @return {Promise} A promise to the Platforms response (includes headers for ETag). - * @throws {ValueError} If entityId or id is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId or id is undefined, null, empty, "." or "..", or contains + * "/", "\", an ASCII control character or an unpaired surrogate. */ async updateReserveRule(entityId, id, body, ifMatch) { try { @@ -87,7 +89,8 @@ export default class ReserveRules { * @param {string} id The sub-entity's ID. * @param {Object} body The body of the reserve rule to be added. * @return {Promise} A promise to the Platforms response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async addReserveRule(id, body) { try { @@ -109,7 +112,8 @@ export default class ReserveRules { * * @param {string} id The sub-entity's ID. * @return {Promise} A promise to the Platforms response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async queryReserveRules(id) { try { diff --git a/src/api/platforms/subentity.js b/src/api/platforms/subentity.js index c5bf8508..f3400632 100644 --- a/src/api/platforms/subentity.js +++ b/src/api/platforms/subentity.js @@ -146,7 +146,8 @@ export default class Subentity { * @param {string} id Sub-entity id. * @param {string} [schemaVersion='3.0'] Schema version to use (1.0, 2.0, or 3.0). * @return {Promise} A promise to the Platforms response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getSubEntityDetails(id, schemaVersion) { try { @@ -173,7 +174,8 @@ export default class Subentity { * @param {string} [schemaVersion='3.0'] Schema version to use (1.0, 2.0, or 3.0). * @return {Promise} A promise to the Platforms response, the same shape as the * onboardSubEntity response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async updateSubEntityDetails(id, body, schemaVersion) { try { @@ -195,7 +197,8 @@ export default class Subentity { * * @param {string} entityId Sub-entity id. * @return {Promise} A promise to the Platforms response. - * @throws {ValueError} If entityId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getSubEntityMembers(entityId) { try { @@ -218,7 +221,8 @@ export default class Subentity { * @param {string} userId The ID of the invited user. * @param {Object} body The body (Reinvite sub-entity member). * @return {Promise} A promise to the Platforms response. - * @throws {ValueError} If entityId or userId is undefined, null, empty, "." or "..". + * @throws {ValueError} If entityId or userId is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async reinviteSubEntityMember(entityId, userId, body) { try { diff --git a/src/api/reconciliation/reconciliation.js b/src/api/reconciliation/reconciliation.js index 8abf2c65..9f18f480 100644 --- a/src/api/reconciliation/reconciliation.js +++ b/src/api/reconciliation/reconciliation.js @@ -53,7 +53,8 @@ export default class Reconciliation { * @memberof Reconciliation * @param {string} paymentId Payment id. * @return {Promise} A promise to the request reconciliation response. - * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..". + * @throws {ValueError} If paymentId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getPayment(paymentId) { try { @@ -116,7 +117,8 @@ export default class Reconciliation { * @memberof Reconciliation * @param {string} statementId Statement id. * @return {Promise} A promise to the request reconciliation response. - * @throws {ValueError} If statementId is undefined, null, empty, "." or "..". + * @throws {ValueError} If statementId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getStatementCsv(statementId) { try { @@ -156,7 +158,8 @@ export default class Reconciliation { * @memberof Reconciliation * @param {string} actionsId Action id. * @return {Promise} A promise to the request reconciliation response. - * @throws {ValueError} If actionsId is undefined, null, empty, "." or "..". + * @throws {ValueError} If actionsId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getPaymentsAction(actionsId) { try { @@ -200,7 +203,8 @@ export default class Reconciliation { * @memberof Reconciliation * @param {string} actionId Action id. * @return {Promise} A promise to the request reconciliation response. - * @throws {ValueError} If actionId is undefined, null, empty, "." or "..". + * @throws {ValueError} If actionId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getAction(actionId) { try { diff --git a/src/api/reports/reports.js b/src/api/reports/reports.js index 2a15aa16..ae41557f 100644 --- a/src/api/reports/reports.js +++ b/src/api/reports/reports.js @@ -41,7 +41,8 @@ export default class Reports { * @memberof Reports * @param {string} id The ID of the report to retrieve. * @return {Promise} A promise to the Reports response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getReportDetails(id) { try { @@ -64,7 +65,8 @@ export default class Reports { * @param {string} id The ID of the report that the file belongs to. * @param {Object} fileId The ID of the file to retrieve. * @return {Promise} A promise to the Reports response. - * @throws {ValueError} If id or fileId is undefined, null, empty, "." or "..". + * @throws {ValueError} If id or fileId is undefined, null, empty, "." or "..", or contains "/", + * "\", an ASCII control character or an unpaired surrogate. */ async getReportFile(id, fileId) { try { diff --git a/src/api/sessions/sessions.js b/src/api/sessions/sessions.js index a295df35..1d338139 100644 --- a/src/api/sessions/sessions.js +++ b/src/api/sessions/sessions.js @@ -62,7 +62,8 @@ export default class Sessions { * @param {string} id Sessions id. * @param {string} channel Type of channnel. * @return {Promise} A promise to the sessions response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async get(id, channel) { try { @@ -89,7 +90,8 @@ export default class Sessions { * @param {string} id Sessions id. * @param {Object} body Sessions request body. * @return {Promise} A promise to the sessions response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async update(id, body) { try { @@ -113,7 +115,8 @@ export default class Sessions { * @memberof Sessions * @param {string} id Sessions id. * @return {Promise} A promise to the sessions response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async complete(id) { try { @@ -137,7 +140,8 @@ export default class Sessions { * @param {string} id Sessions id. * @param {string} threeDsMethodCompletion 3DS Method completion indicator * @return {Promise} A promise to the sessions response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async update3DSMethodCompletionIndicator(id, threeDsMethodCompletion) { try { diff --git a/src/api/tokens/tokens.js b/src/api/tokens/tokens.js index 971ee38f..83d45234 100644 --- a/src/api/tokens/tokens.js +++ b/src/api/tokens/tokens.js @@ -48,7 +48,8 @@ export default class Tokens { * @memberof Tokens * @param {string} tokenId The token id (e.g., "tok_..."). * @return {Promise} A promise to the token metadata response. - * @throws {ValueError} If tokenId is undefined, null, empty, "." or "..". + * @throws {ValueError} If tokenId is undefined, null, empty, "." or "..", or contains "/", "\", + * an ASCII control character or an unpaired surrogate. */ async getTokenMetadata(tokenId) { try { diff --git a/src/api/transfers/transfers.js b/src/api/transfers/transfers.js index c8cb0700..09ddfb19 100644 --- a/src/api/transfers/transfers.js +++ b/src/api/transfers/transfers.js @@ -45,7 +45,8 @@ export default class Transfers { * @memberof Transfers * @param {string} id tra_XXX The transfer identifier. * @return {Promise} A promise to the transfer response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async retrieve(id) { try { diff --git a/src/api/webhooks/webhooks.js b/src/api/webhooks/webhooks.js index 7233cc5f..28fbdf5b 100644 --- a/src/api/webhooks/webhooks.js +++ b/src/api/webhooks/webhooks.js @@ -65,7 +65,8 @@ export default class Webhooks { * @memberof Webhooks * @param {string} id The webhook identifier. * @return {Promise} A promise to the retrieve webhook response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async retrieveWebhook(id) { try { @@ -88,7 +89,8 @@ export default class Webhooks { * @param {string} id The webhook identifier. * @param {Object} body Webhook update body. * @return {Promise} A promise to the update webhook response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async updateWebhook(id, body) { try { @@ -112,7 +114,8 @@ export default class Webhooks { * @param {string} id The webhook identifier. * @param {Object} body Webhook partial-update body. * @return {Promise} A promise to the update webhook response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async partiallyUpdateWebhook(id, body) { try { @@ -135,7 +138,8 @@ export default class Webhooks { * @memberof Webhooks * @param {string} id The webhook identifier. * @return {Promise} A promise to the remove webhook response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async removeWebhook(id) { try { diff --git a/src/api/workflows/workflows.js b/src/api/workflows/workflows.js index 174cb133..a4533612 100644 --- a/src/api/workflows/workflows.js +++ b/src/api/workflows/workflows.js @@ -72,7 +72,8 @@ export default class Workflows { * @memberof Workflows * @param {string} id Workflow id. * @return {Promise} A promise to the workflows response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async get(id) { try { @@ -95,7 +96,8 @@ export default class Workflows { * @memberof Workflows * @param {string} id Workflow id. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async remove(id) { try { @@ -118,7 +120,8 @@ export default class Workflows { * @param {string} id Workflow id. * @param {Object} body Workflows request body. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async patch(id, body) { try { @@ -147,7 +150,8 @@ export default class Workflows { * @param {string} id Workflow Id. * @param {Object} body Workflows action request body. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async addAction(id, body) { try { @@ -172,7 +176,8 @@ export default class Workflows { * @param {string} workflowActionId Workflow action ID. * @param {Object} body Workflows request body. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If workflowId or workflowActionId is undefined, null, empty, "." or "..". + * @throws {ValueError} If workflowId or workflowActionId is undefined, null, empty, "." or + * "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async updateAction(workflowId, workflowActionId, body) { try { @@ -196,7 +201,8 @@ export default class Workflows { * @param {string} workflowId Workflow id. * @param {string} workflowActionId Workflow action Id. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If workflowId or workflowActionId is undefined, null, empty, "." or "..". + * @throws {ValueError} If workflowId or workflowActionId is undefined, null, empty, "." or + * "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async removeAction(workflowId, workflowActionId) { try { @@ -219,7 +225,8 @@ export default class Workflows { * @param {string} id Workflow Id. * @param {Object} body Workflows request body. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async addCondition(id, body) { try { @@ -244,7 +251,8 @@ export default class Workflows { * @param {string} workflowConditionId Workflow condition ID. * @param {Object} body Workflows request body. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If workflowId or workflowConditionId is undefined, null, empty, "." or "..". + * @throws {ValueError} If workflowId or workflowConditionId is undefined, null, empty, "." or + * "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async updateCondition(workflowId, workflowConditionId, body) { try { @@ -268,7 +276,8 @@ export default class Workflows { * @param {string} workflowId Workflow id. * @param {string} workflowConditionId Workflow condition Id. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If workflowId or workflowConditionId is undefined, null, empty, "." or "..". + * @throws {ValueError} If workflowId or workflowConditionId is undefined, null, empty, "." or + * "..", or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async removeCondition(workflowId, workflowConditionId) { try { @@ -291,7 +300,8 @@ export default class Workflows { * @param {string} id Workflow id. * @param {Object} body Event types for which the workflow will execute. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async test(id, body) { try { @@ -334,7 +344,8 @@ export default class Workflows { * @memberof Workflows * @param {string} id Event ID. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getEvent(id) { try { @@ -357,7 +368,8 @@ export default class Workflows { * @param {string} eventId Event ID. * @param {string} workflowActionId Workflow Action ID. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If eventId or workflowActionId is undefined, null, empty, "." or "..". + * @throws {ValueError} If eventId or workflowActionId is undefined, null, empty, "." or "..", + * or contains "/", "\", an ASCII control character or an unpaired surrogate. */ async getActionInvocations(eventId, workflowActionId) { try { @@ -379,7 +391,8 @@ export default class Workflows { * @memberof Workflows * @param {string} id Event ID. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async reflowByEvent(id) { try { @@ -404,7 +417,8 @@ export default class Workflows { * @param {string} eventId Event ID. * @param {string} workflowId Workflow ID. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If eventId or workflowId is undefined, null, empty, "." or "..". + * @throws {ValueError} If eventId or workflowId is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async reflowByEventAndWorkflow(eventId, workflowId) { try { @@ -478,7 +492,8 @@ export default class Workflows { * @memberof Workflows * @param {string} id The event identifier. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async getSubjectEvents(id) { try { @@ -500,7 +515,8 @@ export default class Workflows { * @memberof Workflows * @param {string} id The subject identifier (for example, a payment ID or a dispute ID). * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If id is undefined, null, empty, "." or "..". + * @throws {ValueError} If id is undefined, null, empty, "." or "..", or contains "/", "\", an + * ASCII control character or an unpaired surrogate. */ async reflowBySubject(id) { try { @@ -523,7 +539,8 @@ export default class Workflows { * @param {string} subjectId Subject ID. * @param {string} workflowId Workflow ID. * @return {Promise} A promise to the Workflows response. - * @throws {ValueError} If subjectId or workflowId is undefined, null, empty, "." or "..". + * @throws {ValueError} If subjectId or workflowId is undefined, null, empty, "." or "..", or + * contains "/", "\", an ASCII control character or an unpaired surrogate. */ async reflowBySubjectAndWorkflow(subjectId, workflowId) { try { diff --git a/src/services/utils.js b/src/services/utils.js index d48a93f4..535b3217 100644 --- a/src/services/utils.js +++ b/src/services/utils.js @@ -28,20 +28,27 @@ export const buildQueryParams = (path, params) => { return queryString ? `${path}?${queryString}` : path; }; +// "/", "\" and the ASCII control characters (U+0000 to U+001F, U+007F). +const FORBIDDEN_IN_SEGMENT = /[/\\\u0000-\u001f\u007f]/; + +// A surrogate code unit that is not part of a pair. With the u flag a valid pair is read as one +// code point, so only unpaired surrogates match. +const UNPAIRED_SURROGATE = /[\uD800-\uDFFF]/u; + /** * Encode a caller-supplied value as a single path segment. * * The value is converted to a string and encoded with encodeURIComponent, so characters such as - * "?", "#" and "%" are percent-encoded. "/", "\" and ASCII control characters are rejected rather - * than encoded, because the API decodes "%2F" and "%5C" back into separators. Values that encoding - * leaves unchanged and that are not valid segments ("." and "..") are rejected, as are undefined, - * null and empty values. + * "?", "#" and "%" are percent-encoded. Values that contain "/", "\", an ASCII control character + * or an unpaired surrogate are rejected rather than encoded, so every value stays one path + * segment. Values that encoding leaves unchanged and that are not valid segments ("." and "..") + * are rejected, as are undefined, null and empty values. * * @param {*} value The value to place in the path, such as an id. * @param {string} name The parameter name, used in the error message. * @return {string} The encoded segment. - * @throws {ValueError} If the value is undefined, null, empty, "." or "..", or contains "/", "\" - * or an ASCII control character. + * @throws {ValueError} If the value is undefined, null, empty, "." or "..", or contains "/", "\", + * an ASCII control character or an unpaired surrogate. */ export const encodePathSegment = (value, name) => { const segment = value === undefined || value === null ? '' : String(value); @@ -50,8 +57,14 @@ export const encodePathSegment = (value, name) => { throw new ValueError(`Invalid ${name}: must not be undefined, null, empty, "." or "..".`); } - if (/[/\\\u0000-\u001f\u007f]/.test(segment)) { - throw new ValueError(`Invalid ${name}: must not contain "/", "\\" or ASCII control characters.`); + if (FORBIDDEN_IN_SEGMENT.test(segment)) { + throw new ValueError( + String.raw`Invalid ${name}: must not contain "/", "\" or ASCII control characters.` + ); + } + + if (UNPAIRED_SURROGATE.test(segment)) { + throw new ValueError(`Invalid ${name}: must be valid text (no unpaired surrogates).`); } return encodeURIComponent(segment); diff --git a/test/services/path-segments-unit.js b/test/services/path-segments-unit.js index 3a4d1af9..753865e9 100644 --- a/test/services/path-segments-unit.js +++ b/test/services/path-segments-unit.js @@ -63,9 +63,23 @@ const VALID = 'abc_123'; // Values with reserved characters, which the SDK percent-encodes. const RESERVED = ['%2e%2e', 'a?b', 'a#b', 'a b']; -// "." and ".." (left unchanged by encodeURIComponent), empty values, and "/", "\\" and ASCII control -// characters (the API decodes %2F and %5C back into separators) are rejected before any request is sent. -const REJECTED = ['..', '.', '', undefined, null, '../x', '%2e%2e/x', '..\\x', 'a\u0000b', 'a\u007fb']; +// "." and ".." (left unchanged by encodeURIComponent), empty values, "/", "\\", ASCII control +// characters and text with an unpaired surrogate are rejected before any request is sent. +const REJECTED = [ + '..', + '.', + '', + undefined, + null, + '../x', + '%2e%2e/x', + '..\\x', + 'a\u0000b', + 'a\nb', + 'a\tb', + 'a\u007fb', + 'a\uD800b', +]; // One row per SDK method that puts a caller value in the request path: the endpoint class, the // method, the arguments with every path value set to v, and the path sent for a valid id. @@ -323,7 +337,7 @@ describe('Path segments - caller values are encoded', () => { } }); - it(`${label} rejects ., .., empty, undefined, null, separators and control characters without sending a request`, async () => { + it(`${label} rejects invalid values without sending a request`, async () => { for (const value of REJECTED) { let error; try { diff --git a/test/services/utils.js b/test/services/utils.js index bb233d37..5f7cc95b 100644 --- a/test/services/utils.js +++ b/test/services/utils.js @@ -42,15 +42,15 @@ describe('Service Utils - encodePathSegment', () => { ['%2e%2e', '%252e%252e'], ['a?b', 'a%3Fb'], ['a#b', 'a%23b'], + ['a\u{1F600}b', 'a%F0%9F%98%80b'], ].forEach(([value, expected]) => { it(`encodes ${value}`, () => { expect(encodePathSegment(value, 'id')).to.equal(expected); }); }); - // The API decodes %2F and %5C back into separators, so "/", "\\" and ASCII control - // characters are refused instead of encoded. - ['../x', '%2e%2e/x', 'x/y', '..\\x', 'a\\b', 'a\u0000b', 'a\nb', 'a\u001fb', 'a\u007fb'].forEach((value) => { + // "/", "\\" and ASCII control characters are rejected rather than encoded. + ['../x', '%2e%2e/x', 'x/y', '..\\x', 'a\\b', 'a\u0000b', 'a\nb', 'a\rb', 'a\tb', 'a\u001fb', 'a\u007fb'].forEach((value) => { it(`rejects ${JSON.stringify(value)}`, () => { expect(() => encodePathSegment(value, 'id')).to.throw( ValueError, @@ -59,6 +59,30 @@ describe('Service Utils - encodePathSegment', () => { }); }); + // Text with an unpaired surrogate is rejected with the same error type. + ['a\uD800b', 'a\uDC00b', '\uDC00\uD800', 'a\uD83D'].forEach((value) => { + it(`rejects ${JSON.stringify(value)}`, () => { + expect(() => encodePathSegment(value, 'id')).to.throw( + ValueError, + 'Invalid id: must be valid text (no unpaired surrogates).' + ); + }); + }); + + it('names the parameter but not the value in the error message', () => { + ['sk_secret/x', 'sk_secret\u0000', 'sk_secret\uD800'].forEach((value) => { + let error; + try { + encodePathSegment(value, 'id'); + } catch (err) { + error = err; + } + expect(error).to.be.instanceOf(ValueError); + expect(error.message).to.include('id'); + expect(error.message).to.not.include('sk_secret'); + }); + }); + // encodeURIComponent leaves "." and ".." unchanged, so they are rejected. [undefined, null, '', '.', '..'].forEach((value) => { it(`rejects ${JSON.stringify(value) ?? 'undefined'}`, () => {