diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6379fd98..4101a550 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.105.0" + ".": "0.106.0" } diff --git a/.stats.yml b/.stats.yml index 73802c71..234e8136 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 162 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-67859c948e3b903a317f4bd14135c7ee44254d2760068117bab34b7c4058be71.yml -openapi_spec_hash: 23a4716c6168e96f040ac8575582d075 -config_hash: 227ad54062905d4ae964b24cef0505b0 +configured_endpoints: 165 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-a0d3bcd9c54616729a7e43847e3134205e0695d78f357cc7a25c2775b588dbbd.yml +openapi_spec_hash: 36c423c286ca426f7510b27fadbdd66f +config_hash: 56632a1c934324aa46c1e5c610c2de85 diff --git a/CHANGELOG.md b/CHANGELOG.md index 38e7258c..767110c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.106.0 (2025-06-27) + +Full Changelog: [v0.105.0...v0.106.0](https://github.com/lithic-com/lithic-node/compare/v0.105.0...v0.106.0) + +### Features + +* **client:** adds support for on-demand Auth Rule Performance Reports ([bef8079](https://github.com/lithic-com/lithic-node/commit/bef807998eea5e4189f92fe037a3f34a13227a9c)) + + +### Bug Fixes + +* **ci:** release-doctor — report correct token name ([0551c7c](https://github.com/lithic-com/lithic-node/commit/0551c7c12b94bae5101c1c4e4fe93ec6d8dc5155)) + ## 0.105.0 (2025-06-23) Full Changelog: [v0.104.0...v0.105.0](https://github.com/lithic-com/lithic-node/compare/v0.104.0...v0.105.0) diff --git a/api.md b/api.md index 9c46cfb1..8a798c9e 100644 --- a/api.md +++ b/api.md @@ -72,6 +72,7 @@ Types: - AuthRuleCondition - ConditionalAttribute - ConditionalBlockParameters +- RuleStats - VelocityLimitParams - VelocityLimitParamsPeriodWindow - V2CreateResponse @@ -82,6 +83,7 @@ Types: - V2DraftResponse - V2PromoteResponse - V2ReportResponse +- V2RetrieveReportResponse Methods: @@ -94,6 +96,7 @@ Methods: - client.authRules.v2.draft(authRuleToken, { ...params }) -> V2DraftResponse - client.authRules.v2.promote(authRuleToken) -> V2PromoteResponse - client.authRules.v2.report(authRuleToken) -> V2ReportResponse +- client.authRules.v2.retrieveReport(authRuleToken, { ...params }) -> V2RetrieveReportResponse ### Backtests @@ -656,3 +659,17 @@ Methods: - client.fundingEvents.retrieve(fundingEventToken) -> FundingEventRetrieveResponse - client.fundingEvents.list({ ...params }) -> FundingEventListResponsesCursorPage - client.fundingEvents.retrieveDetails(fundingEventToken) -> FundingEventRetrieveDetailsResponse + +# Fraud + +## Transactions + +Types: + +- TransactionRetrieveResponse +- TransactionReportResponse + +Methods: + +- client.fraud.transactions.retrieve(transactionToken) -> TransactionRetrieveResponse +- client.fraud.transactions.report(transactionToken, { ...params }) -> TransactionReportResponse diff --git a/bin/check-release-environment b/bin/check-release-environment index 81101e49..7400b05b 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -3,7 +3,7 @@ errors=() if [ -z "${NPM_TOKEN}" ]; then - errors+=("The LITHIC_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") + errors+=("The NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi lenErrors=${#errors[@]} diff --git a/package.json b/package.json index e5233f46..5790d3f2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lithic", - "version": "0.105.0", + "version": "0.106.0", "description": "The official TypeScript library for the Lithic API", "author": "Lithic ", "types": "dist/index.d.ts", diff --git a/src/index.ts b/src/index.ts index bb4e0853..25a6fdb1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -215,6 +215,7 @@ import { FinancialAccountsSinglePage, FinancialTransaction, } from './resources/financial-accounts/financial-accounts'; +import { Fraud } from './resources/fraud/fraud'; import { Reports, SettlementDetail, @@ -418,6 +419,7 @@ export class Lithic extends Core.APIClient { externalPayments: API.ExternalPayments = new API.ExternalPayments(this); managementOperations: API.ManagementOperations = new API.ManagementOperations(this); fundingEvents: API.FundingEvents = new API.FundingEvents(this); + fraud: API.Fraud = new API.Fraud(this); /** * Check whether the base URL is set to its default. @@ -520,6 +522,7 @@ Lithic.ManagementOperations = ManagementOperations; Lithic.ManagementOperationTransactionsCursorPage = ManagementOperationTransactionsCursorPage; Lithic.FundingEvents = FundingEvents; Lithic.FundingEventListResponsesCursorPage = FundingEventListResponsesCursorPage; +Lithic.Fraud = Fraud; export declare namespace Lithic { export type RequestOptions = Core.RequestOptions; @@ -800,6 +803,8 @@ export declare namespace Lithic { type FundingEventListParams as FundingEventListParams, }; + export { Fraud as Fraud }; + export type AccountFinancialAccountType = API.AccountFinancialAccountType; export type Address = API.Address; export type Carrier = API.Carrier; diff --git a/src/resources/account-holders.ts b/src/resources/account-holders.ts index b5c066af..8a191d19 100644 --- a/src/resources/account-holders.ts +++ b/src/resources/account-holders.ts @@ -108,6 +108,11 @@ export class AccountHolders extends APIResource { * ```ts * const accountHolder = await client.accountHolders.update( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { + * business_entity: { address: { postal_code: '61023' } }, + * control_person: { address: { postal_code: '68023' } }, + * website_url: 'https://www.mynewbusiness.com', + * }, * ); * ``` */ @@ -218,7 +223,8 @@ export class AccountHolders extends APIResource { * const document = * await client.accountHolders.simulateEnrollmentDocumentReview( * { - * document_upload_token: 'document_upload_token', + * document_upload_token: + * 'b11cd67b-0a52-4180-8365-314f3def5426', * status: 'UPLOADED', * }, * ); diff --git a/src/resources/auth-rules/auth-rules.ts b/src/resources/auth-rules/auth-rules.ts index c06f0bc5..5727b388 100644 --- a/src/resources/auth-rules/auth-rules.ts +++ b/src/resources/auth-rules/auth-rules.ts @@ -7,6 +7,7 @@ import { AuthRuleCondition, ConditionalAttribute, ConditionalBlockParameters, + RuleStats, V2, V2ApplyParams, V2ApplyResponse, @@ -19,6 +20,8 @@ import { V2ListResponsesCursorPage, V2PromoteResponse, V2ReportResponse, + V2RetrieveReportParams, + V2RetrieveReportResponse, V2RetrieveResponse, V2UpdateParams, V2UpdateResponse, @@ -40,6 +43,7 @@ export declare namespace AuthRules { type AuthRuleCondition as AuthRuleCondition, type ConditionalAttribute as ConditionalAttribute, type ConditionalBlockParameters as ConditionalBlockParameters, + type RuleStats as RuleStats, type VelocityLimitParams as VelocityLimitParams, type VelocityLimitParamsPeriodWindow as VelocityLimitParamsPeriodWindow, type V2CreateResponse as V2CreateResponse, @@ -50,11 +54,13 @@ export declare namespace AuthRules { type V2DraftResponse as V2DraftResponse, type V2PromoteResponse as V2PromoteResponse, type V2ReportResponse as V2ReportResponse, + type V2RetrieveReportResponse as V2RetrieveReportResponse, V2ListResponsesCursorPage as V2ListResponsesCursorPage, type V2CreateParams as V2CreateParams, type V2UpdateParams as V2UpdateParams, type V2ListParams as V2ListParams, type V2ApplyParams as V2ApplyParams, type V2DraftParams as V2DraftParams, + type V2RetrieveReportParams as V2RetrieveReportParams, }; } diff --git a/src/resources/auth-rules/index.ts b/src/resources/auth-rules/index.ts index f6c16acd..b96b1961 100644 --- a/src/resources/auth-rules/index.ts +++ b/src/resources/auth-rules/index.ts @@ -8,6 +8,7 @@ export { type AuthRuleCondition, type ConditionalAttribute, type ConditionalBlockParameters, + type RuleStats, type VelocityLimitParams, type VelocityLimitParamsPeriodWindow, type V2CreateResponse, @@ -18,9 +19,11 @@ export { type V2DraftResponse, type V2PromoteResponse, type V2ReportResponse, + type V2RetrieveReportResponse, type V2CreateParams, type V2UpdateParams, type V2ListParams, type V2ApplyParams, type V2DraftParams, + type V2RetrieveReportParams, } from './v2/index'; diff --git a/src/resources/auth-rules/v2/backtests.ts b/src/resources/auth-rules/v2/backtests.ts index 78a3e282..806a8be6 100644 --- a/src/resources/auth-rules/v2/backtests.ts +++ b/src/resources/auth-rules/v2/backtests.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; +import * as V2API from './v2'; export class Backtests extends APIResource { /** @@ -22,13 +23,14 @@ export class Backtests extends APIResource { * `/v2/auth_rules/{auth_rule_token}/backtests/{auth_rule_backtest_token}` * endpoint. * - * Lithic currently supports backtesting for `CONDITIONAL_BLOCK` rules. Backtesting - * for `VELOCITY_LIMIT` rules is generally not supported. In specific cases (i.e. - * where Lithic has pre-calculated the requested velocity metrics for historical - * transactions), a backtest may be feasible. However, such cases are uncommon and - * customers should not anticipate support for velocity backtests under most - * configurations. If a historical transaction does not feature the required inputs - * to evaluate the rule, then it will not be included in the final backtest report. + * Lithic currently supports backtesting for `CONDITIONAL_BLOCK` / + * `CONDITIONAL_3DS_ACTION` rules. Backtesting for `VELOCITY_LIMIT` rules is + * generally not supported. In specific cases (i.e. where Lithic has pre-calculated + * the requested velocity metrics for historical transactions), a backtest may be + * feasible. However, such cases are uncommon and customers should not anticipate + * support for velocity backtests under most configurations. If a historical + * transaction does not feature the required inputs to evaluate the rule, then it + * will not be included in the final backtest report. * * @example * ```ts @@ -96,129 +98,9 @@ export interface BacktestResults { export namespace BacktestResults { export interface Results { - current_version?: Results.CurrentVersion | null; + current_version?: V2API.RuleStats | null; - draft_version?: Results.DraftVersion | null; - } - - export namespace Results { - export interface CurrentVersion { - /** - * The total number of historical transactions approved by this rule during the - * relevant period, or the number of transactions that would have been approved if - * the rule was evaluated in shadow mode. - */ - approved?: number; - - /** - * The total number of historical transactions challenged by this rule during the - * relevant period, or the number of transactions that would have been challenged - * if the rule was evaluated in shadow mode. Currently applicable only for 3DS Auth - * Rules. - */ - challenged?: number; - - /** - * The total number of historical transactions declined by this rule during the - * relevant period, or the number of transactions that would have been declined if - * the rule was evaluated in shadow mode. - */ - declined?: number; - - /** - * Example events and their outcomes. - */ - examples?: Array; - - /** - * The version of the rule, this is incremented whenever the rule's parameters - * change. - */ - version?: number; - } - - export namespace CurrentVersion { - export interface Example { - /** - * Whether the rule would have approved the request. - */ - approved?: boolean; - - /** - * The decision made by the rule for this event. - */ - decision?: 'APPROVED' | 'DECLINED' | 'CHALLENGED'; - - /** - * The event token. - */ - event_token?: string; - - /** - * The timestamp of the event. - */ - timestamp?: string; - } - } - - export interface DraftVersion { - /** - * The total number of historical transactions approved by this rule during the - * relevant period, or the number of transactions that would have been approved if - * the rule was evaluated in shadow mode. - */ - approved?: number; - - /** - * The total number of historical transactions challenged by this rule during the - * relevant period, or the number of transactions that would have been challenged - * if the rule was evaluated in shadow mode. Currently applicable only for 3DS Auth - * Rules. - */ - challenged?: number; - - /** - * The total number of historical transactions declined by this rule during the - * relevant period, or the number of transactions that would have been declined if - * the rule was evaluated in shadow mode. - */ - declined?: number; - - /** - * Example events and their outcomes. - */ - examples?: Array; - - /** - * The version of the rule, this is incremented whenever the rule's parameters - * change. - */ - version?: number; - } - - export namespace DraftVersion { - export interface Example { - /** - * Whether the rule would have approved the request. - */ - approved?: boolean; - - /** - * The decision made by the rule for this event. - */ - decision?: 'APPROVED' | 'DECLINED' | 'CHALLENGED'; - - /** - * The event token. - */ - event_token?: string; - - /** - * The timestamp of the event. - */ - timestamp?: string; - } - } + draft_version?: V2API.RuleStats | null; } export interface SimulationParameters { diff --git a/src/resources/auth-rules/v2/index.ts b/src/resources/auth-rules/v2/index.ts index 1adeff5b..cc511f2c 100644 --- a/src/resources/auth-rules/v2/index.ts +++ b/src/resources/auth-rules/v2/index.ts @@ -13,6 +13,7 @@ export { type AuthRuleCondition, type ConditionalAttribute, type ConditionalBlockParameters, + type RuleStats, type VelocityLimitParams, type VelocityLimitParamsPeriodWindow, type V2CreateResponse, @@ -23,9 +24,11 @@ export { type V2DraftResponse, type V2PromoteResponse, type V2ReportResponse, + type V2RetrieveReportResponse, type V2CreateParams, type V2UpdateParams, type V2ListParams, type V2ApplyParams, type V2DraftParams, + type V2RetrieveReportParams, } from './v2'; diff --git a/src/resources/auth-rules/v2/v2.ts b/src/resources/auth-rules/v2/v2.ts index 9ed4454b..2854367f 100644 --- a/src/resources/auth-rules/v2/v2.ts +++ b/src/resources/auth-rules/v2/v2.ts @@ -154,10 +154,11 @@ export class V2 extends APIResource { } /** - * Requests a performance report of an Auth rule to be asynchronously generated. - * Reports can only be run on rules in draft or active mode and will included - * approved and declined statistics as well as examples. The generated report will - * be delivered asynchronously through a webhook with `event_type` = + * This endpoint is deprecated and will be removed in the future. Requests a + * performance report of an Auth rule to be asynchronously generated. Reports can + * only be run on rules in draft or active mode and will included approved and + * declined statistics as well as examples. The generated report will be delivered + * asynchronously through a webhook with `event_type` = * `auth_rules.performance_report.created`. See the docs on setting up * [webhook subscriptions](https://docs.lithic.com/docs/events-api). * @@ -205,15 +206,41 @@ export class V2 extends APIResource { * between when Lithic's transaction processing systems have processed the * transaction, and when a transaction will be included in the report. * + * @deprecated + */ + report(authRuleToken: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post(`/v2/auth_rules/${authRuleToken}/report`, options); + } + + /** + * Retrieves a performance report for an Auth rule containing daily statistics and + * evaluation outcomes. + * + * **Time Range Limitations:** + * + * - Reports are supported for the past 3 months only + * - Maximum interval length is 1 month + * - Report data is available only through the previous day in UTC (current day + * data is not available) + * + * The report provides daily statistics for both current and draft versions of the + * Auth rule, including approval, decline, and challenge counts along with sample + * events. + * * @example * ```ts - * const response = await client.authRules.v2.report( + * const response = await client.authRules.v2.retrieveReport( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { begin: '2019-12-27', end: '2019-12-27' }, * ); * ``` */ - report(authRuleToken: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post(`/v2/auth_rules/${authRuleToken}/report`, options); + retrieveReport( + authRuleToken: string, + query: V2RetrieveReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.get(`/v2/auth_rules/${authRuleToken}/report`, { query, ...options }); } } @@ -412,6 +439,65 @@ export interface ConditionalBlockParameters { conditions: Array; } +export interface RuleStats { + /** + * The total number of historical transactions approved by this rule during the + * relevant period, or the number of transactions that would have been approved if + * the rule was evaluated in shadow mode. + */ + approved?: number; + + /** + * The total number of historical transactions challenged by this rule during the + * relevant period, or the number of transactions that would have been challenged + * if the rule was evaluated in shadow mode. Currently applicable only for 3DS Auth + * Rules. + */ + challenged?: number; + + /** + * The total number of historical transactions declined by this rule during the + * relevant period, or the number of transactions that would have been declined if + * the rule was evaluated in shadow mode. + */ + declined?: number; + + /** + * Example events and their outcomes. + */ + examples?: Array; + + /** + * The version of the rule, this is incremented whenever the rule's parameters + * change. + */ + version?: number; +} + +export namespace RuleStats { + export interface Example { + /** + * Whether the rule would have approved the request. + */ + approved?: boolean; + + /** + * The decision made by the rule for this event. + */ + decision?: 'APPROVED' | 'DECLINED' | 'CHALLENGED'; + + /** + * The event token. + */ + event_token?: string; + + /** + * The timestamp of the event. + */ + timestamp?: string; + } +} + export interface VelocityLimitParams { filters: VelocityLimitParams.Filters; @@ -2594,6 +2680,47 @@ export interface V2ReportResponse { report_token?: string; } +export interface V2RetrieveReportResponse { + /** + * Auth Rule Token + */ + auth_rule_token: string; + + /** + * The start date (UTC) of the report. + */ + begin: string; + + /** + * Daily evaluation statistics for the Auth Rule. + */ + daily_statistics: Array; + + /** + * The end date (UTC) of the report. + */ + end: string; +} + +export namespace V2RetrieveReportResponse { + export interface DailyStatistic { + /** + * Detailed statistics for the current version of the rule. + */ + current_version_statistics: V2API.RuleStats | null; + + /** + * The date (UTC) for which the statistics are reported. + */ + date: string; + + /** + * Detailed statistics for the draft version of the rule. + */ + draft_version_statistics: V2API.RuleStats | null; + } +} + export type V2CreateParams = | V2CreateParams.CreateAuthRuleRequestAccountTokens | V2CreateParams.CreateAuthRuleRequestCardTokens @@ -3260,6 +3387,18 @@ export namespace V2DraftParams { } } +export interface V2RetrieveReportParams { + /** + * Start date for the report + */ + begin: string; + + /** + * End date for the report + */ + end: string; +} + V2.V2ListResponsesCursorPage = V2ListResponsesCursorPage; V2.Backtests = Backtests; @@ -3269,6 +3408,7 @@ export declare namespace V2 { type AuthRuleCondition as AuthRuleCondition, type ConditionalAttribute as ConditionalAttribute, type ConditionalBlockParameters as ConditionalBlockParameters, + type RuleStats as RuleStats, type VelocityLimitParams as VelocityLimitParams, type VelocityLimitParamsPeriodWindow as VelocityLimitParamsPeriodWindow, type V2CreateResponse as V2CreateResponse, @@ -3279,12 +3419,14 @@ export declare namespace V2 { type V2DraftResponse as V2DraftResponse, type V2PromoteResponse as V2PromoteResponse, type V2ReportResponse as V2ReportResponse, + type V2RetrieveReportResponse as V2RetrieveReportResponse, V2ListResponsesCursorPage as V2ListResponsesCursorPage, type V2CreateParams as V2CreateParams, type V2UpdateParams as V2UpdateParams, type V2ListParams as V2ListParams, type V2ApplyParams as V2ApplyParams, type V2DraftParams as V2DraftParams, + type V2RetrieveReportParams as V2RetrieveReportParams, }; export { diff --git a/src/resources/cards/cards.ts b/src/resources/cards/cards.ts index 2295d347..30283be8 100644 --- a/src/resources/cards/cards.ts +++ b/src/resources/cards/cards.ts @@ -879,10 +879,12 @@ export interface CardCreateParams { * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, * with tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day + * shipping, with tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with * tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight + * or similar international option, with tracking */ shipping_method?: '2_DAY' | 'EXPEDITED' | 'EXPRESS' | 'PRIORITY' | 'STANDARD' | 'STANDARD_WITH_TRACKING'; @@ -1043,10 +1045,12 @@ export interface CardConvertPhysicalParams { * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, * with tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day + * shipping, with tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with * tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight + * or similar international option, with tracking */ shipping_method?: '2_DAY' | 'EXPEDITED' | 'EXPRESS' | 'PRIORITY' | 'STANDARD' | 'STANDARD_WITH_TRACKING'; } @@ -1201,10 +1205,12 @@ export interface CardReissueParams { * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, * with tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day + * shipping, with tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with * tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight + * or similar international option, with tracking */ shipping_method?: '2_DAY' | 'EXPEDITED' | 'EXPRESS' | 'PRIORITY' | 'STANDARD' | 'STANDARD_WITH_TRACKING'; } @@ -1248,10 +1254,12 @@ export interface CardRenewParams { * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, * with tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day + * shipping, with tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with * tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight + * or similar international option, with tracking */ shipping_method?: '2_DAY' | 'EXPEDITED' | 'EXPRESS' | 'PRIORITY' | 'STANDARD' | 'STANDARD_WITH_TRACKING'; } diff --git a/src/resources/external-bank-accounts/external-bank-accounts.ts b/src/resources/external-bank-accounts/external-bank-accounts.ts index d1645318..f1260ed5 100644 --- a/src/resources/external-bank-accounts/external-bank-accounts.ts +++ b/src/resources/external-bank-accounts/external-bank-accounts.ts @@ -17,16 +17,24 @@ export class ExternalBankAccounts extends APIResource { * ```ts * const externalBankAccount = * await client.externalBankAccounts.create({ - * account_number: '12345678901234567', - * country: 'USD', + * account_number: '13719713158835300', + * country: 'USA', * currency: 'USD', * financial_account_token: * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - * owner: 'owner', - * owner_type: 'INDIVIDUAL', - * routing_number: '123456789', + * owner: 'John Doe', + * owner_type: 'BUSINESS', + * routing_number: '011103093', * type: 'CHECKING', - * verification_method: 'MANUAL', + * verification_method: 'MICRO_DEPOSIT', + * address: { + * address1: '5 Broad Street', + * city: 'New York', + * country: 'USA', + * postal_code: '10001', + * state: 'NY', + * }, + * name: 'John Does Checking', * }); * ``` */ @@ -39,6 +47,14 @@ export class ExternalBankAccounts extends APIResource { /** * Get the external bank account by token. + * + * @example + * ```ts + * const externalBankAccount = + * await client.externalBankAccounts.retrieve( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * ); + * ``` */ retrieve( externalBankAccountToken: string, @@ -49,6 +65,14 @@ export class ExternalBankAccounts extends APIResource { /** * Update the external bank account by token. + * + * @example + * ```ts + * const externalBankAccount = + * await client.externalBankAccounts.update( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * ); + * ``` */ update( externalBankAccountToken: string, @@ -60,6 +84,14 @@ export class ExternalBankAccounts extends APIResource { /** * List all the external bank accounts for the provided search criteria. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const externalBankAccountListResponse of client.externalBankAccounts.list()) { + * // ... + * } + * ``` */ list( query?: ExternalBankAccountListParams, @@ -83,6 +115,14 @@ export class ExternalBankAccounts extends APIResource { /** * Retry external bank account micro deposit verification. + * + * @example + * ```ts + * const response = + * await client.externalBankAccounts.retryMicroDeposits( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * ); + * ``` */ retryMicroDeposits( externalBankAccountToken: string, @@ -109,6 +149,14 @@ export class ExternalBankAccounts extends APIResource { /** * Retry external bank account prenote verification. + * + * @example + * ```ts + * const response = + * await client.externalBankAccounts.retryPrenote( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * ); + * ``` */ retryPrenote( externalBankAccountToken: string, @@ -901,7 +949,8 @@ export interface ExternalBankAccountRetryPrenoteResponse { export type ExternalBankAccountCreateParams = | ExternalBankAccountCreateParams.BankVerifiedCreateBankAccountAPIRequest | ExternalBankAccountCreateParams.PlaidCreateBankAccountAPIRequest - | ExternalBankAccountCreateParams.ExternallyVerifiedCreateBankAccountAPIRequest; + | ExternalBankAccountCreateParams.ExternallyVerifiedCreateBankAccountAPIRequest + | ExternalBankAccountCreateParams.UnverifiedCreateBankAccountAPIRequest; export declare namespace ExternalBankAccountCreateParams { export interface BankVerifiedCreateBankAccountAPIRequest { @@ -1119,6 +1168,87 @@ export declare namespace ExternalBankAccountCreateParams { */ user_defined_id?: string; } + + export interface UnverifiedCreateBankAccountAPIRequest { + /** + * Account Number + */ + account_number: string; + + /** + * The country that the bank account is located in using ISO 3166-1. We will only + * accept USA bank accounts e.g., USA + */ + country: string; + + /** + * currency of the external account 3-character alphabetic ISO 4217 code + */ + currency: string; + + /** + * Legal Name of the business or individual who owns the external account. This + * will appear in statements + */ + owner: string; + + /** + * Owner Type + */ + owner_type: OwnerType; + + /** + * Routing Number + */ + routing_number: string; + + /** + * Account Type + */ + type: 'CHECKING' | 'SAVINGS'; + + /** + * Verification Method + */ + verification_method: 'UNVERIFIED'; + + /** + * Indicates which Lithic account the external account is associated with. For + * external accounts that are associated with the program, account_token field + * returned will be null + */ + account_token?: string; + + /** + * Address + */ + address?: ExternalBankAccountAddress; + + /** + * Optional field that helps identify bank accounts in receipts + */ + company_id?: string; + + /** + * Date of Birth of the Individual that owns the external bank account + */ + dob?: string; + + /** + * Doing Business As + */ + doing_business_as?: string; + + /** + * The nickname for this External Bank Account + */ + name?: string; + + /** + * User Defined ID + */ + user_defined_id?: string; + } } export interface ExternalBankAccountUpdateParams { diff --git a/src/resources/external-bank-accounts/micro-deposits.ts b/src/resources/external-bank-accounts/micro-deposits.ts index 00a00027..635eaea2 100644 --- a/src/resources/external-bank-accounts/micro-deposits.ts +++ b/src/resources/external-bank-accounts/micro-deposits.ts @@ -7,6 +7,15 @@ import * as ExternalBankAccountsAPI from './external-bank-accounts'; export class MicroDeposits extends APIResource { /** * Verify the external bank account by providing the micro deposit amounts. + * + * @example + * ```ts + * const microDeposit = + * await client.externalBankAccounts.microDeposits.create( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { micro_deposits: [0, 0] }, + * ); + * ``` */ create( externalBankAccountToken: string, diff --git a/src/resources/financial-accounts/financial-accounts.ts b/src/resources/financial-accounts/financial-accounts.ts index eac4811e..5f38df95 100644 --- a/src/resources/financial-accounts/financial-accounts.ts +++ b/src/resources/financial-accounts/financial-accounts.ts @@ -385,6 +385,7 @@ export namespace FinancialTransaction { | 'CASH_BACK' | 'CASH_BACK_REVERSAL' | 'CLEARING' + | 'COLLECTION' | 'CORRECTION_CREDIT' | 'CORRECTION_DEBIT' | 'CREDIT_AUTHORIZATION' diff --git a/src/resources/financial-accounts/statements/line-items.ts b/src/resources/financial-accounts/statements/line-items.ts index ab75d77b..28d45385 100644 --- a/src/resources/financial-accounts/statements/line-items.ts +++ b/src/resources/financial-accounts/statements/line-items.ts @@ -125,6 +125,7 @@ export namespace StatementLineItems { | 'CASH_BACK' | 'CASH_BACK_REVERSAL' | 'CLEARING' + | 'COLLECTION' | 'CORRECTION_CREDIT' | 'CORRECTION_DEBIT' | 'CREDIT_AUTHORIZATION' diff --git a/src/resources/fraud.ts b/src/resources/fraud.ts new file mode 100644 index 00000000..21d7b3ad --- /dev/null +++ b/src/resources/fraud.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './fraud/index'; diff --git a/src/resources/fraud/fraud.ts b/src/resources/fraud/fraud.ts new file mode 100644 index 00000000..2bfa9d5a --- /dev/null +++ b/src/resources/fraud/fraud.ts @@ -0,0 +1,25 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as TransactionsAPI from './transactions'; +import { + TransactionReportParams, + TransactionReportResponse, + TransactionRetrieveResponse, + Transactions, +} from './transactions'; + +export class Fraud extends APIResource { + transactions: TransactionsAPI.Transactions = new TransactionsAPI.Transactions(this._client); +} + +Fraud.Transactions = Transactions; + +export declare namespace Fraud { + export { + Transactions as Transactions, + type TransactionRetrieveResponse as TransactionRetrieveResponse, + type TransactionReportResponse as TransactionReportResponse, + type TransactionReportParams as TransactionReportParams, + }; +} diff --git a/src/resources/fraud/index.ts b/src/resources/fraud/index.ts new file mode 100644 index 00000000..06bc5ce1 --- /dev/null +++ b/src/resources/fraud/index.ts @@ -0,0 +1,9 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Fraud } from './fraud'; +export { + Transactions, + type TransactionRetrieveResponse, + type TransactionReportResponse, + type TransactionReportParams, +} from './transactions'; diff --git a/src/resources/fraud/transactions.ts b/src/resources/fraud/transactions.ts new file mode 100644 index 00000000..7a3407cb --- /dev/null +++ b/src/resources/fraud/transactions.ts @@ -0,0 +1,248 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; + +export class Transactions extends APIResource { + /** + * Retrieve a fraud report for a specific transaction identified by its unique + * transaction token. + * + * @example + * ```ts + * const transaction = + * await client.fraud.transactions.retrieve( + * '00000000-0000-0000-0000-000000000000', + * ); + * ``` + */ + retrieve( + transactionToken: string, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.get(`/v1/fraud/transactions/${transactionToken}`, options); + } + + /** + * Report fraud for a specific transaction token by providing details such as fraud + * type, fraud status, and any additional comments. + * + * @example + * ```ts + * const response = await client.fraud.transactions.report( + * '00000000-0000-0000-0000-000000000000', + * { fraud_status: 'SUSPECTED_FRAUD' }, + * ); + * ``` + */ + report( + transactionToken: string, + body: TransactionReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post(`/v1/fraud/transactions/${transactionToken}`, { body, ...options }); + } +} + +export interface TransactionRetrieveResponse { + /** + * The fraud status of the transaction, string (enum) supporting the following + * values: + * + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this + * hasn’t been confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may + * immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A + * transaction may immediately be moved into this state, or be graduated into + * this state from the `SUSPECTED_FRAUD` state. + * - `NO_REPORTED_FRAUD`: Indicates that no fraud report exists for the + * transaction. It is the default state for transactions that have not been + * analyzed or associated with any known fraudulent activity. + */ + fraud_status: 'SUSPECTED_FRAUD' | 'FRAUDULENT' | 'NOT_FRAUDULENT' | 'NO_REPORTED_FRAUD'; + + /** + * The universally unique identifier (UUID) associated with the transaction being + * reported. + */ + transaction_token: string; + + /** + * Provides additional context or details about the fraud report. + */ + comment?: string; + + /** + * Timestamp representing when the fraud report was created. + */ + created_at?: string; + + /** + * Specifies the type or category of fraud that the transaction is suspected or + * confirmed to involve, string (enum) supporting the following values: + * + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or + * cardholder intentionally misuses financial services for personal gain. This + * includes actions such as disputing legitimate transactions to obtain a refund, + * abusing return policies, or defaulting on credit obligations without intent to + * repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains + * unauthorized access to an existing account, modifies account settings, and + * carries out fraudulent transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains + * access to card details without taking over the account, such as through + * physical card theft, cloning, or online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen + * personal information, such as Social Security numbers or addresses, to open + * accounts, apply for loans, or conduct financial transactions in someone's + * name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster + * manipulates or coerces a legitimate cardholder into unauthorized transactions, + * often through social engineering tactics. + */ + fraud_type?: + | 'FIRST_PARTY_FRAUD' + | 'ACCOUNT_TAKEOVER' + | 'CARD_COMPROMISED' + | 'IDENTITY_THEFT' + | 'CARDHOLDER_MANIPULATION'; + + /** + * Timestamp representing the last update to the fraud report. + */ + updated_at?: string; +} + +export interface TransactionReportResponse { + /** + * The fraud status of the transaction, string (enum) supporting the following + * values: + * + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this + * hasn’t been confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may + * immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A + * transaction may immediately be moved into this state, or be graduated into + * this state from the `SUSPECTED_FRAUD` state. + * - `NO_REPORTED_FRAUD`: Indicates that no fraud report exists for the + * transaction. It is the default state for transactions that have not been + * analyzed or associated with any known fraudulent activity. + */ + fraud_status: 'SUSPECTED_FRAUD' | 'FRAUDULENT' | 'NOT_FRAUDULENT' | 'NO_REPORTED_FRAUD'; + + /** + * The universally unique identifier (UUID) associated with the transaction being + * reported. + */ + transaction_token: string; + + /** + * Provides additional context or details about the fraud report. + */ + comment?: string; + + /** + * Timestamp representing when the fraud report was created. + */ + created_at?: string; + + /** + * Specifies the type or category of fraud that the transaction is suspected or + * confirmed to involve, string (enum) supporting the following values: + * + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or + * cardholder intentionally misuses financial services for personal gain. This + * includes actions such as disputing legitimate transactions to obtain a refund, + * abusing return policies, or defaulting on credit obligations without intent to + * repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains + * unauthorized access to an existing account, modifies account settings, and + * carries out fraudulent transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains + * access to card details without taking over the account, such as through + * physical card theft, cloning, or online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen + * personal information, such as Social Security numbers or addresses, to open + * accounts, apply for loans, or conduct financial transactions in someone's + * name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster + * manipulates or coerces a legitimate cardholder into unauthorized transactions, + * often through social engineering tactics. + */ + fraud_type?: + | 'FIRST_PARTY_FRAUD' + | 'ACCOUNT_TAKEOVER' + | 'CARD_COMPROMISED' + | 'IDENTITY_THEFT' + | 'CARDHOLDER_MANIPULATION'; + + /** + * Timestamp representing the last update to the fraud report. + */ + updated_at?: string; +} + +export interface TransactionReportParams { + /** + * The fraud status of the transaction, string (enum) supporting the following + * values: + * + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this + * hasn’t been confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may + * immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A + * transaction may immediately be moved into this state, or be graduated into + * this state from the `SUSPECTED_FRAUD` state. + */ + fraud_status: 'SUSPECTED_FRAUD' | 'FRAUDULENT' | 'NOT_FRAUDULENT'; + + /** + * Optional field providing additional information or context about why the + * transaction is considered fraudulent. + */ + comment?: string; + + /** + * Specifies the type or category of fraud that the transaction is suspected or + * confirmed to involve, string (enum) supporting the following values: + * + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or + * cardholder intentionally misuses financial services for personal gain. This + * includes actions such as disputing legitimate transactions to obtain a refund, + * abusing return policies, or defaulting on credit obligations without intent to + * repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains + * unauthorized access to an existing account, modifies account settings, and + * carries out fraudulent transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains + * access to card details without taking over the account, such as through + * physical card theft, cloning, or online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen + * personal information, such as Social Security numbers or addresses, to open + * accounts, apply for loans, or conduct financial transactions in someone's + * name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster + * manipulates or coerces a legitimate cardholder into unauthorized transactions, + * often through social engineering tactics. + */ + fraud_type?: + | 'FIRST_PARTY_FRAUD' + | 'ACCOUNT_TAKEOVER' + | 'CARD_COMPROMISED' + | 'IDENTITY_THEFT' + | 'CARDHOLDER_MANIPULATION'; +} + +export declare namespace Transactions { + export { + type TransactionRetrieveResponse as TransactionRetrieveResponse, + type TransactionReportResponse as TransactionReportResponse, + type TransactionReportParams as TransactionReportParams, + }; +} diff --git a/src/resources/index.ts b/src/resources/index.ts index e409fc1a..b6be973c 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -126,6 +126,7 @@ export { type FinancialAccountRegisterAccountNumberParams, type FinancialAccountUpdateStatusParams, } from './financial-accounts/financial-accounts'; +export { Fraud } from './fraud/fraud'; export { FundingEventListResponsesCursorPage, FundingEvents, diff --git a/src/resources/payments.ts b/src/resources/payments.ts index 4b6f61c1..45b2adac 100644 --- a/src/resources/payments.ts +++ b/src/resources/payments.ts @@ -329,6 +329,8 @@ export namespace Payment { sec_code: 'CCD' | 'PPD' | 'WEB'; trace_numbers: Array; + + addenda?: string | null; } } @@ -441,6 +443,8 @@ export interface PaymentCreateParams { export namespace PaymentCreateParams { export interface MethodAttributes { sec_code: 'CCD' | 'PPD' | 'WEB'; + + addenda?: string | null; } } diff --git a/src/resources/three-ds/authentication.ts b/src/resources/three-ds/authentication.ts index f2e6cfb0..57806168 100644 --- a/src/resources/three-ds/authentication.ts +++ b/src/resources/three-ds/authentication.ts @@ -35,14 +35,13 @@ export class Authentication extends APIResource { * const response = * await client.threeDS.authentication.simulate({ * merchant: { - * country: 'USA', * id: 'OODKZAPJVN4YS7O', + * country: 'USA', * mcc: '5812', * name: 'COFFEE SHOP', * }, * pan: '4111111289144142', - * transaction: { amount: 100, currency: 'USD' }, - * card_expiry_check: 'MATCH', + * transaction: { amount: 0, currency: 'GBP' }, * }); * ``` */ @@ -55,9 +54,9 @@ export class Authentication extends APIResource { /** * Endpoint for simulating entering OTP into 3DS Challenge UI. A call to - * /v1/three_ds_authentication/simulate that resulted in triggered SMS-OTP - * challenge must precede. Only a single attempt is supported; upon entering OTP, - * the challenge is either approved or declined. + * [/v1/three_ds_authentication/simulate](https://docs.lithic.com/reference/postsimulateauthentication) + * that resulted in triggered SMS-OTP challenge must precede. Only a single attempt + * is supported; upon entering OTP, the challenge is either approved or declined. * * @example * ```ts @@ -75,9 +74,13 @@ export class Authentication extends APIResource { } } +/** + * Represents a 3DS authentication + */ export interface AuthenticationRetrieveResponse { /** - * Globally unique identifier for the 3DS authentication. + * Globally unique identifier for the 3DS authentication. Permitted values: + * 36-digit version 4 UUID (including hyphens). */ token: string; @@ -100,7 +103,7 @@ export interface AuthenticationRetrieveResponse { /** * Globally unique identifier for the card on which the 3DS authentication has - * occurred. + * occurred. Permitted values: 36-digit version 4 UUID (including hyphens). */ card_token: string; @@ -110,12 +113,14 @@ export interface AuthenticationRetrieveResponse { cardholder: AuthenticationRetrieveResponse.Cardholder; /** - * Channel in which the authentication occurs. Maps to EMV 3DS field deviceChannel. + * Channel in which the authentication occurs. Maps to EMV 3DS field + * `deviceChannel`. */ channel: 'APP_BASED' | 'BROWSER' | 'THREE_DS_REQUESTOR_INITIATED'; /** - * Date and time when the authentication was created in Lithic's system. + * Date and time when the authentication was created in Lithic's system. Permitted + * values: Date string in the ISO 8601 format yyyy-MM-dd'T'hh:mm:ssZ. */ created: string; @@ -164,12 +169,12 @@ export interface AuthenticationRetrieveResponse { * Object containing data about the app used in the e-commerce transaction. Present * if the channel is 'APP_BASED'. */ - app?: AuthenticationRetrieveResponse.App; + app?: AuthenticationRetrieveResponse.App | null; /** * Type of authentication request - i.e., the type of transaction or interaction is * causing the merchant to request an authentication. Maps to EMV 3DS field - * threeDSRequestorAuthenticationInd. + * `threeDSRequestorAuthenticationInd`. */ authentication_request_type?: | 'ADD_CARD' @@ -188,29 +193,41 @@ export interface AuthenticationRetrieveResponse { * Object containing data about the browser used in the e-commerce transaction. * Present if the channel is 'BROWSER'. */ - browser?: AuthenticationRetrieveResponse.Browser; + browser?: AuthenticationRetrieveResponse.Browser | null; /** - * Metadata about the challenge method and delivery. + * Metadata about the challenge method and delivery. Only present when a challenge + * is triggered. */ challenge_metadata?: AuthenticationRetrieveResponse.ChallengeMetadata | null; /** - * Entity that orchestrates the challenge. + * Entity that orchestrates the challenge. This won't be set for authentications + * for which a decision has not yet been made (e.g. in-flight customer decisioning + * request). */ challenge_orchestrated_by?: 'LITHIC' | 'CUSTOMER' | 'NO_CHALLENGE' | null; /** - * Entity that made the authentication decision. + * Entity that made the authentication decision. This won't be set for + * authentications for which a decision has not yet been made (e.g. in-flight + * customer decisioning request). */ - decision_made_by?: 'CUSTOMER_ENDPOINT' | 'LITHIC_DEFAULT' | 'LITHIC_RULES' | 'NETWORK' | 'UNKNOWN' | null; + decision_made_by?: + | 'LITHIC_RULES' + | 'LITHIC_DEFAULT' + | 'CUSTOMER_RULES' + | 'CUSTOMER_ENDPOINT' + | 'NETWORK' + | 'UNKNOWN' + | null; /** - * Type of 3DS Requestor Initiated (3RI) request i.e., a 3DS authentication that + * Type of 3DS Requestor Initiated (3RI) request — i.e., a 3DS authentication that * takes place at the initiation of the merchant rather than the cardholder. The * most common example of this is where a merchant is authenticating before billing * for a recurring transaction such as a pay TV subscription or a utility bill. - * Maps to EMV 3DS field threeRIInd. + * Maps to EMV 3DS field `threeRIInd`. */ three_ri_request_type?: | 'ACCOUNT_VERIFICATION' @@ -247,7 +264,7 @@ export namespace AuthenticationRetrieveResponse { * Indicates whether the shipping address and billing address provided by the * cardholder are the same. This value - and assessment of whether the addresses * match - is provided directly in the 3DS request and is not determined by Lithic. - * Maps to EMV 3DS field addrMatch. + * Maps to EMV 3DS field `addrMatch`. */ address_match?: boolean | null; @@ -258,30 +275,30 @@ export namespace AuthenticationRetrieveResponse { /** * Email address that is either provided by the cardholder or is on file with the - * merchant in a 3RI request. Maps to EMV 3DS field email. + * merchant in a 3RI request. Maps to EMV 3DS field `email`. */ email?: string | null; /** - * Name of the cardholder. Maps to EMV 3DS field cardholderName. + * Name of the cardholder. Maps to EMV 3DS field `cardholderName`. */ name?: string | null; /** * Home phone number provided by the cardholder. Maps to EMV 3DS fields - * homePhone.cc and homePhone.subscriber. + * `homePhone.cc` and `homePhone.subscriber`. */ phone_number_home?: string | null; /** * Mobile/cell phone number provided by the cardholder. Maps to EMV 3DS fields - * mobilePhone.cc and mobilePhone.subscriber. + * `mobilePhone.cc` and `mobilePhone.subscriber`. */ phone_number_mobile?: string | null; /** * Work phone number provided by the cardholder. Maps to EMV 3DS fields - * workPhone.cc and workPhone.subscriber. + * `workPhone.cc` and `workPhone.subscriber`. */ phone_number_work?: string | null; @@ -372,24 +389,25 @@ export namespace AuthenticationRetrieveResponse { export interface Merchant { /** * Merchant identifier as assigned by the acquirer. Maps to EMV 3DS field - * acquirerMerchantId. + * `acquirerMerchantId`. */ id: string; /** * Country code of the merchant requesting 3DS authentication. Maps to EMV 3DS - * field merchantCountryCode. + * field `merchantCountryCode`. Permitted values: ISO 3166-1 alpha-3 country code + * (e.g., USA). */ country: string; /** * Merchant category code assigned to the merchant that describes its business - * activity type. Maps to EMV 3DS field mcc. + * activity type. Maps to EMV 3DS field `mcc`. */ mcc: string; /** - * Name of the merchant. Maps to EMV 3DS field merchantName. + * Name of the merchant. Maps to EMV 3DS field `merchantName`. */ name: string; @@ -408,13 +426,13 @@ export namespace AuthenticationRetrieveResponse { export interface RiskIndicator { /** * In transactions with electronic delivery, email address to which merchandise is - * delivered. Maps to EMV 3DS field deliveryEmailAddress. + * delivered. Maps to EMV 3DS field `deliveryEmailAddress`. */ delivery_email_address?: string | null; /** * The delivery time frame for the merchandise. Maps to EMV 3DS field - * deliveryTimeframe. + * `deliveryTimeframe`. */ delivery_time_frame?: | 'ELECTRONIC_DELIVERY' @@ -426,37 +444,39 @@ export namespace AuthenticationRetrieveResponse { /** * In prepaid or gift card purchase transactions, purchase amount total in major * units (e.g., a purchase of USD $205.10 would be 205). Maps to EMV 3DS field - * giftCardAmount. + * `giftCardAmount`. */ gift_card_amount?: number | null; /** * In prepaid or gift card purchase transactions, count of individual prepaid or - * gift cards/codes purchased. Maps to EMV 3DS field giftCardCount. + * gift cards/codes purchased. Maps to EMV 3DS field `giftCardCount`. */ gift_card_count?: number | null; /** * In prepaid or gift card purchase transactions, currency code of the gift card. - * Maps to EMV 3DS field giftCardCurr. + * Maps to EMV 3DS field `giftCardCurr`. Permitted values: ISO 4217 three-character + * currency code (e.g., USD). */ gift_card_currency?: string | null; /** * Indicates whether the purchase is for merchandise that is available now or at a - * future date. Maps to EMV 3DS field preOrderPurchaseInd. + * future date. Maps to EMV 3DS field `preOrderPurchaseInd`. */ order_availability?: 'FUTURE_AVAILABILITY' | 'MERCHANDISE_AVAILABLE' | null; /** * In pre-order purchase transactions, the expected date that the merchandise will - * be available. Maps to EMV 3DS field preOrderDate. + * be available. Maps to EMV 3DS field `preOrderDate`. Permitted values: Date + * string in the ISO 8601 format yyyy-MM-dd'T'hh:mm:ssZ */ pre_order_available_date?: string | null; /** * Indicates whether the cardholder is reordering previously purchased merchandise. - * Maps to EMV 3DS field reorderItemsInd. + * Maps to EMV 3DS field `reorderItemsInd`. */ reorder_items?: 'FIRST_TIME_ORDERED' | 'REORDERED' | null; @@ -464,7 +484,7 @@ export namespace AuthenticationRetrieveResponse { * Shipping method that the cardholder chose for the transaction. If purchase * includes one or more item, this indicator is used for the physical goods; if the * purchase only includes digital goods, this indicator is used to describe the - * most expensive item purchased. Maps to EMV 3DS field shipIndicator. + * most expensive item purchased. Maps to EMV 3DS field `shipIndicator`. */ shipping_method?: | 'DIGITAL_GOODS' @@ -494,7 +514,8 @@ export namespace AuthenticationRetrieveResponse { /** * Mastercard only: Assessment by the network of the authentication risk level, - * with a higher value indicating a higher amount of risk. + * with a higher value indicating a higher amount of risk. Permitted values: + * Integer between 0-950, in increments of 50. */ network_risk_score?: number | null; } @@ -506,13 +527,13 @@ export namespace AuthenticationRetrieveResponse { export interface App { /** * Device information gathered from the cardholder's device - JSON name/value pairs - * that is Base64url encoded. Maps to EMV 3DS field deviceInfo. + * that is Base64url encoded. Maps to EMV 3DS field `deviceInfo`. */ device_info?: string | null; /** * External IP address used by the app generating the 3DS authentication request. - * Maps to EMV 3DS field appIp. + * Maps to EMV 3DS field `appIp`. */ ip?: string; } @@ -522,45 +543,52 @@ export namespace AuthenticationRetrieveResponse { * Present if the channel is 'BROWSER'. */ export interface Browser { + /** + * Content of the HTTP accept headers as sent from the cardholder's browser to the + * 3DS requestor (e.g., merchant or digital wallet). + */ + accept_header?: string | null; + /** * IP address of the browser as returned by the HTTP headers to the 3DS requestor - * (e.g., merchant or digital wallet). Maps to EMV 3DS field browserIP. + * (e.g., merchant or digital wallet). Maps to EMV 3DS field `browserIP`. */ ip?: string | null; /** * Indicates whether the cardholder's browser has the ability to execute Java. Maps - * to EMV 3DS field browserJavaEnabled. + * to EMV 3DS field `browserJavaEnabled`. */ java_enabled?: boolean | null; /** * Indicates whether the cardholder's browser has the ability to execute - * JavaScript. Maps to EMV 3DS field browserJavascriptEnabled. + * JavaScript. Maps to EMV 3DS field `browserJavascriptEnabled`. */ javascript_enabled?: boolean | null; /** * Language of the cardholder's browser as defined in IETF BCP47. Maps to EMV 3DS - * field browserLanguage. + * field `browserLanguage`. */ language?: string | null; /** * Time zone of the cardholder's browser offset in minutes between UTC and the * cardholder browser's local time. The offset is positive if the local time is - * behind UTC and negative if it is ahead. Maps to EMV 3DS field browserTz. + * behind UTC and negative if it is ahead. Maps to EMV 3DS field `browserTz`. */ time_zone?: string | null; /** - * Content of the HTTP user-agent header. Maps to EMV 3DS field browserUserAgent. + * Content of the HTTP user-agent header. Maps to EMV 3DS field `browserUserAgent`. */ user_agent?: string | null; } /** - * Metadata about the challenge method and delivery. + * Metadata about the challenge method and delivery. Only present when a challenge + * is triggered. */ export interface ChallengeMetadata { /** @@ -581,7 +609,7 @@ export namespace AuthenticationRetrieveResponse { export interface Transaction { /** * Amount of the purchase in minor units of currency with all punctuation removed. - * Maps to EMV 3DS field purchaseAmount. + * Maps to EMV 3DS field `purchaseAmount`. */ amount: number; @@ -592,25 +620,27 @@ export namespace AuthenticationRetrieveResponse { cardholder_amount: number | null; /** - * Currency of the purchase. Maps to EMV 3DS field purchaseCurrency. + * Currency of the purchase. Maps to EMV 3DS field `purchaseCurrency`. Permitted + * values: ISO 4217 three-character currency code (e.g., USD). */ currency: string; /** * Minor units of currency, as specified in ISO 4217 currency exponent. Maps to EMV - * 3DS field purchaseExponent. + * 3DS field `purchaseExponent`. */ currency_exponent: number; /** * Date and time when the authentication was generated by the merchant/acquirer's - * 3DS server. Maps to EMV 3DS field purchaseDate. + * 3DS server. Maps to EMV 3DS field `purchaseDate`. Permitted values: Date string + * in the ISO 8601 format yyyy-MM-dd'T'hh:mm:ssZ. */ date_time: string; /** * Type of the transaction for which a 3DS authentication request is occurring. - * Maps to EMV 3DS field transType. + * Maps to EMV 3DS field `transType`. */ type: | 'ACCOUNT_FUNDING' @@ -624,13 +654,15 @@ export namespace AuthenticationRetrieveResponse { export interface AuthenticationSimulateResponse { /** - * A unique token to reference this transaction with later calls to void or clear - * the authorization. + * Globally unique identifier for the 3DS authentication. */ token?: string; } export interface AuthenticationSimulateParams { + /** + * Merchant information for the simulated transaction + */ merchant: AuthenticationSimulateParams.Merchant; /** @@ -638,6 +670,9 @@ export interface AuthenticationSimulateParams { */ pan: string; + /** + * Transaction details for the simulation + */ transaction: AuthenticationSimulateParams.Transaction; /** @@ -648,6 +683,9 @@ export interface AuthenticationSimulateParams { } export namespace AuthenticationSimulateParams { + /** + * Merchant information for the simulated transaction + */ export interface Merchant { /** * Unique identifier to identify the payment card acceptor. Corresponds to @@ -675,6 +713,9 @@ export namespace AuthenticationSimulateParams { name: string; } + /** + * Transaction details for the simulation + */ export interface Transaction { /** * Amount (in cents) to authenticate. diff --git a/src/resources/three-ds/decisioning.ts b/src/resources/three-ds/decisioning.ts index b814ba95..ff93232d 100644 --- a/src/resources/three-ds/decisioning.ts +++ b/src/resources/three-ds/decisioning.ts @@ -5,7 +5,12 @@ import * as Core from '../../core'; export class Decisioning extends APIResource { /** - * Card program's response to a 3DS Challenge Request (CReq) + * Card program's response to a 3DS Challenge Request. Challenge Request is emitted + * as a webhook + * [three_ds_authentication.challenge](https://docs.lithic.com/reference/post_three-ds-authentication-challenge) + * and your Card Program needs to be configured with Out of Band (OOB) Challenges + * in order to receive it (see https://docs.lithic.com/docs/3ds-challenge-flow for + * more information). * * @example * ```ts @@ -56,23 +61,24 @@ export class Decisioning extends APIResource { } } +/** + * Response from Card Program to a 3DS Authentication challenge + */ export interface ChallengeResponse { /** - * Globally unique identifier for the 3DS authentication. This token is sent as - * part of the initial 3DS Decisioning Request and as part of the 3DS Challenge - * Event in the [ThreeDSAuthentication](#/components/schemas/ThreeDSAuthentication) - * object + * Globally unique identifier for 3DS Authentication that resulted in + * PENDING_CHALLENGE authentication result. */ token: string; /** - * Whether the Cardholder has Approved or Declined the issued Challenge + * Whether the Cardholder has approved or declined the issued Challenge */ challenge_response: ChallengeResult; } /** - * Whether the Cardholder has Approved or Declined the issued Challenge + * Whether the Cardholder has approved or declined the issued Challenge */ export type ChallengeResult = 'APPROVE' | 'DECLINE_BY_CUSTOMER'; @@ -85,15 +91,13 @@ export interface DecisioningRetrieveSecretResponse { export interface DecisioningChallengeResponseParams { /** - * Globally unique identifier for the 3DS authentication. This token is sent as - * part of the initial 3DS Decisioning Request and as part of the 3DS Challenge - * Event in the [ThreeDSAuthentication](#/components/schemas/ThreeDSAuthentication) - * object + * Globally unique identifier for 3DS Authentication that resulted in + * PENDING_CHALLENGE authentication result. */ token: string; /** - * Whether the Cardholder has Approved or Declined the issued Challenge + * Whether the Cardholder has approved or declined the issued Challenge */ challenge_response: ChallengeResult; } diff --git a/src/resources/transfers.ts b/src/resources/transfers.ts index b260d646..e45085e2 100644 --- a/src/resources/transfers.ts +++ b/src/resources/transfers.ts @@ -145,6 +145,7 @@ export namespace Transfer { | 'CASH_BACK' | 'CASH_BACK_REVERSAL' | 'CLEARING' + | 'COLLECTION' | 'CORRECTION_CREDIT' | 'CORRECTION_DEBIT' | 'CREDIT_AUTHORIZATION' diff --git a/src/version.ts b/src/version.ts index 211d1d62..013fb8ed 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.105.0'; // x-release-please-version +export const VERSION = '0.106.0'; // x-release-please-version diff --git a/tests/api-resources/account-holders.test.ts b/tests/api-resources/account-holders.test.ts index 0879f36b..874686da 100644 --- a/tests/api-resources/account-holders.test.ts +++ b/tests/api-resources/account-holders.test.ts @@ -261,7 +261,7 @@ describe('resource accountHolders', () => { test('simulateEnrollmentDocumentReview: only required params', async () => { const responsePromise = client.accountHolders.simulateEnrollmentDocumentReview({ - document_upload_token: 'document_upload_token', + document_upload_token: 'b11cd67b-0a52-4180-8365-314f3def5426', status: 'UPLOADED', }); const rawResponse = await responsePromise.asResponse(); @@ -275,7 +275,7 @@ describe('resource accountHolders', () => { test('simulateEnrollmentDocumentReview: required and optional params', async () => { const response = await client.accountHolders.simulateEnrollmentDocumentReview({ - document_upload_token: 'document_upload_token', + document_upload_token: 'b11cd67b-0a52-4180-8365-314f3def5426', status: 'UPLOADED', accepted_entity_status_reasons: ['string'], status_reason: 'DOCUMENT_MISSING_REQUIRED_DATA', diff --git a/tests/api-resources/auth-rules/v2/v2.test.ts b/tests/api-resources/auth-rules/v2/v2.test.ts index 6309dea6..b20c6c90 100644 --- a/tests/api-resources/auth-rules/v2/v2.test.ts +++ b/tests/api-resources/auth-rules/v2/v2.test.ts @@ -185,4 +185,25 @@ describe('resource v2', () => { }), ).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', + end: '2019-12-27', + }); + 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('retrieveReport: required and optional params', async () => { + const response = await client.authRules.v2.retrieveReport('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { + begin: '2019-12-27', + end: '2019-12-27', + }); + }); }); diff --git a/tests/api-resources/cards/cards.test.ts b/tests/api-resources/cards/cards.test.ts index 035a22ad..f3e00755 100644 --- a/tests/api-resources/cards/cards.test.ts +++ b/tests/api-resources/cards/cards.test.ts @@ -24,16 +24,16 @@ describe('resource cards', () => { const response = await client.cards.create({ type: 'VIRTUAL', account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - card_program_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + card_program_token: '00000000-0000-0000-1000-000000000000', carrier: { qr_code_url: 'qr_code_url' }, - digital_card_art_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + digital_card_art_token: '00000000-0000-0000-1000-000000000000', exp_month: '06', exp_year: '2027', memo: 'New Card', pin: 'pin', product_id: '1', - replacement_account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - replacement_for: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + replacement_account_token: '00000000-0000-0000-2000-000000000000', + replacement_for: '00000000-0000-0000-1000-000000000000', shipping_address: { address1: '5 Broad Street', city: 'NEW YORK', diff --git a/tests/api-resources/fraud/transactions.test.ts b/tests/api-resources/fraud/transactions.test.ts new file mode 100644 index 00000000..be54164e --- /dev/null +++ b/tests/api-resources/fraud/transactions.test.ts @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Lithic from 'lithic'; +import { Response } from 'node-fetch'; + +const client = new Lithic({ + apiKey: 'My Lithic API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource transactions', () => { + test('retrieve', async () => { + const responsePromise = client.fraud.transactions.retrieve('00000000-0000-0000-0000-000000000000'); + 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('retrieve: 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.fraud.transactions.retrieve('00000000-0000-0000-0000-000000000000', { + path: '/_stainless_unknown_path', + }), + ).rejects.toThrow(Lithic.NotFoundError); + }); + + test('report: only required params', async () => { + const responsePromise = client.fraud.transactions.report('00000000-0000-0000-0000-000000000000', { + fraud_status: 'SUSPECTED_FRAUD', + }); + 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('report: required and optional params', async () => { + const response = await client.fraud.transactions.report('00000000-0000-0000-0000-000000000000', { + fraud_status: 'SUSPECTED_FRAUD', + comment: 'comment', + fraud_type: 'FIRST_PARTY_FRAUD', + }); + }); +}); diff --git a/tests/api-resources/payments.test.ts b/tests/api-resources/payments.test.ts index 5279e5d3..d0fc9244 100644 --- a/tests/api-resources/payments.test.ts +++ b/tests/api-resources/payments.test.ts @@ -33,7 +33,7 @@ describe('resource payments', () => { external_bank_account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', financial_account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', method: 'ACH_NEXT_DAY', - method_attributes: { sec_code: 'CCD' }, + method_attributes: { sec_code: 'CCD', addenda: 'addenda' }, type: 'COLLECTION', token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', memo: 'memo', diff --git a/tests/api-resources/three-ds/authentication.test.ts b/tests/api-resources/three-ds/authentication.test.ts index 756f2ef4..4ab6766d 100644 --- a/tests/api-resources/three-ds/authentication.test.ts +++ b/tests/api-resources/three-ds/authentication.test.ts @@ -33,7 +33,7 @@ describe('resource authentication', () => { const responsePromise = client.threeDS.authentication.simulate({ merchant: { id: 'OODKZAPJVN4YS7O', country: 'USA', mcc: '5812', name: 'COFFEE SHOP' }, pan: '4111111289144142', - transaction: { amount: 100, currency: 'USD' }, + transaction: { amount: 0, currency: 'GBP' }, }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -48,7 +48,7 @@ describe('resource authentication', () => { const response = await client.threeDS.authentication.simulate({ merchant: { id: 'OODKZAPJVN4YS7O', country: 'USA', mcc: '5812', name: 'COFFEE SHOP' }, pan: '4111111289144142', - transaction: { amount: 100, currency: 'USD' }, + transaction: { amount: 0, currency: 'GBP' }, card_expiry_check: 'MATCH', }); }); diff --git a/tests/api-resources/tokenizations.test.ts b/tests/api-resources/tokenizations.test.ts index a29f86f9..6c777632 100644 --- a/tests/api-resources/tokenizations.test.ts +++ b/tests/api-resources/tokenizations.test.ts @@ -231,7 +231,7 @@ describe('resource tokenizations', () => { await expect( client.tokenizations.updateDigitalCardArt( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { digital_card_art_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }, + { digital_card_art_token: '00000000-0000-0000-1000-000000000000' }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Lithic.NotFoundError);