Skip to content

Commit b485ae0

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(client): adds support for on-demand Auth Rule Performance Reports
1 parent 216409b commit b485ae0

30 files changed

Lines changed: 859 additions & 237 deletions

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 162
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-67859c948e3b903a317f4bd14135c7ee44254d2760068117bab34b7c4058be71.yml
3-
openapi_spec_hash: 23a4716c6168e96f040ac8575582d075
4-
config_hash: 227ad54062905d4ae964b24cef0505b0
1+
configured_endpoints: 165
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-a0d3bcd9c54616729a7e43847e3134205e0695d78f357cc7a25c2775b588dbbd.yml
3+
openapi_spec_hash: 36c423c286ca426f7510b27fadbdd66f
4+
config_hash: 56632a1c934324aa46c1e5c610c2de85

api.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Types:
7272
- <code><a href="./src/resources/auth-rules/v2/v2.ts">AuthRuleCondition</a></code>
7373
- <code><a href="./src/resources/auth-rules/v2/v2.ts">ConditionalAttribute</a></code>
7474
- <code><a href="./src/resources/auth-rules/v2/v2.ts">ConditionalBlockParameters</a></code>
75+
- <code><a href="./src/resources/auth-rules/v2/v2.ts">RuleStats</a></code>
7576
- <code><a href="./src/resources/auth-rules/v2/v2.ts">VelocityLimitParams</a></code>
7677
- <code><a href="./src/resources/auth-rules/v2/v2.ts">VelocityLimitParamsPeriodWindow</a></code>
7778
- <code><a href="./src/resources/auth-rules/v2/v2.ts">V2CreateResponse</a></code>
@@ -82,6 +83,7 @@ Types:
8283
- <code><a href="./src/resources/auth-rules/v2/v2.ts">V2DraftResponse</a></code>
8384
- <code><a href="./src/resources/auth-rules/v2/v2.ts">V2PromoteResponse</a></code>
8485
- <code><a href="./src/resources/auth-rules/v2/v2.ts">V2ReportResponse</a></code>
86+
- <code><a href="./src/resources/auth-rules/v2/v2.ts">V2RetrieveReportResponse</a></code>
8587

8688
Methods:
8789

@@ -94,6 +96,7 @@ Methods:
9496
- <code title="post /v2/auth_rules/{auth_rule_token}/draft">client.authRules.v2.<a href="./src/resources/auth-rules/v2/v2.ts">draft</a>(authRuleToken, { ...params }) -> V2DraftResponse</code>
9597
- <code title="post /v2/auth_rules/{auth_rule_token}/promote">client.authRules.v2.<a href="./src/resources/auth-rules/v2/v2.ts">promote</a>(authRuleToken) -> V2PromoteResponse</code>
9698
- <code title="post /v2/auth_rules/{auth_rule_token}/report">client.authRules.v2.<a href="./src/resources/auth-rules/v2/v2.ts">report</a>(authRuleToken) -> V2ReportResponse</code>
99+
- <code title="get /v2/auth_rules/{auth_rule_token}/report">client.authRules.v2.<a href="./src/resources/auth-rules/v2/v2.ts">retrieveReport</a>(authRuleToken, { ...params }) -> V2RetrieveReportResponse</code>
97100

98101
### Backtests
99102

