diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 19c0e9cc..6b28bdb2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.104.0" + ".": "0.105.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 1d2ac3a5..163759d1 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-117e0ee9b030a2efc3b09e189e445fb1a26fd32f1c563f385b9d7071a959c550.yml -openapi_spec_hash: e529a3fa8c3a79d3664db391683334c3 -config_hash: 22e4b128e110e2767daa9d95428ebf9d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-1d44bb7fad99487af1161eb24dfd5369440eda7e80ed237cbc1acc6802a7d212.yml +openapi_spec_hash: 1b6b6215b60094b76b91c56b925a251a +config_hash: ac676e77c8ca051c7aad978c26e96345 diff --git a/CHANGELOG.md b/CHANGELOG.md index e6b5f6bc..69bd9855 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 0.105.0 (2025-09-09) + +Full Changelog: [v0.104.0...v0.105.0](https://github.com/lithic-com/lithic-python/compare/v0.104.0...v0.105.0) + +### Features + +* **api:** adds support for unpauseing external bank accounts ([6abb97a](https://github.com/lithic-com/lithic-python/commit/6abb97ac297e522db029326aa42f526ee4ab6b56)) + + +### Bug Fixes + +* **types:** add missing types to method arguments ([2a2cf4f](https://github.com/lithic-com/lithic-python/commit/2a2cf4f23bbed5067f494d7865194f2237397a67)) + + +### Chores + +* **internal:** move mypy configurations to `pyproject.toml` file ([7334406](https://github.com/lithic-com/lithic-python/commit/73344067058de624d05271c91360f9554935c26e)) +* **tests:** simplify `get_platform` test ([fb87755](https://github.com/lithic-com/lithic-python/commit/fb87755ec9d3575d5720da0e30d07df120955fd5)) + ## 0.104.0 (2025-09-04) Full Changelog: [v0.103.1...v0.104.0](https://github.com/lithic-com/lithic-python/compare/v0.103.1...v0.104.0) diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index d895d267..00000000 --- a/mypy.ini +++ /dev/null @@ -1,50 +0,0 @@ -[mypy] -pretty = True -show_error_codes = True - -# Exclude _files.py because mypy isn't smart enough to apply -# the correct type narrowing and as this is an internal module -# it's fine to just use Pyright. -# -# We also exclude our `tests` as mypy doesn't always infer -# types correctly and Pyright will still catch any type errors. -exclude = ^(src/lithic/_files\.py|_dev/.*\.py|tests/.*)$ - -strict_equality = True -implicit_reexport = True -check_untyped_defs = True -no_implicit_optional = True - -warn_return_any = True -warn_unreachable = True -warn_unused_configs = True - -# Turn these options off as it could cause conflicts -# with the Pyright options. -warn_unused_ignores = False -warn_redundant_casts = False - -disallow_any_generics = True -disallow_untyped_defs = True -disallow_untyped_calls = True -disallow_subclassing_any = True -disallow_incomplete_defs = True -disallow_untyped_decorators = True -cache_fine_grained = True - -# By default, mypy reports an error if you assign a value to the result -# of a function call that doesn't return anything. We do this in our test -# cases: -# ``` -# result = ... -# assert result is None -# ``` -# Changing this codegen to make mypy happy would increase complexity -# and would not be worth it. -disable_error_code = func-returns-value,overload-cannot-match - -# https://github.com/python/mypy/issues/12162 -[mypy.overrides] -module = "black.files.*" -ignore_errors = true -ignore_missing_imports = true diff --git a/pyproject.toml b/pyproject.toml index e63d0230..99e0b4fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "lithic" -version = "0.104.0" +version = "0.105.0" description = "The official Python library for the lithic API" dynamic = ["readme"] license = "Apache-2.0" @@ -56,7 +56,6 @@ dev-dependencies = [ "dirty-equals>=0.6.0", "importlib-metadata>=6.7.0", "rich>=13.7.1", - "nest_asyncio==1.6.0", "pytest-xdist>=3.6.1", ] @@ -157,6 +156,58 @@ reportOverlappingOverload = false reportImportCycles = false reportPrivateUsage = false +[tool.mypy] +pretty = true +show_error_codes = true + +# Exclude _files.py because mypy isn't smart enough to apply +# the correct type narrowing and as this is an internal module +# it's fine to just use Pyright. +# +# We also exclude our `tests` as mypy doesn't always infer +# types correctly and Pyright will still catch any type errors. +exclude = ['src/lithic/_files.py', '_dev/.*.py', 'tests/.*'] + +strict_equality = true +implicit_reexport = true +check_untyped_defs = true +no_implicit_optional = true + +warn_return_any = true +warn_unreachable = true +warn_unused_configs = true + +# Turn these options off as it could cause conflicts +# with the Pyright options. +warn_unused_ignores = false +warn_redundant_casts = false + +disallow_any_generics = true +disallow_untyped_defs = true +disallow_untyped_calls = true +disallow_subclassing_any = true +disallow_incomplete_defs = true +disallow_untyped_decorators = true +cache_fine_grained = true + +# By default, mypy reports an error if you assign a value to the result +# of a function call that doesn't return anything. We do this in our test +# cases: +# ``` +# result = ... +# assert result is None +# ``` +# Changing this codegen to make mypy happy would increase complexity +# and would not be worth it. +disable_error_code = "func-returns-value,overload-cannot-match" + +# https://github.com/python/mypy/issues/12162 +[[tool.mypy.overrides]] +module = "black.files.*" +ignore_errors = true +ignore_missing_imports = true + + [tool.ruff] line-length = 120 output-format = "grouped" diff --git a/requirements-dev.lock b/requirements-dev.lock index 8c6da18f..af3573f5 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -75,7 +75,6 @@ multidict==6.4.4 mypy==1.14.1 mypy-extensions==1.0.0 # via mypy -nest-asyncio==1.6.0 nodeenv==1.8.0 # via pyright nox==2023.4.22 diff --git a/src/lithic/_version.py b/src/lithic/_version.py index eecc58c0..15af33c7 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.104.0" # x-release-please-version +__version__ = "0.105.0" # x-release-please-version diff --git a/src/lithic/resources/account_activity.py b/src/lithic/resources/account_activity.py index 64d0a6bc..b2074015 100644 --- a/src/lithic/resources/account_activity.py +++ b/src/lithic/resources/account_activity.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Union, cast +from typing import Any, Union, cast from datetime import datetime from typing_extensions import Literal @@ -69,9 +69,9 @@ def list( ending_before: str | NotGiven = NOT_GIVEN, financial_account_token: str | NotGiven = NOT_GIVEN, page_size: int | NotGiven = NOT_GIVEN, - result: List[Literal["APPROVED", "DECLINED"]] | NotGiven = NOT_GIVEN, + result: Literal["APPROVED", "DECLINED"] | NotGiven = NOT_GIVEN, starting_after: str | NotGiven = NOT_GIVEN, - status: List[Literal["DECLINED", "EXPIRED", "PENDING", "SETTLED", "VOIDED", "RETURNED", "REVERSED"]] + status: Literal["DECLINED", "EXPIRED", "PENDING", "RETURNED", "REVERSED", "SETTLED", "VOIDED"] | NotGiven = NOT_GIVEN, # 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. @@ -233,9 +233,9 @@ def list( ending_before: str | NotGiven = NOT_GIVEN, financial_account_token: str | NotGiven = NOT_GIVEN, page_size: int | NotGiven = NOT_GIVEN, - result: List[Literal["APPROVED", "DECLINED"]] | NotGiven = NOT_GIVEN, + result: Literal["APPROVED", "DECLINED"] | NotGiven = NOT_GIVEN, starting_after: str | NotGiven = NOT_GIVEN, - status: List[Literal["DECLINED", "EXPIRED", "PENDING", "SETTLED", "VOIDED", "RETURNED", "REVERSED"]] + status: Literal["DECLINED", "EXPIRED", "PENDING", "RETURNED", "REVERSED", "SETTLED", "VOIDED"] | NotGiven = NOT_GIVEN, # 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. diff --git a/src/lithic/resources/account_holders.py b/src/lithic/resources/account_holders.py index 6e3242ad..2e4e5506 100644 --- a/src/lithic/resources/account_holders.py +++ b/src/lithic/resources/account_holders.py @@ -347,11 +347,14 @@ def create( self, *, beneficial_owner_individuals: Iterable[account_holder_create_params.KYBBeneficialOwnerIndividual] + | Iterable[account_holder_create_params.KYBDelegatedBeneficialOwnerIndividual] | NotGiven = NOT_GIVEN, business_entity: account_holder_create_params.KYBBusinessEntity | account_holder_create_params.KYBDelegatedBusinessEntity | NotGiven = NOT_GIVEN, - control_person: account_holder_create_params.KYBControlPerson | NotGiven = NOT_GIVEN, + control_person: account_holder_create_params.KYBControlPerson + | account_holder_create_params.KYBDelegatedControlPerson + | NotGiven = NOT_GIVEN, nature_of_business: str | NotGiven = NOT_GIVEN, tos_timestamp: str | NotGiven = NOT_GIVEN, workflow: Literal["KYB_BASIC", "KYB_BYO"] @@ -1416,11 +1419,14 @@ async def create( self, *, beneficial_owner_individuals: Iterable[account_holder_create_params.KYBBeneficialOwnerIndividual] + | Iterable[account_holder_create_params.KYBDelegatedBeneficialOwnerIndividual] | NotGiven = NOT_GIVEN, business_entity: account_holder_create_params.KYBBusinessEntity | account_holder_create_params.KYBDelegatedBusinessEntity | NotGiven = NOT_GIVEN, - control_person: account_holder_create_params.KYBControlPerson | NotGiven = NOT_GIVEN, + control_person: account_holder_create_params.KYBControlPerson + | account_holder_create_params.KYBDelegatedControlPerson + | NotGiven = NOT_GIVEN, nature_of_business: str | NotGiven = NOT_GIVEN, tos_timestamp: str | NotGiven = NOT_GIVEN, workflow: Literal["KYB_BASIC", "KYB_BYO"] diff --git a/src/lithic/resources/auth_rules/v2/backtests.py b/src/lithic/resources/auth_rules/v2/backtests.py index 760c4a37..a7bd0c9e 100644 --- a/src/lithic/resources/auth_rules/v2/backtests.py +++ b/src/lithic/resources/auth_rules/v2/backtests.py @@ -73,9 +73,9 @@ def create( endpoint. Lithic currently supports backtesting for `CONDITIONAL_BLOCK` / - `CONDITIONAL_3DS_ACTION` rules. Backtesting for `VELOCITY_LIMIT` rules is - generally not supported. In specific cases (i.e. where Lithic has pre-calculated - the requested velocity metrics for historical transactions), a backtest may be + `CONDITIONAL_ACTION` rules. Backtesting for `VELOCITY_LIMIT` rules is generally + not supported. In specific cases (i.e. where Lithic has pre-calculated the + requested velocity metrics for historical transactions), a backtest may be feasible. However, such cases are uncommon and customers should not anticipate support for velocity backtests under most configurations. If a historical transaction does not feature the required inputs to evaluate the rule, then it @@ -219,9 +219,9 @@ async def create( endpoint. Lithic currently supports backtesting for `CONDITIONAL_BLOCK` / - `CONDITIONAL_3DS_ACTION` rules. Backtesting for `VELOCITY_LIMIT` rules is - generally not supported. In specific cases (i.e. where Lithic has pre-calculated - the requested velocity metrics for historical transactions), a backtest may be + `CONDITIONAL_ACTION` rules. Backtesting for `VELOCITY_LIMIT` rules is generally + not supported. In specific cases (i.e. where Lithic has pre-calculated the + requested velocity metrics for historical transactions), a backtest may be feasible. However, such cases are uncommon and customers should not anticipate support for velocity backtests under most configurations. If a historical transaction does not feature the required inputs to evaluate the rule, then it diff --git a/src/lithic/resources/auth_rules/v2/v2.py b/src/lithic/resources/auth_rules/v2/v2.py index cb0d8182..df1f0c60 100644 --- a/src/lithic/resources/auth_rules/v2/v2.py +++ b/src/lithic/resources/auth_rules/v2/v2.py @@ -11,7 +11,7 @@ from .... import _legacy_response from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr -from ...._utils import required_args, maybe_transform, async_maybe_transform +from ...._utils import maybe_transform, async_maybe_transform from .backtests import ( Backtests, AsyncBacktests, @@ -74,10 +74,12 @@ def with_streaming_response(self) -> V2WithStreamingResponse: def create( self, *, - account_tokens: SequenceNotStr[str], + account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + business_account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | NotGiven = NOT_GIVEN, # 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. @@ -92,17 +94,23 @@ def create( 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. Effectively determines the event stream during which it - will be evaluated. + 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 + `event_stream` field. - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. - `VELOCITY_LIMIT`: AUTHORIZATION event stream. - `MERCHANT_LOCK`: AUTHORIZATION event stream. - - `CONDITIONAL_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. extra_headers: Send extra headers @@ -119,9 +127,10 @@ def create( self, *, card_tokens: SequenceNotStr[str], + event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | NotGiven = NOT_GIVEN, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | NotGiven = NOT_GIVEN, # 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. @@ -136,17 +145,21 @@ 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. Effectively determines the event stream during which it - will be evaluated. + 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 + `event_stream` field. - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. - `VELOCITY_LIMIT`: AUTHORIZATION event stream. - `MERCHANT_LOCK`: AUTHORIZATION event stream. - - `CONDITIONAL_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. extra_headers: Send extra headers @@ -163,10 +176,11 @@ def create( self, *, program_level: bool, + event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | NotGiven = NOT_GIVEN, excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | NotGiven = NOT_GIVEN, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | NotGiven = NOT_GIVEN, # 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. @@ -181,19 +195,23 @@ def create( 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 - type: The type of Auth Rule. Effectively determines the event stream during which it - will be evaluated. + 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 + `event_stream` field. - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. - `VELOCITY_LIMIT`: AUTHORIZATION event stream. - `MERCHANT_LOCK`: AUTHORIZATION event stream. - - `CONDITIONAL_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. extra_headers: Send extra headers @@ -205,14 +223,18 @@ def create( """ ... - @required_args(["account_tokens"], ["card_tokens"], ["program_level"]) def create( self, *, account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + business_account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, - parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters + | v2_create_params.CreateAuthRuleRequestCardTokensParameters + | v2_create_params.CreateAuthRuleRequestProgramLevelParameters + | NotGiven = NOT_GIVEN, + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | NotGiven = NOT_GIVEN, card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, program_level: bool | NotGiven = NOT_GIVEN, @@ -229,6 +251,8 @@ def create( body=maybe_transform( { "account_tokens": account_tokens, + "business_account_tokens": business_account_tokens, + "event_stream": event_stream, "name": name, "parameters": parameters, "type": type, @@ -282,7 +306,6 @@ def update( self, auth_rule_token: str, *, - account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -300,8 +323,46 @@ def update( entities. Args: - account_tokens: Account tokens to which the Auth Rule applies. + name: Auth Rule Name + state: The desired state of the Auth Rule. + + Note that only deactivating an Auth Rule through this endpoint is supported at + this time. If you need to (re-)activate an Auth Rule the /promote endpoint + should be used to promote a draft to the currently active version. + + 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 + """ + ... + + @overload + def update( + self, + auth_rule_token: str, + *, + name: Optional[str] | NotGiven = NOT_GIVEN, + state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN, + # 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, + ) -> V2UpdateResponse: + """ + Updates a V2 Auth rule's properties + + If `account_tokens`, `card_tokens`, `program_level`, or `excluded_card_tokens` + is provided, this will replace existing associations with the provided list of + entities. + + Args: name: Auth Rule Name state: The desired state of the Auth Rule. @@ -413,7 +474,6 @@ def update( self, auth_rule_token: str, *, - account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN, card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, @@ -432,7 +492,6 @@ def update( f"/v2/auth_rules/{auth_rule_token}", body=maybe_transform( { - "account_tokens": account_tokens, "name": name, "state": state, "card_tokens": card_tokens, @@ -451,11 +510,12 @@ def list( self, *, account_token: str | NotGiven = NOT_GIVEN, + business_account_token: str | NotGiven = NOT_GIVEN, card_token: str | NotGiven = NOT_GIVEN, ending_before: str | NotGiven = NOT_GIVEN, event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | NotGiven = NOT_GIVEN, page_size: int | NotGiven = NOT_GIVEN, - scope: Literal["PROGRAM", "ACCOUNT", "CARD", "ANY"] | NotGiven = NOT_GIVEN, + scope: Literal["PROGRAM", "ACCOUNT", "BUSINESS_ACCOUNT", "CARD", "ANY"] | NotGiven = NOT_GIVEN, starting_after: str | NotGiven = NOT_GIVEN, # 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. @@ -470,6 +530,8 @@ def list( Args: account_token: Only return Auth Rules that are bound to the provided account token. + business_account_token: Only return Auth Rules that are bound to the provided business account token. + card_token: Only return Auth Rules that are bound to the provided card token. ending_before: A cursor representing an item's token before which a page of results should end. @@ -503,6 +565,7 @@ def list( query=maybe_transform( { "account_token": account_token, + "business_account_token": business_account_token, "card_token": card_token, "ending_before": ending_before, "event_stream": event_stream, @@ -555,7 +618,8 @@ def apply( self, auth_rule_token: str, *, - account_tokens: SequenceNotStr[str], + account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + business_account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # 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, @@ -572,6 +636,8 @@ def apply( 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 @@ -652,12 +718,12 @@ def apply( ... @typing_extensions.deprecated("deprecated") - @required_args(["account_tokens"], ["card_tokens"], ["program_level"]) def apply( self, auth_rule_token: str, *, account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + business_account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, program_level: bool | NotGiven = NOT_GIVEN, excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, @@ -675,6 +741,7 @@ def 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, @@ -936,10 +1003,12 @@ def with_streaming_response(self) -> AsyncV2WithStreamingResponse: async def create( self, *, - account_tokens: SequenceNotStr[str], + account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + business_account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | NotGiven = NOT_GIVEN, # 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. @@ -954,17 +1023,23 @@ async def create( 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. Effectively determines the event stream during which it - will be evaluated. + 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 + `event_stream` field. - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. - `VELOCITY_LIMIT`: AUTHORIZATION event stream. - `MERCHANT_LOCK`: AUTHORIZATION event stream. - - `CONDITIONAL_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. extra_headers: Send extra headers @@ -981,9 +1056,10 @@ async def create( self, *, card_tokens: SequenceNotStr[str], + event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | NotGiven = NOT_GIVEN, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | NotGiven = NOT_GIVEN, # 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. @@ -998,17 +1074,21 @@ 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. Effectively determines the event stream during which it - will be evaluated. + 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 + `event_stream` field. - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. - `VELOCITY_LIMIT`: AUTHORIZATION event stream. - `MERCHANT_LOCK`: AUTHORIZATION event stream. - - `CONDITIONAL_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. extra_headers: Send extra headers @@ -1025,10 +1105,11 @@ async def create( self, *, program_level: bool, + event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | NotGiven = NOT_GIVEN, excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | NotGiven = NOT_GIVEN, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | NotGiven = NOT_GIVEN, # 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. @@ -1043,19 +1124,23 @@ async def create( 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 - type: The type of Auth Rule. Effectively determines the event stream during which it - will be evaluated. + 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 + `event_stream` field. - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. - `VELOCITY_LIMIT`: AUTHORIZATION event stream. - `MERCHANT_LOCK`: AUTHORIZATION event stream. - - `CONDITIONAL_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. extra_headers: Send extra headers @@ -1067,14 +1152,18 @@ async def create( """ ... - @required_args(["account_tokens"], ["card_tokens"], ["program_level"]) async def create( self, *, account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + business_account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, - parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN, - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters + | v2_create_params.CreateAuthRuleRequestCardTokensParameters + | v2_create_params.CreateAuthRuleRequestProgramLevelParameters + | NotGiven = NOT_GIVEN, + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] | NotGiven = NOT_GIVEN, card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, program_level: bool | NotGiven = NOT_GIVEN, @@ -1091,6 +1180,8 @@ async def create( body=await async_maybe_transform( { "account_tokens": account_tokens, + "business_account_tokens": business_account_tokens, + "event_stream": event_stream, "name": name, "parameters": parameters, "type": type, @@ -1144,7 +1235,6 @@ async def update( self, auth_rule_token: str, *, - account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1162,8 +1252,46 @@ async def update( entities. Args: - account_tokens: Account tokens to which the Auth Rule applies. + name: Auth Rule Name + state: The desired state of the Auth Rule. + + Note that only deactivating an Auth Rule through this endpoint is supported at + this time. If you need to (re-)activate an Auth Rule the /promote endpoint + should be used to promote a draft to the currently active version. + + 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 + """ + ... + + @overload + async def update( + self, + auth_rule_token: str, + *, + name: Optional[str] | NotGiven = NOT_GIVEN, + state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN, + # 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, + ) -> V2UpdateResponse: + """ + Updates a V2 Auth rule's properties + + If `account_tokens`, `card_tokens`, `program_level`, or `excluded_card_tokens` + is provided, this will replace existing associations with the provided list of + entities. + + Args: name: Auth Rule Name state: The desired state of the Auth Rule. @@ -1275,7 +1403,6 @@ async def update( self, auth_rule_token: str, *, - account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN, card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, @@ -1294,7 +1421,6 @@ async def update( f"/v2/auth_rules/{auth_rule_token}", body=await async_maybe_transform( { - "account_tokens": account_tokens, "name": name, "state": state, "card_tokens": card_tokens, @@ -1313,11 +1439,12 @@ def list( self, *, account_token: str | NotGiven = NOT_GIVEN, + business_account_token: str | NotGiven = NOT_GIVEN, card_token: str | NotGiven = NOT_GIVEN, ending_before: str | NotGiven = NOT_GIVEN, event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] | NotGiven = NOT_GIVEN, page_size: int | NotGiven = NOT_GIVEN, - scope: Literal["PROGRAM", "ACCOUNT", "CARD", "ANY"] | NotGiven = NOT_GIVEN, + scope: Literal["PROGRAM", "ACCOUNT", "BUSINESS_ACCOUNT", "CARD", "ANY"] | NotGiven = NOT_GIVEN, starting_after: str | NotGiven = NOT_GIVEN, # 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. @@ -1332,6 +1459,8 @@ def list( Args: account_token: Only return Auth Rules that are bound to the provided account token. + business_account_token: Only return Auth Rules that are bound to the provided business account token. + card_token: Only return Auth Rules that are bound to the provided card token. ending_before: A cursor representing an item's token before which a page of results should end. @@ -1365,6 +1494,7 @@ def list( query=maybe_transform( { "account_token": account_token, + "business_account_token": business_account_token, "card_token": card_token, "ending_before": ending_before, "event_stream": event_stream, @@ -1417,7 +1547,8 @@ async def apply( self, auth_rule_token: str, *, - account_tokens: SequenceNotStr[str], + account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + business_account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # 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, @@ -1434,6 +1565,8 @@ async def apply( 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 @@ -1514,12 +1647,12 @@ async def apply( ... @typing_extensions.deprecated("deprecated") - @required_args(["account_tokens"], ["card_tokens"], ["program_level"]) async def apply( self, auth_rule_token: str, *, account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + business_account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, program_level: bool | NotGiven = NOT_GIVEN, excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN, @@ -1537,6 +1670,7 @@ async def 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, diff --git a/src/lithic/resources/events/events.py b/src/lithic/resources/events/events.py index 7274460a..9c3433f4 100644 --- a/src/lithic/resources/events/events.py +++ b/src/lithic/resources/events/events.py @@ -127,6 +127,8 @@ def list( "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -394,6 +396,8 @@ def list( "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", diff --git a/src/lithic/resources/events/subscriptions.py b/src/lithic/resources/events/subscriptions.py index 8f456772..74f03478 100644 --- a/src/lithic/resources/events/subscriptions.py +++ b/src/lithic/resources/events/subscriptions.py @@ -79,6 +79,8 @@ def create( "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -216,6 +218,8 @@ def update( "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -659,6 +663,8 @@ def send_simulated_example( "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -772,6 +778,8 @@ async def create( "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -909,6 +917,8 @@ async def update( "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -1352,6 +1362,8 @@ async def send_simulated_example( "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", diff --git a/src/lithic/resources/external_bank_accounts/external_bank_accounts.py b/src/lithic/resources/external_bank_accounts/external_bank_accounts.py index 9613c792..3eeb7cbd 100644 --- a/src/lithic/resources/external_bank_accounts/external_bank_accounts.py +++ b/src/lithic/resources/external_bank_accounts/external_bank_accounts.py @@ -388,7 +388,7 @@ def create( account_token: str | NotGiven = NOT_GIVEN, address: ExternalBankAccountAddressParam | NotGiven = NOT_GIVEN, company_id: str | NotGiven = NOT_GIVEN, - dob: Union[str, date] | NotGiven = NOT_GIVEN, + dob: Union[str, date] | Union[str, date] | Union[str, date] | Union[str, date] | NotGiven = NOT_GIVEN, doing_business_as: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, user_defined_id: str | NotGiven = NOT_GIVEN, @@ -1031,7 +1031,7 @@ async def create( account_token: str | NotGiven = NOT_GIVEN, address: ExternalBankAccountAddressParam | NotGiven = NOT_GIVEN, company_id: str | NotGiven = NOT_GIVEN, - dob: Union[str, date] | NotGiven = NOT_GIVEN, + dob: Union[str, date] | Union[str, date] | Union[str, date] | Union[str, date] | NotGiven = NOT_GIVEN, doing_business_as: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, user_defined_id: str | NotGiven = NOT_GIVEN, diff --git a/src/lithic/types/account_activity_list_params.py b/src/lithic/types/account_activity_list_params.py index 888edb8b..a10e3424 100644 --- a/src/lithic/types/account_activity_list_params.py +++ b/src/lithic/types/account_activity_list_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Union +from typing import Union from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict @@ -59,7 +59,7 @@ class AccountActivityListParams(TypedDict, total=False): page_size: int """Page size (for pagination).""" - result: List[Literal["APPROVED", "DECLINED"]] + result: Literal["APPROVED", "DECLINED"] """Filter by transaction result""" starting_after: str @@ -69,5 +69,5 @@ class AccountActivityListParams(TypedDict, total=False): Used to retrieve the next page of results after this item. """ - status: List[Literal["DECLINED", "EXPIRED", "PENDING", "SETTLED", "VOIDED", "RETURNED", "REVERSED"]] + status: Literal["DECLINED", "EXPIRED", "PENDING", "RETURNED", "REVERSED", "SETTLED", "VOIDED"] """Filter by transaction status""" diff --git a/src/lithic/types/auth_rules/v2_apply_params.py b/src/lithic/types/auth_rules/v2_apply_params.py index 7e419964..b1018c00 100644 --- a/src/lithic/types/auth_rules/v2_apply_params.py +++ b/src/lithic/types/auth_rules/v2_apply_params.py @@ -16,9 +16,12 @@ class ApplyAuthRuleRequestAccountTokens(TypedDict, total=False): - account_tokens: Required[SequenceNotStr[str]] + 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]] diff --git a/src/lithic/types/auth_rules/v2_apply_response.py b/src/lithic/types/auth_rules/v2_apply_response.py index c42cfb03..c9ea273a 100644 --- a/src/lithic/types/auth_rules/v2_apply_response.py +++ b/src/lithic/types/auth_rules/v2_apply_response.py @@ -9,10 +9,125 @@ from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters -__all__ = ["V2ApplyResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] +__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", + "RISK_SCORE", + "CARD_TRANSACTION_COUNT_15M", + "CARD_TRANSACTION_COUNT_1H", + "CARD_TRANSACTION_COUNT_24H", + "CARD_STATE", + "PIN_ENTERED", + "PIN_STATUS", + "WALLET_TYPE", + "TRANSACTION_INITIATOR", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + CurrentVersionParametersConditionalAuthorizationActionParameters, ] @@ -27,8 +142,112 @@ class CurrentVersion(BaseModel): """ +class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): + attribute: Optional[ + Literal[ + "MCC", + "COUNTRY", + "CURRENCY", + "MERCHANT_ID", + "DESCRIPTOR", + "LIABILITY_SHIFT", + "PAN_ENTRY_MODE", + "TRANSACTION_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", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + DraftVersionParametersConditionalAuthorizationActionParameters, ] @@ -50,6 +269,9 @@ class V2ApplyResponse(BaseModel): 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.""" @@ -58,7 +280,7 @@ class V2ApplyResponse(BaseModel): draft_version: Optional[DraftVersion] = None event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] - """The type of event stream the Auth rule applies to.""" + """The event stream during which the rule will be evaluated.""" name: Optional[str] = None """Auth Rule Name""" @@ -69,15 +291,17 @@ class V2ApplyResponse(BaseModel): state: Literal["ACTIVE", "INACTIVE"] """The state of the Auth Rule""" - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] """The type of Auth Rule. - Effectively determines the event stream during which it will be evaluated. + 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_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. """ excluded_card_tokens: Optional[List[str]] = None diff --git a/src/lithic/types/auth_rules/v2_create_params.py b/src/lithic/types/auth_rules/v2_create_params.py index 5a937a3a..9ba733e4 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, Optional +from typing import Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr @@ -15,40 +15,155 @@ "V2CreateParams", "CreateAuthRuleRequestAccountTokens", "CreateAuthRuleRequestAccountTokensParameters", + "CreateAuthRuleRequestAccountTokensParametersConditionalAuthorizationActionParameters", + "CreateAuthRuleRequestAccountTokensParametersConditionalAuthorizationActionParametersCondition", "CreateAuthRuleRequestCardTokens", "CreateAuthRuleRequestCardTokensParameters", + "CreateAuthRuleRequestCardTokensParametersConditionalAuthorizationActionParameters", + "CreateAuthRuleRequestCardTokensParametersConditionalAuthorizationActionParametersCondition", "CreateAuthRuleRequestProgramLevel", "CreateAuthRuleRequestProgramLevelParameters", + "CreateAuthRuleRequestProgramLevelParametersConditionalAuthorizationActionParameters", + "CreateAuthRuleRequestProgramLevelParametersConditionalAuthorizationActionParametersCondition", ] class CreateAuthRuleRequestAccountTokens(TypedDict, total=False): - account_tokens: Required[SequenceNotStr[str]] + 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 """Parameters for the Auth Rule""" - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] """The type of Auth Rule. - Effectively determines the event stream during which it will be evaluated. + 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_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. """ +class CreateAuthRuleRequestAccountTokensParametersConditionalAuthorizationActionParametersCondition( + TypedDict, total=False +): + attribute: Literal[ + "MCC", + "COUNTRY", + "CURRENCY", + "MERCHANT_ID", + "DESCRIPTOR", + "LIABILITY_SHIFT", + "PAN_ENTRY_MODE", + "TRANSACTION_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", + ] + """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. + - `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`. + """ + + 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 CreateAuthRuleRequestAccountTokensParametersConditionalAuthorizationActionParameters(TypedDict, total=False): + action: Required[Literal["DECLINE", "CHALLENGE"]] + """The action to take if the conditions are met.""" + + conditions: Required[ + Iterable[CreateAuthRuleRequestAccountTokensParametersConditionalAuthorizationActionParametersCondition] + ] + + CreateAuthRuleRequestAccountTokensParameters: TypeAlias = Union[ ConditionalBlockParametersParam, VelocityLimitParamsParam, MerchantLockParametersParam, Conditional3DSActionParametersParam, + CreateAuthRuleRequestAccountTokensParametersConditionalAuthorizationActionParameters, ] @@ -56,29 +171,135 @@ class CreateAuthRuleRequestCardTokens(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 for the Auth Rule""" - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] """The type of Auth Rule. - Effectively determines the event stream during which it will be evaluated. + 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_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + """ + + +class CreateAuthRuleRequestCardTokensParametersConditionalAuthorizationActionParametersCondition( + TypedDict, total=False +): + attribute: Literal[ + "MCC", + "COUNTRY", + "CURRENCY", + "MERCHANT_ID", + "DESCRIPTOR", + "LIABILITY_SHIFT", + "PAN_ENTRY_MODE", + "TRANSACTION_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", + ] + """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. + - `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`. """ + 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] + ] + CreateAuthRuleRequestCardTokensParameters: TypeAlias = Union[ ConditionalBlockParametersParam, VelocityLimitParamsParam, MerchantLockParametersParam, Conditional3DSActionParametersParam, + CreateAuthRuleRequestCardTokensParametersConditionalAuthorizationActionParameters, ] @@ -86,6 +307,9 @@ class CreateAuthRuleRequestProgramLevel(TypedDict, total=False): 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.""" @@ -95,23 +319,126 @@ class CreateAuthRuleRequestProgramLevel(TypedDict, total=False): parameters: CreateAuthRuleRequestProgramLevelParameters """Parameters for the Auth Rule""" - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] """The type of Auth Rule. - Effectively determines the event stream during which it will be evaluated. + 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_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + """ + + +class CreateAuthRuleRequestProgramLevelParametersConditionalAuthorizationActionParametersCondition( + TypedDict, total=False +): + attribute: Literal[ + "MCC", + "COUNTRY", + "CURRENCY", + "MERCHANT_ID", + "DESCRIPTOR", + "LIABILITY_SHIFT", + "PAN_ENTRY_MODE", + "TRANSACTION_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", + ] + """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. + - `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`. """ + 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.""" + + conditions: Required[ + Iterable[CreateAuthRuleRequestProgramLevelParametersConditionalAuthorizationActionParametersCondition] + ] + CreateAuthRuleRequestProgramLevelParameters: TypeAlias = Union[ ConditionalBlockParametersParam, VelocityLimitParamsParam, MerchantLockParametersParam, Conditional3DSActionParametersParam, + CreateAuthRuleRequestProgramLevelParametersConditionalAuthorizationActionParameters, ] V2CreateParams: TypeAlias = Union[ diff --git a/src/lithic/types/auth_rules/v2_create_response.py b/src/lithic/types/auth_rules/v2_create_response.py index 20e0525c..4dc59976 100644 --- a/src/lithic/types/auth_rules/v2_create_response.py +++ b/src/lithic/types/auth_rules/v2_create_response.py @@ -9,10 +9,125 @@ from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters -__all__ = ["V2CreateResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] +__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", + "RISK_SCORE", + "CARD_TRANSACTION_COUNT_15M", + "CARD_TRANSACTION_COUNT_1H", + "CARD_TRANSACTION_COUNT_24H", + "CARD_STATE", + "PIN_ENTERED", + "PIN_STATUS", + "WALLET_TYPE", + "TRANSACTION_INITIATOR", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + CurrentVersionParametersConditionalAuthorizationActionParameters, ] @@ -27,8 +142,112 @@ class CurrentVersion(BaseModel): """ +class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): + attribute: Optional[ + Literal[ + "MCC", + "COUNTRY", + "CURRENCY", + "MERCHANT_ID", + "DESCRIPTOR", + "LIABILITY_SHIFT", + "PAN_ENTRY_MODE", + "TRANSACTION_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", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + DraftVersionParametersConditionalAuthorizationActionParameters, ] @@ -50,6 +269,9 @@ class V2CreateResponse(BaseModel): 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.""" @@ -58,7 +280,7 @@ class V2CreateResponse(BaseModel): draft_version: Optional[DraftVersion] = None event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] - """The type of event stream the Auth rule applies to.""" + """The event stream during which the rule will be evaluated.""" name: Optional[str] = None """Auth Rule Name""" @@ -69,15 +291,17 @@ class V2CreateResponse(BaseModel): state: Literal["ACTIVE", "INACTIVE"] """The state of the Auth Rule""" - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] """The type of Auth Rule. - Effectively determines the event stream during which it will be evaluated. + 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_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. """ excluded_card_tokens: Optional[List[str]] = None diff --git a/src/lithic/types/auth_rules/v2_draft_params.py b/src/lithic/types/auth_rules/v2_draft_params.py index 5b90b082..bb192efa 100644 --- a/src/lithic/types/auth_rules/v2_draft_params.py +++ b/src/lithic/types/auth_rules/v2_draft_params.py @@ -2,15 +2,21 @@ from __future__ import annotations -from typing import Union, Optional -from typing_extensions import TypeAlias, TypedDict +from typing import Union, Iterable, Optional +from typing_extensions import Literal, Required, 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 -__all__ = ["V2DraftParams", "Parameters"] +__all__ = [ + "V2DraftParams", + "Parameters", + "ParametersConditionalAuthorizationActionParameters", + "ParametersConditionalAuthorizationActionParametersCondition", +] class V2DraftParams(TypedDict, total=False): @@ -18,9 +24,106 @@ 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", + "RISK_SCORE", + "CARD_TRANSACTION_COUNT_15M", + "CARD_TRANSACTION_COUNT_1H", + "CARD_TRANSACTION_COUNT_24H", + "CARD_STATE", + "PIN_ENTERED", + "PIN_STATUS", + "WALLET_TYPE", + "TRANSACTION_INITIATOR", + ] + """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. + - `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`. + """ + + 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, ] diff --git a/src/lithic/types/auth_rules/v2_draft_response.py b/src/lithic/types/auth_rules/v2_draft_response.py index db688f4a..1411fe14 100644 --- a/src/lithic/types/auth_rules/v2_draft_response.py +++ b/src/lithic/types/auth_rules/v2_draft_response.py @@ -9,10 +9,125 @@ from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters -__all__ = ["V2DraftResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] +__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", + "RISK_SCORE", + "CARD_TRANSACTION_COUNT_15M", + "CARD_TRANSACTION_COUNT_1H", + "CARD_TRANSACTION_COUNT_24H", + "CARD_STATE", + "PIN_ENTERED", + "PIN_STATUS", + "WALLET_TYPE", + "TRANSACTION_INITIATOR", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + CurrentVersionParametersConditionalAuthorizationActionParameters, ] @@ -27,8 +142,112 @@ class CurrentVersion(BaseModel): """ +class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): + attribute: Optional[ + Literal[ + "MCC", + "COUNTRY", + "CURRENCY", + "MERCHANT_ID", + "DESCRIPTOR", + "LIABILITY_SHIFT", + "PAN_ENTRY_MODE", + "TRANSACTION_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", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + DraftVersionParametersConditionalAuthorizationActionParameters, ] @@ -50,6 +269,9 @@ class V2DraftResponse(BaseModel): 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.""" @@ -58,7 +280,7 @@ class V2DraftResponse(BaseModel): draft_version: Optional[DraftVersion] = None event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] - """The type of event stream the Auth rule applies to.""" + """The event stream during which the rule will be evaluated.""" name: Optional[str] = None """Auth Rule Name""" @@ -69,15 +291,17 @@ class V2DraftResponse(BaseModel): state: Literal["ACTIVE", "INACTIVE"] """The state of the Auth Rule""" - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] """The type of Auth Rule. - Effectively determines the event stream during which it will be evaluated. + 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_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. """ excluded_card_tokens: Optional[List[str]] = None diff --git a/src/lithic/types/auth_rules/v2_list_params.py b/src/lithic/types/auth_rules/v2_list_params.py index bce8a93f..93c52b10 100644 --- a/src/lithic/types/auth_rules/v2_list_params.py +++ b/src/lithic/types/auth_rules/v2_list_params.py @@ -11,6 +11,9 @@ class V2ListParams(TypedDict, total=False): account_token: str """Only return Auth Rules that are bound to the provided account token.""" + business_account_token: str + """Only return Auth Rules that are bound to the provided business account token.""" + card_token: str """Only return Auth Rules that are bound to the provided card token.""" @@ -26,7 +29,7 @@ class V2ListParams(TypedDict, total=False): page_size: int """Page size (for pagination).""" - scope: Literal["PROGRAM", "ACCOUNT", "CARD", "ANY"] + scope: Literal["PROGRAM", "ACCOUNT", "BUSINESS_ACCOUNT", "CARD", "ANY"] """Only return Auth Rules that are bound to the provided scope.""" starting_after: str diff --git a/src/lithic/types/auth_rules/v2_list_response.py b/src/lithic/types/auth_rules/v2_list_response.py index 48b3e1af..bd76ba80 100644 --- a/src/lithic/types/auth_rules/v2_list_response.py +++ b/src/lithic/types/auth_rules/v2_list_response.py @@ -9,10 +9,125 @@ from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters -__all__ = ["V2ListResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] +__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", + "RISK_SCORE", + "CARD_TRANSACTION_COUNT_15M", + "CARD_TRANSACTION_COUNT_1H", + "CARD_TRANSACTION_COUNT_24H", + "CARD_STATE", + "PIN_ENTERED", + "PIN_STATUS", + "WALLET_TYPE", + "TRANSACTION_INITIATOR", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + CurrentVersionParametersConditionalAuthorizationActionParameters, ] @@ -27,8 +142,112 @@ class CurrentVersion(BaseModel): """ +class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): + attribute: Optional[ + Literal[ + "MCC", + "COUNTRY", + "CURRENCY", + "MERCHANT_ID", + "DESCRIPTOR", + "LIABILITY_SHIFT", + "PAN_ENTRY_MODE", + "TRANSACTION_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", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + DraftVersionParametersConditionalAuthorizationActionParameters, ] @@ -50,6 +269,9 @@ class V2ListResponse(BaseModel): 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.""" @@ -58,7 +280,7 @@ class V2ListResponse(BaseModel): draft_version: Optional[DraftVersion] = None event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] - """The type of event stream the Auth rule applies to.""" + """The event stream during which the rule will be evaluated.""" name: Optional[str] = None """Auth Rule Name""" @@ -69,15 +291,17 @@ class V2ListResponse(BaseModel): state: Literal["ACTIVE", "INACTIVE"] """The state of the Auth Rule""" - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] """The type of Auth Rule. - Effectively determines the event stream during which it will be evaluated. + 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_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. """ excluded_card_tokens: Optional[List[str]] = None diff --git a/src/lithic/types/auth_rules/v2_promote_response.py b/src/lithic/types/auth_rules/v2_promote_response.py index e6a1159f..78681e67 100644 --- a/src/lithic/types/auth_rules/v2_promote_response.py +++ b/src/lithic/types/auth_rules/v2_promote_response.py @@ -9,10 +9,125 @@ from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters -__all__ = ["V2PromoteResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] +__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", + "RISK_SCORE", + "CARD_TRANSACTION_COUNT_15M", + "CARD_TRANSACTION_COUNT_1H", + "CARD_TRANSACTION_COUNT_24H", + "CARD_STATE", + "PIN_ENTERED", + "PIN_STATUS", + "WALLET_TYPE", + "TRANSACTION_INITIATOR", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + CurrentVersionParametersConditionalAuthorizationActionParameters, ] @@ -27,8 +142,112 @@ class CurrentVersion(BaseModel): """ +class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): + attribute: Optional[ + Literal[ + "MCC", + "COUNTRY", + "CURRENCY", + "MERCHANT_ID", + "DESCRIPTOR", + "LIABILITY_SHIFT", + "PAN_ENTRY_MODE", + "TRANSACTION_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", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + DraftVersionParametersConditionalAuthorizationActionParameters, ] @@ -50,6 +269,9 @@ class V2PromoteResponse(BaseModel): 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.""" @@ -58,7 +280,7 @@ class V2PromoteResponse(BaseModel): draft_version: Optional[DraftVersion] = None event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] - """The type of event stream the Auth rule applies to.""" + """The event stream during which the rule will be evaluated.""" name: Optional[str] = None """Auth Rule Name""" @@ -69,15 +291,17 @@ class V2PromoteResponse(BaseModel): state: Literal["ACTIVE", "INACTIVE"] """The state of the Auth Rule""" - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] """The type of Auth Rule. - Effectively determines the event stream during which it will be evaluated. + 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_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. """ excluded_card_tokens: Optional[List[str]] = None diff --git a/src/lithic/types/auth_rules/v2_retrieve_response.py b/src/lithic/types/auth_rules/v2_retrieve_response.py index bb055733..05dd5847 100644 --- a/src/lithic/types/auth_rules/v2_retrieve_response.py +++ b/src/lithic/types/auth_rules/v2_retrieve_response.py @@ -9,10 +9,125 @@ from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters -__all__ = ["V2RetrieveResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] +__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", + "RISK_SCORE", + "CARD_TRANSACTION_COUNT_15M", + "CARD_TRANSACTION_COUNT_1H", + "CARD_TRANSACTION_COUNT_24H", + "CARD_STATE", + "PIN_ENTERED", + "PIN_STATUS", + "WALLET_TYPE", + "TRANSACTION_INITIATOR", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + CurrentVersionParametersConditionalAuthorizationActionParameters, ] @@ -27,8 +142,112 @@ class CurrentVersion(BaseModel): """ +class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): + attribute: Optional[ + Literal[ + "MCC", + "COUNTRY", + "CURRENCY", + "MERCHANT_ID", + "DESCRIPTOR", + "LIABILITY_SHIFT", + "PAN_ENTRY_MODE", + "TRANSACTION_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", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + DraftVersionParametersConditionalAuthorizationActionParameters, ] @@ -50,6 +269,9 @@ class V2RetrieveResponse(BaseModel): 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.""" @@ -58,7 +280,7 @@ class V2RetrieveResponse(BaseModel): draft_version: Optional[DraftVersion] = None event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] - """The type of event stream the Auth rule applies to.""" + """The event stream during which the rule will be evaluated.""" name: Optional[str] = None """Auth Rule Name""" @@ -69,15 +291,17 @@ class V2RetrieveResponse(BaseModel): state: Literal["ACTIVE", "INACTIVE"] """The state of the Auth Rule""" - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] """The type of Auth Rule. - Effectively determines the event stream during which it will be evaluated. + 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_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. """ excluded_card_tokens: Optional[List[str]] = None diff --git a/src/lithic/types/auth_rules/v2_update_params.py b/src/lithic/types/auth_rules/v2_update_params.py index 306a4236..2e886523 100644 --- a/src/lithic/types/auth_rules/v2_update_params.py +++ b/src/lithic/types/auth_rules/v2_update_params.py @@ -7,13 +7,23 @@ from ..._types import SequenceNotStr -__all__ = ["V2UpdateParams", "AccountLevelRule", "CardLevelRule", "ProgramLevelRule"] +__all__ = ["V2UpdateParams", "Variant0", "Variant1", "CardLevelRule", "ProgramLevelRule"] -class AccountLevelRule(TypedDict, total=False): - account_tokens: SequenceNotStr[str] - """Account tokens to which the Auth Rule applies.""" +class Variant0(TypedDict, total=False): + name: Optional[str] + """Auth Rule Name""" + + state: Literal["INACTIVE"] + """The desired state of the Auth Rule. + + Note that only deactivating an Auth Rule through this endpoint is supported at + this time. If you need to (re-)activate an Auth Rule the /promote endpoint + should be used to promote a draft to the currently active version. + """ + +class Variant1(TypedDict, total=False): name: Optional[str] """Auth Rule Name""" @@ -61,4 +71,4 @@ class ProgramLevelRule(TypedDict, total=False): """ -V2UpdateParams: TypeAlias = Union[AccountLevelRule, CardLevelRule, ProgramLevelRule] +V2UpdateParams: TypeAlias = Union[Variant0, Variant1, CardLevelRule, ProgramLevelRule] diff --git a/src/lithic/types/auth_rules/v2_update_response.py b/src/lithic/types/auth_rules/v2_update_response.py index 17494042..d7626eac 100644 --- a/src/lithic/types/auth_rules/v2_update_response.py +++ b/src/lithic/types/auth_rules/v2_update_response.py @@ -9,10 +9,125 @@ from .conditional_block_parameters import ConditionalBlockParameters from .conditional_3ds_action_parameters import Conditional3DSActionParameters -__all__ = ["V2UpdateResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"] +__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", + "RISK_SCORE", + "CARD_TRANSACTION_COUNT_15M", + "CARD_TRANSACTION_COUNT_1H", + "CARD_TRANSACTION_COUNT_24H", + "CARD_STATE", + "PIN_ENTERED", + "PIN_STATUS", + "WALLET_TYPE", + "TRANSACTION_INITIATOR", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + CurrentVersionParametersConditionalAuthorizationActionParameters, ] @@ -27,8 +142,112 @@ class CurrentVersion(BaseModel): """ +class DraftVersionParametersConditionalAuthorizationActionParametersCondition(BaseModel): + attribute: Optional[ + Literal[ + "MCC", + "COUNTRY", + "CURRENCY", + "MERCHANT_ID", + "DESCRIPTOR", + "LIABILITY_SHIFT", + "PAN_ENTRY_MODE", + "TRANSACTION_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", + ] + ] = 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. + - `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`. + """ + + 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 + ConditionalBlockParameters, + VelocityLimitParams, + MerchantLockParameters, + Conditional3DSActionParameters, + DraftVersionParametersConditionalAuthorizationActionParameters, ] @@ -50,6 +269,9 @@ class V2UpdateResponse(BaseModel): 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.""" @@ -58,7 +280,7 @@ class V2UpdateResponse(BaseModel): draft_version: Optional[DraftVersion] = None event_stream: Literal["AUTHORIZATION", "THREE_DS_AUTHENTICATION"] - """The type of event stream the Auth rule applies to.""" + """The event stream during which the rule will be evaluated.""" name: Optional[str] = None """Auth Rule Name""" @@ -69,15 +291,17 @@ class V2UpdateResponse(BaseModel): state: Literal["ACTIVE", "INACTIVE"] """The state of the Auth Rule""" - type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"] + type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_ACTION"] """The type of Auth Rule. - Effectively determines the event stream during which it will be evaluated. + 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_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream. + - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. """ excluded_card_tokens: Optional[List[str]] = None diff --git a/src/lithic/types/event.py b/src/lithic/types/event.py index 33e42192..a2c3a119 100644 --- a/src/lithic/types/event.py +++ b/src/lithic/types/event.py @@ -39,6 +39,8 @@ class Event(BaseModel): "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", @@ -83,6 +85,8 @@ class Event(BaseModel): - `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 diff --git a/src/lithic/types/event_list_params.py b/src/lithic/types/event_list_params.py index 4283c093..74a0f10e 100644 --- a/src/lithic/types/event_list_params.py +++ b/src/lithic/types/event_list_params.py @@ -51,6 +51,8 @@ class EventListParams(TypedDict, total=False): "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", diff --git a/src/lithic/types/event_subscription.py b/src/lithic/types/event_subscription.py index 30e2bfb0..ddc838fc 100644 --- a/src/lithic/types/event_subscription.py +++ b/src/lithic/types/event_subscription.py @@ -42,6 +42,8 @@ class EventSubscription(BaseModel): "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", diff --git a/src/lithic/types/events/subscription_create_params.py b/src/lithic/types/events/subscription_create_params.py index 4d29dcec..3d523cd7 100644 --- a/src/lithic/types/events/subscription_create_params.py +++ b/src/lithic/types/events/subscription_create_params.py @@ -39,6 +39,8 @@ class SubscriptionCreateParams(TypedDict, total=False): "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", 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 436e9f7d..9e9ecbf8 100644 --- a/src/lithic/types/events/subscription_send_simulated_example_params.py +++ b/src/lithic/types/events/subscription_send_simulated_example_params.py @@ -28,6 +28,8 @@ class SubscriptionSendSimulatedExampleParams(TypedDict, total=False): "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", diff --git a/src/lithic/types/events/subscription_update_params.py b/src/lithic/types/events/subscription_update_params.py index 9c0b7283..03a65dd9 100644 --- a/src/lithic/types/events/subscription_update_params.py +++ b/src/lithic/types/events/subscription_update_params.py @@ -39,6 +39,8 @@ class SubscriptionUpdateParams(TypedDict, total=False): "digital_wallet.tokenization_updated", "dispute.updated", "dispute_evidence.upload_failed", + "dispute_transaction.created", + "dispute_transaction.updated", "external_bank_account.created", "external_bank_account.updated", "external_payment.created", diff --git a/src/lithic/types/three_ds/authentication_retrieve_response.py b/src/lithic/types/three_ds/authentication_retrieve_response.py index 95ae8a51..c96d5ec9 100644 --- a/src/lithic/types/three_ds/authentication_retrieve_response.py +++ b/src/lithic/types/three_ds/authentication_retrieve_response.py @@ -187,32 +187,39 @@ class MerchantRiskIndicator(BaseModel): class Merchant(BaseModel): - id: str + risk_indicator: MerchantRiskIndicator + """ + Object containing additional data indicating additional risk factors related to + the e-commerce transaction. + """ + + id: Optional[str] = None """Merchant identifier as assigned by the acquirer. - Maps to EMV 3DS field `acquirerMerchantId`. + Maps to EMV 3DS field `acquirerMerchantId`. May not be present for non-payment + authentications. """ - country: str + country: Optional[str] = None """Country code of the merchant requesting 3DS authentication. Maps to EMV 3DS field `merchantCountryCode`. Permitted values: ISO 3166-1 - alpha-3 country code (e.g., USA). + alpha-3 country code (e.g., USA). May not be present for non-payment + authentications. """ - mcc: str + mcc: Optional[str] = None """ Merchant category code assigned to the merchant that describes its business - activity type. Maps to EMV 3DS field `mcc`. + activity type. Maps to EMV 3DS field `mcc`. May not be present for non-payment + authentications. """ - name: str - """Name of the merchant. Maps to EMV 3DS field `merchantName`.""" + name: Optional[str] = None + """Name of the merchant. - risk_indicator: MerchantRiskIndicator - """ - Object containing additional data indicating additional risk factors related to - the e-commerce transaction. + Maps to EMV 3DS field `merchantName`. May not be present for non-payment + authentications. """ diff --git a/src/lithic/types/transaction.py b/src/lithic/types/transaction.py index e3e7b3a8..0c24ad67 100644 --- a/src/lithic/types/transaction.py +++ b/src/lithic/types/transaction.py @@ -480,6 +480,7 @@ class EventRuleResult(BaseModel): "ACCOUNT_INACTIVE", "ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED", "ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED", + "ACCOUNT_PAUSED", "ACCOUNT_UNDER_REVIEW", "ADDRESS_INCORRECT", "APPROVED", @@ -590,6 +591,7 @@ class Event(BaseModel): "ACCOUNT_INACTIVE", "ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED", "ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED", + "ACCOUNT_PAUSED", "ACCOUNT_UNDER_REVIEW", "ADDRESS_INCORRECT", "APPROVED", @@ -657,6 +659,7 @@ class Event(BaseModel): """ result: Literal[ + "ACCOUNT_PAUSED", "ACCOUNT_STATE_TRANSACTION_FAIL", "APPROVED", "BANK_CONNECTION_ERROR", @@ -789,6 +792,7 @@ class Transaction(BaseModel): pos: Pos result: Literal[ + "ACCOUNT_PAUSED", "ACCOUNT_STATE_TRANSACTION_FAIL", "APPROVED", "BANK_CONNECTION_ERROR", diff --git a/tests/api_resources/auth_rules/test_v2.py b/tests/api_resources/auth_rules/test_v2.py index 92fe418a..2cf7c36e 100644 --- a/tests/api_resources/auth_rules/test_v2.py +++ b/tests/api_resources/auth_rules/test_v2.py @@ -33,15 +33,15 @@ class TestV2: @parametrize def test_method_create_overload_1(self, client: Lithic) -> None: - v2 = client.auth_rules.v2.create( - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) + v2 = client.auth_rules.v2.create() 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": [ @@ -58,9 +58,7 @@ def test_method_create_with_all_params_overload_1(self, client: Lithic) -> None: @parametrize def test_raw_response_create_overload_1(self, client: Lithic) -> None: - response = client.auth_rules.v2.with_raw_response.create( - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) + response = client.auth_rules.v2.with_raw_response.create() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -69,9 +67,7 @@ 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( - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) as response: + with client.auth_rules.v2.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -91,6 +87,7 @@ 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": [ @@ -140,6 +137,7 @@ def test_method_create_overload_3(self, client: Lithic) -> None: 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={ @@ -228,7 +226,6 @@ def test_method_update_overload_1(self, client: Lithic) -> None: def test_method_update_with_all_params_overload_1(self, client: Lithic) -> None: v2 = client.auth_rules.v2.update( auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], name="name", state="INACTIVE", ) @@ -276,7 +273,6 @@ def test_method_update_overload_2(self, client: Lithic) -> None: def test_method_update_with_all_params_overload_2(self, client: Lithic) -> None: v2 = client.auth_rules.v2.update( auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], name="name", state="INACTIVE", ) @@ -324,9 +320,8 @@ def test_method_update_overload_3(self, client: Lithic) -> None: def test_method_update_with_all_params_overload_3(self, client: Lithic) -> None: v2 = client.auth_rules.v2.update( auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - excluded_card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], name="name", - program_level=True, state="INACTIVE", ) assert_matches_type(V2UpdateResponse, v2, path=["response"]) @@ -362,6 +357,55 @@ def test_path_params_update_overload_3(self, client: Lithic) -> None: auth_rule_token="", ) + @parametrize + def test_method_update_overload_4(self, client: Lithic) -> None: + v2 = client.auth_rules.v2.update( + auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(V2UpdateResponse, v2, path=["response"]) + + @parametrize + def test_method_update_with_all_params_overload_4(self, client: Lithic) -> None: + v2 = client.auth_rules.v2.update( + auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + excluded_card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + name="name", + program_level=True, + state="INACTIVE", + ) + assert_matches_type(V2UpdateResponse, v2, path=["response"]) + + @parametrize + def test_raw_response_update_overload_4(self, client: Lithic) -> None: + response = client.auth_rules.v2.with_raw_response.update( + 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(V2UpdateResponse, v2, path=["response"]) + + @parametrize + def test_streaming_response_update_overload_4(self, client: Lithic) -> None: + with client.auth_rules.v2.with_streaming_response.update( + 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(V2UpdateResponse, v2, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update_overload_4(self, client: Lithic) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `auth_rule_token` but received ''"): + client.auth_rules.v2.with_raw_response.update( + auth_rule_token="", + ) + @parametrize def test_method_list(self, client: Lithic) -> None: v2 = client.auth_rules.v2.list() @@ -371,6 +415,7 @@ def test_method_list(self, client: Lithic) -> None: def test_method_list_with_all_params(self, client: Lithic) -> None: v2 = client.auth_rules.v2.list( 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", event_stream="AUTHORIZATION", @@ -440,10 +485,20 @@ 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"]) @@ -453,7 +508,6 @@ 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", - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], ) assert response.is_closed is True @@ -466,7 +520,6 @@ 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", - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -482,7 +535,6 @@ def test_path_params_apply_overload_1(self, client: Lithic) -> None: 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="", - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], ) @parametrize @@ -779,15 +831,15 @@ class TestAsyncV2: @parametrize async def test_method_create_overload_1(self, async_client: AsyncLithic) -> None: - v2 = await async_client.auth_rules.v2.create( - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) + v2 = await async_client.auth_rules.v2.create() 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": [ @@ -804,9 +856,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn @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( - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) + response = await async_client.auth_rules.v2.with_raw_response.create() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -815,9 +865,7 @@ 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( - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) as response: + async with async_client.auth_rules.v2.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -837,6 +885,7 @@ 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": [ @@ -886,6 +935,7 @@ async def test_method_create_overload_3(self, async_client: AsyncLithic) -> None 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={ @@ -974,7 +1024,6 @@ async def test_method_update_overload_1(self, async_client: AsyncLithic) -> None async def test_method_update_with_all_params_overload_1(self, async_client: AsyncLithic) -> None: v2 = await async_client.auth_rules.v2.update( auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], name="name", state="INACTIVE", ) @@ -1022,7 +1071,6 @@ async def test_method_update_overload_2(self, async_client: AsyncLithic) -> None async def test_method_update_with_all_params_overload_2(self, async_client: AsyncLithic) -> None: v2 = await async_client.auth_rules.v2.update( auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], name="name", state="INACTIVE", ) @@ -1070,9 +1118,8 @@ async def test_method_update_overload_3(self, async_client: AsyncLithic) -> None async def test_method_update_with_all_params_overload_3(self, async_client: AsyncLithic) -> None: v2 = await async_client.auth_rules.v2.update( auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - excluded_card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], name="name", - program_level=True, state="INACTIVE", ) assert_matches_type(V2UpdateResponse, v2, path=["response"]) @@ -1108,6 +1155,55 @@ async def test_path_params_update_overload_3(self, async_client: AsyncLithic) -> auth_rule_token="", ) + @parametrize + async def test_method_update_overload_4(self, async_client: AsyncLithic) -> None: + v2 = await async_client.auth_rules.v2.update( + auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(V2UpdateResponse, v2, path=["response"]) + + @parametrize + async def test_method_update_with_all_params_overload_4(self, async_client: AsyncLithic) -> None: + v2 = await async_client.auth_rules.v2.update( + auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + excluded_card_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + name="name", + program_level=True, + state="INACTIVE", + ) + assert_matches_type(V2UpdateResponse, v2, path=["response"]) + + @parametrize + async def test_raw_response_update_overload_4(self, async_client: AsyncLithic) -> None: + response = await async_client.auth_rules.v2.with_raw_response.update( + 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(V2UpdateResponse, v2, path=["response"]) + + @parametrize + async def test_streaming_response_update_overload_4(self, async_client: AsyncLithic) -> None: + async with async_client.auth_rules.v2.with_streaming_response.update( + 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(V2UpdateResponse, v2, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update_overload_4(self, async_client: AsyncLithic) -> None: + 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.update( + auth_rule_token="", + ) + @parametrize async def test_method_list(self, async_client: AsyncLithic) -> None: v2 = await async_client.auth_rules.v2.list() @@ -1117,6 +1213,7 @@ async def test_method_list(self, async_client: AsyncLithic) -> None: async def test_method_list_with_all_params(self, async_client: AsyncLithic) -> None: v2 = await async_client.auth_rules.v2.list( 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", event_stream="AUTHORIZATION", @@ -1186,10 +1283,20 @@ 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"]) @@ -1199,7 +1306,6 @@ async def test_raw_response_apply_overload_1(self, async_client: AsyncLithic) -> with pytest.warns(DeprecationWarning): response = await async_client.auth_rules.v2.with_raw_response.apply( auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], ) assert response.is_closed is True @@ -1212,7 +1318,6 @@ async def test_streaming_response_apply_overload_1(self, async_client: AsyncLith with pytest.warns(DeprecationWarning): async with async_client.auth_rules.v2.with_streaming_response.apply( auth_rule_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1228,7 +1333,6 @@ async def test_path_params_apply_overload_1(self, async_client: AsyncLithic) -> 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="", - account_tokens=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], ) @parametrize diff --git a/tests/api_resources/test_account_activity.py b/tests/api_resources/test_account_activity.py index bc44c2c7..f4af2163 100644 --- a/tests/api_resources/test_account_activity.py +++ b/tests/api_resources/test_account_activity.py @@ -38,9 +38,9 @@ def test_method_list_with_all_params(self, client: Lithic) -> None: ending_before="ending_before", financial_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", page_size=1, - result=["APPROVED"], + result="APPROVED", starting_after="starting_after", - status=["DECLINED"], + status="DECLINED", ) assert_matches_type(SyncCursorPage[AccountActivityListResponse], account_activity, path=["response"]) @@ -124,9 +124,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncLithic) -> N ending_before="ending_before", financial_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", page_size=1, - result=["APPROVED"], + result="APPROVED", starting_after="starting_after", - status=["DECLINED"], + status="DECLINED", ) assert_matches_type(AsyncCursorPage[AccountActivityListResponse], account_activity, path=["response"]) diff --git a/tests/test_client.py b/tests/test_client.py index 45231afb..975f34b8 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -6,13 +6,10 @@ import os import sys import json -import time import asyncio import inspect -import subprocess import tracemalloc from typing import Any, Union, cast -from textwrap import dedent from unittest import mock from typing_extensions import Literal @@ -23,14 +20,17 @@ from lithic import Lithic, AsyncLithic, APIResponseValidationError from lithic._types import Omit +from lithic._utils import asyncify from lithic._models import BaseModel, FinalRequestOptions from lithic._exceptions import LithicError, APIStatusError, APITimeoutError, APIResponseValidationError from lithic._base_client import ( DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, + OtherPlatform, DefaultHttpxClient, DefaultAsyncHttpxClient, + get_platform, make_request_options, ) @@ -1696,50 +1696,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert response.retries_taken == failures_before_success assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success - def test_get_platform(self) -> None: - # A previous implementation of asyncify could leave threads unterminated when - # used with nest_asyncio. - # - # Since nest_asyncio.apply() is global and cannot be un-applied, this - # test is run in a separate process to avoid affecting other tests. - test_code = dedent(""" - import asyncio - import nest_asyncio - import threading - - from lithic._utils import asyncify - from lithic._base_client import get_platform - - async def test_main() -> None: - result = await asyncify(get_platform)() - print(result) - for thread in threading.enumerate(): - print(thread.name) - - nest_asyncio.apply() - asyncio.run(test_main()) - """) - with subprocess.Popen( - [sys.executable, "-c", test_code], - text=True, - ) as process: - timeout = 10 # seconds - - start_time = time.monotonic() - while True: - return_code = process.poll() - if return_code is not None: - if return_code != 0: - raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") - - # success - break - - if time.monotonic() - start_time > timeout: - process.kill() - raise AssertionError("calling get_platform using asyncify resulted in a hung process") - - time.sleep(0.1) + async def test_get_platform(self) -> None: + platform = await asyncify(get_platform)() + assert isinstance(platform, (str, OtherPlatform)) async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly