diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 763462fa..43fd5a73 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,9 +9,7 @@ "postCreateCommand": "yarn install", "customizations": { "vscode": { - "extensions": [ - "esbenp.prettier-vscode" - ] + "extensions": ["esbenp.prettier-vscode"] } } } diff --git a/.eslintcache b/.eslintcache new file mode 100644 index 00000000..64ff31db --- /dev/null +++ b/.eslintcache @@ -0,0 +1 @@ +[{"/home/tempuser-qye73c/run/codegen-output/lithic/lithic-node/src/resources/auth-rules/auth-rules.ts":"1","/home/tempuser-qye73c/run/codegen-output/lithic/lithic-node/src/resources/auth-rules/index.ts":"2","/home/tempuser-qye73c/run/codegen-output/lithic/lithic-node/src/resources/auth-rules/v2/index.ts":"3","/home/tempuser-qye73c/run/codegen-output/lithic/lithic-node/src/resources/auth-rules/v2/v2.ts":"4","/home/tempuser-qye73c/run/codegen-output/lithic/lithic-node/tests/api-resources/auth-rules/v2/v2.test.ts":"5"},{"size":2511,"mtime":1759249035561},{"size":845,"mtime":1759249035561},{"size":916,"mtime":1759249035561},{"size":149208,"mtime":1759249035565},{"size":9689,"mtime":1759249035565}] \ No newline at end of file diff --git a/.gitignore b/.gitignore index d98d51a8..2412bb77 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ dist dist-deno /*.tgz .idea/ +.eslintcache diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3200815c..87c62777 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.117.0" + ".": "0.118.0" } diff --git a/.stats.yml b/.stats.yml index fa389875..890e2adb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 169 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-1d44bb7fad99487af1161eb24dfd5369440eda7e80ed237cbc1acc6802a7d212.yml -openapi_spec_hash: 1b6b6215b60094b76b91c56b925a251a -config_hash: e68a052fd109c0885732114753abc739 +configured_endpoints: 170 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-1a0e3a42c88b88140af0f9ad05ab0026fc87f0a500d6879c86b93dfa7f923810.yml +openapi_spec_hash: 2b4db6185c6e4ab3626461a448c97d4b +config_hash: 7a6a0c0bab3306093c6c171cd7407a45 diff --git a/CHANGELOG.md b/CHANGELOG.md index ab4eb133..385832f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## 0.118.0 (2025-09-30) + +Full Changelog: [v0.117.0...v0.118.0](https://github.com/lithic-com/lithic-node/compare/v0.117.0...v0.118.0) + +### Features + +* **api:** adds support for Auth Rule features ([b6f3fe5](https://github.com/lithic-com/lithic-node/commit/b6f3fe52db085742c6d20d31de969e72ddc43b8e)) + + +### Performance Improvements + +* faster formatting ([9655d02](https://github.com/lithic-com/lithic-node/commit/9655d02ac719fc1ec86aad81f48978ae70de05b9)) + + +### Chores + +* do not install brew dependencies in ./scripts/bootstrap by default ([45a4d76](https://github.com/lithic-com/lithic-node/commit/45a4d768d929e802118103c63dba6b7ab61832f6)) +* **docs:** small updates to doc strings on a few endpoints ([4cddaec](https://github.com/lithic-com/lithic-node/commit/4cddaec3d58f0112e4d20a8e6639fbd7e782bfe7)) +* **internal:** codegen related update ([b25d202](https://github.com/lithic-com/lithic-node/commit/b25d2025ad5d21ab206bf7436867ac166c45819c)) +* **internal:** fix incremental formatting in some cases ([4ff1df4](https://github.com/lithic-com/lithic-node/commit/4ff1df4ba0679cd68fdb07a2ad0a591a7dfd2038)) +* **internal:** ignore .eslintcache ([7c61939](https://github.com/lithic-com/lithic-node/commit/7c619399bc0bb0e1322785ca3192602819560656)) +* **internal:** remove deprecated `compilerOptions.baseUrl` from tsconfig.json ([e8adde0](https://github.com/lithic-com/lithic-node/commit/e8adde0644dee008d9401faa8c064f7372217753)) + ## 0.117.0 (2025-09-11) Full Changelog: [v0.116.0...v0.117.0](https://github.com/lithic-com/lithic-node/compare/v0.116.0...v0.117.0) diff --git a/api.md b/api.md index 93ad0062..2a243a77 100644 --- a/api.md +++ b/api.md @@ -85,6 +85,7 @@ Types: - V2DraftResponse - V2PromoteResponse - V2ReportResponse +- V2RetrieveFeaturesResponse - V2RetrieveReportResponse Methods: @@ -98,6 +99,7 @@ Methods: - client.authRules.v2.draft(authRuleToken, { ...params }) -> V2DraftResponse - client.authRules.v2.promote(authRuleToken) -> V2PromoteResponse - client.authRules.v2.report(authRuleToken) -> V2ReportResponse +- client.authRules.v2.retrieveFeatures(authRuleToken, { ...params }) -> V2RetrieveFeaturesResponse - client.authRules.v2.retrieveReport(authRuleToken, { ...params }) -> V2RetrieveReportResponse ### Backtests diff --git a/package.json b/package.json index 1a844532..39165e72 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lithic", - "version": "0.117.0", + "version": "0.118.0", "description": "The official TypeScript library for the Lithic API", "author": "Lithic ", "types": "dist/index.d.ts", diff --git a/scripts/bootstrap b/scripts/bootstrap index 0af58e25..f68bedac 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,10 +4,18 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { - echo "==> Installing Homebrew dependencies…" - brew bundle + echo -n "==> Install Homebrew dependencies? (y/N): " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + brew bundle + ;; + *) + ;; + esac + echo } fi diff --git a/scripts/fast-format b/scripts/fast-format new file mode 100755 index 00000000..8a8e9d59 --- /dev/null +++ b/scripts/fast-format @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "Script started with $# arguments" +echo "Arguments: $*" +echo "Script location: $(dirname "$0")" + +cd "$(dirname "$0")/.." +echo "Changed to directory: $(pwd)" + +if [ $# -eq 0 ]; then + echo "Usage: $0 [additional-formatter-args...]" + echo "The file should contain one file path per line" + exit 1 +fi + +FILE_LIST="$1" + +echo "Looking for file: $FILE_LIST" + +if [ ! -f "$FILE_LIST" ]; then + echo "Error: File '$FILE_LIST' not found" + exit 1 +fi + +echo "==> Running eslint --fix" +ESLINT_FILES="$(grep '\.ts$' "$FILE_LIST" || true)" +if ! [ -z "$ESLINT_FILES" ]; then + echo "$ESLINT_FILES" | ESLINT_USE_FLAT_CONFIG="false" xargs ./node_modules/.bin/eslint --cache --fix +fi + +echo "==> Running prettier --write" +# format things eslint didn't +PRETTIER_FILES="$(grep '\.\(js\|json\)$' "$FILE_LIST" || true)" +if ! [ -z "$PRETTIER_FILES" ]; then + echo "$PRETTIER_FILES" | xargs ./node_modules/.bin/prettier \ + --write --cache --cache-strategy metadata --no-error-on-unmatched-pattern \ + '!**/dist' '!**/*.ts' '!**/*.mts' '!**/*.cts' '!**/*.js' '!**/*.mjs' '!**/*.cjs' +fi diff --git a/src/resources/auth-rules/auth-rules.ts b/src/resources/auth-rules/auth-rules.ts index b84731bf..3783d6fc 100644 --- a/src/resources/auth-rules/auth-rules.ts +++ b/src/resources/auth-rules/auth-rules.ts @@ -22,6 +22,8 @@ import { V2ListResponsesCursorPage, V2PromoteResponse, V2ReportResponse, + V2RetrieveFeaturesParams, + V2RetrieveFeaturesResponse, V2RetrieveReportParams, V2RetrieveReportResponse, V2RetrieveResponse, @@ -58,6 +60,7 @@ export declare namespace AuthRules { type V2DraftResponse as V2DraftResponse, type V2PromoteResponse as V2PromoteResponse, type V2ReportResponse as V2ReportResponse, + type V2RetrieveFeaturesResponse as V2RetrieveFeaturesResponse, type V2RetrieveReportResponse as V2RetrieveReportResponse, V2ListResponsesCursorPage as V2ListResponsesCursorPage, type V2CreateParams as V2CreateParams, @@ -65,6 +68,7 @@ export declare namespace AuthRules { type V2ListParams as V2ListParams, type V2ApplyParams as V2ApplyParams, type V2DraftParams as V2DraftParams, + type V2RetrieveFeaturesParams as V2RetrieveFeaturesParams, type V2RetrieveReportParams as V2RetrieveReportParams, }; } diff --git a/src/resources/auth-rules/index.ts b/src/resources/auth-rules/index.ts index cdb2cff2..395d490a 100644 --- a/src/resources/auth-rules/index.ts +++ b/src/resources/auth-rules/index.ts @@ -21,11 +21,13 @@ export { type V2DraftResponse, type V2PromoteResponse, type V2ReportResponse, + type V2RetrieveFeaturesResponse, type V2RetrieveReportResponse, type V2CreateParams, type V2UpdateParams, type V2ListParams, type V2ApplyParams, type V2DraftParams, + type V2RetrieveFeaturesParams, type V2RetrieveReportParams, } from './v2/index'; diff --git a/src/resources/auth-rules/v2/index.ts b/src/resources/auth-rules/v2/index.ts index d3c2100a..16b711bc 100644 --- a/src/resources/auth-rules/v2/index.ts +++ b/src/resources/auth-rules/v2/index.ts @@ -26,11 +26,13 @@ export { type V2DraftResponse, type V2PromoteResponse, type V2ReportResponse, + type V2RetrieveFeaturesResponse, type V2RetrieveReportResponse, type V2CreateParams, type V2UpdateParams, type V2ListParams, type V2ApplyParams, type V2DraftParams, + type V2RetrieveFeaturesParams, type V2RetrieveReportParams, } from './v2'; diff --git a/src/resources/auth-rules/v2/v2.ts b/src/resources/auth-rules/v2/v2.ts index b1c6b323..ff77411b 100644 --- a/src/resources/auth-rules/v2/v2.ts +++ b/src/resources/auth-rules/v2/v2.ts @@ -210,6 +210,44 @@ export class V2 extends APIResource { return this._client.post(`/v2/auth_rules/${authRuleToken}/report`, options); } + /** + * Fetches the current calculated Feature values for the given Auth Rule + * + * This only calculates the features for the active version. + * + * - VelocityLimit Rules calculates the current Velocity Feature data. This + * requires a `card_token` or `account_token` matching what the rule is Scoped + * to. + * - ConditionalBlock Rules calculates the CARD*TRANSACTION_COUNT*\* attributes on + * the rule. This requires a `card_token` + * + * @example + * ```ts + * const response = await client.authRules.v2.retrieveFeatures( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * ); + * ``` + */ + retrieveFeatures( + authRuleToken: string, + query?: V2RetrieveFeaturesParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + retrieveFeatures( + authRuleToken: string, + options?: Core.RequestOptions, + ): Core.APIPromise; + retrieveFeatures( + authRuleToken: string, + query: V2RetrieveFeaturesParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.retrieveFeatures(authRuleToken, {}, query); + } + return this._client.get(`/v2/auth_rules/${authRuleToken}/features`, { query, ...options }); + } + /** * Retrieves a performance report for an Auth rule containing daily statistics and * evaluation outcomes. @@ -607,11 +645,16 @@ export interface VelocityLimitParams { filters: VelocityLimitParams.Filters; /** + * DEPRECATED: This has been deprecated in favor of the Trailing Window Objects + * * The size of the trailing window to calculate Spend Velocity over in seconds. The * minimum value is 10 seconds, and the maximum value is 2678400 seconds (31 days). */ period: VelocityLimitParamsPeriodWindow; + /** + * The scope the velocity is calculated for + */ scope: 'CARD' | 'ACCOUNT'; /** @@ -658,10 +701,34 @@ export namespace VelocityLimitParams { * matching this MCC will not be included in the calculated velocity. */ include_mccs?: Array | null; + + /** + * PAN entry modes to include in the velocity calculation. Transactions not + * matching any of the provided will not be included in the calculated velocity. + */ + include_pan_entry_modes?: Array< + | 'AUTO_ENTRY' + | 'BAR_CODE' + | 'CONTACTLESS' + | 'CREDENTIAL_ON_FILE' + | 'ECOMMERCE' + | 'ERROR_KEYED' + | 'ERROR_MAGNETIC_STRIPE' + | 'ICC' + | 'KEY_ENTERED' + | 'MAGNETIC_STRIPE' + | 'MANUAL' + | 'OCR' + | 'SECURE_CARDLESS' + | 'UNSPECIFIED' + | 'UNKNOWN' + > | null; } } /** + * DEPRECATED: This has been deprecated in favor of the Trailing Window Objects + * * The size of the trailing window to calculate Spend Velocity over in seconds. The * minimum value is 10 seconds, and the maximum value is 2678400 seconds (31 days). */ @@ -777,6 +844,12 @@ export interface V2CreateResponse { */ event_stream: 'AUTHORIZATION' | 'THREE_DS_AUTHENTICATION'; + /** + * Indicates whether this auth rule is managed by Lithic. If true, the rule cannot + * be modified or deleted by the user + */ + lithic_managed: boolean; + /** * Auth Rule Name */ @@ -869,6 +942,8 @@ export namespace V2CreateResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -902,6 +977,7 @@ export namespace V2CreateResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -992,6 +1068,8 @@ export namespace V2CreateResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -1025,6 +1103,7 @@ export namespace V2CreateResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -1089,6 +1168,12 @@ export interface V2RetrieveResponse { */ event_stream: 'AUTHORIZATION' | 'THREE_DS_AUTHENTICATION'; + /** + * Indicates whether this auth rule is managed by Lithic. If true, the rule cannot + * be modified or deleted by the user + */ + lithic_managed: boolean; + /** * Auth Rule Name */ @@ -1181,6 +1266,8 @@ export namespace V2RetrieveResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -1214,6 +1301,7 @@ export namespace V2RetrieveResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -1304,6 +1392,8 @@ export namespace V2RetrieveResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -1337,6 +1427,7 @@ export namespace V2RetrieveResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -1401,6 +1492,12 @@ export interface V2UpdateResponse { */ event_stream: 'AUTHORIZATION' | 'THREE_DS_AUTHENTICATION'; + /** + * Indicates whether this auth rule is managed by Lithic. If true, the rule cannot + * be modified or deleted by the user + */ + lithic_managed: boolean; + /** * Auth Rule Name */ @@ -1493,6 +1590,8 @@ export namespace V2UpdateResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -1526,6 +1625,7 @@ export namespace V2UpdateResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -1616,6 +1716,8 @@ export namespace V2UpdateResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -1649,6 +1751,7 @@ export namespace V2UpdateResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -1713,6 +1816,12 @@ export interface V2ListResponse { */ event_stream: 'AUTHORIZATION' | 'THREE_DS_AUTHENTICATION'; + /** + * Indicates whether this auth rule is managed by Lithic. If true, the rule cannot + * be modified or deleted by the user + */ + lithic_managed: boolean; + /** * Auth Rule Name */ @@ -1805,6 +1914,8 @@ export namespace V2ListResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -1838,6 +1949,7 @@ export namespace V2ListResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -1928,6 +2040,8 @@ export namespace V2ListResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -1961,6 +2075,7 @@ export namespace V2ListResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -2025,6 +2140,12 @@ export interface V2ApplyResponse { */ event_stream: 'AUTHORIZATION' | 'THREE_DS_AUTHENTICATION'; + /** + * Indicates whether this auth rule is managed by Lithic. If true, the rule cannot + * be modified or deleted by the user + */ + lithic_managed: boolean; + /** * Auth Rule Name */ @@ -2117,6 +2238,8 @@ export namespace V2ApplyResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -2150,6 +2273,7 @@ export namespace V2ApplyResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -2240,6 +2364,8 @@ export namespace V2ApplyResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -2273,6 +2399,7 @@ export namespace V2ApplyResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -2337,6 +2464,12 @@ export interface V2DraftResponse { */ event_stream: 'AUTHORIZATION' | 'THREE_DS_AUTHENTICATION'; + /** + * Indicates whether this auth rule is managed by Lithic. If true, the rule cannot + * be modified or deleted by the user + */ + lithic_managed: boolean; + /** * Auth Rule Name */ @@ -2429,6 +2562,8 @@ export namespace V2DraftResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -2462,6 +2597,7 @@ export namespace V2DraftResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -2552,6 +2688,8 @@ export namespace V2DraftResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -2585,6 +2723,7 @@ export namespace V2DraftResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -2649,6 +2788,12 @@ export interface V2PromoteResponse { */ event_stream: 'AUTHORIZATION' | 'THREE_DS_AUTHENTICATION'; + /** + * Indicates whether this auth rule is managed by Lithic. If true, the rule cannot + * be modified or deleted by the user + */ + lithic_managed: boolean; + /** * Auth Rule Name */ @@ -2741,6 +2886,8 @@ export namespace V2PromoteResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -2774,6 +2921,7 @@ export namespace V2PromoteResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -2864,6 +3012,8 @@ export namespace V2PromoteResponse { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -2897,6 +3047,7 @@ export namespace V2PromoteResponse { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -2935,6 +3086,106 @@ export interface V2ReportResponse { report_token?: string; } +export interface V2RetrieveFeaturesResponse { + /** + * Timestamp at which the Features were evaluated + */ + evaluated: string; + + /** + * Calculated Features used for evaluation of the provided Auth Rule + */ + features: Array; +} + +export namespace V2RetrieveFeaturesResponse { + export interface Feature { + filters: Feature.Filters; + + /** + * DEPRECATED: This has been deprecated in favor of the Trailing Window Objects + * + * The size of the trailing window to calculate Spend Velocity over in seconds. The + * minimum value is 10 seconds, and the maximum value is 2678400 seconds (31 days). + */ + period: V2API.VelocityLimitParamsPeriodWindow; + + /** + * The scope the velocity is calculated for + */ + scope: 'CARD' | 'ACCOUNT'; + + value: Feature.Value; + } + + export namespace Feature { + export interface Filters { + /** + * ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation. + * Transactions matching any of the provided will be excluded from the calculated + * velocity. + */ + exclude_countries?: Array | null; + + /** + * Merchant Category Codes to exclude from the velocity calculation. Transactions + * matching this MCC will be excluded from the calculated velocity. + */ + exclude_mccs?: Array | null; + + /** + * ISO-3166-1 alpha-3 Country Codes to include in the velocity calculation. + * Transactions not matching any of the provided will not be included in the + * calculated velocity. + */ + include_countries?: Array | null; + + /** + * Merchant Category Codes to include in the velocity calculation. Transactions not + * matching this MCC will not be included in the calculated velocity. + */ + include_mccs?: Array | null; + + /** + * PAN entry modes to include in the velocity calculation. Transactions not + * matching any of the provided will not be included in the calculated velocity. + */ + include_pan_entry_modes?: Array< + | 'AUTO_ENTRY' + | 'BAR_CODE' + | 'CONTACTLESS' + | 'CREDENTIAL_ON_FILE' + | 'ECOMMERCE' + | 'ERROR_KEYED' + | 'ERROR_MAGNETIC_STRIPE' + | 'ICC' + | 'KEY_ENTERED' + | 'MAGNETIC_STRIPE' + | 'MANUAL' + | 'OCR' + | 'SECURE_CARDLESS' + | 'UNSPECIFIED' + | 'UNKNOWN' + > | null; + } + + export interface Value { + /** + * Amount (in cents) for the given Auth Rule that is used as input for calculating + * the rule. For Velocity Limit rules this would be the calculated Velocity. For + * Conditional Rules using CARD*TRANSACTION_COUNT*\* this will be 0 + */ + amount: number; + + /** + * Number of velocity impacting transactions matching the given scope, period and + * filters + */ + count: number; + } + } +} + export interface V2RetrieveReportResponse { /** * Auth Rule Token @@ -3066,6 +3317,8 @@ export declare namespace V2CreateParams { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -3099,6 +3352,7 @@ export declare namespace V2CreateParams { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -3211,6 +3465,8 @@ export declare namespace V2CreateParams { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -3244,6 +3500,7 @@ export declare namespace V2CreateParams { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -3361,6 +3618,8 @@ export declare namespace V2CreateParams { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -3394,6 +3653,7 @@ export declare namespace V2CreateParams { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -3632,6 +3892,8 @@ export namespace V2DraftParams { * fee field in the settlement/cardholder billing currency. This is the amount * the issuer should authorize against unless the issuer is paying the acquirer * fee on behalf of the cardholder. + * - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This + * represents the amount of cash being withdrawn or advanced. * - `RISK_SCORE`: Network-provided score assessing risk level associated with a * given authorization. Scores are on a range of 0-999, with 0 representing the * lowest risk and 999 representing the highest risk. For Visa transactions, @@ -3665,6 +3927,7 @@ export namespace V2DraftParams { | 'LIABILITY_SHIFT' | 'PAN_ENTRY_MODE' | 'TRANSACTION_AMOUNT' + | 'CASH_AMOUNT' | 'RISK_SCORE' | 'CARD_TRANSACTION_COUNT_15M' | 'CARD_TRANSACTION_COUNT_1H' @@ -3698,6 +3961,12 @@ export namespace V2DraftParams { } } +export interface V2RetrieveFeaturesParams { + account_token?: string; + + card_token?: string; +} + export interface V2RetrieveReportParams { /** * Start date for the report @@ -3732,6 +4001,7 @@ export declare namespace V2 { type V2DraftResponse as V2DraftResponse, type V2PromoteResponse as V2PromoteResponse, type V2ReportResponse as V2ReportResponse, + type V2RetrieveFeaturesResponse as V2RetrieveFeaturesResponse, type V2RetrieveReportResponse as V2RetrieveReportResponse, V2ListResponsesCursorPage as V2ListResponsesCursorPage, type V2CreateParams as V2CreateParams, @@ -3739,6 +4009,7 @@ export declare namespace V2 { type V2ListParams as V2ListParams, type V2ApplyParams as V2ApplyParams, type V2DraftParams as V2DraftParams, + type V2RetrieveFeaturesParams as V2RetrieveFeaturesParams, type V2RetrieveReportParams as V2RetrieveReportParams, }; diff --git a/src/resources/transactions/transactions.ts b/src/resources/transactions/transactions.ts index 89656bef..98a2cef7 100644 --- a/src/resources/transactions/transactions.ts +++ b/src/resources/transactions/transactions.ts @@ -1492,7 +1492,8 @@ export interface TransactionSimulateVoidParams { /** * Amount (in cents) to void. Typically this will match the amount in the original - * authorization, but can be less. + * authorization, but can be less. Applies to authorization reversals only. An + * authorization expiry will always apply to the full pending amount. */ amount?: number; diff --git a/src/version.ts b/src/version.ts index d3116d4a..23136063 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.117.0'; // x-release-please-version +export const VERSION = '0.118.0'; // x-release-please-version diff --git a/tests/api-resources/auth-rules/v2/v2.test.ts b/tests/api-resources/auth-rules/v2/v2.test.ts index 169430b6..172cdc8a 100644 --- a/tests/api-resources/auth-rules/v2/v2.test.ts +++ b/tests/api-resources/auth-rules/v2/v2.test.ts @@ -168,6 +168,40 @@ describe('resource v2', () => { ).rejects.toThrow(Lithic.NotFoundError); }); + test('retrieveFeatures', async () => { + const responsePromise = client.authRules.v2.retrieveFeatures('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('retrieveFeatures: request options instead of params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.authRules.v2.retrieveFeatures('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { + path: '/_stainless_unknown_path', + }), + ).rejects.toThrow(Lithic.NotFoundError); + }); + + test('retrieveFeatures: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.authRules.v2.retrieveFeatures( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { + account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + card_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Lithic.NotFoundError); + }); + test('retrieveReport: only required params', async () => { const responsePromise = client.authRules.v2.retrieveReport('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { begin: '2019-12-27', diff --git a/tsconfig.build.json b/tsconfig.build.json index 66bca527..f9a123b8 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -5,8 +5,8 @@ "compilerOptions": { "rootDir": "./dist/src", "paths": { - "lithic/*": ["dist/src/*"], - "lithic": ["dist/src/index.ts"] + "lithic/*": ["./dist/src/*"], + "lithic": ["./dist/src/index.ts"] }, "noEmit": false, "declaration": true, diff --git a/tsconfig.json b/tsconfig.json index 283d3e50..c98bb003 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,11 +7,10 @@ "module": "commonjs", "moduleResolution": "node", "esModuleInterop": true, - "baseUrl": "./", "paths": { - "lithic/_shims/auto/*": ["src/_shims/auto/*-node"], - "lithic/*": ["src/*"], - "lithic": ["src/index.ts"] + "lithic/_shims/auto/*": ["./src/_shims/auto/*-node"], + "lithic/*": ["./src/*"], + "lithic": ["./src/index.ts"] }, "noEmit": true, @@ -32,7 +31,7 @@ "noUncheckedIndexedAccess": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, - "isolatedModules": false, + "isolatedModules": false, "skipLibCheck": true }