@@ -656,3 +659,17 @@ Methods:
656659
- <code title="get /v1/funding_events/{funding_event_token}">client.fundingEvents.<a href="./src/resources/funding-events.ts">retrieve</a>(fundingEventToken) -> FundingEventRetrieveResponse</code>
657660
- <code title="get /v1/funding_events">client.fundingEvents.<a href="./src/resources/funding-events.ts">list</a>({ ...params }) -> FundingEventListResponsesCursorPage</code>
658661
- <code title="get /v1/funding_events/{funding_event_token}/details">client.fundingEvents.<a href="./src/resources/funding-events.ts">retrieveDetails</a>(fundingEventToken) -> FundingEventRetrieveDetailsResponse</code>
662+
663+
# Fraud
664+
665+
## Transactions
666+
667+
Types:
668+
669+
- <code><a href="./src/resources/fraud/transactions.ts">TransactionRetrieveResponse</a></code>
670+
- <code><a href="./src/resources/fraud/transactions.ts">TransactionReportResponse</a></code>
671+
672+
Methods:
673+
674+
- <code title="get /v1/fraud/transactions/{transaction_token}">client.fraud.transactions.<a href="./src/resources/fraud/transactions.ts">retrieve</a>(transactionToken) -> TransactionRetrieveResponse</code>
675+
- <code title="post /v1/fraud/transactions/{transaction_token}">client.fraud.transactions.<a href="./src/resources/fraud/transactions.ts">report</a>(transactionToken, { ...params }) -> TransactionReportResponse</code>

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ import {
215215
FinancialAccountsSinglePage,
216216
FinancialTransaction,
217217
} from './resources/financial-accounts/financial-accounts';
218+
import { Fraud } from './resources/fraud/fraud';
218219
import {
219220
Reports,
220221
SettlementDetail,
@@ -418,6 +419,7 @@ export class Lithic extends Core.APIClient {
418419
externalPayments: API.ExternalPayments = new API.ExternalPayments(this);
419420
managementOperations: API.ManagementOperations = new API.ManagementOperations(this);
420421
fundingEvents: API.FundingEvents = new API.FundingEvents(this);
422+
fraud: API.Fraud = new API.Fraud(this);
421423

422424
/**
423425
* Check whether the base URL is set to its default.
@@ -520,6 +522,7 @@ Lithic.ManagementOperations = ManagementOperations;
520522
Lithic.ManagementOperationTransactionsCursorPage = ManagementOperationTransactionsCursorPage;
521523
Lithic.FundingEvents = FundingEvents;
522524
Lithic.FundingEventListResponsesCursorPage = FundingEventListResponsesCursorPage;
525+
Lithic.Fraud = Fraud;
523526
export declare namespace Lithic {
524527
export type RequestOptions = Core.RequestOptions;
525528

@@ -800,6 +803,8 @@ export declare namespace Lithic {
800803
type FundingEventListParams as FundingEventListParams,
801804
};
802805

806+
export { Fraud as Fraud };
807+
803808
export type AccountFinancialAccountType = API.AccountFinancialAccountType;
804809
export type Address = API.Address;
805810
export type Carrier = API.Carrier;

src/resources/account-holders.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ export class AccountHolders extends APIResource {
108108
* ```ts
109109
* const accountHolder = await client.accountHolders.update(
110110
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
111+
* {
112+
* business_entity: { address: { postal_code: '61023' } },
113+
* control_person: { address: { postal_code: '68023' } },
114+
* website_url: 'https://www.mynewbusiness.com',
115+
* },
111116
* );
112117
* ```
113118
*/
@@ -218,7 +223,8 @@ export class AccountHolders extends APIResource {
218223
* const document =
219224
* await client.accountHolders.simulateEnrollmentDocumentReview(
220225
* {
221-
* document_upload_token: 'document_upload_token',
226+
* document_upload_token:
227+
* 'b11cd67b-0a52-4180-8365-314f3def5426',
222228
* status: 'UPLOADED',
223229
* },
224230
* );

src/resources/auth-rules/auth-rules.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
AuthRuleCondition,
88
ConditionalAttribute,
99
ConditionalBlockParameters,
10+
RuleStats,
1011
V2,
1112
V2ApplyParams,
1213
V2ApplyResponse,
@@ -19,6 +20,8 @@ import {
1920
V2ListResponsesCursorPage,
2021
V2PromoteResponse,
2122
V2ReportResponse,
23+
V2RetrieveReportParams,
24+
V2RetrieveReportResponse,
2225
V2RetrieveResponse,
2326
V2UpdateParams,
2427
V2UpdateResponse,
@@ -40,6 +43,7 @@ export declare namespace AuthRules {
4043
type AuthRuleCondition as AuthRuleCondition,
4144
type ConditionalAttribute as ConditionalAttribute,
4245
type ConditionalBlockParameters as ConditionalBlockParameters,
46+
type RuleStats as RuleStats,
4347
type VelocityLimitParams as VelocityLimitParams,
4448
type VelocityLimitParamsPeriodWindow as VelocityLimitParamsPeriodWindow,
4549
type V2CreateResponse as V2CreateResponse,
@@ -50,11 +54,13 @@ export declare namespace AuthRules {
5054
type V2DraftResponse as V2DraftResponse,
5155
type V2PromoteResponse as V2PromoteResponse,
5256
type V2ReportResponse as V2ReportResponse,
57+
type V2RetrieveReportResponse as V2RetrieveReportResponse,
5358
V2ListResponsesCursorPage as V2ListResponsesCursorPage,
5459
type V2CreateParams as V2CreateParams,
5560
type V2UpdateParams as V2UpdateParams,
5661
type V2ListParams as V2ListParams,
5762
type V2ApplyParams as V2ApplyParams,
5863
type V2DraftParams as V2DraftParams,
64+
type V2RetrieveReportParams as V2RetrieveReportParams,
5965
};
6066
}

src/resources/auth-rules/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export {
88
type AuthRuleCondition,
99
type ConditionalAttribute,
1010
type ConditionalBlockParameters,
11+
type RuleStats,
1112
type VelocityLimitParams,
1213
type VelocityLimitParamsPeriodWindow,
1314
type V2CreateResponse,
@@ -18,9 +19,11 @@ export {
1819
type V2DraftResponse,
1920
type V2PromoteResponse,
2021
type V2ReportResponse,
22+
type V2RetrieveReportResponse,
2123
type V2CreateParams,
2224
type V2UpdateParams,
2325
type V2ListParams,
2426
type V2ApplyParams,
2527
type V2DraftParams,
28+
type V2RetrieveReportParams,
2629
} from './v2/index';

src/resources/auth-rules/v2/backtests.ts

Lines changed: 11 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { APIResource } from '../../../resource';
44
import * as Core from '../../../core';
5+
import * as V2API from './v2';
56

67
export class Backtests extends APIResource {
78
/**
@@ -22,13 +23,14 @@ export class Backtests extends APIResource {
2223
* `/v2/auth_rules/{auth_rule_token}/backtests/{auth_rule_backtest_token}`
2324
* endpoint.
2425
*
25-
* Lithic currently supports backtesting for `CONDITIONAL_BLOCK` rules. Backtesting
26-
* for `VELOCITY_LIMIT` rules is generally not supported. In specific cases (i.e.
27-
* where Lithic has pre-calculated the requested velocity metrics for historical
28-
* transactions), a backtest may be feasible. However, such cases are uncommon and
29-
* customers should not anticipate support for velocity backtests under most
30-
* configurations. If a historical transaction does not feature the required inputs
31-
* to evaluate the rule, then it will not be included in the final backtest report.
26+
* Lithic currently supports backtesting for `CONDITIONAL_BLOCK` /
27+
* `CONDITIONAL_3DS_ACTION` rules. Backtesting for `VELOCITY_LIMIT` rules is
28+
* generally not supported. In specific cases (i.e. where Lithic has pre-calculated
29+
* the requested velocity metrics for historical transactions), a backtest may be
30+
* feasible. However, such cases are uncommon and customers should not anticipate
31+
* support for velocity backtests under most configurations. If a historical
32+
* transaction does not feature the required inputs to evaluate the rule, then it
33+
* will not be included in the final backtest report.
3234
*
3335
* @example
3436
* ```ts
@@ -96,129 +98,9 @@ export interface BacktestResults {
9698

9799
export namespace BacktestResults {
98100
export interface Results {
99-
current_version?: Results.CurrentVersion | null;
101+
current_version?: V2API.RuleStats | null;
100102

101-
draft_version?: Results.DraftVersion | null;
102-
}
103-
104-
export namespace Results {
105-
export interface CurrentVersion {
106-
/**
107-
* The total number of historical transactions approved by this rule during the
108-
* relevant period, or the number of transactions that would have been approved if
109-
* the rule was evaluated in shadow mode.
110-
*/
111-
approved?: number;
112-
113-
/**
114-
* The total number of historical transactions challenged by this rule during the
115-
* relevant period, or the number of transactions that would have been challenged
116-
* if the rule was evaluated in shadow mode. Currently applicable only for 3DS Auth
117-
* Rules.
118-
*/
119-
challenged?: number;
120-
121-
/**
122-
* The total number of historical transactions declined by this rule during the
123-
* relevant period, or the number of transactions that would have been declined if
124-
* the rule was evaluated in shadow mode.
125-
*/
126-
declined?: number;
127-
128-
/**
129-
* Example events and their outcomes.
130-
*/
131-
examples?: Array<CurrentVersion.Example>;
132-
133-
/**
134-
* The version of the rule, this is incremented whenever the rule's parameters
135-
* change.
136-
*/
137-
version?: number;
138-
}
139-
140-
export namespace CurrentVersion {
141-
export interface Example {
142-
/**
143-
* Whether the rule would have approved the request.
144-
*/
145-
approved?: boolean;
146-
147-
/**
148-
* The decision made by the rule for this event.
149-
*/
150-
decision?: 'APPROVED' | 'DECLINED' | 'CHALLENGED';
151-
152-
/**
153-
* The event token.
154-
*/
155-
event_token?: string;
156-
157-
/**
158-
* The timestamp of the event.
159-
*/
160-
timestamp?: string;
161-
}
162-
}
163-
164-
export interface DraftVersion {
165-
/**
166-
* The total number of historical transactions approved by this rule during the
167-
* relevant period, or the number of transactions that would have been approved if
168-
* the rule was evaluated in shadow mode.
169-
*/
170-
approved?: number;
171-
172-
/**
173-
* The total number of historical transactions challenged by this rule during the
174-
* relevant period, or the number of transactions that would have been challenged
175-
* if the rule was evaluated in shadow mode. Currently applicable only for 3DS Auth
176-
* Rules.
177-
*/
178-
challenged?: number;
179-
180-
/**
181-
* The total number of historical transactions declined by this rule during the
182-
* relevant period, or the number of transactions that would have been declined if
183-
* the rule was evaluated in shadow mode.
184-
*/
185-
declined?: number;
186-
187-
/**
188-
* Example events and their outcomes.
189-
*/
190-
examples?: Array<DraftVersion.Example>;
191-
192-
/**
193-
* The version of the rule, this is incremented whenever the rule's parameters
194-
* change.
195-
*/
196-
version?: number;
197-
}
198-
199-
export namespace DraftVersion {
200-
export interface Example {
201-
/**
202-
* Whether the rule would have approved the request.
203-
*/
204-
approved?: boolean;
205-
206-
/**
207-
* The decision made by the rule for this event.
208-
*/
209-
decision?: 'APPROVED' | 'DECLINED' | 'CHALLENGED';
210-
211-
/**
212-
* The event token.
213-
*/
214-
event_token?: string;
215-
216-
/**
217-
* The timestamp of the event.
218-
*/
219-
timestamp?: string;
220-
}
221-
}
103+
draft_version?: V2API.RuleStats | null;
222104
}
223105

224106
export interface SimulationParameters {

src/resources/auth-rules/v2/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export {
1313
type AuthRuleCondition,
1414
type ConditionalAttribute,
1515
type ConditionalBlockParameters,
16+
type RuleStats,
1617
type VelocityLimitParams,
1718
type VelocityLimitParamsPeriodWindow,
1819
type V2CreateResponse,
@@ -23,9 +24,11 @@ export {
2324
type V2DraftResponse,
2425
type V2PromoteResponse,
2526
type V2ReportResponse,
27+
type V2RetrieveReportResponse,
2628
type V2CreateParams,
2729
type V2UpdateParams,
2830
type V2ListParams,
2931
type V2ApplyParams,
3032
type V2DraftParams,
33+
type V2RetrieveReportParams,
3134
} from './v2';

0 commit comments

Comments
 (0)