diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0c6e1537..c37434e9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.109.1" + ".": "0.110.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index ec2c9d76..a288cec4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 168 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-6432801dcf017d9234739b9f6153a8cfecd91255af4765f24ba5209f3e320b5c.yml -openapi_spec_hash: c2cfee2f044ba15d15b5bfdbd37280c0 -config_hash: 8ac73ccdb428816c89c84802c794a3f8 +configured_endpoints: 167 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c3f6c23018d70fd1b259b21cfd377b5d905872f0d3c5ce2cdb8013f4b6daa338.yml +openapi_spec_hash: b551344da9d29eb4c5374874ed84a9b0 +config_hash: 012f050e575d1bbfe8db56a9eeaa5fcd diff --git a/CHANGELOG.md b/CHANGELOG.md index c6cc0177..98b93067 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## 0.110.0 (2025-11-11) + +Full Changelog: [v0.109.1...v0.110.0](https://github.com/lithic-com/lithic-python/compare/v0.109.1...v0.110.0) + +### Features + +* **api:** add payment_details ([59653f5](https://github.com/lithic-com/lithic-python/commit/59653f5db08fe87d8c8f97b34c1edac575996e19)) +* **api:** deprecate auth rule apply endpoint and fix several schemas ([2ccbc8e](https://github.com/lithic-com/lithic-python/commit/2ccbc8e1defce005fcf32d22aa68b8d98af68222)) +* **api:** new fields in Statements APIs ([79aa803](https://github.com/lithic-com/lithic-python/commit/79aa803f7e6a30a3d6383f5bca21d7c4c955b6e9)) +* **api:** re-add rules metadata to tokenization events ([7e4b9a7](https://github.com/lithic-com/lithic-python/commit/7e4b9a750be5431be81a74a4b44c7a1f872ebf5d)) +* **api:** remove deprecated fields from Cardholder Authentication object ([7e4b9a7](https://github.com/lithic-com/lithic-python/commit/7e4b9a750be5431be81a74a4b44c7a1f872ebf5d)) + + +### Bug Fixes + +* **api:** adjust Auth Rules spec for better SDK structure ([7e4b9a7](https://github.com/lithic-com/lithic-python/commit/7e4b9a750be5431be81a74a4b44c7a1f872ebf5d)) +* **api:** fix oneOf -> anyOf in account holder update ([59653f5](https://github.com/lithic-com/lithic-python/commit/59653f5db08fe87d8c8f97b34c1edac575996e19)) +* **api:** fixing spec for Tokenizations and Enhanced data ([79aa803](https://github.com/lithic-com/lithic-python/commit/79aa803f7e6a30a3d6383f5bca21d7c4c955b6e9)) +* compat with Python 3.14 ([b56a588](https://github.com/lithic-com/lithic-python/commit/b56a588a807420f848c39e445ea6e39034c2f88f)) + + +### Chores + +* **api:** adds support for new ACH_RECEIPT_RELEASED event ([30908f3](https://github.com/lithic-com/lithic-python/commit/30908f3f1d72c38d57239415d2a093dbdaee4f96)) +* **examples:** fix type checking ([6a138be](https://github.com/lithic-com/lithic-python/commit/6a138beaf9ec36f3db3cb89e8b653ef2e34f4de4)) +* **internal/tests:** avoid race condition with implicit client cleanup ([e90a25d](https://github.com/lithic-com/lithic-python/commit/e90a25da2bb81f93978555a8f671866fbe696235)) +* **internal:** grammar fix (it's -> its) ([091851d](https://github.com/lithic-com/lithic-python/commit/091851d9a940925c83d30cb98470ff22b7bb9de2)) +* **package:** drop Python 3.8 support ([80a0e1f](https://github.com/lithic-com/lithic-python/commit/80a0e1f29373041cc63d7acffa37d91a5c1a66b0)) + ## 0.109.1 (2025-10-29) Full Changelog: [v0.109.0...v0.109.1](https://github.com/lithic-com/lithic-python/compare/v0.109.0...v0.109.1) diff --git a/README.md b/README.md index 1b325b78..0ab4218b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![PyPI version](https://img.shields.io/pypi/v/lithic.svg?label=pypi%20(stable))](https://pypi.org/project/lithic/) -The Lithic Python library provides convenient access to the Lithic REST API from any Python 3.8+ +The Lithic Python library provides convenient access to the Lithic REST API from any Python 3.9+ application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). @@ -481,7 +481,7 @@ print(lithic.__version__) ## Requirements -Python 3.8 or higher. +Python 3.9 or higher. ## Contributing diff --git a/api.md b/api.md index 4be71c91..6b843a47 100644 --- a/api.md +++ b/api.md @@ -83,16 +83,16 @@ from lithic.types.auth_rules import ( AuthRuleCondition, Conditional3DSActionParameters, ConditionalAttribute, + ConditionalAuthorizationActionParameters, ConditionalBlockParameters, MerchantLockParameters, RuleStats, VelocityLimitParams, - VelocityLimitParamsPeriodWindow, + VelocityLimitPeriod, V2CreateResponse, V2RetrieveResponse, V2UpdateResponse, V2ListResponse, - V2ApplyResponse, V2DraftResponse, V2PromoteResponse, V2RetrieveFeaturesResponse, @@ -107,7 +107,6 @@ Methods: - client.auth_rules.v2.update(auth_rule_token, \*\*params) -> V2UpdateResponse - client.auth_rules.v2.list(\*\*params) -> SyncCursorPage[V2ListResponse] - client.auth_rules.v2.delete(auth_rule_token) -> None -- client.auth_rules.v2.apply(auth_rule_token, \*\*params) -> V2ApplyResponse - client.auth_rules.v2.draft(auth_rule_token, \*\*params) -> V2DraftResponse - client.auth_rules.v2.promote(auth_rule_token) -> V2PromoteResponse - client.auth_rules.v2.retrieve_features(auth_rule_token, \*\*params) -> V2RetrieveFeaturesResponse @@ -270,16 +269,24 @@ Methods: Types: ```python -from lithic.types import Dispute, DisputeEvidence +from lithic.types import ( + Dispute, + DisputeEvidence, + DisputeCreateResponse, + DisputeRetrieveResponse, + DisputeUpdateResponse, + DisputeListResponse, + DisputeDeleteResponse, +) ``` Methods: -- client.disputes.create(\*\*params) -> Dispute -- client.disputes.retrieve(dispute_token) -> Dispute -- client.disputes.update(dispute_token, \*\*params) -> Dispute -- client.disputes.list(\*\*params) -> SyncCursorPage[Dispute] -- client.disputes.delete(dispute_token) -> Dispute +- client.disputes.create(\*\*params) -> DisputeCreateResponse +- client.disputes.retrieve(dispute_token) -> DisputeRetrieveResponse +- client.disputes.update(dispute_token, \*\*params) -> DisputeUpdateResponse +- client.disputes.list(\*\*params) -> SyncCursorPage[DisputeListResponse] +- client.disputes.delete(dispute_token) -> DisputeDeleteResponse - client.disputes.delete_evidence(evidence_token, \*, dispute_token) -> DisputeEvidence - client.disputes.initiate_evidence_upload(dispute_token, \*\*params) -> DisputeEvidence - client.disputes.list_evidences(dispute_token, \*\*params) -> SyncCursorPage[DisputeEvidence] diff --git a/examples/upload_evidence.py b/examples/upload_evidence.py index b4129844..e6a23286 100755 --- a/examples/upload_evidence.py +++ b/examples/upload_evidence.py @@ -1,11 +1,12 @@ #!/usr/bin/env -S rye run python +from __future__ import annotations + # To run this example locally # 1. Install Rye and setup a Python virtual environment: ./scripts/bootstrap # 2. Run the example: LITHIC_API_KEY= rye run python examples/upload_evidence.py - - from lithic import Lithic, file_from_path +from lithic.types import DisputeListResponse, DisputeCreateResponse client = Lithic(environment="sandbox") @@ -16,7 +17,7 @@ assert transaction.token, "Transaction must have a token" disputes_page = client.disputes.list() -dispute = disputes_page.data[0] +dispute: DisputeCreateResponse | DisputeListResponse | None = disputes_page.data[0] if disputes_page.data else None if not dispute: dispute = client.disputes.create( amount=42, diff --git a/pyproject.toml b/pyproject.toml index 1c5a47ff..a7acb183 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "lithic" -version = "0.109.1" +version = "0.110.0" description = "The official Python library for the lithic API" dynamic = ["readme"] license = "Apache-2.0" @@ -15,11 +15,10 @@ dependencies = [ "distro>=1.7.0, <2", "sniffio", ] -requires-python = ">= 3.8" +requires-python = ">= 3.9" classifiers = [ "Typing :: Typed", "Intended Audience :: Developers", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -141,7 +140,7 @@ filterwarnings = [ # there are a couple of flags that are still disabled by # default in strict mode as they are experimental and niche. typeCheckingMode = "strict" -pythonVersion = "3.8" +pythonVersion = "3.9" exclude = [ "_dev", diff --git a/src/lithic/_models.py b/src/lithic/_models.py index 6a3cd1d2..fcec2cf9 100644 --- a/src/lithic/_models.py +++ b/src/lithic/_models.py @@ -2,6 +2,7 @@ import os import inspect +import weakref from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast from datetime import date, datetime from typing_extensions import ( @@ -573,6 +574,9 @@ class CachedDiscriminatorType(Protocol): __discriminator__: DiscriminatorDetails +DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary() + + class DiscriminatorDetails: field_name: str """The name of the discriminator field in the variant class, e.g. @@ -615,8 +619,9 @@ def __init__( def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None: - if isinstance(union, CachedDiscriminatorType): - return union.__discriminator__ + cached = DISCRIMINATOR_CACHE.get(union) + if cached is not None: + return cached discriminator_field_name: str | None = None @@ -669,7 +674,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, discriminator_field=discriminator_field_name, discriminator_alias=discriminator_alias, ) - cast(CachedDiscriminatorType, union).__discriminator__ = details + DISCRIMINATOR_CACHE.setdefault(union, details) return details diff --git a/src/lithic/_utils/_sync.py b/src/lithic/_utils/_sync.py index ad7ec71b..f6027c18 100644 --- a/src/lithic/_utils/_sync.py +++ b/src/lithic/_utils/_sync.py @@ -1,10 +1,8 @@ from __future__ import annotations -import sys import asyncio import functools -import contextvars -from typing import Any, TypeVar, Callable, Awaitable +from typing import TypeVar, Callable, Awaitable from typing_extensions import ParamSpec import anyio @@ -15,34 +13,11 @@ T_ParamSpec = ParamSpec("T_ParamSpec") -if sys.version_info >= (3, 9): - _asyncio_to_thread = asyncio.to_thread -else: - # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread - # for Python 3.8 support - async def _asyncio_to_thread( - func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs - ) -> Any: - """Asynchronously run function *func* in a separate thread. - - Any *args and **kwargs supplied for this function are directly passed - to *func*. Also, the current :class:`contextvars.Context` is propagated, - allowing context variables from the main thread to be accessed in the - separate thread. - - Returns a coroutine that can be awaited to get the eventual result of *func*. - """ - loop = asyncio.events.get_running_loop() - ctx = contextvars.copy_context() - func_call = functools.partial(ctx.run, func, *args, **kwargs) - return await loop.run_in_executor(None, func_call) - - async def to_thread( func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs ) -> T_Retval: if sniffio.current_async_library() == "asyncio": - return await _asyncio_to_thread(func, *args, **kwargs) + return await asyncio.to_thread(func, *args, **kwargs) return await anyio.to_thread.run_sync( functools.partial(func, *args, **kwargs), @@ -53,10 +28,7 @@ async def to_thread( def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: """ Take a blocking function and create an async one that receives the same - positional and keyword arguments. For python version 3.9 and above, it uses - asyncio.to_thread to run the function in a separate thread. For python version - 3.8, it uses locally defined copy of the asyncio.to_thread function which was - introduced in python 3.9. + positional and keyword arguments. Usage: diff --git a/src/lithic/_utils/_utils.py b/src/lithic/_utils/_utils.py index 50d59269..eec7f4a1 100644 --- a/src/lithic/_utils/_utils.py +++ b/src/lithic/_utils/_utils.py @@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: # Type safe methods for narrowing types with TypeVars. # The default narrowing for isinstance(obj, dict) is dict[unknown, unknown], # however this cause Pyright to rightfully report errors. As we know we don't -# care about the contained types we can safely use `object` in it's place. +# care about the contained types we can safely use `object` in its place. # # There are two separate functions defined, `is_*` and `is_*_t` for different use cases. # `is_*` is for when you're dealing with an unknown input diff --git a/src/lithic/_version.py b/src/lithic/_version.py index a134b3f0..83631697 100644 --- a/src/lithic/_version.py +++ b/src/lithic/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "lithic" -__version__ = "0.109.1" # x-release-please-version +__version__ = "0.110.0" # x-release-please-version diff --git a/src/lithic/resources/auth_rules/v2/v2.py b/src/lithic/resources/auth_rules/v2/v2.py index ea3f250e..0b6f70ce 100644 --- a/src/lithic/resources/auth_rules/v2/v2.py +++ b/src/lithic/resources/auth_rules/v2/v2.py @@ -2,7 +2,6 @@ from __future__ import annotations -import typing_extensions from typing import Union, Optional from datetime import date from typing_extensions import Literal, overload @@ -11,7 +10,7 @@ from .... import _legacy_response from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform +from ...._utils import required_args, maybe_transform, async_maybe_transform from .backtests import ( Backtests, AsyncBacktests, @@ -27,7 +26,6 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.auth_rules import ( v2_list_params, - v2_apply_params, v2_draft_params, v2_create_params, v2_update_params, @@ -35,7 +33,6 @@ v2_retrieve_features_params, ) from ....types.auth_rules.v2_list_response import V2ListResponse -from ....types.auth_rules.v2_apply_response import V2ApplyResponse from ....types.auth_rules.v2_draft_response import V2DraftResponse from ....types.auth_rules.v2_create_response import V2CreateResponse from ....types.auth_rules.v2_update_response import V2UpdateResponse @@ -75,12 +72,12 @@ def with_streaming_response(self) -> V2WithStreamingResponse: def create( self, *, + parameters: v2_create_params.AccountLevelRuleParameters, + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"], account_tokens: SequenceNotStr[str] | Omit = omit, business_account_tokens: SequenceNotStr[str] | Omit = omit, event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | Omit = omit, name: Optional[str] | Omit = omit, - parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | Omit = omit, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -92,14 +89,6 @@ def create( Creates a new V2 Auth rule in draft mode Args: - account_tokens: Account tokens to which the Auth Rule applies. - - business_account_tokens: Business Account tokens to which the Auth Rule applies. - - event_stream: The event stream during which the rule will be evaluated. - - name: Auth Rule Name - parameters: Parameters for the Auth Rule type: The type of Auth Rule. For certain rule types, this determines the event stream @@ -112,6 +101,14 @@ def create( - `MERCHANT_LOCK`: AUTHORIZATION event stream. - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + account_tokens: Account tokens to which the Auth Rule applies. + + business_account_tokens: Business Account tokens to which the Auth Rule applies. + + event_stream: The event stream during which the rule will be evaluated. + + name: Auth Rule Name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -127,10 +124,10 @@ def create( self, *, card_tokens: SequenceNotStr[str], + parameters: v2_create_params.CardLevelRuleParameters, + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"], event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | Omit = omit, name: Optional[str] | Omit = omit, - parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | Omit = omit, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -144,10 +141,6 @@ def create( Args: card_tokens: Card tokens to which the Auth Rule applies. - event_stream: The event stream during which the rule will be evaluated. - - name: Auth Rule Name - parameters: Parameters for the Auth Rule type: The type of Auth Rule. For certain rule types, this determines the event stream @@ -160,6 +153,10 @@ def create( - `MERCHANT_LOCK`: AUTHORIZATION event stream. - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + event_stream: The event stream during which the rule will be evaluated. + + name: Auth Rule Name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -174,12 +171,12 @@ def create( def create( self, *, + parameters: v2_create_params.ProgramLevelRuleParameters, program_level: bool, + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"], event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | Omit = omit, excluded_card_tokens: SequenceNotStr[str] | Omit = omit, name: Optional[str] | Omit = omit, - parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | Omit = omit, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -191,16 +188,10 @@ def create( Creates a new V2 Auth rule in draft mode Args: - program_level: Whether the Auth Rule applies to all authorizations on the card program. - - event_stream: The event stream during which the rule will be evaluated. - - excluded_card_tokens: Card tokens to which the Auth Rule does not apply. - - name: Auth Rule Name - parameters: Parameters for the Auth Rule + program_level: Whether the Auth Rule applies to all authorizations on the card program. + type: The type of Auth Rule. For certain rule types, this determines the event stream during which it will be evaluated. For rules that can be applied to one of several event streams, the effective one is defined by the separate @@ -211,6 +202,12 @@ def create( - `MERCHANT_LOCK`: AUTHORIZATION event stream. - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + event_stream: The event stream during which the rule will be evaluated. + + excluded_card_tokens: Card tokens to which the Auth Rule does not apply. + + name: Auth Rule Name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -221,18 +218,20 @@ def create( """ ... + @required_args( + ["parameters", "type"], ["card_tokens", "parameters", "type"], ["parameters", "program_level", "type"] + ) def create( self, *, + parameters: v2_create_params.AccountLevelRuleParameters + | v2_create_params.CardLevelRuleParameters + | v2_create_params.ProgramLevelRuleParameters, + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"], account_tokens: SequenceNotStr[str] | Omit = omit, business_account_tokens: SequenceNotStr[str] | Omit = omit, event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | Omit = omit, name: Optional[str] | Omit = omit, - parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters - | v2_create_params.CreateAuthRuleRequestCardTokensParameters - | v2_create_params.CreateAuthRuleRequestProgramLevelParameters - | Omit = omit, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | Omit = omit, card_tokens: SequenceNotStr[str] | Omit = omit, program_level: bool | Omit = omit, excluded_card_tokens: SequenceNotStr[str] | Omit = omit, @@ -247,12 +246,12 @@ def create( "/v2/auth_rules", body=maybe_transform( { + "parameters": parameters, + "type": type, "account_tokens": account_tokens, "business_account_tokens": business_account_tokens, "event_stream": event_stream, "name": name, - "parameters": parameters, - "type": type, "card_tokens": card_tokens, "program_level": program_level, "excluded_card_tokens": excluded_card_tokens, @@ -579,148 +578,6 @@ def delete( cast_to=NoneType, ) - @typing_extensions.deprecated("deprecated") - @overload - def apply( - self, - auth_rule_token: str, - *, - account_tokens: SequenceNotStr[str] | Omit = omit, - business_account_tokens: SequenceNotStr[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> V2ApplyResponse: - """ - Associates a V2 Auth rule with a card program, the provided account(s) or - card(s). - - Prefer using the `PATCH` method for this operation. - - Args: - account_tokens: Account tokens to which the Auth Rule applies. - - business_account_tokens: Business Account tokens to which the Auth Rule applies. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @typing_extensions.deprecated("deprecated") - @overload - def apply( - self, - auth_rule_token: str, - *, - card_tokens: SequenceNotStr[str], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> V2ApplyResponse: - """ - Associates a V2 Auth rule with a card program, the provided account(s) or - card(s). - - Prefer using the `PATCH` method for this operation. - - Args: - card_tokens: Card tokens to which the Auth Rule applies. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @typing_extensions.deprecated("deprecated") - @overload - def apply( - self, - auth_rule_token: str, - *, - program_level: bool, - excluded_card_tokens: SequenceNotStr[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> V2ApplyResponse: - """ - Associates a V2 Auth rule with a card program, the provided account(s) or - card(s). - - Prefer using the `PATCH` method for this operation. - - Args: - program_level: Whether the Auth Rule applies to all authorizations on the card program. - - excluded_card_tokens: Card tokens to which the Auth Rule does not apply. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @typing_extensions.deprecated("deprecated") - def apply( - self, - auth_rule_token: str, - *, - account_tokens: SequenceNotStr[str] | Omit = omit, - business_account_tokens: SequenceNotStr[str] | Omit = omit, - card_tokens: SequenceNotStr[str] | Omit = omit, - program_level: bool | Omit = omit, - excluded_card_tokens: SequenceNotStr[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> V2ApplyResponse: - if not auth_rule_token: - raise ValueError(f"Expected a non-empty value for `auth_rule_token` but received {auth_rule_token!r}") - return self._post( - f"/v2/auth_rules/{auth_rule_token}/apply", - body=maybe_transform( - { - "account_tokens": account_tokens, - "business_account_tokens": business_account_tokens, - "card_tokens": card_tokens, - "program_level": program_level, - "excluded_card_tokens": excluded_card_tokens, - }, - v2_apply_params.V2ApplyParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=V2ApplyResponse, - ) - def draft( self, auth_rule_token: str, @@ -938,12 +795,12 @@ def with_streaming_response(self) -> AsyncV2WithStreamingResponse: async def create( self, *, + parameters: v2_create_params.AccountLevelRuleParameters, + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"], account_tokens: SequenceNotStr[str] | Omit = omit, business_account_tokens: SequenceNotStr[str] | Omit = omit, event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | Omit = omit, name: Optional[str] | Omit = omit, - parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | Omit = omit, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -955,14 +812,6 @@ async def create( Creates a new V2 Auth rule in draft mode Args: - account_tokens: Account tokens to which the Auth Rule applies. - - business_account_tokens: Business Account tokens to which the Auth Rule applies. - - event_stream: The event stream during which the rule will be evaluated. - - name: Auth Rule Name - parameters: Parameters for the Auth Rule type: The type of Auth Rule. For certain rule types, this determines the event stream @@ -975,6 +824,14 @@ async def create( - `MERCHANT_LOCK`: AUTHORIZATION event stream. - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + account_tokens: Account tokens to which the Auth Rule applies. + + business_account_tokens: Business Account tokens to which the Auth Rule applies. + + event_stream: The event stream during which the rule will be evaluated. + + name: Auth Rule Name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -990,10 +847,10 @@ async def create( self, *, card_tokens: SequenceNotStr[str], + parameters: v2_create_params.CardLevelRuleParameters, + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"], event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | Omit = omit, name: Optional[str] | Omit = omit, - parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | Omit = omit, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1007,10 +864,6 @@ async def create( Args: card_tokens: Card tokens to which the Auth Rule applies. - event_stream: The event stream during which the rule will be evaluated. - - name: Auth Rule Name - parameters: Parameters for the Auth Rule type: The type of Auth Rule. For certain rule types, this determines the event stream @@ -1023,6 +876,10 @@ async def create( - `MERCHANT_LOCK`: AUTHORIZATION event stream. - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + event_stream: The event stream during which the rule will be evaluated. + + name: Auth Rule Name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1037,12 +894,12 @@ async def create( async def create( self, *, + parameters: v2_create_params.ProgramLevelRuleParameters, program_level: bool, + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"], event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | Omit = omit, excluded_card_tokens: SequenceNotStr[str] | Omit = omit, name: Optional[str] | Omit = omit, - parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | Omit = omit, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1054,16 +911,10 @@ async def create( Creates a new V2 Auth rule in draft mode Args: - program_level: Whether the Auth Rule applies to all authorizations on the card program. - - event_stream: The event stream during which the rule will be evaluated. - - excluded_card_tokens: Card tokens to which the Auth Rule does not apply. - - name: Auth Rule Name - parameters: Parameters for the Auth Rule + program_level: Whether the Auth Rule applies to all authorizations on the card program. + type: The type of Auth Rule. For certain rule types, this determines the event stream during which it will be evaluated. For rules that can be applied to one of several event streams, the effective one is defined by the separate @@ -1074,6 +925,12 @@ async def create( - `MERCHANT_LOCK`: AUTHORIZATION event stream. - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + event_stream: The event stream during which the rule will be evaluated. + + excluded_card_tokens: Card tokens to which the Auth Rule does not apply. + + name: Auth Rule Name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1084,18 +941,20 @@ async def create( """ ... + @required_args( + ["parameters", "type"], ["card_tokens", "parameters", "type"], ["parameters", "program_level", "type"] + ) async def create( self, *, + parameters: v2_create_params.AccountLevelRuleParameters + | v2_create_params.CardLevelRuleParameters + | v2_create_params.ProgramLevelRuleParameters, + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"], account_tokens: SequenceNotStr[str] | Omit = omit, business_account_tokens: SequenceNotStr[str] | Omit = omit, event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | Omit = omit, name: Optional[str] | Omit = omit, - parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters - | v2_create_params.CreateAuthRuleRequestCardTokensParameters - | v2_create_params.CreateAuthRuleRequestProgramLevelParameters - | Omit = omit, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | Omit = omit, card_tokens: SequenceNotStr[str] | Omit = omit, program_level: bool | Omit = omit, excluded_card_tokens: SequenceNotStr[str] | Omit = omit, @@ -1110,12 +969,12 @@ async def create( "/v2/auth_rules", body=await async_maybe_transform( { + "parameters": parameters, + "type": type, "account_tokens": account_tokens, "business_account_tokens": business_account_tokens, "event_stream": event_stream, "name": name, - "parameters": parameters, - "type": type, "card_tokens": card_tokens, "program_level": program_level, "excluded_card_tokens": excluded_card_tokens, @@ -1442,148 +1301,6 @@ async def delete( cast_to=NoneType, ) - @typing_extensions.deprecated("deprecated") - @overload - async def apply( - self, - auth_rule_token: str, - *, - account_tokens: SequenceNotStr[str] | Omit = omit, - business_account_tokens: SequenceNotStr[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> V2ApplyResponse: - """ - Associates a V2 Auth rule with a card program, the provided account(s) or - card(s). - - Prefer using the `PATCH` method for this operation. - - Args: - account_tokens: Account tokens to which the Auth Rule applies. - - business_account_tokens: Business Account tokens to which the Auth Rule applies. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @typing_extensions.deprecated("deprecated") - @overload - async def apply( - self, - auth_rule_token: str, - *, - card_tokens: SequenceNotStr[str], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> V2ApplyResponse: - """ - Associates a V2 Auth rule with a card program, the provided account(s) or - card(s). - - Prefer using the `PATCH` method for this operation. - - Args: - card_tokens: Card tokens to which the Auth Rule applies. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @typing_extensions.deprecated("deprecated") - @overload - async def apply( - self, - auth_rule_token: str, - *, - program_level: bool, - excluded_card_tokens: SequenceNotStr[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> V2ApplyResponse: - """ - Associates a V2 Auth rule with a card program, the provided account(s) or - card(s). - - Prefer using the `PATCH` method for this operation. - - Args: - program_level: Whether the Auth Rule applies to all authorizations on the card program. - - excluded_card_tokens: Card tokens to which the Auth Rule does not apply. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @typing_extensions.deprecated("deprecated") - async def apply( - self, - auth_rule_token: str, - *, - account_tokens: SequenceNotStr[str] | Omit = omit, - business_account_tokens: SequenceNotStr[str] | Omit = omit, - card_tokens: SequenceNotStr[str] | Omit = omit, - program_level: bool | Omit = omit, - excluded_card_tokens: SequenceNotStr[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> V2ApplyResponse: - if not auth_rule_token: - raise ValueError(f"Expected a non-empty value for `auth_rule_token` but received {auth_rule_token!r}") - return await self._post( - f"/v2/auth_rules/{auth_rule_token}/apply", - body=await async_maybe_transform( - { - "account_tokens": account_tokens, - "business_account_tokens": business_account_tokens, - "card_tokens": card_tokens, - "program_level": program_level, - "excluded_card_tokens": excluded_card_tokens, - }, - v2_apply_params.V2ApplyParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=V2ApplyResponse, - ) - async def draft( self, auth_rule_token: str, @@ -1792,11 +1509,6 @@ def __init__(self, v2: V2) -> None: self.delete = _legacy_response.to_raw_response_wrapper( v2.delete, ) - self.apply = ( # pyright: ignore[reportDeprecated] - _legacy_response.to_raw_response_wrapper( - v2.apply, # pyright: ignore[reportDeprecated], - ) - ) self.draft = _legacy_response.to_raw_response_wrapper( v2.draft, ) @@ -1834,11 +1546,6 @@ def __init__(self, v2: AsyncV2) -> None: self.delete = _legacy_response.async_to_raw_response_wrapper( v2.delete, ) - self.apply = ( # pyright: ignore[reportDeprecated] - _legacy_response.async_to_raw_response_wrapper( - v2.apply, # pyright: ignore[reportDeprecated], - ) - ) self.draft = _legacy_response.async_to_raw_response_wrapper( v2.draft, ) @@ -1876,11 +1583,6 @@ def __init__(self, v2: V2) -> None: self.delete = to_streamed_response_wrapper( v2.delete, ) - self.apply = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - v2.apply, # pyright: ignore[reportDeprecated], - ) - ) self.draft = to_streamed_response_wrapper( v2.draft, ) @@ -1918,11 +1620,6 @@ def __init__(self, v2: AsyncV2) -> None: self.delete = async_to_streamed_response_wrapper( v2.delete, ) - self.apply = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - v2.apply, # pyright: ignore[reportDeprecated], - ) - ) self.draft = async_to_streamed_response_wrapper( v2.draft, ) diff --git a/src/lithic/resources/disputes.py b/src/lithic/resources/disputes.py index a6a50705..ec1daf82 100644 --- a/src/lithic/resources/disputes.py +++ b/src/lithic/resources/disputes.py @@ -23,8 +23,12 @@ from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ..pagination import SyncCursorPage, AsyncCursorPage from .._base_client import AsyncPaginator, make_request_options -from ..types.dispute import Dispute from ..types.dispute_evidence import DisputeEvidence +from ..types.dispute_list_response import DisputeListResponse +from ..types.dispute_create_response import DisputeCreateResponse +from ..types.dispute_delete_response import DisputeDeleteResponse +from ..types.dispute_update_response import DisputeUpdateResponse +from ..types.dispute_retrieve_response import DisputeRetrieveResponse __all__ = ["Disputes", "AsyncDisputes"] @@ -78,7 +82,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Dispute: + ) -> DisputeCreateResponse: """ Initiate a dispute. @@ -116,7 +120,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Dispute, + cast_to=DisputeCreateResponse, ) def retrieve( @@ -129,7 +133,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Dispute: + ) -> DisputeRetrieveResponse: """ Get dispute. @@ -149,7 +153,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Dispute, + cast_to=DisputeRetrieveResponse, ) def update( @@ -182,7 +186,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Dispute: + ) -> DisputeUpdateResponse: """Update dispute. Can only be modified if status is `NEW`. @@ -220,7 +224,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Dispute, + cast_to=DisputeUpdateResponse, ) def list( @@ -249,7 +253,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncCursorPage[Dispute]: + ) -> SyncCursorPage[DisputeListResponse]: """List disputes. Args: @@ -283,7 +287,7 @@ def list( """ return self._get_api_list( "/v1/disputes", - page=SyncCursorPage[Dispute], + page=SyncCursorPage[DisputeListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -302,7 +306,7 @@ def list( dispute_list_params.DisputeListParams, ), ), - model=Dispute, + model=DisputeListResponse, ) def delete( @@ -315,7 +319,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Dispute: + ) -> DisputeDeleteResponse: """ Withdraw dispute. @@ -335,7 +339,7 @@ def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Dispute, + cast_to=DisputeDeleteResponse, ) def delete_evidence( @@ -594,7 +598,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Dispute: + ) -> DisputeCreateResponse: """ Initiate a dispute. @@ -632,7 +636,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Dispute, + cast_to=DisputeCreateResponse, ) async def retrieve( @@ -645,7 +649,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Dispute: + ) -> DisputeRetrieveResponse: """ Get dispute. @@ -665,7 +669,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Dispute, + cast_to=DisputeRetrieveResponse, ) async def update( @@ -698,7 +702,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Dispute: + ) -> DisputeUpdateResponse: """Update dispute. Can only be modified if status is `NEW`. @@ -736,7 +740,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Dispute, + cast_to=DisputeUpdateResponse, ) def list( @@ -765,7 +769,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[Dispute, AsyncCursorPage[Dispute]]: + ) -> AsyncPaginator[DisputeListResponse, AsyncCursorPage[DisputeListResponse]]: """List disputes. Args: @@ -799,7 +803,7 @@ def list( """ return self._get_api_list( "/v1/disputes", - page=AsyncCursorPage[Dispute], + page=AsyncCursorPage[DisputeListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -818,7 +822,7 @@ def list( dispute_list_params.DisputeListParams, ), ), - model=Dispute, + model=DisputeListResponse, ) async def delete( @@ -831,7 +835,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Dispute: + ) -> DisputeDeleteResponse: """ Withdraw dispute. @@ -851,7 +855,7 @@ async def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Dispute, + cast_to=DisputeDeleteResponse, ) async def delete_evidence( diff --git a/src/lithic/resources/events/events.py b/src/lithic/resources/events/events.py index fdec4d03..bf582f08 100644 --- a/src/lithic/resources/events/events.py +++ b/src/lithic/resources/events/events.py @@ -108,26 +108,31 @@ def list( ending_before: str | Omit = omit, event_types: List[ Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -135,6 +140,8 @@ def list( "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -143,10 +150,9 @@ def list( "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", @@ -376,26 +382,31 @@ def list( ending_before: str | Omit = omit, event_types: List[ Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -403,6 +414,8 @@ def list( "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -411,10 +424,9 @@ def list( "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", diff --git a/src/lithic/resources/events/subscriptions.py b/src/lithic/resources/events/subscriptions.py index 3e6cefe3..263ee10a 100644 --- a/src/lithic/resources/events/subscriptions.py +++ b/src/lithic/resources/events/subscriptions.py @@ -60,26 +60,31 @@ def create( disabled: bool | Omit = omit, event_types: List[ Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -87,6 +92,8 @@ def create( "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -95,10 +102,9 @@ def create( "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", @@ -198,26 +204,31 @@ def update( disabled: bool | Omit = omit, event_types: List[ Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -225,6 +236,8 @@ def update( "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -233,10 +246,9 @@ def update( "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", @@ -642,26 +654,31 @@ def send_simulated_example( event_subscription_token: str, *, event_type: Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -669,6 +686,8 @@ def send_simulated_example( "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -677,10 +696,9 @@ def send_simulated_example( "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", @@ -756,26 +774,31 @@ async def create( disabled: bool | Omit = omit, event_types: List[ Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -783,6 +806,8 @@ async def create( "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -791,10 +816,9 @@ async def create( "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", @@ -894,26 +918,31 @@ async def update( disabled: bool | Omit = omit, event_types: List[ Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -921,6 +950,8 @@ async def update( "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -929,10 +960,9 @@ async def update( "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", @@ -1338,26 +1368,31 @@ async def send_simulated_example( event_subscription_token: str, *, event_type: Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -1365,6 +1400,8 @@ async def send_simulated_example( "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -1373,10 +1410,9 @@ async def send_simulated_example( "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", diff --git a/src/lithic/resources/payments.py b/src/lithic/resources/payments.py index b197fbdf..3bbc3ced 100644 --- a/src/lithic/resources/payments.py +++ b/src/lithic/resources/payments.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Union -from datetime import datetime +from datetime import date, datetime from typing_extensions import Literal import httpx @@ -267,10 +267,12 @@ def simulate_action( "ACH_RETURN_PROCESSED", "ACH_RETURN_SETTLED", ], + date_of_death: Union[str, date] | Omit = omit, decline_reason: Literal[ "PROGRAM_TRANSACTION_LIMIT_EXCEEDED", "PROGRAM_DAILY_LIMIT_EXCEEDED", "PROGRAM_MONTHLY_LIMIT_EXCEEDED" ] | Omit = omit, + return_addenda: str | Omit = omit, return_reason_code: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -285,8 +287,12 @@ def simulate_action( Args: event_type: Event Type + date_of_death: Date of Death for ACH Return + decline_reason: Decline reason + return_addenda: Return Addenda + return_reason_code: Return Reason Code extra_headers: Send extra headers @@ -304,7 +310,9 @@ def simulate_action( body=maybe_transform( { "event_type": event_type, + "date_of_death": date_of_death, "decline_reason": decline_reason, + "return_addenda": return_addenda, "return_reason_code": return_reason_code, }, payment_simulate_action_params.PaymentSimulateActionParams, @@ -682,10 +690,12 @@ async def simulate_action( "ACH_RETURN_PROCESSED", "ACH_RETURN_SETTLED", ], + date_of_death: Union[str, date] | Omit = omit, decline_reason: Literal[ "PROGRAM_TRANSACTION_LIMIT_EXCEEDED", "PROGRAM_DAILY_LIMIT_EXCEEDED", "PROGRAM_MONTHLY_LIMIT_EXCEEDED" ] | Omit = omit, + return_addenda: str | Omit = omit, return_reason_code: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -700,8 +710,12 @@ async def simulate_action( Args: event_type: Event Type + date_of_death: Date of Death for ACH Return + decline_reason: Decline reason + return_addenda: Return Addenda + return_reason_code: Return Reason Code extra_headers: Send extra headers @@ -719,7 +733,9 @@ async def simulate_action( body=await async_maybe_transform( { "event_type": event_type, + "date_of_death": date_of_death, "decline_reason": decline_reason, + "return_addenda": return_addenda, "return_reason_code": return_reason_code, }, payment_simulate_action_params.PaymentSimulateActionParams, diff --git a/src/lithic/types/__init__.py b/src/lithic/types/__init__.py index b8b6c968..14d0cd07 100644 --- a/src/lithic/types/__init__.py +++ b/src/lithic/types/__init__.py @@ -15,7 +15,6 @@ ) from .account import Account as Account from .balance import Balance as Balance -from .dispute import Dispute as Dispute from .payment import Payment as Payment from .kyb_param import KYBParam as KYBParam from .kyc_param import KYCParam as KYCParam @@ -65,6 +64,7 @@ from .account_update_params import AccountUpdateParams as AccountUpdateParams from .card_provision_params import CardProvisionParams as CardProvisionParams from .dispute_create_params import DisputeCreateParams as DisputeCreateParams +from .dispute_list_response import DisputeListResponse as DisputeListResponse from .dispute_update_params import DisputeUpdateParams as DisputeUpdateParams from .financial_transaction import FinancialTransaction as FinancialTransaction from .payment_create_params import PaymentCreateParams as PaymentCreateParams @@ -72,6 +72,9 @@ from .external_resource_type import ExternalResourceType as ExternalResourceType from .payment_retry_response import PaymentRetryResponse as PaymentRetryResponse from .card_provision_response import CardProvisionResponse as CardProvisionResponse +from .dispute_create_response import DisputeCreateResponse as DisputeCreateResponse +from .dispute_delete_response import DisputeDeleteResponse as DisputeDeleteResponse +from .dispute_update_response import DisputeUpdateResponse as DisputeUpdateResponse from .payment_create_response import PaymentCreateResponse as PaymentCreateResponse from .transaction_list_params import TransactionListParams as TransactionListParams from .card_program_list_params import CardProgramListParams as CardProgramListParams @@ -80,6 +83,7 @@ from .card_get_embed_url_params import CardGetEmbedURLParams as CardGetEmbedURLParams from .card_search_by_pan_params import CardSearchByPanParams as CardSearchByPanParams from .card_web_provision_params import CardWebProvisionParams as CardWebProvisionParams +from .dispute_retrieve_response import DisputeRetrieveResponse as DisputeRetrieveResponse from .funding_event_list_params import FundingEventListParams as FundingEventListParams from .responder_endpoint_status import ResponderEndpointStatus as ResponderEndpointStatus from .account_holder_list_params import AccountHolderListParams as AccountHolderListParams diff --git a/src/lithic/types/account_activity_list_response.py b/src/lithic/types/account_activity_list_response.py index c24679a6..2453fea7 100644 --- a/src/lithic/types/account_activity_list_response.py +++ b/src/lithic/types/account_activity_list_response.py @@ -44,6 +44,7 @@ class FinancialTransactionEvent(BaseModel): "ACH_ORIGINATION_REVIEWED", "ACH_ORIGINATION_SETTLED", "ACH_RECEIPT_PROCESSED", + "ACH_RECEIPT_RELEASED", "ACH_RECEIPT_SETTLED", "ACH_RETURN_INITIATED", "ACH_RETURN_PROCESSED", diff --git a/src/lithic/types/account_activity_retrieve_transaction_response.py b/src/lithic/types/account_activity_retrieve_transaction_response.py index e9ea58d5..cb516727 100644 --- a/src/lithic/types/account_activity_retrieve_transaction_response.py +++ b/src/lithic/types/account_activity_retrieve_transaction_response.py @@ -49,6 +49,7 @@ class FinancialTransactionEvent(BaseModel): "ACH_ORIGINATION_REVIEWED", "ACH_ORIGINATION_SETTLED", "ACH_RECEIPT_PROCESSED", + "ACH_RECEIPT_RELEASED", "ACH_RECEIPT_SETTLED", "ACH_RETURN_INITIATED", "ACH_RETURN_PROCESSED", diff --git a/src/lithic/types/auth_rules/__init__.py b/src/lithic/types/auth_rules/__init__.py index 7418e32d..ad5a1d7e 100644 --- a/src/lithic/types/auth_rules/__init__.py +++ b/src/lithic/types/auth_rules/__init__.py @@ -4,12 +4,10 @@ from .rule_stats import RuleStats as RuleStats from .v2_list_params import V2ListParams as V2ListParams -from .v2_apply_params import V2ApplyParams as V2ApplyParams from .v2_draft_params import V2DraftParams as V2DraftParams from .v2_create_params import V2CreateParams as V2CreateParams from .v2_list_response import V2ListResponse as V2ListResponse from .v2_update_params import V2UpdateParams as V2UpdateParams -from .v2_apply_response import V2ApplyResponse as V2ApplyResponse from .v2_draft_response import V2DraftResponse as V2DraftResponse from .v2_create_response import V2CreateResponse as V2CreateResponse from .v2_update_response import V2UpdateResponse as V2UpdateResponse @@ -18,21 +16,25 @@ from .v2_retrieve_response import V2RetrieveResponse as V2RetrieveResponse from .conditional_attribute import ConditionalAttribute as ConditionalAttribute from .velocity_limit_params import VelocityLimitParams as VelocityLimitParams +from .velocity_limit_period import VelocityLimitPeriod as VelocityLimitPeriod from .merchant_lock_parameters import MerchantLockParameters as MerchantLockParameters from .auth_rule_condition_param import AuthRuleConditionParam as AuthRuleConditionParam from .v2_retrieve_report_params import V2RetrieveReportParams as V2RetrieveReportParams from .v2_retrieve_features_params import V2RetrieveFeaturesParams as V2RetrieveFeaturesParams from .v2_retrieve_report_response import V2RetrieveReportResponse as V2RetrieveReportResponse from .velocity_limit_params_param import VelocityLimitParamsParam as VelocityLimitParamsParam +from .velocity_limit_period_param import VelocityLimitPeriodParam as VelocityLimitPeriodParam from .conditional_block_parameters import ConditionalBlockParameters as ConditionalBlockParameters from .v2_retrieve_features_response import V2RetrieveFeaturesResponse as V2RetrieveFeaturesResponse from .merchant_lock_parameters_param import MerchantLockParametersParam as MerchantLockParametersParam from .conditional_3ds_action_parameters import Conditional3DSActionParameters as Conditional3DSActionParameters from .conditional_block_parameters_param import ConditionalBlockParametersParam as ConditionalBlockParametersParam -from .velocity_limit_params_period_window import VelocityLimitParamsPeriodWindow as VelocityLimitParamsPeriodWindow from .conditional_3ds_action_parameters_param import ( Conditional3DSActionParametersParam as Conditional3DSActionParametersParam, ) -from .velocity_limit_params_period_window_param import ( - VelocityLimitParamsPeriodWindowParam as VelocityLimitParamsPeriodWindowParam, +from .conditional_authorization_action_parameters import ( + ConditionalAuthorizationActionParameters as ConditionalAuthorizationActionParameters, +) +from .conditional_authorization_action_parameters_param import ( + ConditionalAuthorizationActionParametersParam as ConditionalAuthorizationActionParametersParam, ) diff --git a/src/lithic/types/auth_rules/conditional_authorization_action_parameters.py b/src/lithic/types/auth_rules/conditional_authorization_action_parameters.py new file mode 100644 index 00000000..d999d578 --- /dev/null +++ b/src/lithic/types/auth_rules/conditional_authorization_action_parameters.py @@ -0,0 +1,115 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["ConditionalAuthorizationActionParameters", "Condition"] + + +class Condition(BaseModel): + attribute: Optional[ + Literal[ + "MCC", + "COUNTRY", + "CURRENCY", + "MERCHANT_ID", + "DESCRIPTOR", + "LIABILITY_SHIFT", + "PAN_ENTRY_MODE", + "TRANSACTION_AMOUNT", + "CASH_AMOUNT", + "RISK_SCORE", + "CARD_TRANSACTION_COUNT_15M", + "CARD_TRANSACTION_COUNT_1H", + "CARD_TRANSACTION_COUNT_24H", + "CARD_STATE", + "PIN_ENTERED", + "PIN_STATUS", + "WALLET_TYPE", + "TRANSACTION_INITIATOR", + "ADDRESS_MATCH", + ] + ] = None + """The attribute to target. + + The following attributes may be targeted: + + - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a + business by the types of goods or services it provides. + - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all + ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for + Netherlands Antilles. + - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of + the transaction. + - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor + (merchant). + - `DESCRIPTOR`: Short description of card acceptor. + - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer + applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or + `TOKEN_AUTHENTICATED`. + - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number + (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, + `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, + `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, + `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. + - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer + 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, + where the raw score has a range of 0-99, Lithic will normalize the score by + multiplying the raw score by 10x. + - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the + trailing 15 minutes before the authorization. + - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the + trailing hour up and until the authorization. + - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the + trailing 24 hours up and until the authorization. + - `CARD_STATE`: The current state of the card associated with the transaction. + Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, + `PENDING_FULFILLMENT`. + - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. + Valid values are `TRUE`, `FALSE`. + - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, + `OK`, `BLOCKED`. + - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the + source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, + `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. + - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates + the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. + - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + data with the cardholder KYC data if it exists. Valid values are `MATCH`, + `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. + """ + + operation: Optional[ + Literal[ + "IS_ONE_OF", + "IS_NOT_ONE_OF", + "MATCHES", + "DOES_NOT_MATCH", + "IS_EQUAL_TO", + "IS_NOT_EQUAL_TO", + "IS_GREATER_THAN", + "IS_GREATER_THAN_OR_EQUAL_TO", + "IS_LESS_THAN", + "IS_LESS_THAN_OR_EQUAL_TO", + ] + ] = None + """The operation to apply to the attribute""" + + value: Union[str, int, List[str], None] = None + """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" + + +class ConditionalAuthorizationActionParameters(BaseModel): + action: Literal["DECLINE", "CHALLENGE"] + """The action to take if the conditions are met.""" + + conditions: List[Condition] diff --git a/src/lithic/types/auth_rules/conditional_authorization_action_parameters_param.py b/src/lithic/types/auth_rules/conditional_authorization_action_parameters_param.py new file mode 100644 index 00000000..84e2ad30 --- /dev/null +++ b/src/lithic/types/auth_rules/conditional_authorization_action_parameters_param.py @@ -0,0 +1,113 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Literal, Required, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["ConditionalAuthorizationActionParametersParam", "Condition"] + + +class Condition(TypedDict, total=False): + attribute: Literal[ + "MCC", + "COUNTRY", + "CURRENCY", + "MERCHANT_ID", + "DESCRIPTOR", + "LIABILITY_SHIFT", + "PAN_ENTRY_MODE", + "TRANSACTION_AMOUNT", + "CASH_AMOUNT", + "RISK_SCORE", + "CARD_TRANSACTION_COUNT_15M", + "CARD_TRANSACTION_COUNT_1H", + "CARD_TRANSACTION_COUNT_24H", + "CARD_STATE", + "PIN_ENTERED", + "PIN_STATUS", + "WALLET_TYPE", + "TRANSACTION_INITIATOR", + "ADDRESS_MATCH", + ] + """The attribute to target. + + The following attributes may be targeted: + + - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a + business by the types of goods or services it provides. + - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all + ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for + Netherlands Antilles. + - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of + the transaction. + - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor + (merchant). + - `DESCRIPTOR`: Short description of card acceptor. + - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer + applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or + `TOKEN_AUTHENTICATED`. + - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number + (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, + `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, + `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, + `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. + - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer + 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, + where the raw score has a range of 0-99, Lithic will normalize the score by + multiplying the raw score by 10x. + - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the + trailing 15 minutes before the authorization. + - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the + trailing hour up and until the authorization. + - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the + trailing 24 hours up and until the authorization. + - `CARD_STATE`: The current state of the card associated with the transaction. + Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, + `PENDING_FULFILLMENT`. + - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. + Valid values are `TRUE`, `FALSE`. + - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, + `OK`, `BLOCKED`. + - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the + source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, + `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. + - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates + the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. + - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + data with the cardholder KYC data if it exists. Valid values are `MATCH`, + `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. + """ + + operation: Literal[ + "IS_ONE_OF", + "IS_NOT_ONE_OF", + "MATCHES", + "DOES_NOT_MATCH", + "IS_EQUAL_TO", + "IS_NOT_EQUAL_TO", + "IS_GREATER_THAN", + "IS_GREATER_THAN_OR_EQUAL_TO", + "IS_LESS_THAN", + "IS_LESS_THAN_OR_EQUAL_TO", + ] + """The operation to apply to the attribute""" + + value: Union[str, int, SequenceNotStr[str]] + """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" + + +class ConditionalAuthorizationActionParametersParam(TypedDict, total=False): + action: Required[Literal["DECLINE", "CHALLENGE"]] + """The action to take if the conditions are met.""" + + conditions: Required[Iterable[Condition]] diff --git a/src/lithic/types/auth_rules/v2_apply_params.py b/src/lithic/types/auth_rules/v2_apply_params.py deleted file mode 100644 index b1018c00..00000000 --- a/src/lithic/types/auth_rules/v2_apply_params.py +++ /dev/null @@ -1,41 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from typing_extensions import Required, TypeAlias, TypedDict - -from ..._types import SequenceNotStr - -__all__ = [ - "V2ApplyParams", - "ApplyAuthRuleRequestAccountTokens", - "ApplyAuthRuleRequestCardTokens", - "ApplyAuthRuleRequestProgramLevel", -] - - -class ApplyAuthRuleRequestAccountTokens(TypedDict, total=False): - account_tokens: SequenceNotStr[str] - """Account tokens to which the Auth Rule applies.""" - - business_account_tokens: SequenceNotStr[str] - """Business Account tokens to which the Auth Rule applies.""" - - -class ApplyAuthRuleRequestCardTokens(TypedDict, total=False): - card_tokens: Required[SequenceNotStr[str]] - """Card tokens to which the Auth Rule applies.""" - - -class ApplyAuthRuleRequestProgramLevel(TypedDict, total=False): - program_level: Required[bool] - """Whether the Auth Rule applies to all authorizations on the card program.""" - - excluded_card_tokens: SequenceNotStr[str] - """Card tokens to which the Auth Rule does not apply.""" - - -V2ApplyParams: TypeAlias = Union[ - ApplyAuthRuleRequestAccountTokens, ApplyAuthRuleRequestCardTokens, ApplyAuthRuleRequestProgramLevel -] diff --git a/src/lithic/types/auth_rules/v2_apply_response.py b/src/lithic/types/auth_rules/v2_apply_response.py deleted file mode 100644 index aa950d29..00000000 --- a/src/lithic/types/auth_rules/v2_apply_response.py +++ /dev/null @@ -1,328 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from ..._models import BaseModel -from .velocity_limit_params import VelocityLimitParams -from .merchant_lock_parameters import MerchantLockParameters -from .conditional_block_parameters import ConditionalBlockParameters -from .conditional_3ds_action_parameters import Conditional3DSActionParameters - -__all__ = [ - "V2ApplyResponse", - "CurrentVersion", - "CurrentVersionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParametersCondition", - "DraftVersion", - "DraftVersionParameters", - "DraftVersionParametersConditionalAuthorizationActionParameters", - "DraftVersionParametersConditionalAuthorizationActionParametersCondition", -] - - -class CurrentVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class CurrentVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[CurrentVersionParametersConditionalAuthorizationActionParametersCondition] - - -CurrentVersionParameters: TypeAlias = Union[ - ConditionalBlockParameters, - VelocityLimitParams, - MerchantLockParameters, - Conditional3DSActionParameters, - CurrentVersionParametersConditionalAuthorizationActionParameters, -] - - -class CurrentVersion(BaseModel): - parameters: CurrentVersionParameters - """Parameters for the Auth Rule""" - - version: int - """ - The version of the rule, this is incremented whenever the rule's parameters - change. - """ - - -class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class DraftVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[DraftVersionParametersConditionalAuthorizationActionParametersCondition] - - -DraftVersionParameters: TypeAlias = Union[ - ConditionalBlockParameters, - VelocityLimitParams, - MerchantLockParameters, - Conditional3DSActionParameters, - DraftVersionParametersConditionalAuthorizationActionParameters, -] - - -class DraftVersion(BaseModel): - parameters: DraftVersionParameters - """Parameters for the Auth Rule""" - - version: int - """ - The version of the rule, this is incremented whenever the rule's parameters - change. - """ - - -class V2ApplyResponse(BaseModel): - token: str - """Auth Rule Token""" - - account_tokens: List[str] - """Account tokens to which the Auth Rule applies.""" - - business_account_tokens: List[str] - """Business Account tokens to which the Auth Rule applies.""" - - card_tokens: List[str] - """Card tokens to which the Auth Rule applies.""" - - current_version: Optional[CurrentVersion] = None - - draft_version: Optional[DraftVersion] = None - - event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] - """The event stream during which the rule will be evaluated.""" - - lithic_managed: bool - """Indicates whether this auth rule is managed by Lithic. - - If true, the rule cannot be modified or deleted by the user - """ - - name: Optional[str] = None - """Auth Rule Name""" - - program_level: bool - """Whether the Auth Rule applies to all authorizations on the card program.""" - - state: Literal["ACTIVE", "INACTIVE"] - """The state of the Auth Rule""" - - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] - """The type of Auth Rule. - - For certain rule types, this determines the event stream during which it will be - evaluated. For rules that can be applied to one of several event streams, the - effective one is defined by the separate `event_stream` field. - - - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. - - `VELOCITY_LIMIT`: AUTHORIZATION event stream. - - `MERCHANT_LOCK`: AUTHORIZATION event stream. - - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. - """ - - excluded_card_tokens: Optional[List[str]] = None - """Card tokens to which the Auth Rule does not apply.""" diff --git a/src/lithic/types/auth_rules/v2_create_params.py b/src/lithic/types/auth_rules/v2_create_params.py index be9c4ebc..954acfdc 100644 --- a/src/lithic/types/auth_rules/v2_create_params.py +++ b/src/lithic/types/auth_rules/v2_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Union, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr @@ -10,41 +10,24 @@ from .merchant_lock_parameters_param import MerchantLockParametersParam from .conditional_block_parameters_param import ConditionalBlockParametersParam from .conditional_3ds_action_parameters_param import Conditional3DSActionParametersParam +from .conditional_authorization_action_parameters_param import ConditionalAuthorizationActionParametersParam __all__ = [ "V2CreateParams", - "CreateAuthRuleRequestAccountTokens", - "CreateAuthRuleRequestAccountTokensParameters", - "CreateAuthRuleRequestAccountTokensParametersConditionalAuthorizationActionParameters", - "CreateAuthRuleRequestAccountTokensParametersConditionalAuthorizationActionParametersCondition", - "CreateAuthRuleRequestCardTokens", - "CreateAuthRuleRequestCardTokensParameters", - "CreateAuthRuleRequestCardTokensParametersConditionalAuthorizationActionParameters", - "CreateAuthRuleRequestCardTokensParametersConditionalAuthorizationActionParametersCondition", - "CreateAuthRuleRequestProgramLevel", - "CreateAuthRuleRequestProgramLevelParameters", - "CreateAuthRuleRequestProgramLevelParametersConditionalAuthorizationActionParameters", - "CreateAuthRuleRequestProgramLevelParametersConditionalAuthorizationActionParametersCondition", + "AccountLevelRule", + "AccountLevelRuleParameters", + "CardLevelRule", + "CardLevelRuleParameters", + "ProgramLevelRule", + "ProgramLevelRuleParameters", ] -class CreateAuthRuleRequestAccountTokens(TypedDict, total=False): - account_tokens: SequenceNotStr[str] - """Account tokens to which the Auth Rule applies.""" - - business_account_tokens: SequenceNotStr[str] - """Business Account tokens to which the Auth Rule applies.""" - - event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] - """The event stream during which the rule will be evaluated.""" - - name: Optional[str] - """Auth Rule Name""" - - parameters: CreateAuthRuleRequestAccountTokensParameters +class AccountLevelRule(TypedDict, total=False): + parameters: Required[AccountLevelRuleParameters] """Parameters for the Auth Rule""" - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] + type: Required[Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"]] """The type of Auth Rule. For certain rule types, this determines the event stream during which it will be @@ -57,137 +40,36 @@ class CreateAuthRuleRequestAccountTokens(TypedDict, total=False): - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. """ + account_tokens: SequenceNotStr[str] + """Account tokens to which the Auth Rule applies.""" -class CreateAuthRuleRequestAccountTokensParametersConditionalAuthorizationActionParametersCondition( - TypedDict, total=False -): - attribute: Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - """The operation to apply to the attribute""" - - value: Union[str, int, SequenceNotStr[str]] - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - + business_account_tokens: SequenceNotStr[str] + """Business Account tokens to which the Auth Rule applies.""" -class CreateAuthRuleRequestAccountTokensParametersConditionalAuthorizationActionParameters(TypedDict, total=False): - action: Required[Literal["DECLINE", "CHALLENGE"]] - """The action to take if the conditions are met.""" + event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] + """The event stream during which the rule will be evaluated.""" - conditions: Required[ - Iterable[CreateAuthRuleRequestAccountTokensParametersConditionalAuthorizationActionParametersCondition] - ] + name: Optional[str] + """Auth Rule Name""" -CreateAuthRuleRequestAccountTokensParameters: TypeAlias = Union[ +AccountLevelRuleParameters: TypeAlias = Union[ ConditionalBlockParametersParam, VelocityLimitParamsParam, MerchantLockParametersParam, Conditional3DSActionParametersParam, - CreateAuthRuleRequestAccountTokensParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParametersParam, ] -class CreateAuthRuleRequestCardTokens(TypedDict, total=False): +class CardLevelRule(TypedDict, total=False): card_tokens: Required[SequenceNotStr[str]] """Card tokens to which the Auth Rule applies.""" - event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] - """The event stream during which the rule will be evaluated.""" - - name: Optional[str] - """Auth Rule Name""" - - parameters: CreateAuthRuleRequestCardTokensParameters + parameters: Required[CardLevelRuleParameters] """Parameters for the Auth Rule""" - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] + type: Required[Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"]] """The type of Auth Rule. For certain rule types, this determines the event stream during which it will be @@ -200,140 +82,30 @@ class CreateAuthRuleRequestCardTokens(TypedDict, total=False): - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. """ + event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] + """The event stream during which the rule will be evaluated.""" -class CreateAuthRuleRequestCardTokensParametersConditionalAuthorizationActionParametersCondition( - TypedDict, total=False -): - attribute: Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - """The operation to apply to the attribute""" - - value: Union[str, int, SequenceNotStr[str]] - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class CreateAuthRuleRequestCardTokensParametersConditionalAuthorizationActionParameters(TypedDict, total=False): - action: Required[Literal["DECLINE", "CHALLENGE"]] - """The action to take if the conditions are met.""" - - conditions: Required[ - Iterable[CreateAuthRuleRequestCardTokensParametersConditionalAuthorizationActionParametersCondition] - ] + name: Optional[str] + """Auth Rule Name""" -CreateAuthRuleRequestCardTokensParameters: TypeAlias = Union[ +CardLevelRuleParameters: TypeAlias = Union[ ConditionalBlockParametersParam, VelocityLimitParamsParam, MerchantLockParametersParam, Conditional3DSActionParametersParam, - CreateAuthRuleRequestCardTokensParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParametersParam, ] -class CreateAuthRuleRequestProgramLevel(TypedDict, total=False): +class ProgramLevelRule(TypedDict, total=False): + parameters: Required[ProgramLevelRuleParameters] + """Parameters for the Auth Rule""" + program_level: Required[bool] """Whether the Auth Rule applies to all authorizations on the card program.""" - event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] - """The event stream during which the rule will be evaluated.""" - - excluded_card_tokens: SequenceNotStr[str] - """Card tokens to which the Auth Rule does not apply.""" - - name: Optional[str] - """Auth Rule Name""" - - parameters: CreateAuthRuleRequestProgramLevelParameters - """Parameters for the Auth Rule""" - - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] + type: Required[Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"]] """The type of Auth Rule. For certain rule types, this determines the event stream during which it will be @@ -346,122 +118,22 @@ class CreateAuthRuleRequestProgramLevel(TypedDict, total=False): - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. """ + event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] + """The event stream during which the rule will be evaluated.""" -class CreateAuthRuleRequestProgramLevelParametersConditionalAuthorizationActionParametersCondition( - TypedDict, total=False -): - attribute: Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - """The operation to apply to the attribute""" - - value: Union[str, int, SequenceNotStr[str]] - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class CreateAuthRuleRequestProgramLevelParametersConditionalAuthorizationActionParameters(TypedDict, total=False): - action: Required[Literal["DECLINE", "CHALLENGE"]] - """The action to take if the conditions are met.""" + excluded_card_tokens: SequenceNotStr[str] + """Card tokens to which the Auth Rule does not apply.""" - conditions: Required[ - Iterable[CreateAuthRuleRequestProgramLevelParametersConditionalAuthorizationActionParametersCondition] - ] + name: Optional[str] + """Auth Rule Name""" -CreateAuthRuleRequestProgramLevelParameters: TypeAlias = Union[ +ProgramLevelRuleParameters: TypeAlias = Union[ ConditionalBlockParametersParam, VelocityLimitParamsParam, MerchantLockParametersParam, Conditional3DSActionParametersParam, - CreateAuthRuleRequestProgramLevelParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParametersParam, ] -V2CreateParams: TypeAlias = Union[ - CreateAuthRuleRequestAccountTokens, CreateAuthRuleRequestCardTokens, CreateAuthRuleRequestProgramLevel -] +V2CreateParams: TypeAlias = Union[AccountLevelRule, CardLevelRule, ProgramLevelRule] diff --git a/src/lithic/types/auth_rules/v2_create_response.py b/src/lithic/types/auth_rules/v2_create_response.py index f533b2c8..0cff3a75 100644 --- a/src/lithic/types/auth_rules/v2_create_response.py +++ b/src/lithic/types/auth_rules/v2_create_response.py @@ -8,133 +8,16 @@ from .merchant_lock_parameters import MerchantLockParameters from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters +from .conditional_authorization_action_parameters import ConditionalAuthorizationActionParameters -__all__ = [ - "V2CreateResponse", - "CurrentVersion", - "CurrentVersionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParametersCondition", - "DraftVersion", - "DraftVersionParameters", - "DraftVersionParametersConditionalAuthorizationActionParameters", - "DraftVersionParametersConditionalAuthorizationActionParametersCondition", -] - - -class CurrentVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class CurrentVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[CurrentVersionParametersConditionalAuthorizationActionParametersCondition] - +__all__ = ["V2CreateResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] CurrentVersionParameters: TypeAlias = Union[ ConditionalBlockParameters, VelocityLimitParams, MerchantLockParameters, Conditional3DSActionParameters, - CurrentVersionParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParameters, ] @@ -149,119 +32,12 @@ class CurrentVersion(BaseModel): """ -class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class DraftVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[DraftVersionParametersConditionalAuthorizationActionParametersCondition] - - DraftVersionParameters: TypeAlias = Union[ ConditionalBlockParameters, VelocityLimitParams, MerchantLockParameters, Conditional3DSActionParameters, - DraftVersionParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParameters, ] diff --git a/src/lithic/types/auth_rules/v2_draft_params.py b/src/lithic/types/auth_rules/v2_draft_params.py index a016e7c6..aa38ff44 100644 --- a/src/lithic/types/auth_rules/v2_draft_params.py +++ b/src/lithic/types/auth_rules/v2_draft_params.py @@ -2,21 +2,16 @@ from __future__ import annotations -from typing import Union, Iterable, Optional -from typing_extensions import Literal, Required, TypeAlias, TypedDict +from typing import Union, Optional +from typing_extensions import TypeAlias, TypedDict -from ..._types import SequenceNotStr from .velocity_limit_params_param import VelocityLimitParamsParam from .merchant_lock_parameters_param import MerchantLockParametersParam from .conditional_block_parameters_param import ConditionalBlockParametersParam from .conditional_3ds_action_parameters_param import Conditional3DSActionParametersParam +from .conditional_authorization_action_parameters_param import ConditionalAuthorizationActionParametersParam -__all__ = [ - "V2DraftParams", - "Parameters", - "ParametersConditionalAuthorizationActionParameters", - "ParametersConditionalAuthorizationActionParametersCondition", -] +__all__ = ["V2DraftParams", "Parameters"] class V2DraftParams(TypedDict, total=False): @@ -24,113 +19,10 @@ class V2DraftParams(TypedDict, total=False): """Parameters for the Auth Rule""" -class ParametersConditionalAuthorizationActionParametersCondition(TypedDict, total=False): - attribute: Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - """The operation to apply to the attribute""" - - value: Union[str, int, SequenceNotStr[str]] - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class ParametersConditionalAuthorizationActionParameters(TypedDict, total=False): - action: Required[Literal["DECLINE", "CHALLENGE"]] - """The action to take if the conditions are met.""" - - conditions: Required[Iterable[ParametersConditionalAuthorizationActionParametersCondition]] - - Parameters: TypeAlias = Union[ ConditionalBlockParametersParam, VelocityLimitParamsParam, MerchantLockParametersParam, Conditional3DSActionParametersParam, - ParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParametersParam, ] diff --git a/src/lithic/types/auth_rules/v2_draft_response.py b/src/lithic/types/auth_rules/v2_draft_response.py index 6ddca9b8..c55b53ec 100644 --- a/src/lithic/types/auth_rules/v2_draft_response.py +++ b/src/lithic/types/auth_rules/v2_draft_response.py @@ -8,133 +8,16 @@ from .merchant_lock_parameters import MerchantLockParameters from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters +from .conditional_authorization_action_parameters import ConditionalAuthorizationActionParameters -__all__ = [ - "V2DraftResponse", - "CurrentVersion", - "CurrentVersionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParametersCondition", - "DraftVersion", - "DraftVersionParameters", - "DraftVersionParametersConditionalAuthorizationActionParameters", - "DraftVersionParametersConditionalAuthorizationActionParametersCondition", -] - - -class CurrentVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class CurrentVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[CurrentVersionParametersConditionalAuthorizationActionParametersCondition] - +__all__ = ["V2DraftResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] CurrentVersionParameters: TypeAlias = Union[ ConditionalBlockParameters, VelocityLimitParams, MerchantLockParameters, Conditional3DSActionParameters, - CurrentVersionParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParameters, ] @@ -149,119 +32,12 @@ class CurrentVersion(BaseModel): """ -class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class DraftVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[DraftVersionParametersConditionalAuthorizationActionParametersCondition] - - DraftVersionParameters: TypeAlias = Union[ ConditionalBlockParameters, VelocityLimitParams, MerchantLockParameters, Conditional3DSActionParameters, - DraftVersionParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParameters, ] diff --git a/src/lithic/types/auth_rules/v2_list_response.py b/src/lithic/types/auth_rules/v2_list_response.py index 524f0b37..0363a3de 100644 --- a/src/lithic/types/auth_rules/v2_list_response.py +++ b/src/lithic/types/auth_rules/v2_list_response.py @@ -8,133 +8,16 @@ from .merchant_lock_parameters import MerchantLockParameters from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters +from .conditional_authorization_action_parameters import ConditionalAuthorizationActionParameters -__all__ = [ - "V2ListResponse", - "CurrentVersion", - "CurrentVersionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParametersCondition", - "DraftVersion", - "DraftVersionParameters", - "DraftVersionParametersConditionalAuthorizationActionParameters", - "DraftVersionParametersConditionalAuthorizationActionParametersCondition", -] - - -class CurrentVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class CurrentVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[CurrentVersionParametersConditionalAuthorizationActionParametersCondition] - +__all__ = ["V2ListResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] CurrentVersionParameters: TypeAlias = Union[ ConditionalBlockParameters, VelocityLimitParams, MerchantLockParameters, Conditional3DSActionParameters, - CurrentVersionParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParameters, ] @@ -149,119 +32,12 @@ class CurrentVersion(BaseModel): """ -class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class DraftVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[DraftVersionParametersConditionalAuthorizationActionParametersCondition] - - DraftVersionParameters: TypeAlias = Union[ ConditionalBlockParameters, VelocityLimitParams, MerchantLockParameters, Conditional3DSActionParameters, - DraftVersionParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParameters, ] diff --git a/src/lithic/types/auth_rules/v2_promote_response.py b/src/lithic/types/auth_rules/v2_promote_response.py index 4e6e8c94..5a15b838 100644 --- a/src/lithic/types/auth_rules/v2_promote_response.py +++ b/src/lithic/types/auth_rules/v2_promote_response.py @@ -8,133 +8,16 @@ from .merchant_lock_parameters import MerchantLockParameters from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters +from .conditional_authorization_action_parameters import ConditionalAuthorizationActionParameters -__all__ = [ - "V2PromoteResponse", - "CurrentVersion", - "CurrentVersionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParametersCondition", - "DraftVersion", - "DraftVersionParameters", - "DraftVersionParametersConditionalAuthorizationActionParameters", - "DraftVersionParametersConditionalAuthorizationActionParametersCondition", -] - - -class CurrentVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class CurrentVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[CurrentVersionParametersConditionalAuthorizationActionParametersCondition] - +__all__ = ["V2PromoteResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] CurrentVersionParameters: TypeAlias = Union[ ConditionalBlockParameters, VelocityLimitParams, MerchantLockParameters, Conditional3DSActionParameters, - CurrentVersionParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParameters, ] @@ -149,119 +32,12 @@ class CurrentVersion(BaseModel): """ -class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class DraftVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[DraftVersionParametersConditionalAuthorizationActionParametersCondition] - - DraftVersionParameters: TypeAlias = Union[ ConditionalBlockParameters, VelocityLimitParams, MerchantLockParameters, Conditional3DSActionParameters, - DraftVersionParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParameters, ] diff --git a/src/lithic/types/auth_rules/v2_retrieve_features_response.py b/src/lithic/types/auth_rules/v2_retrieve_features_response.py index fb1b6cb0..708a3fdc 100644 --- a/src/lithic/types/auth_rules/v2_retrieve_features_response.py +++ b/src/lithic/types/auth_rules/v2_retrieve_features_response.py @@ -5,7 +5,7 @@ from typing_extensions import Literal from ..._models import BaseModel -from .velocity_limit_params_period_window import VelocityLimitParamsPeriodWindow +from .velocity_limit_period import VelocityLimitPeriod __all__ = ["V2RetrieveFeaturesResponse", "Feature", "FeatureFilters", "FeatureValue"] @@ -84,12 +84,8 @@ class FeatureValue(BaseModel): class Feature(BaseModel): filters: FeatureFilters - period: VelocityLimitParamsPeriodWindow - """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: VelocityLimitPeriod + """Velocity over the current day since 00:00 / 12 AM in Eastern Time""" scope: Literal["CARD", "ACCOUNT"] """The scope the velocity is calculated for""" diff --git a/src/lithic/types/auth_rules/v2_retrieve_response.py b/src/lithic/types/auth_rules/v2_retrieve_response.py index c06d6141..5cdc6f64 100644 --- a/src/lithic/types/auth_rules/v2_retrieve_response.py +++ b/src/lithic/types/auth_rules/v2_retrieve_response.py @@ -8,133 +8,16 @@ from .merchant_lock_parameters import MerchantLockParameters from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters +from .conditional_authorization_action_parameters import ConditionalAuthorizationActionParameters -__all__ = [ - "V2RetrieveResponse", - "CurrentVersion", - "CurrentVersionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParametersCondition", - "DraftVersion", - "DraftVersionParameters", - "DraftVersionParametersConditionalAuthorizationActionParameters", - "DraftVersionParametersConditionalAuthorizationActionParametersCondition", -] - - -class CurrentVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class CurrentVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[CurrentVersionParametersConditionalAuthorizationActionParametersCondition] - +__all__ = ["V2RetrieveResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] CurrentVersionParameters: TypeAlias = Union[ ConditionalBlockParameters, VelocityLimitParams, MerchantLockParameters, Conditional3DSActionParameters, - CurrentVersionParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParameters, ] @@ -149,119 +32,12 @@ class CurrentVersion(BaseModel): """ -class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class DraftVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[DraftVersionParametersConditionalAuthorizationActionParametersCondition] - - DraftVersionParameters: TypeAlias = Union[ ConditionalBlockParameters, VelocityLimitParams, MerchantLockParameters, Conditional3DSActionParameters, - DraftVersionParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParameters, ] diff --git a/src/lithic/types/auth_rules/v2_update_response.py b/src/lithic/types/auth_rules/v2_update_response.py index d51568b7..afbb10ec 100644 --- a/src/lithic/types/auth_rules/v2_update_response.py +++ b/src/lithic/types/auth_rules/v2_update_response.py @@ -8,133 +8,16 @@ from .merchant_lock_parameters import MerchantLockParameters from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters +from .conditional_authorization_action_parameters import ConditionalAuthorizationActionParameters -__all__ = [ - "V2UpdateResponse", - "CurrentVersion", - "CurrentVersionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParameters", - "CurrentVersionParametersConditionalAuthorizationActionParametersCondition", - "DraftVersion", - "DraftVersionParameters", - "DraftVersionParametersConditionalAuthorizationActionParameters", - "DraftVersionParametersConditionalAuthorizationActionParametersCondition", -] - - -class CurrentVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class CurrentVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[CurrentVersionParametersConditionalAuthorizationActionParametersCondition] - +__all__ = ["V2UpdateResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] CurrentVersionParameters: TypeAlias = Union[ ConditionalBlockParameters, VelocityLimitParams, MerchantLockParameters, Conditional3DSActionParameters, - CurrentVersionParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParameters, ] @@ -149,119 +32,12 @@ class CurrentVersion(BaseModel): """ -class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): - attribute: Optional[ - Literal[ - "MCC", - "COUNTRY", - "CURRENCY", - "MERCHANT_ID", - "DESCRIPTOR", - "LIABILITY_SHIFT", - "PAN_ENTRY_MODE", - "TRANSACTION_AMOUNT", - "CASH_AMOUNT", - "RISK_SCORE", - "CARD_TRANSACTION_COUNT_15M", - "CARD_TRANSACTION_COUNT_1H", - "CARD_TRANSACTION_COUNT_24H", - "CARD_STATE", - "PIN_ENTERED", - "PIN_STATUS", - "WALLET_TYPE", - "TRANSACTION_INITIATOR", - "ADDRESS_MATCH", - ] - ] = None - """The attribute to target. - - The following attributes may be targeted: - - - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a - business by the types of goods or services it provides. - - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - Netherlands Antilles. - - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of - the transaction. - - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - (merchant). - - `DESCRIPTOR`: Short description of card acceptor. - - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer - applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or - `TOKEN_AUTHENTICATED`. - - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number - (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`, - `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, - `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, - `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer - 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, - where the raw score has a range of 0-99, Lithic will normalize the score by - multiplying the raw score by 10x. - - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - trailing 15 minutes before the authorization. - - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - trailing hour up and until the authorization. - - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - trailing 24 hours up and until the authorization. - - `CARD_STATE`: The current state of the card associated with the transaction. - Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`, - `PENDING_FULFILLMENT`. - - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - Valid values are `TRUE`, `FALSE`. - - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - `OK`, `BLOCKED`. - - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates - the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. - - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - data with the cardholder KYC data if it exists. Valid values are `MATCH`, - `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - """ - - operation: Optional[ - Literal[ - "IS_ONE_OF", - "IS_NOT_ONE_OF", - "MATCHES", - "DOES_NOT_MATCH", - "IS_EQUAL_TO", - "IS_NOT_EQUAL_TO", - "IS_GREATER_THAN", - "IS_GREATER_THAN_OR_EQUAL_TO", - "IS_LESS_THAN", - "IS_LESS_THAN_OR_EQUAL_TO", - ] - ] = None - """The operation to apply to the attribute""" - - value: Union[str, int, List[str], None] = None - """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`""" - - -class DraftVersionParametersConditionalAuthorizationActionParameters(BaseModel): - action: Literal["DECLINE", "CHALLENGE"] - """The action to take if the conditions are met.""" - - conditions: List[DraftVersionParametersConditionalAuthorizationActionParametersCondition] - - DraftVersionParameters: TypeAlias = Union[ ConditionalBlockParameters, VelocityLimitParams, MerchantLockParameters, Conditional3DSActionParameters, - DraftVersionParametersConditionalAuthorizationActionParameters, + ConditionalAuthorizationActionParameters, ] diff --git a/src/lithic/types/auth_rules/velocity_limit_params.py b/src/lithic/types/auth_rules/velocity_limit_params.py index aed74ac1..911fe78b 100644 --- a/src/lithic/types/auth_rules/velocity_limit_params.py +++ b/src/lithic/types/auth_rules/velocity_limit_params.py @@ -4,7 +4,7 @@ from typing_extensions import Literal from ..._models import BaseModel -from .velocity_limit_params_period_window import VelocityLimitParamsPeriodWindow +from .velocity_limit_period import VelocityLimitPeriod __all__ = ["VelocityLimitParams", "Filters"] @@ -68,12 +68,8 @@ class Filters(BaseModel): class VelocityLimitParams(BaseModel): filters: Filters - period: VelocityLimitParamsPeriodWindow - """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: VelocityLimitPeriod + """Velocity over the current day since 00:00 / 12 AM in Eastern Time""" scope: Literal["CARD", "ACCOUNT"] """The scope the velocity is calculated for""" diff --git a/src/lithic/types/auth_rules/velocity_limit_params_param.py b/src/lithic/types/auth_rules/velocity_limit_params_param.py index c8321357..fc4b6e11 100644 --- a/src/lithic/types/auth_rules/velocity_limit_params_param.py +++ b/src/lithic/types/auth_rules/velocity_limit_params_param.py @@ -6,7 +6,7 @@ from typing_extensions import Literal, Required, TypedDict from ..._types import SequenceNotStr -from .velocity_limit_params_period_window_param import VelocityLimitParamsPeriodWindowParam +from .velocity_limit_period_param import VelocityLimitPeriodParam __all__ = ["VelocityLimitParamsParam", "Filters"] @@ -70,12 +70,8 @@ class Filters(TypedDict, total=False): class VelocityLimitParamsParam(TypedDict, total=False): filters: Required[Filters] - period: Required[VelocityLimitParamsPeriodWindowParam] - """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: Required[VelocityLimitPeriodParam] + """Velocity over the current day since 00:00 / 12 AM in Eastern Time""" scope: Required[Literal["CARD", "ACCOUNT"]] """The scope the velocity is calculated for""" diff --git a/src/lithic/types/auth_rules/velocity_limit_params_period_window.py b/src/lithic/types/auth_rules/velocity_limit_period.py similarity index 74% rename from src/lithic/types/auth_rules/velocity_limit_params_period_window.py rename to src/lithic/types/auth_rules/velocity_limit_period.py index 0d243e08..d4b43f6c 100644 --- a/src/lithic/types/auth_rules/velocity_limit_params_period_window.py +++ b/src/lithic/types/auth_rules/velocity_limit_period.py @@ -6,7 +6,7 @@ from ..._models import BaseModel __all__ = [ - "VelocityLimitParamsPeriodWindow", + "VelocityLimitPeriod", "TrailingWindowObject", "FixedWindowDay", "FixedWindowWeek", @@ -16,21 +16,23 @@ class TrailingWindowObject(BaseModel): - duration: Optional[int] = None + duration: int """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). """ - type: Optional[Literal["CUSTOM"]] = None + type: Literal["CUSTOM"] class FixedWindowDay(BaseModel): - type: Optional[Literal["DAY"]] = None + type: Literal["DAY"] class FixedWindowWeek(BaseModel): + type: Literal["WEEK"] + day_of_week: Optional[int] = None """The day of the week to start the week from. @@ -38,10 +40,10 @@ class FixedWindowWeek(BaseModel): specified. """ - type: Optional[Literal["WEEK"]] = None - class FixedWindowMonth(BaseModel): + type: Literal["MONTH"] + day_of_month: Optional[int] = None """The day of the month to start from. @@ -50,10 +52,10 @@ class FixedWindowMonth(BaseModel): specified. """ - type: Optional[Literal["MONTH"]] = None - class FixedWindowYear(BaseModel): + type: Literal["YEAR"] + day_of_month: Optional[int] = None """The day of the month to start from. @@ -66,15 +68,7 @@ class FixedWindowYear(BaseModel): 1 is January and 12 is December. Defaults to January if not specified. """ - type: Optional[Literal["YEAR"]] = None - -VelocityLimitParamsPeriodWindow: TypeAlias = Union[ - int, - Literal["DAY", "WEEK", "MONTH", "YEAR"], - TrailingWindowObject, - FixedWindowDay, - FixedWindowWeek, - FixedWindowMonth, - FixedWindowYear, +VelocityLimitPeriod: TypeAlias = Union[ + TrailingWindowObject, FixedWindowDay, FixedWindowWeek, FixedWindowMonth, FixedWindowYear ] diff --git a/src/lithic/types/auth_rules/velocity_limit_params_period_window_param.py b/src/lithic/types/auth_rules/velocity_limit_period_param.py similarity index 74% rename from src/lithic/types/auth_rules/velocity_limit_params_period_window_param.py rename to src/lithic/types/auth_rules/velocity_limit_period_param.py index 7da762af..1fc31ccf 100644 --- a/src/lithic/types/auth_rules/velocity_limit_params_period_window_param.py +++ b/src/lithic/types/auth_rules/velocity_limit_period_param.py @@ -3,10 +3,10 @@ from __future__ import annotations from typing import Union -from typing_extensions import Literal, TypeAlias, TypedDict +from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ - "VelocityLimitParamsPeriodWindowParam", + "VelocityLimitPeriodParam", "TrailingWindowObject", "FixedWindowDay", "FixedWindowWeek", @@ -16,21 +16,23 @@ class TrailingWindowObject(TypedDict, total=False): - duration: int + duration: Required[int] """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). """ - type: Literal["CUSTOM"] + type: Required[Literal["CUSTOM"]] class FixedWindowDay(TypedDict, total=False): - type: Literal["DAY"] + type: Required[Literal["DAY"]] class FixedWindowWeek(TypedDict, total=False): + type: Required[Literal["WEEK"]] + day_of_week: int """The day of the week to start the week from. @@ -38,10 +40,10 @@ class FixedWindowWeek(TypedDict, total=False): specified. """ - type: Literal["WEEK"] - class FixedWindowMonth(TypedDict, total=False): + type: Required[Literal["MONTH"]] + day_of_month: int """The day of the month to start from. @@ -50,10 +52,10 @@ class FixedWindowMonth(TypedDict, total=False): specified. """ - type: Literal["MONTH"] - class FixedWindowYear(TypedDict, total=False): + type: Required[Literal["YEAR"]] + day_of_month: int """The day of the month to start from. @@ -66,15 +68,7 @@ class FixedWindowYear(TypedDict, total=False): 1 is January and 12 is December. Defaults to January if not specified. """ - type: Literal["YEAR"] - -VelocityLimitParamsPeriodWindowParam: TypeAlias = Union[ - int, - Literal["DAY", "WEEK", "MONTH", "YEAR"], - TrailingWindowObject, - FixedWindowDay, - FixedWindowWeek, - FixedWindowMonth, - FixedWindowYear, +VelocityLimitPeriodParam: TypeAlias = Union[ + TrailingWindowObject, FixedWindowDay, FixedWindowWeek, FixedWindowMonth, FixedWindowYear ] diff --git a/src/lithic/types/book_transfer_response.py b/src/lithic/types/book_transfer_response.py index e27fcdfa..266ffc61 100644 --- a/src/lithic/types/book_transfer_response.py +++ b/src/lithic/types/book_transfer_response.py @@ -23,7 +23,7 @@ class Event(BaseModel): created: datetime """Date and time when the financial event occurred. UTC time zone.""" - detailed_results: Literal["APPROVED", "FUNDS_INSUFFICIENT"] + detailed_results: List[Literal["APPROVED", "FUNDS_INSUFFICIENT"]] memo: str """Memo for the transfer.""" diff --git a/src/lithic/types/dispute_create_response.py b/src/lithic/types/dispute_create_response.py new file mode 100644 index 00000000..0d1058cd --- /dev/null +++ b/src/lithic/types/dispute_create_response.py @@ -0,0 +1,164 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["DisputeCreateResponse"] + + +class DisputeCreateResponse(BaseModel): + token: str + """Globally unique identifier.""" + + amount: int + """Amount under dispute. May be different from the original transaction amount.""" + + arbitration_date: Optional[datetime] = None + """Date dispute entered arbitration.""" + + created: datetime + """Timestamp of when first Dispute was reported.""" + + customer_filed_date: Optional[datetime] = None + """Date that the dispute was filed by the customer making the dispute.""" + + customer_note: Optional[str] = None + """End customer description of the reason for the dispute.""" + + network_claim_ids: Optional[List[str]] = None + """Unique identifiers for the dispute from the network.""" + + network_filed_date: Optional[datetime] = None + """Date that the dispute was submitted to the network.""" + + network_reason_code: Optional[str] = None + """Network reason code used to file the dispute.""" + + prearbitration_date: Optional[datetime] = None + """Date dispute entered pre-arbitration.""" + + primary_claim_id: Optional[str] = None + """Unique identifier for the dispute from the network. + + If there are multiple, this will be the first claim id set by the network + """ + + reason: Literal[ + "ATM_CASH_MISDISPENSE", + "CANCELLED", + "DUPLICATED", + "FRAUD_CARD_NOT_PRESENT", + "FRAUD_CARD_PRESENT", + "FRAUD_OTHER", + "GOODS_SERVICES_NOT_AS_DESCRIBED", + "GOODS_SERVICES_NOT_RECEIVED", + "INCORRECT_AMOUNT", + "MISSING_AUTH", + "OTHER", + "PROCESSING_ERROR", + "RECURRING_TRANSACTION_NOT_CANCELLED", + "REFUND_NOT_PROCESSED", + ] + """Dispute reason: + + - `ATM_CASH_MISDISPENSE`: ATM cash misdispense. + - `CANCELLED`: Transaction was cancelled by the customer. + - `DUPLICATED`: The transaction was a duplicate. + - `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. + - `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. + - `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable + merchant activity. + - `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as + described. + - `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. + - `INCORRECT_AMOUNT`: The transaction amount was incorrect. + - `MISSING_AUTH`: The transaction was missing authorization. + - `OTHER`: Other reason. + - `PROCESSING_ERROR`: Processing error. + - `REFUND_NOT_PROCESSED`: The refund was not processed. + - `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not + cancelled. + """ + + representment_date: Optional[datetime] = None + """Date the representment was received.""" + + resolution_date: Optional[datetime] = None + """Date that the dispute was resolved.""" + + resolution_note: Optional[str] = None + """Note by Dispute team on the case resolution.""" + + resolution_reason: Optional[ + Literal[ + "CASE_LOST", + "NETWORK_REJECTED", + "NO_DISPUTE_RIGHTS_3DS", + "NO_DISPUTE_RIGHTS_BELOW_THRESHOLD", + "NO_DISPUTE_RIGHTS_CONTACTLESS", + "NO_DISPUTE_RIGHTS_HYBRID", + "NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS", + "NO_DISPUTE_RIGHTS_OTHER", + "PAST_FILING_DATE", + "PREARBITRATION_REJECTED", + "PROCESSOR_REJECTED_OTHER", + "REFUNDED", + "REFUNDED_AFTER_CHARGEBACK", + "WITHDRAWN", + "WON_ARBITRATION", + "WON_FIRST_CHARGEBACK", + "WON_PREARBITRATION", + ] + ] = None + """Reason for the dispute resolution: + + - `CASE_LOST`: This case was lost at final arbitration. + - `NETWORK_REJECTED`: Network rejected. + - `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. + - `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. + - `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. + - `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. + - `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. + - `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. + - `PAST_FILING_DATE`: Past filing date. + - `PREARBITRATION_REJECTED`: Prearbitration rejected. + - `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. + - `REFUNDED`: Refunded. + - `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. + - `WITHDRAWN`: Withdrawn. + - `WON_ARBITRATION`: Won arbitration. + - `WON_FIRST_CHARGEBACK`: Won first chargeback. + - `WON_PREARBITRATION`: Won prearbitration. + """ + + status: Literal[ + "ARBITRATION", + "CASE_CLOSED", + "CASE_WON", + "NEW", + "PENDING_CUSTOMER", + "PREARBITRATION", + "REPRESENTMENT", + "SUBMITTED", + ] + """Status types: + + - `NEW` - New dispute case is opened. + - `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more + information. + - `SUBMITTED` - Dispute is submitted to the card network. + - `REPRESENTMENT` - Case has entered second presentment. + - `PREARBITRATION` - Case has entered prearbitration. + - `ARBITRATION` - Case has entered arbitration. + - `CASE_WON` - Case was won and credit will be issued. + - `CASE_CLOSED` - Case was lost or withdrawn. + """ + + transaction_token: str + """The transaction that is being disputed. + + A transaction can only be disputed once but may have multiple dispute cases. + """ diff --git a/src/lithic/types/dispute_delete_response.py b/src/lithic/types/dispute_delete_response.py new file mode 100644 index 00000000..c82f9664 --- /dev/null +++ b/src/lithic/types/dispute_delete_response.py @@ -0,0 +1,164 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["DisputeDeleteResponse"] + + +class DisputeDeleteResponse(BaseModel): + token: str + """Globally unique identifier.""" + + amount: int + """Amount under dispute. May be different from the original transaction amount.""" + + arbitration_date: Optional[datetime] = None + """Date dispute entered arbitration.""" + + created: datetime + """Timestamp of when first Dispute was reported.""" + + customer_filed_date: Optional[datetime] = None + """Date that the dispute was filed by the customer making the dispute.""" + + customer_note: Optional[str] = None + """End customer description of the reason for the dispute.""" + + network_claim_ids: Optional[List[str]] = None + """Unique identifiers for the dispute from the network.""" + + network_filed_date: Optional[datetime] = None + """Date that the dispute was submitted to the network.""" + + network_reason_code: Optional[str] = None + """Network reason code used to file the dispute.""" + + prearbitration_date: Optional[datetime] = None + """Date dispute entered pre-arbitration.""" + + primary_claim_id: Optional[str] = None + """Unique identifier for the dispute from the network. + + If there are multiple, this will be the first claim id set by the network + """ + + reason: Literal[ + "ATM_CASH_MISDISPENSE", + "CANCELLED", + "DUPLICATED", + "FRAUD_CARD_NOT_PRESENT", + "FRAUD_CARD_PRESENT", + "FRAUD_OTHER", + "GOODS_SERVICES_NOT_AS_DESCRIBED", + "GOODS_SERVICES_NOT_RECEIVED", + "INCORRECT_AMOUNT", + "MISSING_AUTH", + "OTHER", + "PROCESSING_ERROR", + "RECURRING_TRANSACTION_NOT_CANCELLED", + "REFUND_NOT_PROCESSED", + ] + """Dispute reason: + + - `ATM_CASH_MISDISPENSE`: ATM cash misdispense. + - `CANCELLED`: Transaction was cancelled by the customer. + - `DUPLICATED`: The transaction was a duplicate. + - `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. + - `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. + - `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable + merchant activity. + - `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as + described. + - `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. + - `INCORRECT_AMOUNT`: The transaction amount was incorrect. + - `MISSING_AUTH`: The transaction was missing authorization. + - `OTHER`: Other reason. + - `PROCESSING_ERROR`: Processing error. + - `REFUND_NOT_PROCESSED`: The refund was not processed. + - `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not + cancelled. + """ + + representment_date: Optional[datetime] = None + """Date the representment was received.""" + + resolution_date: Optional[datetime] = None + """Date that the dispute was resolved.""" + + resolution_note: Optional[str] = None + """Note by Dispute team on the case resolution.""" + + resolution_reason: Optional[ + Literal[ + "CASE_LOST", + "NETWORK_REJECTED", + "NO_DISPUTE_RIGHTS_3DS", + "NO_DISPUTE_RIGHTS_BELOW_THRESHOLD", + "NO_DISPUTE_RIGHTS_CONTACTLESS", + "NO_DISPUTE_RIGHTS_HYBRID", + "NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS", + "NO_DISPUTE_RIGHTS_OTHER", + "PAST_FILING_DATE", + "PREARBITRATION_REJECTED", + "PROCESSOR_REJECTED_OTHER", + "REFUNDED", + "REFUNDED_AFTER_CHARGEBACK", + "WITHDRAWN", + "WON_ARBITRATION", + "WON_FIRST_CHARGEBACK", + "WON_PREARBITRATION", + ] + ] = None + """Reason for the dispute resolution: + + - `CASE_LOST`: This case was lost at final arbitration. + - `NETWORK_REJECTED`: Network rejected. + - `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. + - `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. + - `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. + - `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. + - `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. + - `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. + - `PAST_FILING_DATE`: Past filing date. + - `PREARBITRATION_REJECTED`: Prearbitration rejected. + - `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. + - `REFUNDED`: Refunded. + - `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. + - `WITHDRAWN`: Withdrawn. + - `WON_ARBITRATION`: Won arbitration. + - `WON_FIRST_CHARGEBACK`: Won first chargeback. + - `WON_PREARBITRATION`: Won prearbitration. + """ + + status: Literal[ + "ARBITRATION", + "CASE_CLOSED", + "CASE_WON", + "NEW", + "PENDING_CUSTOMER", + "PREARBITRATION", + "REPRESENTMENT", + "SUBMITTED", + ] + """Status types: + + - `NEW` - New dispute case is opened. + - `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more + information. + - `SUBMITTED` - Dispute is submitted to the card network. + - `REPRESENTMENT` - Case has entered second presentment. + - `PREARBITRATION` - Case has entered prearbitration. + - `ARBITRATION` - Case has entered arbitration. + - `CASE_WON` - Case was won and credit will be issued. + - `CASE_CLOSED` - Case was lost or withdrawn. + """ + + transaction_token: str + """The transaction that is being disputed. + + A transaction can only be disputed once but may have multiple dispute cases. + """ diff --git a/src/lithic/types/dispute.py b/src/lithic/types/dispute_list_response.py similarity index 98% rename from src/lithic/types/dispute.py rename to src/lithic/types/dispute_list_response.py index 38a26a97..06f8ffc4 100644 --- a/src/lithic/types/dispute.py +++ b/src/lithic/types/dispute_list_response.py @@ -6,10 +6,10 @@ from .._models import BaseModel -__all__ = ["Dispute"] +__all__ = ["DisputeListResponse"] -class Dispute(BaseModel): +class DisputeListResponse(BaseModel): token: str """Globally unique identifier.""" diff --git a/src/lithic/types/dispute_retrieve_response.py b/src/lithic/types/dispute_retrieve_response.py new file mode 100644 index 00000000..9a72caee --- /dev/null +++ b/src/lithic/types/dispute_retrieve_response.py @@ -0,0 +1,164 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["DisputeRetrieveResponse"] + + +class DisputeRetrieveResponse(BaseModel): + token: str + """Globally unique identifier.""" + + amount: int + """Amount under dispute. May be different from the original transaction amount.""" + + arbitration_date: Optional[datetime] = None + """Date dispute entered arbitration.""" + + created: datetime + """Timestamp of when first Dispute was reported.""" + + customer_filed_date: Optional[datetime] = None + """Date that the dispute was filed by the customer making the dispute.""" + + customer_note: Optional[str] = None + """End customer description of the reason for the dispute.""" + + network_claim_ids: Optional[List[str]] = None + """Unique identifiers for the dispute from the network.""" + + network_filed_date: Optional[datetime] = None + """Date that the dispute was submitted to the network.""" + + network_reason_code: Optional[str] = None + """Network reason code used to file the dispute.""" + + prearbitration_date: Optional[datetime] = None + """Date dispute entered pre-arbitration.""" + + primary_claim_id: Optional[str] = None + """Unique identifier for the dispute from the network. + + If there are multiple, this will be the first claim id set by the network + """ + + reason: Literal[ + "ATM_CASH_MISDISPENSE", + "CANCELLED", + "DUPLICATED", + "FRAUD_CARD_NOT_PRESENT", + "FRAUD_CARD_PRESENT", + "FRAUD_OTHER", + "GOODS_SERVICES_NOT_AS_DESCRIBED", + "GOODS_SERVICES_NOT_RECEIVED", + "INCORRECT_AMOUNT", + "MISSING_AUTH", + "OTHER", + "PROCESSING_ERROR", + "RECURRING_TRANSACTION_NOT_CANCELLED", + "REFUND_NOT_PROCESSED", + ] + """Dispute reason: + + - `ATM_CASH_MISDISPENSE`: ATM cash misdispense. + - `CANCELLED`: Transaction was cancelled by the customer. + - `DUPLICATED`: The transaction was a duplicate. + - `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. + - `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. + - `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable + merchant activity. + - `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as + described. + - `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. + - `INCORRECT_AMOUNT`: The transaction amount was incorrect. + - `MISSING_AUTH`: The transaction was missing authorization. + - `OTHER`: Other reason. + - `PROCESSING_ERROR`: Processing error. + - `REFUND_NOT_PROCESSED`: The refund was not processed. + - `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not + cancelled. + """ + + representment_date: Optional[datetime] = None + """Date the representment was received.""" + + resolution_date: Optional[datetime] = None + """Date that the dispute was resolved.""" + + resolution_note: Optional[str] = None + """Note by Dispute team on the case resolution.""" + + resolution_reason: Optional[ + Literal[ + "CASE_LOST", + "NETWORK_REJECTED", + "NO_DISPUTE_RIGHTS_3DS", + "NO_DISPUTE_RIGHTS_BELOW_THRESHOLD", + "NO_DISPUTE_RIGHTS_CONTACTLESS", + "NO_DISPUTE_RIGHTS_HYBRID", + "NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS", + "NO_DISPUTE_RIGHTS_OTHER", + "PAST_FILING_DATE", + "PREARBITRATION_REJECTED", + "PROCESSOR_REJECTED_OTHER", + "REFUNDED", + "REFUNDED_AFTER_CHARGEBACK", + "WITHDRAWN", + "WON_ARBITRATION", + "WON_FIRST_CHARGEBACK", + "WON_PREARBITRATION", + ] + ] = None + """Reason for the dispute resolution: + + - `CASE_LOST`: This case was lost at final arbitration. + - `NETWORK_REJECTED`: Network rejected. + - `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. + - `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. + - `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. + - `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. + - `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. + - `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. + - `PAST_FILING_DATE`: Past filing date. + - `PREARBITRATION_REJECTED`: Prearbitration rejected. + - `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. + - `REFUNDED`: Refunded. + - `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. + - `WITHDRAWN`: Withdrawn. + - `WON_ARBITRATION`: Won arbitration. + - `WON_FIRST_CHARGEBACK`: Won first chargeback. + - `WON_PREARBITRATION`: Won prearbitration. + """ + + status: Literal[ + "ARBITRATION", + "CASE_CLOSED", + "CASE_WON", + "NEW", + "PENDING_CUSTOMER", + "PREARBITRATION", + "REPRESENTMENT", + "SUBMITTED", + ] + """Status types: + + - `NEW` - New dispute case is opened. + - `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more + information. + - `SUBMITTED` - Dispute is submitted to the card network. + - `REPRESENTMENT` - Case has entered second presentment. + - `PREARBITRATION` - Case has entered prearbitration. + - `ARBITRATION` - Case has entered arbitration. + - `CASE_WON` - Case was won and credit will be issued. + - `CASE_CLOSED` - Case was lost or withdrawn. + """ + + transaction_token: str + """The transaction that is being disputed. + + A transaction can only be disputed once but may have multiple dispute cases. + """ diff --git a/src/lithic/types/dispute_update_response.py b/src/lithic/types/dispute_update_response.py new file mode 100644 index 00000000..a80cd8b8 --- /dev/null +++ b/src/lithic/types/dispute_update_response.py @@ -0,0 +1,164 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["DisputeUpdateResponse"] + + +class DisputeUpdateResponse(BaseModel): + token: str + """Globally unique identifier.""" + + amount: int + """Amount under dispute. May be different from the original transaction amount.""" + + arbitration_date: Optional[datetime] = None + """Date dispute entered arbitration.""" + + created: datetime + """Timestamp of when first Dispute was reported.""" + + customer_filed_date: Optional[datetime] = None + """Date that the dispute was filed by the customer making the dispute.""" + + customer_note: Optional[str] = None + """End customer description of the reason for the dispute.""" + + network_claim_ids: Optional[List[str]] = None + """Unique identifiers for the dispute from the network.""" + + network_filed_date: Optional[datetime] = None + """Date that the dispute was submitted to the network.""" + + network_reason_code: Optional[str] = None + """Network reason code used to file the dispute.""" + + prearbitration_date: Optional[datetime] = None + """Date dispute entered pre-arbitration.""" + + primary_claim_id: Optional[str] = None + """Unique identifier for the dispute from the network. + + If there are multiple, this will be the first claim id set by the network + """ + + reason: Literal[ + "ATM_CASH_MISDISPENSE", + "CANCELLED", + "DUPLICATED", + "FRAUD_CARD_NOT_PRESENT", + "FRAUD_CARD_PRESENT", + "FRAUD_OTHER", + "GOODS_SERVICES_NOT_AS_DESCRIBED", + "GOODS_SERVICES_NOT_RECEIVED", + "INCORRECT_AMOUNT", + "MISSING_AUTH", + "OTHER", + "PROCESSING_ERROR", + "RECURRING_TRANSACTION_NOT_CANCELLED", + "REFUND_NOT_PROCESSED", + ] + """Dispute reason: + + - `ATM_CASH_MISDISPENSE`: ATM cash misdispense. + - `CANCELLED`: Transaction was cancelled by the customer. + - `DUPLICATED`: The transaction was a duplicate. + - `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. + - `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. + - `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable + merchant activity. + - `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as + described. + - `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. + - `INCORRECT_AMOUNT`: The transaction amount was incorrect. + - `MISSING_AUTH`: The transaction was missing authorization. + - `OTHER`: Other reason. + - `PROCESSING_ERROR`: Processing error. + - `REFUND_NOT_PROCESSED`: The refund was not processed. + - `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not + cancelled. + """ + + representment_date: Optional[datetime] = None + """Date the representment was received.""" + + resolution_date: Optional[datetime] = None + """Date that the dispute was resolved.""" + + resolution_note: Optional[str] = None + """Note by Dispute team on the case resolution.""" + + resolution_reason: Optional[ + Literal[ + "CASE_LOST", + "NETWORK_REJECTED", + "NO_DISPUTE_RIGHTS_3DS", + "NO_DISPUTE_RIGHTS_BELOW_THRESHOLD", + "NO_DISPUTE_RIGHTS_CONTACTLESS", + "NO_DISPUTE_RIGHTS_HYBRID", + "NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS", + "NO_DISPUTE_RIGHTS_OTHER", + "PAST_FILING_DATE", + "PREARBITRATION_REJECTED", + "PROCESSOR_REJECTED_OTHER", + "REFUNDED", + "REFUNDED_AFTER_CHARGEBACK", + "WITHDRAWN", + "WON_ARBITRATION", + "WON_FIRST_CHARGEBACK", + "WON_PREARBITRATION", + ] + ] = None + """Reason for the dispute resolution: + + - `CASE_LOST`: This case was lost at final arbitration. + - `NETWORK_REJECTED`: Network rejected. + - `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. + - `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. + - `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. + - `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. + - `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. + - `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. + - `PAST_FILING_DATE`: Past filing date. + - `PREARBITRATION_REJECTED`: Prearbitration rejected. + - `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. + - `REFUNDED`: Refunded. + - `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. + - `WITHDRAWN`: Withdrawn. + - `WON_ARBITRATION`: Won arbitration. + - `WON_FIRST_CHARGEBACK`: Won first chargeback. + - `WON_PREARBITRATION`: Won prearbitration. + """ + + status: Literal[ + "ARBITRATION", + "CASE_CLOSED", + "CASE_WON", + "NEW", + "PENDING_CUSTOMER", + "PREARBITRATION", + "REPRESENTMENT", + "SUBMITTED", + ] + """Status types: + + - `NEW` - New dispute case is opened. + - `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more + information. + - `SUBMITTED` - Dispute is submitted to the card network. + - `REPRESENTMENT` - Case has entered second presentment. + - `PREARBITRATION` - Case has entered prearbitration. + - `ARBITRATION` - Case has entered arbitration. + - `CASE_WON` - Case was won and credit will be issued. + - `CASE_CLOSED` - Case was lost or withdrawn. + """ + + transaction_token: str + """The transaction that is being disputed. + + A transaction can only be disputed once but may have multiple dispute cases. + """ diff --git a/src/lithic/types/event.py b/src/lithic/types/event.py index bc3cda33..a3c87151 100644 --- a/src/lithic/types/event.py +++ b/src/lithic/types/event.py @@ -20,26 +20,31 @@ class Event(BaseModel): """ event_type: Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -47,6 +52,8 @@ class Event(BaseModel): "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -55,10 +62,9 @@ class Event(BaseModel): "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", @@ -67,37 +73,106 @@ class Event(BaseModel): "tokenization.two_factor_authentication_code_sent", "tokenization.updated", ] - """Event types: - - - `account_holder.created` - Notification that a new account holder has been - created and was not rejected. - - `account_holder.updated` - Notification that an account holder was updated. - - `account_holder.verification` - Notification than an account holder's identity - verification is complete. - - `card.created` - Notification that a card has been created. - - `card.renewed` - Notification that a card has been renewed. - - `card.reissued` - Notification that a card has been reissued. - - `card.shipped` - Physical card shipment notification. See - https://docs.lithic.com/docs/cards#physical-card-shipped-webhook. - - `card.converted` - Notification that a virtual card has been converted to a - physical card. - - `card_transaction.updated` - Transaction Lifecycle webhook. See - https://docs.lithic.com/docs/transaction-webhooks. - - `dispute.updated` - A dispute has been updated. - - `dispute_transaction.created` - A new dispute transaction has been created. - - `dispute_transaction.updated` - A dispute transaction has been updated. - - `digital_wallet.tokenization_approval_request` - Card network's request to - Lithic to activate a digital wallet token. - - `digital_wallet.tokenization_result` - Notification of the end result of a - tokenization, whether successful or failed. - - `digital_wallet.tokenization_two_factor_authentication_code` - A code to be - passed to an end user to complete digital wallet authentication. See - https://docs.lithic.com/docs/tokenization-control#digital-wallet-tokenization-auth-code. - - `digital_wallet.tokenization_two_factor_authentication_code_sent` - - Notification that a two factor authentication code for activating a digital - wallet has been sent to the end user. - - `digital_wallet.tokenization_updated` - Notification that a digital wallet - tokenization's status has changed. + """The type of event that occurred. Possible values: + + - account_holder_document.updated: Occurs when an account holder's document + upload status has been updated + - account_holder.created: Occurs when a new account_holder is created. + - account_holder.updated: Occurs when an account_holder is updated. + - account_holder.verification: Occurs when an asynchronous account_holder's + verification is completed. + - auth_rules.backtest_report.created: Auth Rules backtest report created. + - balance.updated: Financial Account Balance Update + - book_transfer_transaction.created: Occurs when a book transfer transaction is + created. + - book_transfer_transaction.updated: Occurs when a book transfer transaction is + updated. + - card_transaction.enhanced_data.created: Occurs when L2/L3 enhanced commercial + data is processed for a transaction event. + - card_transaction.enhanced_data.updated: Occurs when L2/L3 enhanced commercial + data is reprocessed for a transaction event. + - card_transaction.updated: Occurs when a card transaction happens. + - card.converted: Occurs when a card is converted from virtual to physical + cards. + - card.created: Occurs when a new card is created. + - card.reissued: Occurs when a card is reissued. + - card.renewed: Occurs when a card is renewed. + - card.shipped: Occurs when a card is shipped. + - digital_wallet.tokenization_approval_request: Occurs when a tokenization + approval request is made. This event will be deprecated in the future. We + recommend using `tokenization.approval_request` instead. + - digital_wallet.tokenization_result: Occurs when a tokenization request + succeeded or failed. + + This event will be deprecated in the future. We recommend using + `tokenization.result` instead. + + - digital_wallet.tokenization_two_factor_authentication_code: Occurs when a + tokenization request 2FA code is sent to the Lithic customer for self serve + delivery. + + This event will be deprecated in the future. We recommend using + `tokenization.two_factor_authentication_code` instead. + + - digital_wallet.tokenization_two_factor_authentication_code_sent: Occurs when a + tokenization request 2FA code is sent to our downstream messaging providers + for delivery. + + This event will be deprecated in the future. We recommend using + `tokenization.two_factor_authentication_code_sent` instead. + + - digital_wallet.tokenization_updated: Occurs when a tokenization's status has + changed. + + This event will be deprecated in the future. We recommend using + `tokenization.updated` instead. + + - dispute_evidence.upload_failed: Occurs when a dispute evidence upload fails. + - dispute_transaction.created: Occurs when a new dispute transaction is created + - dispute_transaction.updated: Occurs when a dispute transaction is updated + - dispute.updated: Occurs when a dispute is updated. + - external_bank_account.created: Occurs when an external bank account is + created. + - external_bank_account.updated: Occurs when an external bank account is + updated. + - external_payment.created: Occurs when an external payment is created. + - external_payment.updated: Occurs when an external payment is updated. + - financial_account.created: Occurs when a financial account is created. + - financial_account.updated: Occurs when a financial account is updated. + - funding_event.created: Occurs when a funding event is created. + - internal_transaction.created: Occurs when an internal adjustment is created. + - internal_transaction.updated: Occurs when an internal adjustment is updated. + - loan_tape.created: Occurs when a loan tape is created. + - loan_tape.updated: Occurs when a loan tape is updated. + - management_operation.created: Occurs when an management operation is created. + - management_operation.updated: Occurs when an management operation is updated. + - network_total.created: Occurs when a network total is created. + - network_total.updated: Occurs when a network total is updated. + - payment_transaction.created: Occurs when a payment transaction is created. + - payment_transaction.updated: Occurs when a payment transaction is updated. + - settlement_report.updated: Occurs when a settlement report is created or + updated. + - statements.created: Occurs when a statement has been created + - three_ds_authentication.challenge: The `three_ds_authentication.challenge` + event. Upon receiving this request, the Card Program should issue its own + challenge to the cardholder. After a cardholder challenge is successfully + completed, the Card Program needs to respond back to Lithic by call to + [/v1/three_ds_decisioning/challenge_response](https://docs.lithic.com/reference/post_v1-three-ds-decisioning-challenge-response). + Then the cardholder must navigate back to the merchant checkout flow to + complete the transaction. Some merchants will include an `app_requestor_url` + for app-based purchases; Lithic recommends triggering a redirect to that URL + after the cardholder completes an app-based challenge. + - three_ds_authentication.created: Occurs when a 3DS authentication is created. + - three_ds_authentication.updated: Occurs when a 3DS authentication is updated + (eg. challenge is completed). + - tokenization.approval_request: Occurs when a tokenization approval request is + made. + - tokenization.result: Occurs when a tokenization request succeeded or failed. + - tokenization.two_factor_authentication_code: Occurs when a tokenization + request 2FA code is sent to the Lithic customer for self serve delivery. + - tokenization.two_factor_authentication_code_sent: Occurs when a tokenization + request 2FA code is sent to our downstream messaging providers for delivery. + - tokenization.updated: Occurs when a tokenization's status has changed. """ payload: Dict[str, object] diff --git a/src/lithic/types/event_list_params.py b/src/lithic/types/event_list_params.py index 8056d55d..3092590a 100644 --- a/src/lithic/types/event_list_params.py +++ b/src/lithic/types/event_list_params.py @@ -32,26 +32,31 @@ class EventListParams(TypedDict, total=False): event_types: List[ Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -59,6 +64,8 @@ class EventListParams(TypedDict, total=False): "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -67,10 +74,9 @@ class EventListParams(TypedDict, total=False): "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", diff --git a/src/lithic/types/event_subscription.py b/src/lithic/types/event_subscription.py index 5e78bd4a..cb921413 100644 --- a/src/lithic/types/event_subscription.py +++ b/src/lithic/types/event_subscription.py @@ -23,26 +23,31 @@ class EventSubscription(BaseModel): event_types: Optional[ List[ Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -50,6 +55,8 @@ class EventSubscription(BaseModel): "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -58,10 +65,9 @@ class EventSubscription(BaseModel): "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", diff --git a/src/lithic/types/events/subscription_create_params.py b/src/lithic/types/events/subscription_create_params.py index 8166f060..43b7e5f2 100644 --- a/src/lithic/types/events/subscription_create_params.py +++ b/src/lithic/types/events/subscription_create_params.py @@ -20,26 +20,31 @@ class SubscriptionCreateParams(TypedDict, total=False): event_types: List[ Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -47,6 +52,8 @@ class SubscriptionCreateParams(TypedDict, total=False): "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -55,10 +62,9 @@ class SubscriptionCreateParams(TypedDict, total=False): "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", diff --git a/src/lithic/types/events/subscription_send_simulated_example_params.py b/src/lithic/types/events/subscription_send_simulated_example_params.py index b72343ec..dc39c63a 100644 --- a/src/lithic/types/events/subscription_send_simulated_example_params.py +++ b/src/lithic/types/events/subscription_send_simulated_example_params.py @@ -9,26 +9,31 @@ class SubscriptionSendSimulatedExampleParams(TypedDict, total=False): event_type: Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -36,6 +41,8 @@ class SubscriptionSendSimulatedExampleParams(TypedDict, total=False): "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -44,10 +51,9 @@ class SubscriptionSendSimulatedExampleParams(TypedDict, total=False): "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", diff --git a/src/lithic/types/events/subscription_update_params.py b/src/lithic/types/events/subscription_update_params.py index 8a330654..834d78fc 100644 --- a/src/lithic/types/events/subscription_update_params.py +++ b/src/lithic/types/events/subscription_update_params.py @@ -20,26 +20,31 @@ class SubscriptionUpdateParams(TypedDict, total=False): event_types: List[ Literal[ + "account_holder_document.updated", "account_holder.created", "account_holder.updated", "account_holder.verification", + "auth_rules.backtest_report.created", "balance.updated", "book_transfer_transaction.created", + "book_transfer_transaction.updated", + "card_transaction.enhanced_data.created", + "card_transaction.enhanced_data.updated", + "card_transaction.updated", + "card.converted", "card.created", - "card.renewed", "card.reissued", - "card.converted", + "card.renewed", "card.shipped", - "card_transaction.updated", "digital_wallet.tokenization_approval_request", "digital_wallet.tokenization_result", "digital_wallet.tokenization_two_factor_authentication_code", "digital_wallet.tokenization_two_factor_authentication_code_sent", "digital_wallet.tokenization_updated", - "dispute.updated", "dispute_evidence.upload_failed", "dispute_transaction.created", "dispute_transaction.updated", + "dispute.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -47,6 +52,8 @@ class SubscriptionUpdateParams(TypedDict, total=False): "financial_account.created", "financial_account.updated", "funding_event.created", + "internal_transaction.created", + "internal_transaction.updated", "loan_tape.created", "loan_tape.updated", "management_operation.created", @@ -55,10 +62,9 @@ class SubscriptionUpdateParams(TypedDict, total=False): "network_total.updated", "payment_transaction.created", "payment_transaction.updated", - "internal_transaction.created", - "internal_transaction.updated", "settlement_report.updated", "statements.created", + "three_ds_authentication.challenge", "three_ds_authentication.created", "three_ds_authentication.updated", "tokenization.approval_request", diff --git a/src/lithic/types/financial_account.py b/src/lithic/types/financial_account.py index bb1492ba..94d7db28 100644 --- a/src/lithic/types/financial_account.py +++ b/src/lithic/types/financial_account.py @@ -27,14 +27,6 @@ class CreditConfiguration(BaseModel): tier: Optional[str] = None """Tier assigned to the financial account""" - charged_off_reason: Optional[Literal["DELINQUENT", "FRAUD"]] = None - """Reason for the financial account being marked as Charged Off""" - - financial_account_state: Optional[Literal["PENDING", "CURRENT", "DELINQUENT", "CHARGED_OFF"]] = None - """State of the financial account""" - - is_spend_blocked: Optional[bool] = None - class FinancialAccount(BaseModel): token: str diff --git a/src/lithic/types/financial_accounts/financial_account_credit_config.py b/src/lithic/types/financial_accounts/financial_account_credit_config.py index daaf97e9..67b3d16c 100644 --- a/src/lithic/types/financial_accounts/financial_account_credit_config.py +++ b/src/lithic/types/financial_accounts/financial_account_credit_config.py @@ -1,7 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal from ..._models import BaseModel @@ -28,11 +27,3 @@ class FinancialAccountCreditConfig(BaseModel): tier: Optional[str] = None """Tier assigned to the financial account""" - - charged_off_reason: Optional[Literal["DELINQUENT", "FRAUD"]] = None - """Reason for the financial account being marked as Charged Off""" - - financial_account_state: Optional[Literal["PENDING", "CURRENT", "DELINQUENT", "CHARGED_OFF"]] = None - """State of the financial account""" - - is_spend_blocked: Optional[bool] = None diff --git a/src/lithic/types/financial_accounts/loan_tape.py b/src/lithic/types/financial_accounts/loan_tape.py index 40b2adfb..3e1fe155 100644 --- a/src/lithic/types/financial_accounts/loan_tape.py +++ b/src/lithic/types/financial_accounts/loan_tape.py @@ -130,6 +130,9 @@ class DayTotals(BaseModel): cents """ + debits: int + """Volume of debit management operation transactions less any interest in cents""" + fees: int """Volume of debit management operation transactions less any interest in cents""" @@ -142,6 +145,15 @@ class DayTotals(BaseModel): purchases: int """Net card transaction volume less any cash advances in cents""" + credit_details: Optional[object] = None + """Breakdown of credits""" + + debit_details: Optional[object] = None + """Breakdown of debits""" + + payment_details: Optional[object] = None + """Breakdown of payments""" + class InterestDetailsDailyBalanceAmounts(BaseModel): balance_transfers: str @@ -210,6 +222,9 @@ class PeriodTotals(BaseModel): cents """ + debits: int + """Volume of debit management operation transactions less any interest in cents""" + fees: int """Volume of debit management operation transactions less any interest in cents""" @@ -222,6 +237,15 @@ class PeriodTotals(BaseModel): purchases: int """Net card transaction volume less any cash advances in cents""" + credit_details: Optional[object] = None + """Breakdown of credits""" + + debit_details: Optional[object] = None + """Breakdown of debits""" + + payment_details: Optional[object] = None + """Breakdown of payments""" + class PreviousStatementBalance(BaseModel): amount: int @@ -242,6 +266,9 @@ class YtdTotals(BaseModel): cents """ + debits: int + """Volume of debit management operation transactions less any interest in cents""" + fees: int """Volume of debit management operation transactions less any interest in cents""" @@ -254,6 +281,15 @@ class YtdTotals(BaseModel): purchases: int """Net card transaction volume less any cash advances in cents""" + credit_details: Optional[object] = None + """Breakdown of credits""" + + debit_details: Optional[object] = None + """Breakdown of debits""" + + payment_details: Optional[object] = None + """Breakdown of payments""" + class LoanTape(BaseModel): token: str diff --git a/src/lithic/types/financial_accounts/statement.py b/src/lithic/types/financial_accounts/statement.py index b683f844..5f629be0 100644 --- a/src/lithic/types/financial_accounts/statement.py +++ b/src/lithic/types/financial_accounts/statement.py @@ -81,6 +81,9 @@ class PeriodTotals(BaseModel): cents """ + debits: int + """Volume of debit management operation transactions less any interest in cents""" + fees: int """Volume of debit management operation transactions less any interest in cents""" @@ -93,6 +96,15 @@ class PeriodTotals(BaseModel): purchases: int """Net card transaction volume less any cash advances in cents""" + credit_details: Optional[object] = None + """Breakdown of credits""" + + debit_details: Optional[object] = None + """Breakdown of debits""" + + payment_details: Optional[object] = None + """Breakdown of payments""" + class YtdTotals(BaseModel): balance_transfers: int @@ -107,6 +119,9 @@ class YtdTotals(BaseModel): cents """ + debits: int + """Volume of debit management operation transactions less any interest in cents""" + fees: int """Volume of debit management operation transactions less any interest in cents""" @@ -119,6 +134,15 @@ class YtdTotals(BaseModel): purchases: int """Net card transaction volume less any cash advances in cents""" + credit_details: Optional[object] = None + """Breakdown of credits""" + + debit_details: Optional[object] = None + """Breakdown of debits""" + + payment_details: Optional[object] = None + """Breakdown of payments""" + class InterestDetailsDailyBalanceAmounts(BaseModel): balance_transfers: str diff --git a/src/lithic/types/financial_accounts/statements/statement_line_items.py b/src/lithic/types/financial_accounts/statements/statement_line_items.py index 60b8122e..c8ad115e 100644 --- a/src/lithic/types/financial_accounts/statements/statement_line_items.py +++ b/src/lithic/types/financial_accounts/statements/statement_line_items.py @@ -58,6 +58,7 @@ class Data(BaseModel): "ACH_ORIGINATION_REVIEWED", "ACH_ORIGINATION_SETTLED", "ACH_RECEIPT_PROCESSED", + "ACH_RECEIPT_RELEASED", "ACH_RECEIPT_SETTLED", "ACH_RETURN_INITIATED", "ACH_RETURN_PROCESSED", diff --git a/src/lithic/types/financial_transaction.py b/src/lithic/types/financial_transaction.py index 2235c413..5bb20396 100644 --- a/src/lithic/types/financial_transaction.py +++ b/src/lithic/types/financial_transaction.py @@ -38,6 +38,7 @@ class Event(BaseModel): "ACH_ORIGINATION_REVIEWED", "ACH_ORIGINATION_SETTLED", "ACH_RECEIPT_PROCESSED", + "ACH_RECEIPT_RELEASED", "ACH_RECEIPT_SETTLED", "ACH_RETURN_INITIATED", "ACH_RETURN_PROCESSED", diff --git a/src/lithic/types/payment.py b/src/lithic/types/payment.py index de048263..e34d4299 100644 --- a/src/lithic/types/payment.py +++ b/src/lithic/types/payment.py @@ -40,13 +40,16 @@ class Event(BaseModel): "ACH_ORIGINATION_CANCELLED", "ACH_ORIGINATION_INITIATED", "ACH_ORIGINATION_PROCESSED", - "ACH_ORIGINATION_SETTLED", + "ACH_ORIGINATION_REJECTED", "ACH_ORIGINATION_RELEASED", "ACH_ORIGINATION_REVIEWED", + "ACH_ORIGINATION_SETTLED", "ACH_RECEIPT_PROCESSED", + "ACH_RECEIPT_RELEASED", "ACH_RECEIPT_SETTLED", "ACH_RETURN_INITIATED", "ACH_RETURN_PROCESSED", + "ACH_RETURN_REJECTED", "ACH_RETURN_SETTLED", ] """Event types: @@ -60,14 +63,18 @@ class Event(BaseModel): - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available balance. - - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository - Financial Institution. + - `ACH_ORIGINATION_REJECTED` - ACH origination was rejected and not sent to the + Federal Reserve. - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. - - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - - `ACH_RETURN_SETTLED` - ACH receipt return settled by the Receiving Depository + - `ACH_RETURN_INITIATED` - ACH initiated return for an ACH receipt. + - `ACH_RETURN_PROCESSED` - ACH receipt returned by the Receiving Depository + Financial Institution. + - `ACH_RETURN_SETTLED` - ACH return settled by the Receiving Depository + Financial Institution. + - `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository Financial Institution. """ @@ -110,6 +117,9 @@ class MethodAttributesACHMethodAttributes(BaseModel): class MethodAttributesWireMethodAttributes(BaseModel): + wire_message_type: Optional[str] = None + """Type of wire message""" + wire_network: Literal["FEDWIRE", "SWIFT"] """Type of wire transfer""" @@ -126,9 +136,6 @@ class MethodAttributesWireMethodAttributes(BaseModel): remittance_information: Optional[str] = None """Payment details or invoice reference""" - wire_message_type: Optional[str] = None - """Type of wire message""" - MethodAttributes: TypeAlias = Union[MethodAttributesACHMethodAttributes, MethodAttributesWireMethodAttributes] diff --git a/src/lithic/types/payment_simulate_action_params.py b/src/lithic/types/payment_simulate_action_params.py index 8fcf4f7c..1f242232 100644 --- a/src/lithic/types/payment_simulate_action_params.py +++ b/src/lithic/types/payment_simulate_action_params.py @@ -2,7 +2,11 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing import Union +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._utils import PropertyInfo __all__ = ["PaymentSimulateActionParams"] @@ -23,10 +27,16 @@ class PaymentSimulateActionParams(TypedDict, total=False): ] """Event Type""" + date_of_death: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Date of Death for ACH Return""" + decline_reason: Literal[ "PROGRAM_TRANSACTION_LIMIT_EXCEEDED", "PROGRAM_DAILY_LIMIT_EXCEEDED", "PROGRAM_MONTHLY_LIMIT_EXCEEDED" ] """Decline reason""" + return_addenda: str + """Return Addenda""" + return_reason_code: str """Return Reason Code""" diff --git a/src/lithic/types/tokenization.py b/src/lithic/types/tokenization.py index 81e581b4..543a3581 100644 --- a/src/lithic/types/tokenization.py +++ b/src/lithic/types/tokenization.py @@ -1,12 +1,32 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel -__all__ = ["Tokenization", "Event"] +__all__ = ["Tokenization", "Event", "EventRuleResult"] + + +class EventRuleResult(BaseModel): + auth_rule_token: Optional[str] = None + """The Auth Rule Token associated with the rule. + + If this is set to null, then the result was not associated with a + customer-configured rule. This may happen in cases where a tokenization is + declined or requires TFA due to a Lithic-configured security or compliance rule, + for example. + """ + + explanation: Optional[str] = None + """A human-readable explanation outlining the motivation for the rule's result""" + + name: Optional[str] = None + """The name for the rule, if any was configured""" + + result: Literal["APPROVED", "DECLINED", "REQUIRE_TFA", "ERROR"] + """The result associated with this rule""" class Event(BaseModel): @@ -34,6 +54,53 @@ class Event(BaseModel): ] = None """Enum representing the result of the tokenization event""" + rule_results: Optional[List[EventRuleResult]] = None + """Results from rules that were evaluated for this tokenization""" + + tokenization_decline_reasons: Optional[ + List[ + Literal[ + "ACCOUNT_SCORE_1", + "DEVICE_SCORE_1", + "ALL_WALLET_DECLINE_REASONS_PRESENT", + "WALLET_RECOMMENDED_DECISION_RED", + "CVC_MISMATCH", + "CARD_EXPIRY_MONTH_MISMATCH", + "CARD_EXPIRY_YEAR_MISMATCH", + "CARD_INVALID_STATE", + "CUSTOMER_RED_PATH", + "INVALID_CUSTOMER_RESPONSE", + "NETWORK_FAILURE", + "GENERIC_DECLINE", + "DIGITAL_CARD_ART_REQUIRED", + ] + ] + ] = None + """List of reasons why the tokenization was declined""" + + tokenization_tfa_reasons: Optional[ + List[ + Literal[ + "WALLET_RECOMMENDED_TFA", + "SUSPICIOUS_ACTIVITY", + "DEVICE_RECENTLY_LOST", + "TOO_MANY_RECENT_ATTEMPTS", + "TOO_MANY_RECENT_TOKENS", + "TOO_MANY_DIFFERENT_CARDHOLDERS", + "OUTSIDE_HOME_TERRITORY", + "HAS_SUSPENDED_TOKENS", + "HIGH_RISK", + "ACCOUNT_SCORE_LOW", + "DEVICE_SCORE_LOW", + "CARD_STATE_TFA", + "HARDCODED_TFA", + "CUSTOMER_RULE_TFA", + "DEVICE_HOST_CARD_EMULATION", + ] + ] + ] = None + """List of reasons why two-factor authentication was required""" + type: Optional[ Literal[ "TOKENIZATION_2FA", @@ -63,22 +130,27 @@ class Tokenization(BaseModel): status: Literal["ACTIVE", "DEACTIVATED", "INACTIVE", "PAUSED", "PENDING_2FA", "PENDING_ACTIVATION", "UNKNOWN"] """The status of the tokenization request""" - token_requestor_name: Literal[ - "AMAZON_ONE", - "ANDROID_PAY", - "APPLE_PAY", - "FACEBOOK", - "FITBIT_PAY", - "GARMIN_PAY", - "MICROSOFT_PAY", - "NETFLIX", - "SAMSUNG_PAY", - "UNKNOWN", - "VISA_CHECKOUT", + token_requestor_name: Union[ + Literal[ + "AMAZON_ONE", + "ANDROID_PAY", + "APPLE_PAY", + "FACEBOOK", + "FITBIT_PAY", + "GARMIN_PAY", + "GOOGLE_PAY", + "MICROSOFT_PAY", + "NETFLIX", + "SAMSUNG_PAY", + "UNKNOWN", + "VISA_CHECKOUT", + ], + str, ] """The entity that requested the tokenization. - Represents a Digital Wallet or merchant. + For digital wallets, this will be one of the defined wallet types. For merchant + tokenizations, this will be a free-form merchant name string. """ token_unique_reference: str @@ -90,9 +162,12 @@ class Tokenization(BaseModel): updated_at: datetime """Latest date and time when the tokenization was updated. UTC time zone.""" + device_id: Optional[str] = None + """The device identifier associated with the tokenization.""" + digital_card_art_token: Optional[str] = None """ - Specifies the digital card art displayed in the user’s digital wallet after + Specifies the digital card art displayed in the user's digital wallet after tokenization. This will be null if the tokenization was created without an associated digital card art. See [Flexible Card Art Guide](https://docs.lithic.com/docs/about-digital-wallets#flexible-card-art). diff --git a/src/lithic/types/transaction.py b/src/lithic/types/transaction.py index f5c204d4..ed78ffb5 100644 --- a/src/lithic/types/transaction.py +++ b/src/lithic/types/transaction.py @@ -4,8 +4,6 @@ from datetime import datetime from typing_extensions import Literal -from pydantic import Field as FieldInfo - from .._models import BaseModel from .shared.currency import Currency @@ -101,23 +99,8 @@ class Avs(BaseModel): class CardholderAuthentication(BaseModel): - three_ds_version: Optional[str] = FieldInfo(alias="3ds_version", default=None) - """The 3DS version used for the authentication""" - - acquirer_exemption: Literal[ - "AUTHENTICATION_OUTAGE_EXCEPTION", - "LOW_VALUE", - "MERCHANT_INITIATED_TRANSACTION", - "NONE", - "RECURRING_PAYMENT", - "SECURE_CORPORATE_PAYMENT", - "STRONG_CUSTOMER_AUTHENTICATION_DELEGATION", - "TRANSACTION_RISK_ANALYSIS", - ] - """Whether an acquirer exemption applied to the transaction. - - Not currently populated and will be removed in the future. - """ + authentication_method: Literal["FRICTIONLESS", "CHALLENGE", "NONE"] + """Indicates the method used to authenticate the cardholder.""" authentication_result: Literal["ATTEMPTS", "DECLINE", "NONE", "SUCCESS"] """Indicates the outcome of the 3DS authentication process.""" @@ -149,21 +132,6 @@ class CardholderAuthentication(BaseModel): transaction on a best-effort basis. """ - verification_attempted: Literal["NONE", "OTHER"] - """ - Indicates whether a 3DS challenge flow was used, and if so, what the - verification method was. (deprecated, use `authentication_result`) - """ - - verification_result: Literal["CANCELLED", "FAILED", "FRICTIONLESS", "NOT_ATTEMPTED", "REJECTED", "SUCCESS"] - """Indicates whether a transaction is considered 3DS authenticated. - - (deprecated, use `authentication_result`) - """ - - authentication_method: Optional[Literal["FRICTIONLESS", "CHALLENGE", "NONE"]] = None - """Indicates the method used to authenticate the cardholder.""" - class Merchant(BaseModel): acceptor_id: str diff --git a/src/lithic/types/transactions/events/enhanced_data.py b/src/lithic/types/transactions/events/enhanced_data.py index 27d7b68e..2954359d 100644 --- a/src/lithic/types/transactions/events/enhanced_data.py +++ b/src/lithic/types/transactions/events/enhanced_data.py @@ -10,7 +10,7 @@ class CommonLineItem(BaseModel): - amount: Optional[float] = None + amount: Optional[str] = None """The price of the item purchased in merchant currency.""" description: Optional[str] = None @@ -19,7 +19,7 @@ class CommonLineItem(BaseModel): product_code: Optional[str] = None """An identifier for the item purchased.""" - quantity: Optional[float] = None + quantity: Optional[str] = None """The quantity of the item purchased.""" @@ -61,7 +61,7 @@ class FleetAmountTotals(BaseModel): class FleetFuel(BaseModel): - quantity: Optional[float] = None + quantity: Optional[str] = None """The quantity of fuel purchased.""" type: Optional[ diff --git a/tests/api_resources/auth_rules/test_v2.py b/tests/api_resources/auth_rules/test_v2.py index d2677553..6ecf7404 100644 --- a/tests/api_resources/auth_rules/test_v2.py +++ b/tests/api_resources/auth_rules/test_v2.py @@ -13,7 +13,6 @@ from lithic.pagination import SyncCursorPage, AsyncCursorPage from lithic.types.auth_rules import ( V2ListResponse, - V2ApplyResponse, V2DraftResponse, V2CreateResponse, V2UpdateResponse, @@ -23,8 +22,6 @@ V2RetrieveFeaturesResponse, ) -# pyright: reportDeprecated=false - base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -33,16 +30,15 @@ class TestV2: @parametrize def test_method_create_overload_1(self, client: Lithic) -> None: - v2 = client.auth_rules.v2.create() + v2 = client.auth_rules.v2.create( + parameters={"conditions": [{}]}, + type="CONDITIONAL_BLOCK", + ) assert_matches_type(V2CreateResponse, v2, path=["response"]) @parametrize def test_method_create_with_all_params_overload_1(self, client: Lithic) -> None: v2 = client.auth_rules.v2.create( - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - business_account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - event_stream="AUTHORIZATION", - name="name", parameters={ "conditions": [ { @@ -53,12 +49,19 @@ def test_method_create_with_all_params_overload_1(self, client: Lithic) -> None: ] }, type="CONDITIONAL_BLOCK", + account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + business_account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + event_stream="AUTHORIZATION", + name="name", ) assert_matches_type(V2CreateResponse, v2, path=["response"]) @parametrize def test_raw_response_create_overload_1(self, client: Lithic) -> None: - response = client.auth_rules.v2.with_raw_response.create() + response = client.auth_rules.v2.with_raw_response.create( + parameters={"conditions": [{}]}, + type="CONDITIONAL_BLOCK", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -67,7 +70,10 @@ def test_raw_response_create_overload_1(self, client: Lithic) -> None: @parametrize def test_streaming_response_create_overload_1(self, client: Lithic) -> None: - with client.auth_rules.v2.with_streaming_response.create() as response: + with client.auth_rules.v2.with_streaming_response.create( + parameters={"conditions": [{}]}, + type="CONDITIONAL_BLOCK", + ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -80,6 +86,8 @@ def test_streaming_response_create_overload_1(self, client: Lithic) -> None: def test_method_create_overload_2(self, client: Lithic) -> None: v2 = client.auth_rules.v2.create( card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + parameters={"conditions": [{}]}, + type="CONDITIONAL_BLOCK", ) assert_matches_type(V2CreateResponse, v2, path=["response"]) @@ -87,8 +95,6 @@ def test_method_create_overload_2(self, client: Lithic) -> None: def test_method_create_with_all_params_overload_2(self, client: Lithic) -> None: v2 = client.auth_rules.v2.create( card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - event_stream="AUTHORIZATION", - name="name", parameters={ "conditions": [ { @@ -99,6 +105,8 @@ def test_method_create_with_all_params_overload_2(self, client: Lithic) -> None: ] }, type="CONDITIONAL_BLOCK", + event_stream="AUTHORIZATION", + name="name", ) assert_matches_type(V2CreateResponse, v2, path=["response"]) @@ -106,6 +114,8 @@ def test_method_create_with_all_params_overload_2(self, client: Lithic) -> None: def test_raw_response_create_overload_2(self, client: Lithic) -> None: response = client.auth_rules.v2.with_raw_response.create( card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + parameters={"conditions": [{}]}, + type="CONDITIONAL_BLOCK", ) assert response.is_closed is True @@ -117,6 +127,8 @@ def test_raw_response_create_overload_2(self, client: Lithic) -> None: def test_streaming_response_create_overload_2(self, client: Lithic) -> None: with client.auth_rules.v2.with_streaming_response.create( card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + parameters={"conditions": [{}]}, + type="CONDITIONAL_BLOCK", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -129,17 +141,15 @@ def test_streaming_response_create_overload_2(self, client: Lithic) -> None: @parametrize def test_method_create_overload_3(self, client: Lithic) -> None: v2 = client.auth_rules.v2.create( + parameters={"conditions": [{}]}, program_level=True, + type="CONDITIONAL_BLOCK", ) assert_matches_type(V2CreateResponse, v2, path=["response"]) @parametrize def test_method_create_with_all_params_overload_3(self, client: Lithic) -> None: v2 = client.auth_rules.v2.create( - program_level=True, - event_stream="AUTHORIZATION", - excluded_card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - name="name", parameters={ "conditions": [ { @@ -149,14 +159,20 @@ def test_method_create_with_all_params_overload_3(self, client: Lithic) -> None: } ] }, + program_level=True, type="CONDITIONAL_BLOCK", + event_stream="AUTHORIZATION", + excluded_card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + name="name", ) assert_matches_type(V2CreateResponse, v2, path=["response"]) @parametrize def test_raw_response_create_overload_3(self, client: Lithic) -> None: response = client.auth_rules.v2.with_raw_response.create( + parameters={"conditions": [{}]}, program_level=True, + type="CONDITIONAL_BLOCK", ) assert response.is_closed is True @@ -167,7 +183,9 @@ def test_raw_response_create_overload_3(self, client: Lithic) -> None: @parametrize def test_streaming_response_create_overload_3(self, client: Lithic) -> None: with client.auth_rules.v2.with_streaming_response.create( + parameters={"conditions": [{}]}, program_level=True, + type="CONDITIONAL_BLOCK", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -372,11 +390,11 @@ def test_method_list_with_all_params(self, client: Lithic) -> None: account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", business_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ending_before="ending_before", + ending_before="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", event_stream="AUTHORIZATION", page_size=1, scope="PROGRAM", - starting_after="starting_after", + starting_after="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(SyncCursorPage[V2ListResponse], v2, path=["response"]) @@ -438,165 +456,6 @@ def test_path_params_delete(self, client: Lithic) -> None: "", ) - @parametrize - def test_method_apply_overload_1(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - v2 = client.auth_rules.v2.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - def test_method_apply_with_all_params_overload_1(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - v2 = client.auth_rules.v2.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - business_account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) - - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - def test_raw_response_apply_overload_1(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - response = client.auth_rules.v2.with_raw_response.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v2 = response.parse() - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - def test_streaming_response_apply_overload_1(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - with client.auth_rules.v2.with_streaming_response.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - v2 = response.parse() - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_apply_overload_1(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `auth_rule_token` but received ''"): - client.auth_rules.v2.with_raw_response.apply( - auth_rule_token="", - ) - - @parametrize - def test_method_apply_overload_2(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - v2 = client.auth_rules.v2.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) - - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - def test_raw_response_apply_overload_2(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - response = client.auth_rules.v2.with_raw_response.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v2 = response.parse() - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - def test_streaming_response_apply_overload_2(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - with client.auth_rules.v2.with_streaming_response.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - v2 = response.parse() - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_apply_overload_2(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `auth_rule_token` but received ''"): - client.auth_rules.v2.with_raw_response.apply( - auth_rule_token="", - card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) - - @parametrize - def test_method_apply_overload_3(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - v2 = client.auth_rules.v2.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - program_level=True, - ) - - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - def test_method_apply_with_all_params_overload_3(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - v2 = client.auth_rules.v2.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - program_level=True, - excluded_card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) - - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - def test_raw_response_apply_overload_3(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - response = client.auth_rules.v2.with_raw_response.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - program_level=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v2 = response.parse() - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - def test_streaming_response_apply_overload_3(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - with client.auth_rules.v2.with_streaming_response.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - program_level=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - v2 = response.parse() - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_apply_overload_3(self, client: Lithic) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `auth_rule_token` but received ''"): - client.auth_rules.v2.with_raw_response.apply( - auth_rule_token="", - program_level=True, - ) - @parametrize def test_method_draft(self, client: Lithic) -> None: v2 = client.auth_rules.v2.draft( @@ -790,16 +649,15 @@ class TestAsyncV2: @parametrize async def test_method_create_overload_1(self, async_client: AsyncLithic) -> None: - v2 = await async_client.auth_rules.v2.create() + v2 = await async_client.auth_rules.v2.create( + parameters={"conditions": [{}]}, + type="CONDITIONAL_BLOCK", + ) assert_matches_type(V2CreateResponse, v2, path=["response"]) @parametrize async def test_method_create_with_all_params_overload_1(self, async_client: AsyncLithic) -> None: v2 = await async_client.auth_rules.v2.create( - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - business_account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - event_stream="AUTHORIZATION", - name="name", parameters={ "conditions": [ { @@ -810,12 +668,19 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn ] }, type="CONDITIONAL_BLOCK", + account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + business_account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + event_stream="AUTHORIZATION", + name="name", ) assert_matches_type(V2CreateResponse, v2, path=["response"]) @parametrize async def test_raw_response_create_overload_1(self, async_client: AsyncLithic) -> None: - response = await async_client.auth_rules.v2.with_raw_response.create() + response = await async_client.auth_rules.v2.with_raw_response.create( + parameters={"conditions": [{}]}, + type="CONDITIONAL_BLOCK", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -824,7 +689,10 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncLithic) - @parametrize async def test_streaming_response_create_overload_1(self, async_client: AsyncLithic) -> None: - async with async_client.auth_rules.v2.with_streaming_response.create() as response: + async with async_client.auth_rules.v2.with_streaming_response.create( + parameters={"conditions": [{}]}, + type="CONDITIONAL_BLOCK", + ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -837,6 +705,8 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncLit async def test_method_create_overload_2(self, async_client: AsyncLithic) -> None: v2 = await async_client.auth_rules.v2.create( card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + parameters={"conditions": [{}]}, + type="CONDITIONAL_BLOCK", ) assert_matches_type(V2CreateResponse, v2, path=["response"]) @@ -844,8 +714,6 @@ async def test_method_create_overload_2(self, async_client: AsyncLithic) -> None async def test_method_create_with_all_params_overload_2(self, async_client: AsyncLithic) -> None: v2 = await async_client.auth_rules.v2.create( card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - event_stream="AUTHORIZATION", - name="name", parameters={ "conditions": [ { @@ -856,6 +724,8 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn ] }, type="CONDITIONAL_BLOCK", + event_stream="AUTHORIZATION", + name="name", ) assert_matches_type(V2CreateResponse, v2, path=["response"]) @@ -863,6 +733,8 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn async def test_raw_response_create_overload_2(self, async_client: AsyncLithic) -> None: response = await async_client.auth_rules.v2.with_raw_response.create( card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + parameters={"conditions": [{}]}, + type="CONDITIONAL_BLOCK", ) assert response.is_closed is True @@ -874,6 +746,8 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncLithic) - async def test_streaming_response_create_overload_2(self, async_client: AsyncLithic) -> None: async with async_client.auth_rules.v2.with_streaming_response.create( card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + parameters={"conditions": [{}]}, + type="CONDITIONAL_BLOCK", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -886,17 +760,15 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncLit @parametrize async def test_method_create_overload_3(self, async_client: AsyncLithic) -> None: v2 = await async_client.auth_rules.v2.create( + parameters={"conditions": [{}]}, program_level=True, + type="CONDITIONAL_BLOCK", ) assert_matches_type(V2CreateResponse, v2, path=["response"]) @parametrize async def test_method_create_with_all_params_overload_3(self, async_client: AsyncLithic) -> None: v2 = await async_client.auth_rules.v2.create( - program_level=True, - event_stream="AUTHORIZATION", - excluded_card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - name="name", parameters={ "conditions": [ { @@ -906,14 +778,20 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn } ] }, + program_level=True, type="CONDITIONAL_BLOCK", + event_stream="AUTHORIZATION", + excluded_card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + name="name", ) assert_matches_type(V2CreateResponse, v2, path=["response"]) @parametrize async def test_raw_response_create_overload_3(self, async_client: AsyncLithic) -> None: response = await async_client.auth_rules.v2.with_raw_response.create( + parameters={"conditions": [{}]}, program_level=True, + type="CONDITIONAL_BLOCK", ) assert response.is_closed is True @@ -924,7 +802,9 @@ async def test_raw_response_create_overload_3(self, async_client: AsyncLithic) - @parametrize async def test_streaming_response_create_overload_3(self, async_client: AsyncLithic) -> None: async with async_client.auth_rules.v2.with_streaming_response.create( + parameters={"conditions": [{}]}, program_level=True, + type="CONDITIONAL_BLOCK", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1129,11 +1009,11 @@ async def test_method_list_with_all_params(self, async_client: AsyncLithic) -> N account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", business_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ending_before="ending_before", + ending_before="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", event_stream="AUTHORIZATION", page_size=1, scope="PROGRAM", - starting_after="starting_after", + starting_after="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(AsyncCursorPage[V2ListResponse], v2, path=["response"]) @@ -1195,165 +1075,6 @@ async def test_path_params_delete(self, async_client: AsyncLithic) -> None: "", ) - @parametrize - async def test_method_apply_overload_1(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - v2 = await async_client.auth_rules.v2.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - async def test_method_apply_with_all_params_overload_1(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - v2 = await async_client.auth_rules.v2.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - business_account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) - - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - async def test_raw_response_apply_overload_1(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.auth_rules.v2.with_raw_response.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v2 = response.parse() - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - async def test_streaming_response_apply_overload_1(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.auth_rules.v2.with_streaming_response.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - v2 = await response.parse() - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_apply_overload_1(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `auth_rule_token` but received ''"): - await async_client.auth_rules.v2.with_raw_response.apply( - auth_rule_token="", - ) - - @parametrize - async def test_method_apply_overload_2(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - v2 = await async_client.auth_rules.v2.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) - - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - async def test_raw_response_apply_overload_2(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.auth_rules.v2.with_raw_response.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v2 = response.parse() - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - async def test_streaming_response_apply_overload_2(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.auth_rules.v2.with_streaming_response.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - v2 = await response.parse() - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_apply_overload_2(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `auth_rule_token` but received ''"): - await async_client.auth_rules.v2.with_raw_response.apply( - auth_rule_token="", - card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) - - @parametrize - async def test_method_apply_overload_3(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - v2 = await async_client.auth_rules.v2.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - program_level=True, - ) - - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - async def test_method_apply_with_all_params_overload_3(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - v2 = await async_client.auth_rules.v2.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - program_level=True, - excluded_card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) - - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - async def test_raw_response_apply_overload_3(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.auth_rules.v2.with_raw_response.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - program_level=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v2 = response.parse() - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - @parametrize - async def test_streaming_response_apply_overload_3(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.auth_rules.v2.with_streaming_response.apply( - auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - program_level=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - v2 = await response.parse() - assert_matches_type(V2ApplyResponse, v2, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_apply_overload_3(self, async_client: AsyncLithic) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `auth_rule_token` but received ''"): - await async_client.auth_rules.v2.with_raw_response.apply( - auth_rule_token="", - program_level=True, - ) - @parametrize async def test_method_draft(self, async_client: AsyncLithic) -> None: v2 = await async_client.auth_rules.v2.draft( diff --git a/tests/api_resources/events/test_subscriptions.py b/tests/api_resources/events/test_subscriptions.py index 4b8d45cd..0a87188d 100644 --- a/tests/api_resources/events/test_subscriptions.py +++ b/tests/api_resources/events/test_subscriptions.py @@ -35,7 +35,7 @@ def test_method_create_with_all_params(self, client: Lithic) -> None: url="https://example.com", description="description", disabled=True, - event_types=["account_holder.created"], + event_types=["account_holder_document.updated"], ) assert_matches_type(EventSubscription, subscription, path=["response"]) @@ -118,7 +118,7 @@ def test_method_update_with_all_params(self, client: Lithic) -> None: url="https://example.com", description="description", disabled=True, - event_types=["account_holder.created"], + event_types=["account_holder_document.updated"], ) assert_matches_type(EventSubscription, subscription, path=["response"]) @@ -492,7 +492,7 @@ def test_method_send_simulated_example(self, client: Lithic) -> None: def test_method_send_simulated_example_with_all_params(self, client: Lithic) -> None: subscription = client.events.subscriptions.send_simulated_example( event_subscription_token="event_subscription_token", - event_type="account_holder.created", + event_type="account_holder_document.updated", ) assert subscription is None @@ -548,7 +548,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncLithic) -> url="https://example.com", description="description", disabled=True, - event_types=["account_holder.created"], + event_types=["account_holder_document.updated"], ) assert_matches_type(EventSubscription, subscription, path=["response"]) @@ -631,7 +631,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncLithic) -> url="https://example.com", description="description", disabled=True, - event_types=["account_holder.created"], + event_types=["account_holder_document.updated"], ) assert_matches_type(EventSubscription, subscription, path=["response"]) @@ -1005,7 +1005,7 @@ async def test_method_send_simulated_example(self, async_client: AsyncLithic) -> async def test_method_send_simulated_example_with_all_params(self, async_client: AsyncLithic) -> None: subscription = await async_client.events.subscriptions.send_simulated_example( event_subscription_token="event_subscription_token", - event_type="account_holder.created", + event_type="account_holder_document.updated", ) assert subscription is None diff --git a/tests/api_resources/test_account_holders.py b/tests/api_resources/test_account_holders.py index 31ecd345..ef040ea1 100644 --- a/tests/api_resources/test_account_holders.py +++ b/tests/api_resources/test_account_holders.py @@ -988,7 +988,7 @@ def test_path_params_retrieve_document(self, client: Lithic) -> None: @parametrize def test_method_simulate_enrollment_document_review(self, client: Lithic) -> None: account_holder = client.account_holders.simulate_enrollment_document_review( - document_upload_token="document_upload_token", + document_upload_token="b11cd67b-0a52-4180-8365-314f3def5426", status="UPLOADED", ) assert_matches_type(Document, account_holder, path=["response"]) @@ -996,7 +996,7 @@ def test_method_simulate_enrollment_document_review(self, client: Lithic) -> Non @parametrize def test_method_simulate_enrollment_document_review_with_all_params(self, client: Lithic) -> None: account_holder = client.account_holders.simulate_enrollment_document_review( - 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", @@ -1006,7 +1006,7 @@ def test_method_simulate_enrollment_document_review_with_all_params(self, client @parametrize def test_raw_response_simulate_enrollment_document_review(self, client: Lithic) -> None: response = client.account_holders.with_raw_response.simulate_enrollment_document_review( - document_upload_token="document_upload_token", + document_upload_token="b11cd67b-0a52-4180-8365-314f3def5426", status="UPLOADED", ) @@ -1018,7 +1018,7 @@ def test_raw_response_simulate_enrollment_document_review(self, client: Lithic) @parametrize def test_streaming_response_simulate_enrollment_document_review(self, client: Lithic) -> None: with client.account_holders.with_streaming_response.simulate_enrollment_document_review( - document_upload_token="document_upload_token", + document_upload_token="b11cd67b-0a52-4180-8365-314f3def5426", status="UPLOADED", ) as response: assert not response.is_closed @@ -2077,7 +2077,7 @@ async def test_path_params_retrieve_document(self, async_client: AsyncLithic) -> @parametrize async def test_method_simulate_enrollment_document_review(self, async_client: AsyncLithic) -> None: account_holder = await async_client.account_holders.simulate_enrollment_document_review( - document_upload_token="document_upload_token", + document_upload_token="b11cd67b-0a52-4180-8365-314f3def5426", status="UPLOADED", ) assert_matches_type(Document, account_holder, path=["response"]) @@ -2085,7 +2085,7 @@ async def test_method_simulate_enrollment_document_review(self, async_client: As @parametrize async def test_method_simulate_enrollment_document_review_with_all_params(self, async_client: AsyncLithic) -> None: account_holder = await async_client.account_holders.simulate_enrollment_document_review( - 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", @@ -2095,7 +2095,7 @@ async def test_method_simulate_enrollment_document_review_with_all_params(self, @parametrize async def test_raw_response_simulate_enrollment_document_review(self, async_client: AsyncLithic) -> None: response = await async_client.account_holders.with_raw_response.simulate_enrollment_document_review( - document_upload_token="document_upload_token", + document_upload_token="b11cd67b-0a52-4180-8365-314f3def5426", status="UPLOADED", ) @@ -2107,7 +2107,7 @@ async def test_raw_response_simulate_enrollment_document_review(self, async_clie @parametrize async def test_streaming_response_simulate_enrollment_document_review(self, async_client: AsyncLithic) -> None: async with async_client.account_holders.with_streaming_response.simulate_enrollment_document_review( - document_upload_token="document_upload_token", + document_upload_token="b11cd67b-0a52-4180-8365-314f3def5426", status="UPLOADED", ) as response: assert not response.is_closed diff --git a/tests/api_resources/test_disputes.py b/tests/api_resources/test_disputes.py index 28821e5c..595dfa6d 100644 --- a/tests/api_resources/test_disputes.py +++ b/tests/api_resources/test_disputes.py @@ -10,8 +10,12 @@ from lithic import Lithic, AsyncLithic from tests.utils import assert_matches_type from lithic.types import ( - Dispute, DisputeEvidence, + DisputeListResponse, + DisputeCreateResponse, + DisputeDeleteResponse, + DisputeUpdateResponse, + DisputeRetrieveResponse, ) from lithic._utils import parse_datetime from lithic.pagination import SyncCursorPage, AsyncCursorPage @@ -29,7 +33,7 @@ def test_method_create(self, client: Lithic) -> None: reason="FRAUD_CARD_PRESENT", transaction_token="12345624-aa69-4cbc-a946-30d90181b621", ) - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeCreateResponse, dispute, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Lithic) -> None: @@ -40,7 +44,7 @@ def test_method_create_with_all_params(self, client: Lithic) -> None: customer_filed_date=parse_datetime("2021-06-28T22:53:15Z"), customer_note="customer_note", ) - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeCreateResponse, dispute, path=["response"]) @parametrize def test_raw_response_create(self, client: Lithic) -> None: @@ -53,7 +57,7 @@ def test_raw_response_create(self, client: Lithic) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeCreateResponse, dispute, path=["response"]) @parametrize def test_streaming_response_create(self, client: Lithic) -> None: @@ -66,7 +70,7 @@ def test_streaming_response_create(self, client: Lithic) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeCreateResponse, dispute, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +79,7 @@ def test_method_retrieve(self, client: Lithic) -> None: dispute = client.disputes.retrieve( "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeRetrieveResponse, dispute, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Lithic) -> None: @@ -86,7 +90,7 @@ def test_raw_response_retrieve(self, client: Lithic) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeRetrieveResponse, dispute, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: Lithic) -> None: @@ -97,7 +101,7 @@ def test_streaming_response_retrieve(self, client: Lithic) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeRetrieveResponse, dispute, path=["response"]) assert cast(Any, response.is_closed) is True @@ -113,7 +117,7 @@ def test_method_update(self, client: Lithic) -> None: dispute = client.disputes.update( dispute_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeUpdateResponse, dispute, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Lithic) -> None: @@ -124,7 +128,7 @@ def test_method_update_with_all_params(self, client: Lithic) -> None: customer_note="customer_note", reason="ATM_CASH_MISDISPENSE", ) - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeUpdateResponse, dispute, path=["response"]) @parametrize def test_raw_response_update(self, client: Lithic) -> None: @@ -135,7 +139,7 @@ def test_raw_response_update(self, client: Lithic) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeUpdateResponse, dispute, path=["response"]) @parametrize def test_streaming_response_update(self, client: Lithic) -> None: @@ -146,7 +150,7 @@ def test_streaming_response_update(self, client: Lithic) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeUpdateResponse, dispute, path=["response"]) assert cast(Any, response.is_closed) is True @@ -160,7 +164,7 @@ def test_path_params_update(self, client: Lithic) -> None: @parametrize def test_method_list(self, client: Lithic) -> None: dispute = client.disputes.list() - assert_matches_type(SyncCursorPage[Dispute], dispute, path=["response"]) + assert_matches_type(SyncCursorPage[DisputeListResponse], dispute, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Lithic) -> None: @@ -173,7 +177,7 @@ def test_method_list_with_all_params(self, client: Lithic) -> None: status="ARBITRATION", transaction_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], ) - assert_matches_type(SyncCursorPage[Dispute], dispute, path=["response"]) + assert_matches_type(SyncCursorPage[DisputeListResponse], dispute, path=["response"]) @parametrize def test_raw_response_list(self, client: Lithic) -> None: @@ -182,7 +186,7 @@ def test_raw_response_list(self, client: Lithic) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(SyncCursorPage[Dispute], dispute, path=["response"]) + assert_matches_type(SyncCursorPage[DisputeListResponse], dispute, path=["response"]) @parametrize def test_streaming_response_list(self, client: Lithic) -> None: @@ -191,7 +195,7 @@ def test_streaming_response_list(self, client: Lithic) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(SyncCursorPage[Dispute], dispute, path=["response"]) + assert_matches_type(SyncCursorPage[DisputeListResponse], dispute, path=["response"]) assert cast(Any, response.is_closed) is True @@ -200,7 +204,7 @@ def test_method_delete(self, client: Lithic) -> None: dispute = client.disputes.delete( "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeDeleteResponse, dispute, path=["response"]) @parametrize def test_raw_response_delete(self, client: Lithic) -> None: @@ -211,7 +215,7 @@ def test_raw_response_delete(self, client: Lithic) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeDeleteResponse, dispute, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Lithic) -> None: @@ -222,7 +226,7 @@ def test_streaming_response_delete(self, client: Lithic) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeDeleteResponse, dispute, path=["response"]) assert cast(Any, response.is_closed) is True @@ -438,7 +442,7 @@ async def test_method_create(self, async_client: AsyncLithic) -> None: reason="FRAUD_CARD_PRESENT", transaction_token="12345624-aa69-4cbc-a946-30d90181b621", ) - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeCreateResponse, dispute, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncLithic) -> None: @@ -449,7 +453,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncLithic) -> customer_filed_date=parse_datetime("2021-06-28T22:53:15Z"), customer_note="customer_note", ) - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeCreateResponse, dispute, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncLithic) -> None: @@ -462,7 +466,7 @@ async def test_raw_response_create(self, async_client: AsyncLithic) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeCreateResponse, dispute, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncLithic) -> None: @@ -475,7 +479,7 @@ async def test_streaming_response_create(self, async_client: AsyncLithic) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = await response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeCreateResponse, dispute, path=["response"]) assert cast(Any, response.is_closed) is True @@ -484,7 +488,7 @@ async def test_method_retrieve(self, async_client: AsyncLithic) -> None: dispute = await async_client.disputes.retrieve( "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeRetrieveResponse, dispute, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncLithic) -> None: @@ -495,7 +499,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncLithic) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeRetrieveResponse, dispute, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncLithic) -> None: @@ -506,7 +510,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncLithic) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = await response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeRetrieveResponse, dispute, path=["response"]) assert cast(Any, response.is_closed) is True @@ -522,7 +526,7 @@ async def test_method_update(self, async_client: AsyncLithic) -> None: dispute = await async_client.disputes.update( dispute_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeUpdateResponse, dispute, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncLithic) -> None: @@ -533,7 +537,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncLithic) -> customer_note="customer_note", reason="ATM_CASH_MISDISPENSE", ) - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeUpdateResponse, dispute, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncLithic) -> None: @@ -544,7 +548,7 @@ async def test_raw_response_update(self, async_client: AsyncLithic) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeUpdateResponse, dispute, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncLithic) -> None: @@ -555,7 +559,7 @@ async def test_streaming_response_update(self, async_client: AsyncLithic) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = await response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeUpdateResponse, dispute, path=["response"]) assert cast(Any, response.is_closed) is True @@ -569,7 +573,7 @@ async def test_path_params_update(self, async_client: AsyncLithic) -> None: @parametrize async def test_method_list(self, async_client: AsyncLithic) -> None: dispute = await async_client.disputes.list() - assert_matches_type(AsyncCursorPage[Dispute], dispute, path=["response"]) + assert_matches_type(AsyncCursorPage[DisputeListResponse], dispute, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncLithic) -> None: @@ -582,7 +586,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncLithic) -> N status="ARBITRATION", transaction_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], ) - assert_matches_type(AsyncCursorPage[Dispute], dispute, path=["response"]) + assert_matches_type(AsyncCursorPage[DisputeListResponse], dispute, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncLithic) -> None: @@ -591,7 +595,7 @@ async def test_raw_response_list(self, async_client: AsyncLithic) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(AsyncCursorPage[Dispute], dispute, path=["response"]) + assert_matches_type(AsyncCursorPage[DisputeListResponse], dispute, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncLithic) -> None: @@ -600,7 +604,7 @@ async def test_streaming_response_list(self, async_client: AsyncLithic) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = await response.parse() - assert_matches_type(AsyncCursorPage[Dispute], dispute, path=["response"]) + assert_matches_type(AsyncCursorPage[DisputeListResponse], dispute, path=["response"]) assert cast(Any, response.is_closed) is True @@ -609,7 +613,7 @@ async def test_method_delete(self, async_client: AsyncLithic) -> None: dispute = await async_client.disputes.delete( "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeDeleteResponse, dispute, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncLithic) -> None: @@ -620,7 +624,7 @@ async def test_raw_response_delete(self, async_client: AsyncLithic) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeDeleteResponse, dispute, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncLithic) -> None: @@ -631,7 +635,7 @@ async def test_streaming_response_delete(self, async_client: AsyncLithic) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" dispute = await response.parse() - assert_matches_type(Dispute, dispute, path=["response"]) + assert_matches_type(DisputeDeleteResponse, dispute, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index 0f74ba88..6d67648b 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -68,7 +68,7 @@ def test_method_list_with_all_params(self, client: Lithic) -> None: begin=parse_datetime("2019-12-27T18:11:19.117Z"), end=parse_datetime("2019-12-27T18:11:19.117Z"), ending_before="ending_before", - event_types=["account_holder.created"], + event_types=["account_holder_document.updated"], page_size=1, starting_after="starting_after", with_content=True, @@ -208,7 +208,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncLithic) -> N begin=parse_datetime("2019-12-27T18:11:19.117Z"), end=parse_datetime("2019-12-27T18:11:19.117Z"), ending_before="ending_before", - event_types=["account_holder.created"], + event_types=["account_holder_document.updated"], page_size=1, starting_after="starting_after", with_content=True, diff --git a/tests/api_resources/test_payments.py b/tests/api_resources/test_payments.py index 5857f51f..1801c86f 100644 --- a/tests/api_resources/test_payments.py +++ b/tests/api_resources/test_payments.py @@ -18,7 +18,7 @@ PaymentSimulateReceiptResponse, PaymentSimulateReleaseResponse, ) -from lithic._utils import parse_datetime +from lithic._utils import parse_date, parse_datetime from lithic.pagination import SyncCursorPage, AsyncCursorPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -222,7 +222,9 @@ def test_method_simulate_action_with_all_params(self, client: Lithic) -> None: payment = client.payments.simulate_action( payment_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", event_type="ACH_ORIGINATION_REVIEWED", + date_of_death=parse_date("2019-12-27"), decline_reason="PROGRAM_TRANSACTION_LIMIT_EXCEEDED", + return_addenda="return_addenda", return_reason_code="return_reason_code", ) assert_matches_type(PaymentSimulateActionResponse, payment, path=["response"]) @@ -583,7 +585,9 @@ async def test_method_simulate_action_with_all_params(self, async_client: AsyncL payment = await async_client.payments.simulate_action( payment_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", event_type="ACH_ORIGINATION_REVIEWED", + date_of_death=parse_date("2019-12-27"), decline_reason="PROGRAM_TRANSACTION_LIMIT_EXCEEDED", + return_addenda="return_addenda", return_reason_code="return_reason_code", ) assert_matches_type(PaymentSimulateActionResponse, payment, path=["response"]) diff --git a/tests/test_client.py b/tests/test_client.py index 975f34b8..2c78b5b1 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -59,51 +59,49 @@ def _get_open_connections(client: Lithic | AsyncLithic) -> int: class TestLithic: - client = Lithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) - @pytest.mark.respx(base_url=base_url) - def test_raw_response(self, respx_mock: MockRouter) -> None: + def test_raw_response(self, respx_mock: MockRouter, client: Lithic) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.post("/foo", cast_to=httpx.Response) + response = client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} @pytest.mark.respx(base_url=base_url) - def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + def test_raw_response_for_binary(self, respx_mock: MockRouter, client: Lithic) -> None: respx_mock.post("/foo").mock( return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') ) - response = self.client.post("/foo", cast_to=httpx.Response) + response = client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} - def test_copy(self) -> None: - copied = self.client.copy() - assert id(copied) != id(self.client) + def test_copy(self, client: Lithic) -> None: + copied = client.copy() + assert id(copied) != id(client) - copied = self.client.copy(api_key="another My Lithic API Key") + copied = client.copy(api_key="another My Lithic API Key") assert copied.api_key == "another My Lithic API Key" - assert self.client.api_key == "My Lithic API Key" + assert client.api_key == "My Lithic API Key" - def test_copy_default_options(self) -> None: + def test_copy_default_options(self, client: Lithic) -> None: # options that have a default are overridden correctly - copied = self.client.copy(max_retries=7) + copied = client.copy(max_retries=7) assert copied.max_retries == 7 - assert self.client.max_retries == 2 + assert client.max_retries == 2 copied2 = copied.copy(max_retries=6) assert copied2.max_retries == 6 assert copied.max_retries == 7 # timeout - assert isinstance(self.client.timeout, httpx.Timeout) - copied = self.client.copy(timeout=None) + assert isinstance(client.timeout, httpx.Timeout) + copied = client.copy(timeout=None) assert copied.timeout is None - assert isinstance(self.client.timeout, httpx.Timeout) + assert isinstance(client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: client = Lithic( @@ -138,6 +136,7 @@ def test_copy_default_headers(self) -> None: match="`default_headers` and `set_default_headers` arguments are mutually exclusive", ): client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + client.close() def test_copy_default_query(self) -> None: client = Lithic( @@ -175,13 +174,15 @@ def test_copy_default_query(self) -> None: ): client.copy(set_default_query={}, default_query={"foo": "Bar"}) - def test_copy_signature(self) -> None: + client.close() + + def test_copy_signature(self, client: Lithic) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + client.__init__, # type: ignore[misc] ) - copy_signature = inspect.signature(self.client.copy) + copy_signature = inspect.signature(client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} for name in init_signature.parameters.keys(): @@ -192,12 +193,12 @@ def test_copy_signature(self) -> None: assert copy_param is not None, f"copy() signature is missing the {name} param" @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") - def test_copy_build_request(self) -> None: + def test_copy_build_request(self, client: Lithic) -> None: options = FinalRequestOptions(method="get", url="/foo") def build_request(options: FinalRequestOptions) -> None: - client = self.client.copy() - client._build_request(options) + client_copy = client.copy() + client_copy._build_request(options) # ensure that the machinery is warmed up before tracing starts. build_request(options) @@ -254,14 +255,12 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic print(frame) raise AssertionError() - def test_request_timeout(self) -> None: - request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + def test_request_timeout(self, client: Lithic) -> None: + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT - request = self.client._build_request( - FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) - ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0))) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(100.0) @@ -272,6 +271,8 @@ def test_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(0) + client.close() + def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used with httpx.Client(timeout=None) as http_client: @@ -283,6 +284,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(None) + client.close() + # no timeout given to the httpx client should not use the httpx default with httpx.Client() as http_client: client = Lithic( @@ -293,6 +296,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT + client.close() + # explicitly passing the default timeout currently results in it being ignored with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: client = Lithic( @@ -303,6 +308,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT # our default + client.close() + async def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): async with httpx.AsyncClient() as http_client: @@ -314,14 +321,14 @@ async def test_invalid_http_client(self) -> None: ) def test_default_headers_option(self) -> None: - client = Lithic( + test_client = Lithic( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - client2 = Lithic( + test_client2 = Lithic( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -330,10 +337,13 @@ def test_default_headers_option(self) -> None: "X-Stainless-Lang": "my-overriding-header", }, ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client2._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "stainless" assert request.headers.get("x-stainless-lang") == "my-overriding-header" + test_client.close() + test_client2.close() + def test_validate_headers(self) -> None: client = Lithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) @@ -362,8 +372,10 @@ def test_default_query_option(self) -> None: url = httpx.URL(request.url) assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} - def test_request_extra_json(self) -> None: - request = self.client._build_request( + client.close() + + def test_request_extra_json(self, client: Lithic) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -374,7 +386,7 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": False} - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -385,7 +397,7 @@ def test_request_extra_json(self) -> None: assert data == {"baz": False} # `extra_json` takes priority over `json_data` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -396,8 +408,8 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": None} - def test_request_extra_headers(self) -> None: - request = self.client._build_request( + def test_request_extra_headers(self, client: Lithic) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -407,7 +419,7 @@ def test_request_extra_headers(self) -> None: assert request.headers.get("X-Foo") == "Foo" # `extra_headers` takes priority over `default_headers` when keys clash - request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + request = client.with_options(default_headers={"X-Bar": "true"})._build_request( FinalRequestOptions( method="post", url="/foo", @@ -418,8 +430,8 @@ def test_request_extra_headers(self) -> None: ) assert request.headers.get("X-Bar") == "false" - def test_request_extra_query(self) -> None: - request = self.client._build_request( + def test_request_extra_query(self, client: Lithic) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -432,7 +444,7 @@ def test_request_extra_query(self) -> None: assert params == {"my_query_param": "Foo"} # if both `query` and `extra_query` are given, they are merged - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -446,7 +458,7 @@ def test_request_extra_query(self) -> None: assert params == {"bar": "1", "foo": "2"} # `extra_query` takes priority over `query` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -489,7 +501,7 @@ def test_multipart_repeating_array(self, client: Lithic) -> None: ] @pytest.mark.respx(base_url=base_url) - def test_basic_union_response(self, respx_mock: MockRouter) -> None: + def test_basic_union_response(self, respx_mock: MockRouter, client: Lithic) -> None: class Model1(BaseModel): name: str @@ -498,12 +510,12 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" @pytest.mark.respx(base_url=base_url) - def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + def test_union_response_different_types(self, respx_mock: MockRouter, client: Lithic) -> None: """Union of objects with the same field name using a different type""" class Model1(BaseModel): @@ -514,18 +526,18 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) assert response.foo == 1 @pytest.mark.respx(base_url=base_url) - def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter, client: Lithic) -> None: """ Response that sets Content-Type to something other than application/json but returns json data """ @@ -541,7 +553,7 @@ class Model(BaseModel): ) ) - response = self.client.get("/foo", cast_to=Model) + response = client.get("/foo", cast_to=Model) assert isinstance(response, Model) assert response.foo == 2 @@ -553,6 +565,8 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" + client.close() + def test_base_url_env(self) -> None: with update_env(LITHIC_BASE_URL="http://localhost:5000/from/env"): client = Lithic(api_key=api_key, _strict_response_validation=True) @@ -566,6 +580,8 @@ def test_base_url_env(self) -> None: client = Lithic(base_url=None, api_key=api_key, _strict_response_validation=True, environment="production") assert str(client.base_url).startswith("https://api.lithic.com") + client.close() + @pytest.mark.parametrize( "client", [ @@ -588,6 +604,7 @@ def test_base_url_trailing_slash(self, client: Lithic) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + client.close() @pytest.mark.parametrize( "client", @@ -611,6 +628,7 @@ def test_base_url_no_trailing_slash(self, client: Lithic) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + client.close() @pytest.mark.parametrize( "client", @@ -634,35 +652,36 @@ def test_absolute_request_url(self, client: Lithic) -> None: ), ) assert request.url == "https://myapi.com/foo" + client.close() def test_copied_client_does_not_close_http(self) -> None: - client = Lithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) - assert not client.is_closed() + test_client = Lithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) + assert not test_client.is_closed() - copied = client.copy() - assert copied is not client + copied = test_client.copy() + assert copied is not test_client del copied - assert not client.is_closed() + assert not test_client.is_closed() def test_client_context_manager(self) -> None: - client = Lithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) - with client as c2: - assert c2 is client + test_client = Lithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) + with test_client as c2: + assert c2 is test_client assert not c2.is_closed() - assert not client.is_closed() - assert client.is_closed() + assert not test_client.is_closed() + assert test_client.is_closed() @pytest.mark.respx(base_url=base_url) - def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + def test_client_response_validation_error(self, respx_mock: MockRouter, client: Lithic) -> None: class Model(BaseModel): foo: str respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) with pytest.raises(APIResponseValidationError) as exc: - self.client.get("/foo", cast_to=Model) + client.get("/foo", cast_to=Model) assert isinstance(exc.value.__cause__, ValidationError) @@ -682,11 +701,14 @@ class Model(BaseModel): with pytest.raises(APIResponseValidationError): strict_client.get("/foo", cast_to=Model) - client = Lithic(base_url=base_url, api_key=api_key, _strict_response_validation=False) + non_strict_client = Lithic(base_url=base_url, api_key=api_key, _strict_response_validation=False) - response = client.get("/foo", cast_to=Model) + response = non_strict_client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] + strict_client.close() + non_strict_client.close() + @pytest.mark.parametrize( "remaining_retries,retry_after,timeout", [ @@ -709,9 +731,9 @@ class Model(BaseModel): ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) - def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: - client = Lithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) - + def test_parse_retry_after_header( + self, remaining_retries: int, retry_after: str, timeout: float, client: Lithic + ) -> None: headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) @@ -725,7 +747,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien with pytest.raises(APITimeoutError): client.cards.with_streaming_response.create(type="VIRTUAL").__enter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(client) == 0 @mock.patch("lithic._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -734,7 +756,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client with pytest.raises(APIStatusError): client.cards.with_streaming_response.create(type="VIRTUAL").__enter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("lithic._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @@ -863,83 +885,77 @@ def test_default_client_creation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - def test_follow_redirects(self, respx_mock: MockRouter) -> None: + def test_follow_redirects(self, respx_mock: MockRouter, client: Lithic) -> None: # Test that the default follow_redirects=True allows following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) - response = self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + response = client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) assert response.status_code == 200 assert response.json() == {"status": "ok"} @pytest.mark.respx(base_url=base_url) - def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + def test_follow_redirects_disabled(self, respx_mock: MockRouter, client: Lithic) -> None: # Test that follow_redirects=False prevents following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) with pytest.raises(APIStatusError) as exc_info: - self.client.post( - "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response - ) + client.post("/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response) assert exc_info.value.response.status_code == 302 assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" class TestAsyncLithic: - client = AsyncLithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) - @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_raw_response(self, respx_mock: MockRouter) -> None: + async def test_raw_response(self, respx_mock: MockRouter, async_client: AsyncLithic) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.post("/foo", cast_to=httpx.Response) + response = await async_client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + async def test_raw_response_for_binary(self, respx_mock: MockRouter, async_client: AsyncLithic) -> None: respx_mock.post("/foo").mock( return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') ) - response = await self.client.post("/foo", cast_to=httpx.Response) + response = await async_client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} - def test_copy(self) -> None: - copied = self.client.copy() - assert id(copied) != id(self.client) + def test_copy(self, async_client: AsyncLithic) -> None: + copied = async_client.copy() + assert id(copied) != id(async_client) - copied = self.client.copy(api_key="another My Lithic API Key") + copied = async_client.copy(api_key="another My Lithic API Key") assert copied.api_key == "another My Lithic API Key" - assert self.client.api_key == "My Lithic API Key" + assert async_client.api_key == "My Lithic API Key" - def test_copy_default_options(self) -> None: + def test_copy_default_options(self, async_client: AsyncLithic) -> None: # options that have a default are overridden correctly - copied = self.client.copy(max_retries=7) + copied = async_client.copy(max_retries=7) assert copied.max_retries == 7 - assert self.client.max_retries == 2 + assert async_client.max_retries == 2 copied2 = copied.copy(max_retries=6) assert copied2.max_retries == 6 assert copied.max_retries == 7 # timeout - assert isinstance(self.client.timeout, httpx.Timeout) - copied = self.client.copy(timeout=None) + assert isinstance(async_client.timeout, httpx.Timeout) + copied = async_client.copy(timeout=None) assert copied.timeout is None - assert isinstance(self.client.timeout, httpx.Timeout) + assert isinstance(async_client.timeout, httpx.Timeout) - def test_copy_default_headers(self) -> None: + async def test_copy_default_headers(self) -> None: client = AsyncLithic( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) @@ -972,8 +988,9 @@ def test_copy_default_headers(self) -> None: match="`default_headers` and `set_default_headers` arguments are mutually exclusive", ): client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + await client.close() - def test_copy_default_query(self) -> None: + async def test_copy_default_query(self) -> None: client = AsyncLithic( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} ) @@ -1009,13 +1026,15 @@ def test_copy_default_query(self) -> None: ): client.copy(set_default_query={}, default_query={"foo": "Bar"}) - def test_copy_signature(self) -> None: + await client.close() + + def test_copy_signature(self, async_client: AsyncLithic) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + async_client.__init__, # type: ignore[misc] ) - copy_signature = inspect.signature(self.client.copy) + copy_signature = inspect.signature(async_client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} for name in init_signature.parameters.keys(): @@ -1026,12 +1045,12 @@ def test_copy_signature(self) -> None: assert copy_param is not None, f"copy() signature is missing the {name} param" @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") - def test_copy_build_request(self) -> None: + def test_copy_build_request(self, async_client: AsyncLithic) -> None: options = FinalRequestOptions(method="get", url="/foo") def build_request(options: FinalRequestOptions) -> None: - client = self.client.copy() - client._build_request(options) + client_copy = async_client.copy() + client_copy._build_request(options) # ensure that the machinery is warmed up before tracing starts. build_request(options) @@ -1088,12 +1107,12 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic print(frame) raise AssertionError() - async def test_request_timeout(self) -> None: - request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + async def test_request_timeout(self, async_client: AsyncLithic) -> None: + request = async_client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT - request = self.client._build_request( + request = async_client._build_request( FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) ) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -1108,6 +1127,8 @@ async def test_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(0) + await client.close() + async def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used async with httpx.AsyncClient(timeout=None) as http_client: @@ -1119,6 +1140,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(None) + await client.close() + # no timeout given to the httpx client should not use the httpx default async with httpx.AsyncClient() as http_client: client = AsyncLithic( @@ -1129,6 +1152,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT + await client.close() + # explicitly passing the default timeout currently results in it being ignored async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: client = AsyncLithic( @@ -1139,6 +1164,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT # our default + await client.close() + def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): with httpx.Client() as http_client: @@ -1149,15 +1176,15 @@ def test_invalid_http_client(self) -> None: http_client=cast(Any, http_client), ) - def test_default_headers_option(self) -> None: - client = AsyncLithic( + async def test_default_headers_option(self) -> None: + test_client = AsyncLithic( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - client2 = AsyncLithic( + test_client2 = AsyncLithic( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -1166,10 +1193,13 @@ def test_default_headers_option(self) -> None: "X-Stainless-Lang": "my-overriding-header", }, ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client2._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "stainless" assert request.headers.get("x-stainless-lang") == "my-overriding-header" + await test_client.close() + await test_client2.close() + def test_validate_headers(self) -> None: client = AsyncLithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) @@ -1180,7 +1210,7 @@ def test_validate_headers(self) -> None: client2 = AsyncLithic(base_url=base_url, api_key=None, _strict_response_validation=True) _ = client2 - def test_default_query_option(self) -> None: + async def test_default_query_option(self) -> None: client = AsyncLithic( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} ) @@ -1198,8 +1228,10 @@ def test_default_query_option(self) -> None: url = httpx.URL(request.url) assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} - def test_request_extra_json(self) -> None: - request = self.client._build_request( + await client.close() + + def test_request_extra_json(self, client: Lithic) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1210,7 +1242,7 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": False} - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1221,7 +1253,7 @@ def test_request_extra_json(self) -> None: assert data == {"baz": False} # `extra_json` takes priority over `json_data` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1232,8 +1264,8 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": None} - def test_request_extra_headers(self) -> None: - request = self.client._build_request( + def test_request_extra_headers(self, client: Lithic) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1243,7 +1275,7 @@ def test_request_extra_headers(self) -> None: assert request.headers.get("X-Foo") == "Foo" # `extra_headers` takes priority over `default_headers` when keys clash - request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + request = client.with_options(default_headers={"X-Bar": "true"})._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1254,8 +1286,8 @@ def test_request_extra_headers(self) -> None: ) assert request.headers.get("X-Bar") == "false" - def test_request_extra_query(self) -> None: - request = self.client._build_request( + def test_request_extra_query(self, client: Lithic) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1268,7 +1300,7 @@ def test_request_extra_query(self) -> None: assert params == {"my_query_param": "Foo"} # if both `query` and `extra_query` are given, they are merged - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1282,7 +1314,7 @@ def test_request_extra_query(self) -> None: assert params == {"bar": "1", "foo": "2"} # `extra_query` takes priority over `query` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1325,7 +1357,7 @@ def test_multipart_repeating_array(self, async_client: AsyncLithic) -> None: ] @pytest.mark.respx(base_url=base_url) - async def test_basic_union_response(self, respx_mock: MockRouter) -> None: + async def test_basic_union_response(self, respx_mock: MockRouter, async_client: AsyncLithic) -> None: class Model1(BaseModel): name: str @@ -1334,12 +1366,12 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" @pytest.mark.respx(base_url=base_url) - async def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + async def test_union_response_different_types(self, respx_mock: MockRouter, async_client: AsyncLithic) -> None: """Union of objects with the same field name using a different type""" class Model1(BaseModel): @@ -1350,18 +1382,20 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) assert response.foo == 1 @pytest.mark.respx(base_url=base_url) - async def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + async def test_non_application_json_content_type_for_json_data( + self, respx_mock: MockRouter, async_client: AsyncLithic + ) -> None: """ Response that sets Content-Type to something other than application/json but returns json data """ @@ -1377,11 +1411,11 @@ class Model(BaseModel): ) ) - response = await self.client.get("/foo", cast_to=Model) + response = await async_client.get("/foo", cast_to=Model) assert isinstance(response, Model) assert response.foo == 2 - def test_base_url_setter(self) -> None: + async def test_base_url_setter(self) -> None: client = AsyncLithic( base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True ) @@ -1391,7 +1425,9 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" - def test_base_url_env(self) -> None: + await client.close() + + async def test_base_url_env(self) -> None: with update_env(LITHIC_BASE_URL="http://localhost:5000/from/env"): client = AsyncLithic(api_key=api_key, _strict_response_validation=True) assert client.base_url == "http://localhost:5000/from/env/" @@ -1406,6 +1442,8 @@ def test_base_url_env(self) -> None: ) assert str(client.base_url).startswith("https://api.lithic.com") + await client.close() + @pytest.mark.parametrize( "client", [ @@ -1421,7 +1459,7 @@ def test_base_url_env(self) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_trailing_slash(self, client: AsyncLithic) -> None: + async def test_base_url_trailing_slash(self, client: AsyncLithic) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1430,6 +1468,7 @@ def test_base_url_trailing_slash(self, client: AsyncLithic) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + await client.close() @pytest.mark.parametrize( "client", @@ -1446,7 +1485,7 @@ def test_base_url_trailing_slash(self, client: AsyncLithic) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_no_trailing_slash(self, client: AsyncLithic) -> None: + async def test_base_url_no_trailing_slash(self, client: AsyncLithic) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1455,6 +1494,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncLithic) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + await client.close() @pytest.mark.parametrize( "client", @@ -1471,7 +1511,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncLithic) -> None: ], ids=["standard", "custom http client"], ) - def test_absolute_request_url(self, client: AsyncLithic) -> None: + async def test_absolute_request_url(self, client: AsyncLithic) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1480,37 +1520,37 @@ def test_absolute_request_url(self, client: AsyncLithic) -> None: ), ) assert request.url == "https://myapi.com/foo" + await client.close() async def test_copied_client_does_not_close_http(self) -> None: - client = AsyncLithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) - assert not client.is_closed() + test_client = AsyncLithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) + assert not test_client.is_closed() - copied = client.copy() - assert copied is not client + copied = test_client.copy() + assert copied is not test_client del copied await asyncio.sleep(0.2) - assert not client.is_closed() + assert not test_client.is_closed() async def test_client_context_manager(self) -> None: - client = AsyncLithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) - async with client as c2: - assert c2 is client + test_client = AsyncLithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) + async with test_client as c2: + assert c2 is test_client assert not c2.is_closed() - assert not client.is_closed() - assert client.is_closed() + assert not test_client.is_closed() + assert test_client.is_closed() @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + async def test_client_response_validation_error(self, respx_mock: MockRouter, async_client: AsyncLithic) -> None: class Model(BaseModel): foo: str respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) with pytest.raises(APIResponseValidationError) as exc: - await self.client.get("/foo", cast_to=Model) + await async_client.get("/foo", cast_to=Model) assert isinstance(exc.value.__cause__, ValidationError) @@ -1521,7 +1561,6 @@ async def test_client_max_retries_validation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: class Model(BaseModel): name: str @@ -1533,11 +1572,14 @@ class Model(BaseModel): with pytest.raises(APIResponseValidationError): await strict_client.get("/foo", cast_to=Model) - client = AsyncLithic(base_url=base_url, api_key=api_key, _strict_response_validation=False) + non_strict_client = AsyncLithic(base_url=base_url, api_key=api_key, _strict_response_validation=False) - response = await client.get("/foo", cast_to=Model) + response = await non_strict_client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] + await strict_client.close() + await non_strict_client.close() + @pytest.mark.parametrize( "remaining_retries,retry_after,timeout", [ @@ -1560,13 +1602,12 @@ class Model(BaseModel): ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) - @pytest.mark.asyncio - async def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: - client = AsyncLithic(base_url=base_url, api_key=api_key, _strict_response_validation=True) - + async def test_parse_retry_after_header( + self, remaining_retries: int, retry_after: str, timeout: float, async_client: AsyncLithic + ) -> None: headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) - calculated = client._calculate_retry_timeout(remaining_retries, options, headers) + calculated = async_client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("lithic._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @@ -1577,7 +1618,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, with pytest.raises(APITimeoutError): await async_client.cards.with_streaming_response.create(type="VIRTUAL").__aenter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(async_client) == 0 @mock.patch("lithic._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -1586,12 +1627,11 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, with pytest.raises(APIStatusError): await async_client.cards.with_streaming_response.create(type="VIRTUAL").__aenter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(async_client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("lithic._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio @pytest.mark.parametrize("failure_mode", ["status", "exception"]) async def test_retries_taken( self, @@ -1623,7 +1663,6 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("lithic._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_omit_retry_count_header( self, async_client: AsyncLithic, failures_before_success: int, respx_mock: MockRouter ) -> None: @@ -1649,7 +1688,6 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("lithic._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_overwrite_retry_count_header( self, async_client: AsyncLithic, failures_before_success: int, respx_mock: MockRouter ) -> None: @@ -1675,7 +1713,6 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("lithic._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_retries_taken_new_response_class( self, async_client: AsyncLithic, failures_before_success: int, respx_mock: MockRouter ) -> None: @@ -1723,26 +1760,26 @@ async def test_default_client_creation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - async def test_follow_redirects(self, respx_mock: MockRouter) -> None: + async def test_follow_redirects(self, respx_mock: MockRouter, async_client: AsyncLithic) -> None: # Test that the default follow_redirects=True allows following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) - response = await self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + response = await async_client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) assert response.status_code == 200 assert response.json() == {"status": "ok"} @pytest.mark.respx(base_url=base_url) - async def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + async def test_follow_redirects_disabled(self, respx_mock: MockRouter, async_client: AsyncLithic) -> None: # Test that follow_redirects=False prevents following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) with pytest.raises(APIStatusError) as exc_info: - await self.client.post( + await async_client.post( "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response ) diff --git a/tests/test_models.py b/tests/test_models.py index 75384c49..a11c900d 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -9,7 +9,7 @@ from lithic._utils import PropertyInfo from lithic._compat import PYDANTIC_V1, parse_obj, model_dump, model_json -from lithic._models import BaseModel, construct_type +from lithic._models import DISCRIMINATOR_CACHE, BaseModel, construct_type class BasicModel(BaseModel): @@ -809,7 +809,7 @@ class B(BaseModel): UnionType = cast(Any, Union[A, B]) - assert not hasattr(UnionType, "__discriminator__") + assert not DISCRIMINATOR_CACHE.get(UnionType) m = construct_type( value={"type": "b", "data": "foo"}, type_=cast(Any, Annotated[UnionType, PropertyInfo(discriminator="type")]) @@ -818,7 +818,7 @@ class B(BaseModel): assert m.type == "b" assert m.data == "foo" # type: ignore[comparison-overlap] - discriminator = UnionType.__discriminator__ + discriminator = DISCRIMINATOR_CACHE.get(UnionType) assert discriminator is not None m = construct_type( @@ -830,7 +830,7 @@ class B(BaseModel): # if the discriminator details object stays the same between invocations then # we hit the cache - assert UnionType.__discriminator__ is discriminator + assert DISCRIMINATOR_CACHE.get(UnionType) is discriminator @pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1")