diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 368100f1..f24634e6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.81.1" + ".": "0.82.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a1625035..c2e506e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,58 @@ # Changelog +## 0.82.0 (2025-01-21) + +Full Changelog: [v0.81.1...v0.82.0](https://github.com/lithic-com/lithic-python/compare/v0.81.1...v0.82.0) + +### ⚠ BREAKING CHANGES + +* **types:** improve auth rules types ([#671](https://github.com/lithic-com/lithic-python/issues/671)) +* **api:** removes AccountHolder `resubmit` endpoint and `KYC_ADVANCED` workflow ([#659](https://github.com/lithic-com/lithic-python/issues/659)) + +### Features + +* **api:** removes AccountHolder `resubmit` endpoint and `KYC_ADVANCED` workflow ([#659](https://github.com/lithic-com/lithic-python/issues/659)) ([8b181ca](https://github.com/lithic-com/lithic-python/commit/8b181ca9ab1e09309d22f0c2de9ec41cb6b448dc)) +* generate more types that are used as request bodies ([#649](https://github.com/lithic-com/lithic-python/issues/649)) ([413bb22](https://github.com/lithic-com/lithic-python/commit/413bb22511b1f28190eae3da910bac35fb1de841)) +* **types:** improve auth rules types ([#671](https://github.com/lithic-com/lithic-python/issues/671)) ([5748bc0](https://github.com/lithic-com/lithic-python/commit/5748bc033592204bc983d8adea36df51b59671df)) + + +### Bug Fixes + +* **client:** only call .close() when needed ([#664](https://github.com/lithic-com/lithic-python/issues/664)) ([f6528df](https://github.com/lithic-com/lithic-python/commit/f6528dfd841d00157a50c9b0dbd9e4a61baae530)) +* correctly handle deserialising `cls` fields ([#668](https://github.com/lithic-com/lithic-python/issues/668)) ([2ce887f](https://github.com/lithic-com/lithic-python/commit/2ce887f68604500c0c7ff0f5a0a3e2da6f9f7d02)) +* reuse model in pagination items type ([#679](https://github.com/lithic-com/lithic-python/issues/679)) ([150965a](https://github.com/lithic-com/lithic-python/commit/150965ac048661778ba5becd99cdcde0903d5e71)) +* **tests:** make test_get_platform less flaky ([#675](https://github.com/lithic-com/lithic-python/issues/675)) ([2dff4e0](https://github.com/lithic-com/lithic-python/commit/2dff4e0609c7226f61d7ff503c3d9a6abe08f895)) + + +### Chores + +* add back compat aliases for LineItemListResponse ([1e7eb6d](https://github.com/lithic-com/lithic-python/commit/1e7eb6daf16f95888ff30f020f954afd0faf55a3)) +* add missing isclass check ([#661](https://github.com/lithic-com/lithic-python/issues/661)) ([e572151](https://github.com/lithic-com/lithic-python/commit/e572151d763b4ef9a27748bc0f6ddc088e35b29b)) +* **api:** new ConvertPhysical endpoint to convert a virtual card to a physical card ([#656](https://github.com/lithic-com/lithic-python/issues/656)) ([6412dcd](https://github.com/lithic-com/lithic-python/commit/6412dcd78bae44cd35a742c357ec1e56948144e1)) +* **api:** updates to documentation and additional filter for status on Transactions ([#669](https://github.com/lithic-com/lithic-python/issues/669)) ([2e69678](https://github.com/lithic-com/lithic-python/commit/2e69678de96264a5d2ba7b38cf07ffa76823e3f1)) +* bump license year ([#660](https://github.com/lithic-com/lithic-python/issues/660)) ([b76a630](https://github.com/lithic-com/lithic-python/commit/b76a6307f08bc628e382638e33f07cac12160826)) +* **docs:** updates documentation for DPANs ([#677](https://github.com/lithic-com/lithic-python/issues/677)) ([1fd8a18](https://github.com/lithic-com/lithic-python/commit/1fd8a184d28568eb4990a73746c440889325b6fa)) +* **internal:** add support for TypeAliasType ([#652](https://github.com/lithic-com/lithic-python/issues/652)) ([988f2a0](https://github.com/lithic-com/lithic-python/commit/988f2a016c98cef5a3558c08f8568af27776a0fb)) +* **internal:** avoid pytest-asyncio deprecation warning ([#676](https://github.com/lithic-com/lithic-python/issues/676)) ([f1a31f3](https://github.com/lithic-com/lithic-python/commit/f1a31f34ebe689b048f889b3ef0d470dc5defda4)) +* **internal:** bump httpx dependency ([#662](https://github.com/lithic-com/lithic-python/issues/662)) ([767729e](https://github.com/lithic-com/lithic-python/commit/767729e44232516426fc018e9189e9a8d2ab48c5)) +* **internal:** bump pyright ([#651](https://github.com/lithic-com/lithic-python/issues/651)) ([1406b81](https://github.com/lithic-com/lithic-python/commit/1406b81f7ca5e58d787afa86b723f4f271d361a4)) +* **internal:** bump pyright dependency ([#672](https://github.com/lithic-com/lithic-python/issues/672)) ([77a255c](https://github.com/lithic-com/lithic-python/commit/77a255cb547c13d3b87127d096f628513dceb63f)) +* **internal:** fix some typos ([#658](https://github.com/lithic-com/lithic-python/issues/658)) ([79baa5d](https://github.com/lithic-com/lithic-python/commit/79baa5d8fa228ee9f9575e264b8022e2c609f44a)) +* **internal:** minor style changes ([#680](https://github.com/lithic-com/lithic-python/issues/680)) ([b1fb9fb](https://github.com/lithic-com/lithic-python/commit/b1fb9fbbe878bb1779db0ca23959565dcff929e1)) +* **internal:** remove some duplicated imports ([#653](https://github.com/lithic-com/lithic-python/issues/653)) ([c446d74](https://github.com/lithic-com/lithic-python/commit/c446d74a9fd059d45d93966dd63894a68a76a965)) +* **internal:** update deps ([#670](https://github.com/lithic-com/lithic-python/issues/670)) ([2eddffd](https://github.com/lithic-com/lithic-python/commit/2eddffdab2e6180f9f5b5f6848d3e8bbe45567fd)) +* **internal:** update examples ([#663](https://github.com/lithic-com/lithic-python/issues/663)) ([7e704cf](https://github.com/lithic-com/lithic-python/commit/7e704cf7776ff4beb47beb397a846333c3843617)) +* **internal:** updated imports ([#654](https://github.com/lithic-com/lithic-python/issues/654)) ([b0b1b64](https://github.com/lithic-com/lithic-python/commit/b0b1b644dcc1db989c22ba9def0fa4712e2e18d3)) + + +### Documentation + +* fix typos ([#665](https://github.com/lithic-com/lithic-python/issues/665)) ([b0de6d4](https://github.com/lithic-com/lithic-python/commit/b0de6d41f28cd60e8adfdcca389699a3c608156f)) +* more typo fixes ([#666](https://github.com/lithic-com/lithic-python/issues/666)) ([f97e3bc](https://github.com/lithic-com/lithic-python/commit/f97e3bc55387ed862cf40d357051c896a28ad375)) +* **raw responses:** fix duplicate `the` ([#674](https://github.com/lithic-com/lithic-python/issues/674)) ([9bc6a5e](https://github.com/lithic-com/lithic-python/commit/9bc6a5e8b9cbcb8e69497f4fef32f3ba2d7f2d1f)) +* **readme:** example snippet for client context manager ([#657](https://github.com/lithic-com/lithic-python/issues/657)) ([4ca06b8](https://github.com/lithic-com/lithic-python/commit/4ca06b884448c3737fda47e1343814d20714d5ea)) +* **readme:** fix misplaced period ([#667](https://github.com/lithic-com/lithic-python/issues/667)) ([51bdab7](https://github.com/lithic-com/lithic-python/commit/51bdab75952ec5716dab38b61c7c87cc8cda63fc)) + ## 0.81.1 (2024-12-11) Full Changelog: [v0.81.0...v0.81.1](https://github.com/lithic-com/lithic-python/compare/v0.81.0...v0.81.1) diff --git a/LICENSE b/LICENSE index bca930a9..06eee64e 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024 Lithic + Copyright 2025 Lithic Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 5d8e8574..1a695287 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ except lithic.APIStatusError as e: print(e.response) ``` -Error codes are as followed: +Error codes are as follows: | Status Code | Error Type | | ----------- | -------------------------- | @@ -332,7 +332,7 @@ card = response.parse() # get the object that `cards.create()` would have retur print(card.token) ``` -These methods return an [`LegacyAPIResponse`](https://github.com/lithic-com/lithic-python/tree/main/src/lithic/_legacy_response.py) object. This is a legacy class as we're changing it slightly in the next major version. +These methods return a [`LegacyAPIResponse`](https://github.com/lithic-com/lithic-python/tree/main/src/lithic/_legacy_response.py) object. This is a legacy class as we're changing it slightly in the next major version. For the sync client this will mostly be the same with the exception of `content` & `text` will be methods instead of properties. In the @@ -370,8 +370,7 @@ If you need to access undocumented endpoints, params, or response properties, th #### Undocumented endpoints To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other -http verbs. Options on the client will be respected (such as retries) will be respected when making this -request. +http verbs. Options on the client will be respected (such as retries) when making this request. ```py import httpx @@ -428,12 +427,22 @@ client.with_options(http_client=DefaultHttpxClient(...)) By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting. +```py +from lithic import Lithic + +with Lithic() as client: + # make requests here + ... + +# HTTP client is now closed +``` + ## Versioning This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: 1. Changes that only affect static types, without breaking runtime behavior. -2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_. +2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_ 3. Changes that we do not expect to impact the vast majority of users in practice. We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. diff --git a/api.md b/api.md index 9ff4ac64..04131b90 100644 --- a/api.md +++ b/api.md @@ -4,14 +4,11 @@ from lithic.types import ( AccountFinancialAccountType, Address, - AuthRule, Carrier, Currency, Document, InstanceFinancialAccountType, ShippingAddress, - VelocityLimitParams, - VelocityLimitParamsPeriodWindow, ) ``` @@ -67,7 +64,6 @@ Methods: - client.account_holders.update(account_holder_token, \*\*params) -> AccountHolderUpdateResponse - client.account_holders.list(\*\*params) -> SyncSinglePage[AccountHolder] - client.account_holders.list_documents(account_holder_token) -> AccountHolderListDocumentsResponse -- client.account_holders.resubmit(account_holder_token, \*\*params) -> AccountHolder - client.account_holders.retrieve_document(document_token, \*, account_holder_token) -> Document - client.account_holders.simulate_enrollment_document_review(\*\*params) -> Document - client.account_holders.simulate_enrollment_review(\*\*params) -> AccountHolderSimulateEnrollmentReviewResponse @@ -81,6 +77,12 @@ Types: ```python from lithic.types.auth_rules import ( + AuthRule, + AuthRuleCondition, + ConditionalAttribute, + ConditionalBlockParameters, + VelocityLimitParams, + VelocityLimitParamsPeriodWindow, V2CreateResponse, V2RetrieveResponse, V2UpdateResponse, @@ -187,6 +189,7 @@ Methods: - client.cards.retrieve(card_token) -> Card - client.cards.update(card_token, \*\*params) -> Card - client.cards.list(\*\*params) -> SyncCursorPage[Card] +- client.cards.convert_physical(card_token, \*\*params) -> Card - client.cards.embed(\*\*params) -> str - client.cards.provision(card_token, \*\*params) -> CardProvisionResponse - client.cards.reissue(card_token, \*\*params) -> Card @@ -375,12 +378,12 @@ Methods: Types: ```python -from lithic.types.financial_accounts.statements import StatementLineItems, LineItemListResponse +from lithic.types.financial_accounts.statements import StatementLineItems ``` Methods: -- client.financial_accounts.statements.line_items.list(statement_token, \*, financial_account_token, \*\*params) -> SyncCursorPage[LineItemListResponse] +- client.financial_accounts.statements.line_items.list(statement_token, \*, financial_account_token, \*\*params) -> SyncCursorPage[Data] ## LoanTapes diff --git a/mypy.ini b/mypy.ini index b21574d7..c0bb47f6 100644 --- a/mypy.ini +++ b/mypy.ini @@ -41,7 +41,7 @@ cache_fine_grained = True # ``` # Changing this codegen to make mypy happy would increase complexity # and would not be worth it. -disable_error_code = func-returns-value +disable_error_code = func-returns-value,overload-cannot-match # https://github.com/python/mypy/issues/12162 [mypy.overrides] diff --git a/pyproject.toml b/pyproject.toml index 2a38b190..34cf57b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "lithic" -version = "0.81.1" +version = "0.82.0" description = "The official Python library for the lithic API" dynamic = ["readme"] license = "Apache-2.0" @@ -10,7 +10,7 @@ authors = [ dependencies = [ "httpx>=0.23.0, <1", "pydantic>=1.9.0, <3", - "typing-extensions>=4.7, <5", + "typing-extensions>=4.10, <5", "anyio>=3.5.0, <5", "distro>=1.7.0, <2", "sniffio", @@ -54,7 +54,7 @@ dev-dependencies = [ "dirty-equals>=0.6.0", "importlib-metadata>=6.7.0", "rich>=13.7.1", - "nest_asyncio==1.6.0" + "nest_asyncio==1.6.0", ] [tool.rye.scripts] @@ -129,6 +129,7 @@ testpaths = ["tests"] addopts = "--tb=short" xfail_strict = true asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "session" filterwarnings = [ "error" ] diff --git a/requirements-dev.lock b/requirements-dev.lock index af8ea8ad..a68cd5a9 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -35,7 +35,7 @@ h11==0.14.0 # via httpcore httpcore==1.0.2 # via httpx -httpx==0.25.2 +httpx==0.28.1 # via lithic # via respx idna==3.4 @@ -48,7 +48,7 @@ markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -mypy==1.13.0 +mypy==1.14.1 mypy-extensions==1.0.0 # via mypy nest-asyncio==1.6.0 @@ -68,7 +68,7 @@ pydantic-core==2.27.1 # via pydantic pygments==2.18.0 # via rich -pyright==1.1.389 +pyright==1.1.392.post0 pytest==8.3.3 # via pytest-asyncio pytest-asyncio==0.24.0 @@ -76,7 +76,7 @@ python-dateutil==2.8.2 # via time-machine pytz==2023.3.post1 # via dirty-equals -respx==0.20.2 +respx==0.22.0 rich==13.7.1 ruff==0.6.9 setuptools==68.2.2 @@ -85,7 +85,6 @@ six==1.16.0 # via python-dateutil sniffio==1.3.0 # via anyio - # via httpx # via lithic time-machine==2.9.0 tomli==2.0.2 diff --git a/requirements.lock b/requirements.lock index 03084024..49dcac95 100644 --- a/requirements.lock +++ b/requirements.lock @@ -25,7 +25,7 @@ h11==0.14.0 # via httpcore httpcore==1.0.2 # via httpx -httpx==0.25.2 +httpx==0.28.1 # via lithic idna==3.4 # via anyio @@ -36,7 +36,6 @@ pydantic-core==2.27.1 # via pydantic sniffio==1.3.0 # via anyio - # via httpx # via lithic typing-extensions==4.12.2 # via anyio diff --git a/src/lithic/_base_client.py b/src/lithic/_base_client.py index ea4b067f..5e25b373 100644 --- a/src/lithic/_base_client.py +++ b/src/lithic/_base_client.py @@ -768,6 +768,9 @@ def __init__(self, **kwargs: Any) -> None: class SyncHttpxClientWrapper(DefaultHttpxClient): def __del__(self) -> None: + if self.is_closed: + return + try: self.close() except Exception: @@ -1349,6 +1352,9 @@ def __init__(self, **kwargs: Any) -> None: class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient): def __del__(self) -> None: + if self.is_closed: + return + try: # TODO(someday): support non asyncio runtimes here asyncio.get_running_loop().create_task(self.aclose()) diff --git a/src/lithic/_client.py b/src/lithic/_client.py index c37138af..2d0aab22 100644 --- a/src/lithic/_client.py +++ b/src/lithic/_client.py @@ -8,7 +8,7 @@ import httpx -from . import resources, _exceptions, _legacy_response +from . import _exceptions, _legacy_response from ._qs import Querystring from ._types import ( NOT_GIVEN, @@ -29,6 +29,24 @@ ) from ._version import __version__ from ._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper +from .resources import ( + accounts, + balances, + disputes, + payments, + webhooks, + card_programs, + tokenizations, + book_transfers, + account_holders, + digital_card_art, + external_payments, + aggregate_balances, + responder_endpoints, + management_operations, + auth_stream_enrollment, + tokenization_decisioning, +) from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import LithicError, APIStatusError from ._base_client import ( @@ -40,7 +58,16 @@ AsyncHttpxClientWrapper, make_request_options, ) +from .resources.cards import cards +from .resources.events import events from .types.api_status import APIStatus +from .resources.reports import reports +from .resources.three_ds import three_ds +from .resources.auth_rules import auth_rules +from .resources.transactions import transactions +from .resources.credit_products import credit_products +from .resources.financial_accounts import financial_accounts +from .resources.external_bank_accounts import external_bank_accounts __all__ = [ "ENVIRONMENTS", @@ -48,7 +75,6 @@ "Transport", "ProxiesTypes", "RequestOptions", - "resources", "Lithic", "AsyncLithic", "Client", @@ -62,31 +88,31 @@ class Lithic(SyncAPIClient): - accounts: resources.Accounts - account_holders: resources.AccountHolders - auth_rules: resources.AuthRules - auth_stream_enrollment: resources.AuthStreamEnrollment - tokenization_decisioning: resources.TokenizationDecisioning - tokenizations: resources.Tokenizations - cards: resources.Cards - balances: resources.Balances - aggregate_balances: resources.AggregateBalances - disputes: resources.Disputes - events: resources.Events - financial_accounts: resources.FinancialAccounts - transactions: resources.Transactions - responder_endpoints: resources.ResponderEndpoints - webhooks: resources.Webhooks - external_bank_accounts: resources.ExternalBankAccounts - payments: resources.Payments - three_ds: resources.ThreeDS - reports: resources.Reports - card_programs: resources.CardPrograms - digital_card_art: resources.DigitalCardArtResource - book_transfers: resources.BookTransfers - credit_products: resources.CreditProducts - external_payments: resources.ExternalPayments - management_operations: resources.ManagementOperations + accounts: accounts.Accounts + account_holders: account_holders.AccountHolders + auth_rules: auth_rules.AuthRules + auth_stream_enrollment: auth_stream_enrollment.AuthStreamEnrollment + tokenization_decisioning: tokenization_decisioning.TokenizationDecisioning + tokenizations: tokenizations.Tokenizations + cards: cards.Cards + balances: balances.Balances + aggregate_balances: aggregate_balances.AggregateBalances + disputes: disputes.Disputes + events: events.Events + financial_accounts: financial_accounts.FinancialAccounts + transactions: transactions.Transactions + responder_endpoints: responder_endpoints.ResponderEndpoints + webhooks: webhooks.Webhooks + external_bank_accounts: external_bank_accounts.ExternalBankAccounts + payments: payments.Payments + three_ds: three_ds.ThreeDS + reports: reports.Reports + card_programs: card_programs.CardPrograms + digital_card_art: digital_card_art.DigitalCardArtResource + book_transfers: book_transfers.BookTransfers + credit_products: credit_products.CreditProducts + external_payments: external_payments.ExternalPayments + management_operations: management_operations.ManagementOperations with_raw_response: LithicWithRawResponse with_streaming_response: LithicWithStreamedResponse @@ -185,31 +211,31 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.accounts = resources.Accounts(self) - self.account_holders = resources.AccountHolders(self) - self.auth_rules = resources.AuthRules(self) - self.auth_stream_enrollment = resources.AuthStreamEnrollment(self) - self.tokenization_decisioning = resources.TokenizationDecisioning(self) - self.tokenizations = resources.Tokenizations(self) - self.cards = resources.Cards(self) - self.balances = resources.Balances(self) - self.aggregate_balances = resources.AggregateBalances(self) - self.disputes = resources.Disputes(self) - self.events = resources.Events(self) - self.financial_accounts = resources.FinancialAccounts(self) - self.transactions = resources.Transactions(self) - self.responder_endpoints = resources.ResponderEndpoints(self) - self.webhooks = resources.Webhooks(self) - self.external_bank_accounts = resources.ExternalBankAccounts(self) - self.payments = resources.Payments(self) - self.three_ds = resources.ThreeDS(self) - self.reports = resources.Reports(self) - self.card_programs = resources.CardPrograms(self) - self.digital_card_art = resources.DigitalCardArtResource(self) - self.book_transfers = resources.BookTransfers(self) - self.credit_products = resources.CreditProducts(self) - self.external_payments = resources.ExternalPayments(self) - self.management_operations = resources.ManagementOperations(self) + self.accounts = accounts.Accounts(self) + self.account_holders = account_holders.AccountHolders(self) + self.auth_rules = auth_rules.AuthRules(self) + self.auth_stream_enrollment = auth_stream_enrollment.AuthStreamEnrollment(self) + self.tokenization_decisioning = tokenization_decisioning.TokenizationDecisioning(self) + self.tokenizations = tokenizations.Tokenizations(self) + self.cards = cards.Cards(self) + self.balances = balances.Balances(self) + self.aggregate_balances = aggregate_balances.AggregateBalances(self) + self.disputes = disputes.Disputes(self) + self.events = events.Events(self) + self.financial_accounts = financial_accounts.FinancialAccounts(self) + self.transactions = transactions.Transactions(self) + self.responder_endpoints = responder_endpoints.ResponderEndpoints(self) + self.webhooks = webhooks.Webhooks(self) + self.external_bank_accounts = external_bank_accounts.ExternalBankAccounts(self) + self.payments = payments.Payments(self) + self.three_ds = three_ds.ThreeDS(self) + self.reports = reports.Reports(self) + self.card_programs = card_programs.CardPrograms(self) + self.digital_card_art = digital_card_art.DigitalCardArtResource(self) + self.book_transfers = book_transfers.BookTransfers(self) + self.credit_products = credit_products.CreditProducts(self) + self.external_payments = external_payments.ExternalPayments(self) + self.management_operations = management_operations.ManagementOperations(self) self.with_raw_response = LithicWithRawResponse(self) self.with_streaming_response = LithicWithStreamedResponse(self) @@ -362,31 +388,31 @@ def _make_status_error( class AsyncLithic(AsyncAPIClient): - accounts: resources.AsyncAccounts - account_holders: resources.AsyncAccountHolders - auth_rules: resources.AsyncAuthRules - auth_stream_enrollment: resources.AsyncAuthStreamEnrollment - tokenization_decisioning: resources.AsyncTokenizationDecisioning - tokenizations: resources.AsyncTokenizations - cards: resources.AsyncCards - balances: resources.AsyncBalances - aggregate_balances: resources.AsyncAggregateBalances - disputes: resources.AsyncDisputes - events: resources.AsyncEvents - financial_accounts: resources.AsyncFinancialAccounts - transactions: resources.AsyncTransactions - responder_endpoints: resources.AsyncResponderEndpoints - webhooks: resources.AsyncWebhooks - external_bank_accounts: resources.AsyncExternalBankAccounts - payments: resources.AsyncPayments - three_ds: resources.AsyncThreeDS - reports: resources.AsyncReports - card_programs: resources.AsyncCardPrograms - digital_card_art: resources.AsyncDigitalCardArtResource - book_transfers: resources.AsyncBookTransfers - credit_products: resources.AsyncCreditProducts - external_payments: resources.AsyncExternalPayments - management_operations: resources.AsyncManagementOperations + accounts: accounts.AsyncAccounts + account_holders: account_holders.AsyncAccountHolders + auth_rules: auth_rules.AsyncAuthRules + auth_stream_enrollment: auth_stream_enrollment.AsyncAuthStreamEnrollment + tokenization_decisioning: tokenization_decisioning.AsyncTokenizationDecisioning + tokenizations: tokenizations.AsyncTokenizations + cards: cards.AsyncCards + balances: balances.AsyncBalances + aggregate_balances: aggregate_balances.AsyncAggregateBalances + disputes: disputes.AsyncDisputes + events: events.AsyncEvents + financial_accounts: financial_accounts.AsyncFinancialAccounts + transactions: transactions.AsyncTransactions + responder_endpoints: responder_endpoints.AsyncResponderEndpoints + webhooks: webhooks.AsyncWebhooks + external_bank_accounts: external_bank_accounts.AsyncExternalBankAccounts + payments: payments.AsyncPayments + three_ds: three_ds.AsyncThreeDS + reports: reports.AsyncReports + card_programs: card_programs.AsyncCardPrograms + digital_card_art: digital_card_art.AsyncDigitalCardArtResource + book_transfers: book_transfers.AsyncBookTransfers + credit_products: credit_products.AsyncCreditProducts + external_payments: external_payments.AsyncExternalPayments + management_operations: management_operations.AsyncManagementOperations with_raw_response: AsyncLithicWithRawResponse with_streaming_response: AsyncLithicWithStreamedResponse @@ -485,31 +511,31 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.accounts = resources.AsyncAccounts(self) - self.account_holders = resources.AsyncAccountHolders(self) - self.auth_rules = resources.AsyncAuthRules(self) - self.auth_stream_enrollment = resources.AsyncAuthStreamEnrollment(self) - self.tokenization_decisioning = resources.AsyncTokenizationDecisioning(self) - self.tokenizations = resources.AsyncTokenizations(self) - self.cards = resources.AsyncCards(self) - self.balances = resources.AsyncBalances(self) - self.aggregate_balances = resources.AsyncAggregateBalances(self) - self.disputes = resources.AsyncDisputes(self) - self.events = resources.AsyncEvents(self) - self.financial_accounts = resources.AsyncFinancialAccounts(self) - self.transactions = resources.AsyncTransactions(self) - self.responder_endpoints = resources.AsyncResponderEndpoints(self) - self.webhooks = resources.AsyncWebhooks(self) - self.external_bank_accounts = resources.AsyncExternalBankAccounts(self) - self.payments = resources.AsyncPayments(self) - self.three_ds = resources.AsyncThreeDS(self) - self.reports = resources.AsyncReports(self) - self.card_programs = resources.AsyncCardPrograms(self) - self.digital_card_art = resources.AsyncDigitalCardArtResource(self) - self.book_transfers = resources.AsyncBookTransfers(self) - self.credit_products = resources.AsyncCreditProducts(self) - self.external_payments = resources.AsyncExternalPayments(self) - self.management_operations = resources.AsyncManagementOperations(self) + self.accounts = accounts.AsyncAccounts(self) + self.account_holders = account_holders.AsyncAccountHolders(self) + self.auth_rules = auth_rules.AsyncAuthRules(self) + self.auth_stream_enrollment = auth_stream_enrollment.AsyncAuthStreamEnrollment(self) + self.tokenization_decisioning = tokenization_decisioning.AsyncTokenizationDecisioning(self) + self.tokenizations = tokenizations.AsyncTokenizations(self) + self.cards = cards.AsyncCards(self) + self.balances = balances.AsyncBalances(self) + self.aggregate_balances = aggregate_balances.AsyncAggregateBalances(self) + self.disputes = disputes.AsyncDisputes(self) + self.events = events.AsyncEvents(self) + self.financial_accounts = financial_accounts.AsyncFinancialAccounts(self) + self.transactions = transactions.AsyncTransactions(self) + self.responder_endpoints = responder_endpoints.AsyncResponderEndpoints(self) + self.webhooks = webhooks.AsyncWebhooks(self) + self.external_bank_accounts = external_bank_accounts.AsyncExternalBankAccounts(self) + self.payments = payments.AsyncPayments(self) + self.three_ds = three_ds.AsyncThreeDS(self) + self.reports = reports.AsyncReports(self) + self.card_programs = card_programs.AsyncCardPrograms(self) + self.digital_card_art = digital_card_art.AsyncDigitalCardArtResource(self) + self.book_transfers = book_transfers.AsyncBookTransfers(self) + self.credit_products = credit_products.AsyncCreditProducts(self) + self.external_payments = external_payments.AsyncExternalPayments(self) + self.management_operations = management_operations.AsyncManagementOperations(self) self.with_raw_response = AsyncLithicWithRawResponse(self) self.with_streaming_response = AsyncLithicWithStreamedResponse(self) @@ -663,32 +689,38 @@ def _make_status_error( class LithicWithRawResponse: def __init__(self, client: Lithic) -> None: - self.accounts = resources.AccountsWithRawResponse(client.accounts) - self.account_holders = resources.AccountHoldersWithRawResponse(client.account_holders) - self.auth_rules = resources.AuthRulesWithRawResponse(client.auth_rules) - self.auth_stream_enrollment = resources.AuthStreamEnrollmentWithRawResponse(client.auth_stream_enrollment) - self.tokenization_decisioning = resources.TokenizationDecisioningWithRawResponse( + self.accounts = accounts.AccountsWithRawResponse(client.accounts) + self.account_holders = account_holders.AccountHoldersWithRawResponse(client.account_holders) + self.auth_rules = auth_rules.AuthRulesWithRawResponse(client.auth_rules) + self.auth_stream_enrollment = auth_stream_enrollment.AuthStreamEnrollmentWithRawResponse( + client.auth_stream_enrollment + ) + self.tokenization_decisioning = tokenization_decisioning.TokenizationDecisioningWithRawResponse( client.tokenization_decisioning ) - self.tokenizations = resources.TokenizationsWithRawResponse(client.tokenizations) - self.cards = resources.CardsWithRawResponse(client.cards) - self.balances = resources.BalancesWithRawResponse(client.balances) - self.aggregate_balances = resources.AggregateBalancesWithRawResponse(client.aggregate_balances) - self.disputes = resources.DisputesWithRawResponse(client.disputes) - self.events = resources.EventsWithRawResponse(client.events) - self.financial_accounts = resources.FinancialAccountsWithRawResponse(client.financial_accounts) - self.transactions = resources.TransactionsWithRawResponse(client.transactions) - self.responder_endpoints = resources.ResponderEndpointsWithRawResponse(client.responder_endpoints) - self.external_bank_accounts = resources.ExternalBankAccountsWithRawResponse(client.external_bank_accounts) - self.payments = resources.PaymentsWithRawResponse(client.payments) - self.three_ds = resources.ThreeDSWithRawResponse(client.three_ds) - self.reports = resources.ReportsWithRawResponse(client.reports) - self.card_programs = resources.CardProgramsWithRawResponse(client.card_programs) - self.digital_card_art = resources.DigitalCardArtResourceWithRawResponse(client.digital_card_art) - self.book_transfers = resources.BookTransfersWithRawResponse(client.book_transfers) - self.credit_products = resources.CreditProductsWithRawResponse(client.credit_products) - self.external_payments = resources.ExternalPaymentsWithRawResponse(client.external_payments) - self.management_operations = resources.ManagementOperationsWithRawResponse(client.management_operations) + self.tokenizations = tokenizations.TokenizationsWithRawResponse(client.tokenizations) + self.cards = cards.CardsWithRawResponse(client.cards) + self.balances = balances.BalancesWithRawResponse(client.balances) + self.aggregate_balances = aggregate_balances.AggregateBalancesWithRawResponse(client.aggregate_balances) + self.disputes = disputes.DisputesWithRawResponse(client.disputes) + self.events = events.EventsWithRawResponse(client.events) + self.financial_accounts = financial_accounts.FinancialAccountsWithRawResponse(client.financial_accounts) + self.transactions = transactions.TransactionsWithRawResponse(client.transactions) + self.responder_endpoints = responder_endpoints.ResponderEndpointsWithRawResponse(client.responder_endpoints) + self.external_bank_accounts = external_bank_accounts.ExternalBankAccountsWithRawResponse( + client.external_bank_accounts + ) + self.payments = payments.PaymentsWithRawResponse(client.payments) + self.three_ds = three_ds.ThreeDSWithRawResponse(client.three_ds) + self.reports = reports.ReportsWithRawResponse(client.reports) + self.card_programs = card_programs.CardProgramsWithRawResponse(client.card_programs) + self.digital_card_art = digital_card_art.DigitalCardArtResourceWithRawResponse(client.digital_card_art) + self.book_transfers = book_transfers.BookTransfersWithRawResponse(client.book_transfers) + self.credit_products = credit_products.CreditProductsWithRawResponse(client.credit_products) + self.external_payments = external_payments.ExternalPaymentsWithRawResponse(client.external_payments) + self.management_operations = management_operations.ManagementOperationsWithRawResponse( + client.management_operations + ) self.api_status = _legacy_response.to_raw_response_wrapper( client.api_status, @@ -697,32 +729,40 @@ def __init__(self, client: Lithic) -> None: class AsyncLithicWithRawResponse: def __init__(self, client: AsyncLithic) -> None: - self.accounts = resources.AsyncAccountsWithRawResponse(client.accounts) - self.account_holders = resources.AsyncAccountHoldersWithRawResponse(client.account_holders) - self.auth_rules = resources.AsyncAuthRulesWithRawResponse(client.auth_rules) - self.auth_stream_enrollment = resources.AsyncAuthStreamEnrollmentWithRawResponse(client.auth_stream_enrollment) - self.tokenization_decisioning = resources.AsyncTokenizationDecisioningWithRawResponse( + self.accounts = accounts.AsyncAccountsWithRawResponse(client.accounts) + self.account_holders = account_holders.AsyncAccountHoldersWithRawResponse(client.account_holders) + self.auth_rules = auth_rules.AsyncAuthRulesWithRawResponse(client.auth_rules) + self.auth_stream_enrollment = auth_stream_enrollment.AsyncAuthStreamEnrollmentWithRawResponse( + client.auth_stream_enrollment + ) + self.tokenization_decisioning = tokenization_decisioning.AsyncTokenizationDecisioningWithRawResponse( client.tokenization_decisioning ) - self.tokenizations = resources.AsyncTokenizationsWithRawResponse(client.tokenizations) - self.cards = resources.AsyncCardsWithRawResponse(client.cards) - self.balances = resources.AsyncBalancesWithRawResponse(client.balances) - self.aggregate_balances = resources.AsyncAggregateBalancesWithRawResponse(client.aggregate_balances) - self.disputes = resources.AsyncDisputesWithRawResponse(client.disputes) - self.events = resources.AsyncEventsWithRawResponse(client.events) - self.financial_accounts = resources.AsyncFinancialAccountsWithRawResponse(client.financial_accounts) - self.transactions = resources.AsyncTransactionsWithRawResponse(client.transactions) - self.responder_endpoints = resources.AsyncResponderEndpointsWithRawResponse(client.responder_endpoints) - self.external_bank_accounts = resources.AsyncExternalBankAccountsWithRawResponse(client.external_bank_accounts) - self.payments = resources.AsyncPaymentsWithRawResponse(client.payments) - self.three_ds = resources.AsyncThreeDSWithRawResponse(client.three_ds) - self.reports = resources.AsyncReportsWithRawResponse(client.reports) - self.card_programs = resources.AsyncCardProgramsWithRawResponse(client.card_programs) - self.digital_card_art = resources.AsyncDigitalCardArtResourceWithRawResponse(client.digital_card_art) - self.book_transfers = resources.AsyncBookTransfersWithRawResponse(client.book_transfers) - self.credit_products = resources.AsyncCreditProductsWithRawResponse(client.credit_products) - self.external_payments = resources.AsyncExternalPaymentsWithRawResponse(client.external_payments) - self.management_operations = resources.AsyncManagementOperationsWithRawResponse(client.management_operations) + self.tokenizations = tokenizations.AsyncTokenizationsWithRawResponse(client.tokenizations) + self.cards = cards.AsyncCardsWithRawResponse(client.cards) + self.balances = balances.AsyncBalancesWithRawResponse(client.balances) + self.aggregate_balances = aggregate_balances.AsyncAggregateBalancesWithRawResponse(client.aggregate_balances) + self.disputes = disputes.AsyncDisputesWithRawResponse(client.disputes) + self.events = events.AsyncEventsWithRawResponse(client.events) + self.financial_accounts = financial_accounts.AsyncFinancialAccountsWithRawResponse(client.financial_accounts) + self.transactions = transactions.AsyncTransactionsWithRawResponse(client.transactions) + self.responder_endpoints = responder_endpoints.AsyncResponderEndpointsWithRawResponse( + client.responder_endpoints + ) + self.external_bank_accounts = external_bank_accounts.AsyncExternalBankAccountsWithRawResponse( + client.external_bank_accounts + ) + self.payments = payments.AsyncPaymentsWithRawResponse(client.payments) + self.three_ds = three_ds.AsyncThreeDSWithRawResponse(client.three_ds) + self.reports = reports.AsyncReportsWithRawResponse(client.reports) + self.card_programs = card_programs.AsyncCardProgramsWithRawResponse(client.card_programs) + self.digital_card_art = digital_card_art.AsyncDigitalCardArtResourceWithRawResponse(client.digital_card_art) + self.book_transfers = book_transfers.AsyncBookTransfersWithRawResponse(client.book_transfers) + self.credit_products = credit_products.AsyncCreditProductsWithRawResponse(client.credit_products) + self.external_payments = external_payments.AsyncExternalPaymentsWithRawResponse(client.external_payments) + self.management_operations = management_operations.AsyncManagementOperationsWithRawResponse( + client.management_operations + ) self.api_status = _legacy_response.async_to_raw_response_wrapper( client.api_status, @@ -731,32 +771,40 @@ def __init__(self, client: AsyncLithic) -> None: class LithicWithStreamedResponse: def __init__(self, client: Lithic) -> None: - self.accounts = resources.AccountsWithStreamingResponse(client.accounts) - self.account_holders = resources.AccountHoldersWithStreamingResponse(client.account_holders) - self.auth_rules = resources.AuthRulesWithStreamingResponse(client.auth_rules) - self.auth_stream_enrollment = resources.AuthStreamEnrollmentWithStreamingResponse(client.auth_stream_enrollment) - self.tokenization_decisioning = resources.TokenizationDecisioningWithStreamingResponse( + self.accounts = accounts.AccountsWithStreamingResponse(client.accounts) + self.account_holders = account_holders.AccountHoldersWithStreamingResponse(client.account_holders) + self.auth_rules = auth_rules.AuthRulesWithStreamingResponse(client.auth_rules) + self.auth_stream_enrollment = auth_stream_enrollment.AuthStreamEnrollmentWithStreamingResponse( + client.auth_stream_enrollment + ) + self.tokenization_decisioning = tokenization_decisioning.TokenizationDecisioningWithStreamingResponse( client.tokenization_decisioning ) - self.tokenizations = resources.TokenizationsWithStreamingResponse(client.tokenizations) - self.cards = resources.CardsWithStreamingResponse(client.cards) - self.balances = resources.BalancesWithStreamingResponse(client.balances) - self.aggregate_balances = resources.AggregateBalancesWithStreamingResponse(client.aggregate_balances) - self.disputes = resources.DisputesWithStreamingResponse(client.disputes) - self.events = resources.EventsWithStreamingResponse(client.events) - self.financial_accounts = resources.FinancialAccountsWithStreamingResponse(client.financial_accounts) - self.transactions = resources.TransactionsWithStreamingResponse(client.transactions) - self.responder_endpoints = resources.ResponderEndpointsWithStreamingResponse(client.responder_endpoints) - self.external_bank_accounts = resources.ExternalBankAccountsWithStreamingResponse(client.external_bank_accounts) - self.payments = resources.PaymentsWithStreamingResponse(client.payments) - self.three_ds = resources.ThreeDSWithStreamingResponse(client.three_ds) - self.reports = resources.ReportsWithStreamingResponse(client.reports) - self.card_programs = resources.CardProgramsWithStreamingResponse(client.card_programs) - self.digital_card_art = resources.DigitalCardArtResourceWithStreamingResponse(client.digital_card_art) - self.book_transfers = resources.BookTransfersWithStreamingResponse(client.book_transfers) - self.credit_products = resources.CreditProductsWithStreamingResponse(client.credit_products) - self.external_payments = resources.ExternalPaymentsWithStreamingResponse(client.external_payments) - self.management_operations = resources.ManagementOperationsWithStreamingResponse(client.management_operations) + self.tokenizations = tokenizations.TokenizationsWithStreamingResponse(client.tokenizations) + self.cards = cards.CardsWithStreamingResponse(client.cards) + self.balances = balances.BalancesWithStreamingResponse(client.balances) + self.aggregate_balances = aggregate_balances.AggregateBalancesWithStreamingResponse(client.aggregate_balances) + self.disputes = disputes.DisputesWithStreamingResponse(client.disputes) + self.events = events.EventsWithStreamingResponse(client.events) + self.financial_accounts = financial_accounts.FinancialAccountsWithStreamingResponse(client.financial_accounts) + self.transactions = transactions.TransactionsWithStreamingResponse(client.transactions) + self.responder_endpoints = responder_endpoints.ResponderEndpointsWithStreamingResponse( + client.responder_endpoints + ) + self.external_bank_accounts = external_bank_accounts.ExternalBankAccountsWithStreamingResponse( + client.external_bank_accounts + ) + self.payments = payments.PaymentsWithStreamingResponse(client.payments) + self.three_ds = three_ds.ThreeDSWithStreamingResponse(client.three_ds) + self.reports = reports.ReportsWithStreamingResponse(client.reports) + self.card_programs = card_programs.CardProgramsWithStreamingResponse(client.card_programs) + self.digital_card_art = digital_card_art.DigitalCardArtResourceWithStreamingResponse(client.digital_card_art) + self.book_transfers = book_transfers.BookTransfersWithStreamingResponse(client.book_transfers) + self.credit_products = credit_products.CreditProductsWithStreamingResponse(client.credit_products) + self.external_payments = external_payments.ExternalPaymentsWithStreamingResponse(client.external_payments) + self.management_operations = management_operations.ManagementOperationsWithStreamingResponse( + client.management_operations + ) self.api_status = to_streamed_response_wrapper( client.api_status, @@ -765,36 +813,44 @@ def __init__(self, client: Lithic) -> None: class AsyncLithicWithStreamedResponse: def __init__(self, client: AsyncLithic) -> None: - self.accounts = resources.AsyncAccountsWithStreamingResponse(client.accounts) - self.account_holders = resources.AsyncAccountHoldersWithStreamingResponse(client.account_holders) - self.auth_rules = resources.AsyncAuthRulesWithStreamingResponse(client.auth_rules) - self.auth_stream_enrollment = resources.AsyncAuthStreamEnrollmentWithStreamingResponse( + self.accounts = accounts.AsyncAccountsWithStreamingResponse(client.accounts) + self.account_holders = account_holders.AsyncAccountHoldersWithStreamingResponse(client.account_holders) + self.auth_rules = auth_rules.AsyncAuthRulesWithStreamingResponse(client.auth_rules) + self.auth_stream_enrollment = auth_stream_enrollment.AsyncAuthStreamEnrollmentWithStreamingResponse( client.auth_stream_enrollment ) - self.tokenization_decisioning = resources.AsyncTokenizationDecisioningWithStreamingResponse( + self.tokenization_decisioning = tokenization_decisioning.AsyncTokenizationDecisioningWithStreamingResponse( client.tokenization_decisioning ) - self.tokenizations = resources.AsyncTokenizationsWithStreamingResponse(client.tokenizations) - self.cards = resources.AsyncCardsWithStreamingResponse(client.cards) - self.balances = resources.AsyncBalancesWithStreamingResponse(client.balances) - self.aggregate_balances = resources.AsyncAggregateBalancesWithStreamingResponse(client.aggregate_balances) - self.disputes = resources.AsyncDisputesWithStreamingResponse(client.disputes) - self.events = resources.AsyncEventsWithStreamingResponse(client.events) - self.financial_accounts = resources.AsyncFinancialAccountsWithStreamingResponse(client.financial_accounts) - self.transactions = resources.AsyncTransactionsWithStreamingResponse(client.transactions) - self.responder_endpoints = resources.AsyncResponderEndpointsWithStreamingResponse(client.responder_endpoints) - self.external_bank_accounts = resources.AsyncExternalBankAccountsWithStreamingResponse( + self.tokenizations = tokenizations.AsyncTokenizationsWithStreamingResponse(client.tokenizations) + self.cards = cards.AsyncCardsWithStreamingResponse(client.cards) + self.balances = balances.AsyncBalancesWithStreamingResponse(client.balances) + self.aggregate_balances = aggregate_balances.AsyncAggregateBalancesWithStreamingResponse( + client.aggregate_balances + ) + self.disputes = disputes.AsyncDisputesWithStreamingResponse(client.disputes) + self.events = events.AsyncEventsWithStreamingResponse(client.events) + self.financial_accounts = financial_accounts.AsyncFinancialAccountsWithStreamingResponse( + client.financial_accounts + ) + self.transactions = transactions.AsyncTransactionsWithStreamingResponse(client.transactions) + self.responder_endpoints = responder_endpoints.AsyncResponderEndpointsWithStreamingResponse( + client.responder_endpoints + ) + self.external_bank_accounts = external_bank_accounts.AsyncExternalBankAccountsWithStreamingResponse( client.external_bank_accounts ) - self.payments = resources.AsyncPaymentsWithStreamingResponse(client.payments) - self.three_ds = resources.AsyncThreeDSWithStreamingResponse(client.three_ds) - self.reports = resources.AsyncReportsWithStreamingResponse(client.reports) - self.card_programs = resources.AsyncCardProgramsWithStreamingResponse(client.card_programs) - self.digital_card_art = resources.AsyncDigitalCardArtResourceWithStreamingResponse(client.digital_card_art) - self.book_transfers = resources.AsyncBookTransfersWithStreamingResponse(client.book_transfers) - self.credit_products = resources.AsyncCreditProductsWithStreamingResponse(client.credit_products) - self.external_payments = resources.AsyncExternalPaymentsWithStreamingResponse(client.external_payments) - self.management_operations = resources.AsyncManagementOperationsWithStreamingResponse( + self.payments = payments.AsyncPaymentsWithStreamingResponse(client.payments) + self.three_ds = three_ds.AsyncThreeDSWithStreamingResponse(client.three_ds) + self.reports = reports.AsyncReportsWithStreamingResponse(client.reports) + self.card_programs = card_programs.AsyncCardProgramsWithStreamingResponse(client.card_programs) + self.digital_card_art = digital_card_art.AsyncDigitalCardArtResourceWithStreamingResponse( + client.digital_card_art + ) + self.book_transfers = book_transfers.AsyncBookTransfersWithStreamingResponse(client.book_transfers) + self.credit_products = credit_products.AsyncCreditProductsWithStreamingResponse(client.credit_products) + self.external_payments = external_payments.AsyncExternalPaymentsWithStreamingResponse(client.external_payments) + self.management_operations = management_operations.AsyncManagementOperationsWithStreamingResponse( client.management_operations ) diff --git a/src/lithic/_legacy_response.py b/src/lithic/_legacy_response.py index 8d00883e..93436bcf 100644 --- a/src/lithic/_legacy_response.py +++ b/src/lithic/_legacy_response.py @@ -24,7 +24,7 @@ import pydantic from ._types import NoneType -from ._utils import is_given, extract_type_arg, is_annotated_type +from ._utils import is_given, extract_type_arg, is_annotated_type, is_type_alias_type from ._models import BaseModel, is_basemodel from ._constants import RAW_RESPONSE_HEADER from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type @@ -188,9 +188,17 @@ def elapsed(self) -> datetime.timedelta: return self.http_response.elapsed def _parse(self, *, to: type[_T] | None = None) -> R | _T: + cast_to = to if to is not None else self._cast_to + + # unwrap `TypeAlias('Name', T)` -> `T` + if is_type_alias_type(cast_to): + cast_to = cast_to.__value__ # type: ignore[unreachable] + # unwrap `Annotated[T, ...]` -> `T` - if to and is_annotated_type(to): - to = extract_type_arg(to, 0) + if cast_to and is_annotated_type(cast_to): + cast_to = extract_type_arg(cast_to, 0) + + origin = get_origin(cast_to) or cast_to if self._stream: if to: @@ -226,18 +234,12 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: return cast( R, stream_cls( - cast_to=self._cast_to, + cast_to=cast_to, response=self.http_response, client=cast(Any, self._client), ), ) - cast_to = to if to is not None else self._cast_to - - # unwrap `Annotated[T, ...]` -> `T` - if is_annotated_type(cast_to): - cast_to = extract_type_arg(cast_to, 0) - if cast_to is NoneType: return cast(R, None) @@ -254,15 +256,15 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to == bool: return cast(R, response.text.lower() == "true") - origin = get_origin(cast_to) or cast_to - if inspect.isclass(origin) and issubclass(origin, HttpxBinaryResponseContent): return cast(R, cast_to(response)) # type: ignore if origin == LegacyAPIResponse: raise RuntimeError("Unexpected state - cast_to is `APIResponse`") - if inspect.isclass(origin) and issubclass(origin, httpx.Response): + if inspect.isclass( + origin # pyright: ignore[reportUnknownArgumentType] + ) and issubclass(origin, httpx.Response): # Because of the invariance of our ResponseT TypeVar, users can subclass httpx.Response # and pass that class to our request functions. We cannot change the variance to be either # covariant or contravariant as that makes our usage of ResponseT illegal. We could construct @@ -272,7 +274,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`") return cast(R, response) - if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel): + if ( + inspect.isclass( + origin # pyright: ignore[reportUnknownArgumentType] + ) + and not issubclass(origin, BaseModel) + and issubclass(origin, pydantic.BaseModel) + ): raise TypeError("Pydantic models must subclass our base model type, e.g. `from lithic import BaseModel`") if ( diff --git a/src/lithic/_models.py b/src/lithic/_models.py index 6cb469e2..9a918aab 100644 --- a/src/lithic/_models.py +++ b/src/lithic/_models.py @@ -46,6 +46,7 @@ strip_not_given, extract_type_arg, is_annotated_type, + is_type_alias_type, strip_annotated_type, ) from ._compat import ( @@ -178,14 +179,14 @@ def __str__(self) -> str: @classmethod @override def construct( # pyright: ignore[reportIncompatibleMethodOverride] - cls: Type[ModelT], + __cls: Type[ModelT], _fields_set: set[str] | None = None, **values: object, ) -> ModelT: - m = cls.__new__(cls) + m = __cls.__new__(__cls) fields_values: dict[str, object] = {} - config = get_model_config(cls) + config = get_model_config(__cls) populate_by_name = ( config.allow_population_by_field_name if isinstance(config, _ConfigProtocol) @@ -195,7 +196,7 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] if _fields_set is None: _fields_set = set() - model_fields = get_model_fields(cls) + model_fields = get_model_fields(__cls) for name, field in model_fields.items(): key = field.alias if key is None or (key not in values and populate_by_name): @@ -428,6 +429,8 @@ def construct_type(*, value: object, type_: object) -> object: # we allow `object` as the input type because otherwise, passing things like # `Literal['value']` will be reported as a type error by type checkers type_ = cast("type[object]", type_) + if is_type_alias_type(type_): + type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` if is_annotated_type(type_): @@ -485,7 +488,11 @@ def construct_type(*, value: object, type_: object) -> object: _, items_type = get_args(type_) # Dict[_, items_type] return {key: construct_type(value=item, type_=items_type) for key, item in value.items()} - if not is_literal_type(type_) and (issubclass(origin, BaseModel) or issubclass(origin, GenericModel)): + if ( + not is_literal_type(type_) + and inspect.isclass(origin) + and (issubclass(origin, BaseModel) or issubclass(origin, GenericModel)) + ): if is_list(value): return [cast(Any, type_).construct(**entry) if is_mapping(entry) else entry for entry in value] diff --git a/src/lithic/_response.py b/src/lithic/_response.py index 4ee27ec4..44110a9d 100644 --- a/src/lithic/_response.py +++ b/src/lithic/_response.py @@ -25,7 +25,7 @@ import pydantic from ._types import NoneType -from ._utils import is_given, extract_type_arg, is_annotated_type, extract_type_var_from_base +from ._utils import is_given, extract_type_arg, is_annotated_type, is_type_alias_type, extract_type_var_from_base from ._models import BaseModel, is_basemodel from ._constants import RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type @@ -126,9 +126,17 @@ def __repr__(self) -> str: ) def _parse(self, *, to: type[_T] | None = None) -> R | _T: + cast_to = to if to is not None else self._cast_to + + # unwrap `TypeAlias('Name', T)` -> `T` + if is_type_alias_type(cast_to): + cast_to = cast_to.__value__ # type: ignore[unreachable] + # unwrap `Annotated[T, ...]` -> `T` - if to and is_annotated_type(to): - to = extract_type_arg(to, 0) + if cast_to and is_annotated_type(cast_to): + cast_to = extract_type_arg(cast_to, 0) + + origin = get_origin(cast_to) or cast_to if self._is_sse_stream: if to: @@ -164,18 +172,12 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: return cast( R, stream_cls( - cast_to=self._cast_to, + cast_to=cast_to, response=self.http_response, client=cast(Any, self._client), ), ) - cast_to = to if to is not None else self._cast_to - - # unwrap `Annotated[T, ...]` -> `T` - if is_annotated_type(cast_to): - cast_to = extract_type_arg(cast_to, 0) - if cast_to is NoneType: return cast(R, None) @@ -195,8 +197,6 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to == bool: return cast(R, response.text.lower() == "true") - origin = get_origin(cast_to) or cast_to - # handle the legacy binary response case if inspect.isclass(cast_to) and cast_to.__name__ == "HttpxBinaryResponseContent": return cast(R, cast_to(response)) # type: ignore @@ -214,7 +214,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`") return cast(R, response) - if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel): + if ( + inspect.isclass( + origin # pyright: ignore[reportUnknownArgumentType] + ) + and not issubclass(origin, BaseModel) + and issubclass(origin, pydantic.BaseModel) + ): raise TypeError("Pydantic models must subclass our base model type, e.g. `from lithic import BaseModel`") if ( diff --git a/src/lithic/_utils/__init__.py b/src/lithic/_utils/__init__.py index a7cff3c0..d4fda26f 100644 --- a/src/lithic/_utils/__init__.py +++ b/src/lithic/_utils/__init__.py @@ -39,6 +39,7 @@ is_iterable_type as is_iterable_type, is_required_type as is_required_type, is_annotated_type as is_annotated_type, + is_type_alias_type as is_type_alias_type, strip_annotated_type as strip_annotated_type, extract_type_var_from_base as extract_type_var_from_base, ) diff --git a/src/lithic/_utils/_typing.py b/src/lithic/_utils/_typing.py index c036991f..278749b1 100644 --- a/src/lithic/_utils/_typing.py +++ b/src/lithic/_utils/_typing.py @@ -1,8 +1,17 @@ from __future__ import annotations +import sys +import typing +import typing_extensions from typing import Any, TypeVar, Iterable, cast from collections import abc as _c_abc -from typing_extensions import Required, Annotated, get_args, get_origin +from typing_extensions import ( + TypeIs, + Required, + Annotated, + get_args, + get_origin, +) from .._types import InheritsGeneric from .._compat import is_union as _is_union @@ -36,6 +45,26 @@ def is_typevar(typ: type) -> bool: return type(typ) == TypeVar # type: ignore +_TYPE_ALIAS_TYPES: tuple[type[typing_extensions.TypeAliasType], ...] = (typing_extensions.TypeAliasType,) +if sys.version_info >= (3, 12): + _TYPE_ALIAS_TYPES = (*_TYPE_ALIAS_TYPES, typing.TypeAliasType) + + +def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]: + """Return whether the provided argument is an instance of `TypeAliasType`. + + ```python + type Int = int + is_type_alias_type(Int) + # > True + Str = TypeAliasType("Str", str) + is_type_alias_type(Str) + # > True + ``` + """ + return isinstance(tp, _TYPE_ALIAS_TYPES) + + # Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]] def strip_annotated_type(typ: type) -> type: if is_required_type(typ) or is_annotated_type(typ): diff --git a/src/lithic/_version.py b/src/lithic/_version.py index dae57adb..6f19e9cf 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.81.1" # x-release-please-version +__version__ = "0.82.0" # x-release-please-version diff --git a/src/lithic/resources/account_holders.py b/src/lithic/resources/account_holders.py index fc225ac8..75a4f3b2 100644 --- a/src/lithic/resources/account_holders.py +++ b/src/lithic/resources/account_holders.py @@ -13,7 +13,6 @@ account_holder_list_params, account_holder_create_params, account_holder_update_params, - account_holder_resubmit_params, account_holder_upload_document_params, account_holder_simulate_enrollment_review_params, account_holder_simulate_enrollment_document_review_params, @@ -46,7 +45,7 @@ class AccountHolders(SyncAPIResource): @cached_property def with_raw_response(self) -> AccountHoldersWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -84,12 +83,13 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AccountHolderCreateResponse: """ - Run an individual or business's information through the Customer Identification - Program (CIP). All calls to this endpoint will return an immediate response - - though in some cases, the response may indicate the enrollment is under review - or further action will be needed to complete the account enrollment process. - This endpoint can only be used on accounts that are part of the program that the - calling API key manages. + Create an account holder and initiate the appropriate onboarding workflow. + Account holders and accounts have a 1:1 relationship. When an account holder is + successfully created an associated account is also created. All calls to this + endpoint will return an immediate response - though in some cases, the response + may indicate the enrollment is under review or further action will be needed to + complete the account enrollment process. This endpoint can only be used on + accounts that are part of the program that the calling API key manages. Args: beneficial_owner_entities: List of all entities with >25% ownership in the company. If no entity or @@ -155,7 +155,7 @@ def create( *, individual: account_holder_create_params.KYCIndividual, tos_timestamp: str, - workflow: Literal["KYC_ADVANCED", "KYC_BASIC", "KYC_BYO"], + workflow: Literal["KYC_BASIC", "KYC_BYO"], external_id: str | NotGiven = NOT_GIVEN, kyc_passed_timestamp: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -166,12 +166,13 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AccountHolderCreateResponse: """ - Run an individual or business's information through the Customer Identification - Program (CIP). All calls to this endpoint will return an immediate response - - though in some cases, the response may indicate the enrollment is under review - or further action will be needed to complete the account enrollment process. - This endpoint can only be used on accounts that are part of the program that the - calling API key manages. + Create an account holder and initiate the appropriate onboarding workflow. + Account holders and accounts have a 1:1 relationship. When an account holder is + successfully created an associated account is also created. All calls to this + endpoint will return an immediate response - though in some cases, the response + may indicate the enrollment is under review or further action will be needed to + complete the account enrollment process. This endpoint can only be used on + accounts that are part of the program that the calling API key manages. Args: individual: Information on individual for whom the account is being opened and KYC is being @@ -222,12 +223,13 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AccountHolderCreateResponse: """ - Run an individual or business's information through the Customer Identification - Program (CIP). All calls to this endpoint will return an immediate response - - though in some cases, the response may indicate the enrollment is under review - or further action will be needed to complete the account enrollment process. - This endpoint can only be used on accounts that are part of the program that the - calling API key manages. + Create an account holder and initiate the appropriate onboarding workflow. + Account holders and accounts have a 1:1 relationship. When an account holder is + successfully created an associated account is also created. All calls to this + endpoint will return an immediate response - though in some cases, the response + may indicate the enrollment is under review or further action will be needed to + complete the account enrollment process. This endpoint can only be used on + accounts that are part of the program that the calling API key manages. Args: address: KYC Exempt user's current address - PO boxes, UPS drops, and FedEx drops are not @@ -241,7 +243,7 @@ def create( last_name: The KYC Exempt user's last name - phone_number: The KYC Exempt user's phone number + phone_number: The KYC Exempt user's phone number, entered in E.164 format. workflow: Specifies the workflow type. This must be 'KYC_EXEMPT' @@ -286,9 +288,7 @@ def create( control_person: account_holder_create_params.KYBControlPerson | NotGiven = NOT_GIVEN, nature_of_business: str | NotGiven = NOT_GIVEN, tos_timestamp: str | NotGiven = NOT_GIVEN, - workflow: Literal["KYB_BASIC", "KYB_BYO"] - | Literal["KYC_ADVANCED", "KYC_BASIC", "KYC_BYO"] - | Literal["KYC_EXEMPT"], + workflow: Literal["KYB_BASIC", "KYB_BYO"] | Literal["KYC_BASIC", "KYC_BYO"] | Literal["KYC_EXEMPT"], external_id: str | NotGiven = NOT_GIVEN, kyb_passed_timestamp: str | NotGiven = NOT_GIVEN, website_url: str | NotGiven = NOT_GIVEN, @@ -577,67 +577,6 @@ def list_documents( cast_to=AccountHolderListDocumentsResponse, ) - def resubmit( - self, - account_holder_token: str, - *, - individual: account_holder_resubmit_params.Individual, - tos_timestamp: str, - workflow: Literal["KYC_ADVANCED"], - # 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, - ) -> AccountHolder: - """Resubmit a KYC submission. - - This endpoint should be used in cases where a KYC - submission returned a `PENDING_RESUBMIT` result, meaning one or more critical - KYC fields may have been mis-entered and the individual's identity has not yet - been successfully verified. This step must be completed in order to proceed with - the KYC evaluation. - - Two resubmission attempts are permitted via this endpoint before a `REJECTED` - status is returned and the account creation process is ended. - - Args: - individual: Information on individual for whom the account is being opened and KYC is being - re-run. - - tos_timestamp: An RFC 3339 timestamp indicating when the account holder accepted the applicable - legal agreements (e.g., cardholder terms) as agreed upon during API customer's - implementation with Lithic. - - 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 - """ - if not account_holder_token: - raise ValueError( - f"Expected a non-empty value for `account_holder_token` but received {account_holder_token!r}" - ) - return self._post( - f"/v1/account_holders/{account_holder_token}/resubmit", - body=maybe_transform( - { - "individual": individual, - "tos_timestamp": tos_timestamp, - "workflow": workflow, - }, - account_holder_resubmit_params.AccountHolderResubmitParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AccountHolder, - ) - def retrieve_document( self, document_token: str, @@ -791,8 +730,7 @@ def simulate_enrollment_review( """Simulates an enrollment review for an account holder. This endpoint is only - applicable for workflows that may required intervention such as `KYB_BASIC` or - `KYC_ADVANCED`. + applicable for workflows that may required intervention such as `KYB_BASIC`. Args: account_holder_token: The account holder which to perform the simulation upon. @@ -849,6 +787,7 @@ def upload_document( "UTILITY_BILL_STATEMENT", "SSN_CARD", "ITIN_LETTER", + "FINCEN_BOI_REPORT", ], entity_token: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -915,7 +854,7 @@ class AsyncAccountHolders(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAccountHoldersWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -953,12 +892,13 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AccountHolderCreateResponse: """ - Run an individual or business's information through the Customer Identification - Program (CIP). All calls to this endpoint will return an immediate response - - though in some cases, the response may indicate the enrollment is under review - or further action will be needed to complete the account enrollment process. - This endpoint can only be used on accounts that are part of the program that the - calling API key manages. + Create an account holder and initiate the appropriate onboarding workflow. + Account holders and accounts have a 1:1 relationship. When an account holder is + successfully created an associated account is also created. All calls to this + endpoint will return an immediate response - though in some cases, the response + may indicate the enrollment is under review or further action will be needed to + complete the account enrollment process. This endpoint can only be used on + accounts that are part of the program that the calling API key manages. Args: beneficial_owner_entities: List of all entities with >25% ownership in the company. If no entity or @@ -1024,7 +964,7 @@ async def create( *, individual: account_holder_create_params.KYCIndividual, tos_timestamp: str, - workflow: Literal["KYC_ADVANCED", "KYC_BASIC", "KYC_BYO"], + workflow: Literal["KYC_BASIC", "KYC_BYO"], external_id: str | NotGiven = NOT_GIVEN, kyc_passed_timestamp: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1035,12 +975,13 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AccountHolderCreateResponse: """ - Run an individual or business's information through the Customer Identification - Program (CIP). All calls to this endpoint will return an immediate response - - though in some cases, the response may indicate the enrollment is under review - or further action will be needed to complete the account enrollment process. - This endpoint can only be used on accounts that are part of the program that the - calling API key manages. + Create an account holder and initiate the appropriate onboarding workflow. + Account holders and accounts have a 1:1 relationship. When an account holder is + successfully created an associated account is also created. All calls to this + endpoint will return an immediate response - though in some cases, the response + may indicate the enrollment is under review or further action will be needed to + complete the account enrollment process. This endpoint can only be used on + accounts that are part of the program that the calling API key manages. Args: individual: Information on individual for whom the account is being opened and KYC is being @@ -1091,12 +1032,13 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AccountHolderCreateResponse: """ - Run an individual or business's information through the Customer Identification - Program (CIP). All calls to this endpoint will return an immediate response - - though in some cases, the response may indicate the enrollment is under review - or further action will be needed to complete the account enrollment process. - This endpoint can only be used on accounts that are part of the program that the - calling API key manages. + Create an account holder and initiate the appropriate onboarding workflow. + Account holders and accounts have a 1:1 relationship. When an account holder is + successfully created an associated account is also created. All calls to this + endpoint will return an immediate response - though in some cases, the response + may indicate the enrollment is under review or further action will be needed to + complete the account enrollment process. This endpoint can only be used on + accounts that are part of the program that the calling API key manages. Args: address: KYC Exempt user's current address - PO boxes, UPS drops, and FedEx drops are not @@ -1110,7 +1052,7 @@ async def create( last_name: The KYC Exempt user's last name - phone_number: The KYC Exempt user's phone number + phone_number: The KYC Exempt user's phone number, entered in E.164 format. workflow: Specifies the workflow type. This must be 'KYC_EXEMPT' @@ -1155,9 +1097,7 @@ async def create( control_person: account_holder_create_params.KYBControlPerson | NotGiven = NOT_GIVEN, nature_of_business: str | NotGiven = NOT_GIVEN, tos_timestamp: str | NotGiven = NOT_GIVEN, - workflow: Literal["KYB_BASIC", "KYB_BYO"] - | Literal["KYC_ADVANCED", "KYC_BASIC", "KYC_BYO"] - | Literal["KYC_EXEMPT"], + workflow: Literal["KYB_BASIC", "KYB_BYO"] | Literal["KYC_BASIC", "KYC_BYO"] | Literal["KYC_EXEMPT"], external_id: str | NotGiven = NOT_GIVEN, kyb_passed_timestamp: str | NotGiven = NOT_GIVEN, website_url: str | NotGiven = NOT_GIVEN, @@ -1446,67 +1386,6 @@ async def list_documents( cast_to=AccountHolderListDocumentsResponse, ) - async def resubmit( - self, - account_holder_token: str, - *, - individual: account_holder_resubmit_params.Individual, - tos_timestamp: str, - workflow: Literal["KYC_ADVANCED"], - # 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, - ) -> AccountHolder: - """Resubmit a KYC submission. - - This endpoint should be used in cases where a KYC - submission returned a `PENDING_RESUBMIT` result, meaning one or more critical - KYC fields may have been mis-entered and the individual's identity has not yet - been successfully verified. This step must be completed in order to proceed with - the KYC evaluation. - - Two resubmission attempts are permitted via this endpoint before a `REJECTED` - status is returned and the account creation process is ended. - - Args: - individual: Information on individual for whom the account is being opened and KYC is being - re-run. - - tos_timestamp: An RFC 3339 timestamp indicating when the account holder accepted the applicable - legal agreements (e.g., cardholder terms) as agreed upon during API customer's - implementation with Lithic. - - 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 - """ - if not account_holder_token: - raise ValueError( - f"Expected a non-empty value for `account_holder_token` but received {account_holder_token!r}" - ) - return await self._post( - f"/v1/account_holders/{account_holder_token}/resubmit", - body=await async_maybe_transform( - { - "individual": individual, - "tos_timestamp": tos_timestamp, - "workflow": workflow, - }, - account_holder_resubmit_params.AccountHolderResubmitParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AccountHolder, - ) - async def retrieve_document( self, document_token: str, @@ -1660,8 +1539,7 @@ async def simulate_enrollment_review( """Simulates an enrollment review for an account holder. This endpoint is only - applicable for workflows that may required intervention such as `KYB_BASIC` or - `KYC_ADVANCED`. + applicable for workflows that may required intervention such as `KYB_BASIC`. Args: account_holder_token: The account holder which to perform the simulation upon. @@ -1718,6 +1596,7 @@ async def upload_document( "UTILITY_BILL_STATEMENT", "SSN_CARD", "ITIN_LETTER", + "FINCEN_BOI_REPORT", ], entity_token: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1799,9 +1678,6 @@ def __init__(self, account_holders: AccountHolders) -> None: self.list_documents = _legacy_response.to_raw_response_wrapper( account_holders.list_documents, ) - self.resubmit = _legacy_response.to_raw_response_wrapper( - account_holders.resubmit, - ) self.retrieve_document = _legacy_response.to_raw_response_wrapper( account_holders.retrieve_document, ) @@ -1835,9 +1711,6 @@ def __init__(self, account_holders: AsyncAccountHolders) -> None: self.list_documents = _legacy_response.async_to_raw_response_wrapper( account_holders.list_documents, ) - self.resubmit = _legacy_response.async_to_raw_response_wrapper( - account_holders.resubmit, - ) self.retrieve_document = _legacy_response.async_to_raw_response_wrapper( account_holders.retrieve_document, ) @@ -1871,9 +1744,6 @@ def __init__(self, account_holders: AccountHolders) -> None: self.list_documents = to_streamed_response_wrapper( account_holders.list_documents, ) - self.resubmit = to_streamed_response_wrapper( - account_holders.resubmit, - ) self.retrieve_document = to_streamed_response_wrapper( account_holders.retrieve_document, ) @@ -1907,9 +1777,6 @@ def __init__(self, account_holders: AsyncAccountHolders) -> None: self.list_documents = async_to_streamed_response_wrapper( account_holders.list_documents, ) - self.resubmit = async_to_streamed_response_wrapper( - account_holders.resubmit, - ) self.retrieve_document = async_to_streamed_response_wrapper( account_holders.retrieve_document, ) diff --git a/src/lithic/resources/accounts.py b/src/lithic/resources/accounts.py index 94e6d3d6..076386f7 100644 --- a/src/lithic/resources/accounts.py +++ b/src/lithic/resources/accounts.py @@ -30,7 +30,7 @@ class Accounts(SyncAPIResource): @cached_property def with_raw_response(self) -> AccountsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -102,19 +102,19 @@ def update( in the `PAUSED` state will not be able to transact or create new cards. Args: - daily_spend_limit: Amount (in cents) for the account's daily spend limit. By default the daily - spend limit is set to $1,250. + daily_spend_limit: Amount (in cents) for the account's daily spend limit (e.g. 100000 would be a + $1,000 limit). By default the daily spend limit is set to $1,250. - lifetime_spend_limit: Amount (in cents) for the account's lifetime spend limit. Once this limit is - reached, no transactions will be accepted on any card created for this account - until the limit is updated. Note that a spend limit of 0 is effectively no - limit, and should only be used to reset or remove a prior limit. Only a limit of - 1 or above will result in declined transactions due to checks against the - account limit. This behavior differs from the daily spend limit and the monthly - spend limit. + lifetime_spend_limit: Amount (in cents) for the account's lifetime spend limit (e.g. 100000 would be a + $1,000 limit). Once this limit is reached, no transactions will be accepted on + any card created for this account until the limit is updated. Note that a spend + limit of 0 is effectively no limit, and should only be used to reset or remove a + prior limit. Only a limit of 1 or above will result in declined transactions due + to checks against the account limit. This behavior differs from the daily spend + limit and the monthly spend limit. - monthly_spend_limit: Amount (in cents) for the account's monthly spend limit. By default the monthly - spend limit is set to $5,000. + monthly_spend_limit: Amount (in cents) for the account's monthly spend limit (e.g. 100000 would be a + $1,000 limit). By default the monthly spend limit is set to $5,000. state: Account states. @@ -257,7 +257,7 @@ class AsyncAccounts(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAccountsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -329,19 +329,19 @@ async def update( in the `PAUSED` state will not be able to transact or create new cards. Args: - daily_spend_limit: Amount (in cents) for the account's daily spend limit. By default the daily - spend limit is set to $1,250. - - lifetime_spend_limit: Amount (in cents) for the account's lifetime spend limit. Once this limit is - reached, no transactions will be accepted on any card created for this account - until the limit is updated. Note that a spend limit of 0 is effectively no - limit, and should only be used to reset or remove a prior limit. Only a limit of - 1 or above will result in declined transactions due to checks against the - account limit. This behavior differs from the daily spend limit and the monthly - spend limit. - - monthly_spend_limit: Amount (in cents) for the account's monthly spend limit. By default the monthly - spend limit is set to $5,000. + daily_spend_limit: Amount (in cents) for the account's daily spend limit (e.g. 100000 would be a + $1,000 limit). By default the daily spend limit is set to $1,250. + + lifetime_spend_limit: Amount (in cents) for the account's lifetime spend limit (e.g. 100000 would be a + $1,000 limit). Once this limit is reached, no transactions will be accepted on + any card created for this account until the limit is updated. Note that a spend + limit of 0 is effectively no limit, and should only be used to reset or remove a + prior limit. Only a limit of 1 or above will result in declined transactions due + to checks against the account limit. This behavior differs from the daily spend + limit and the monthly spend limit. + + monthly_spend_limit: Amount (in cents) for the account's monthly spend limit (e.g. 100000 would be a + $1,000 limit). By default the monthly spend limit is set to $5,000. state: Account states. diff --git a/src/lithic/resources/aggregate_balances.py b/src/lithic/resources/aggregate_balances.py index a79f9e8a..8dce819b 100644 --- a/src/lithic/resources/aggregate_balances.py +++ b/src/lithic/resources/aggregate_balances.py @@ -24,7 +24,7 @@ class AggregateBalances(SyncAPIResource): @cached_property def with_raw_response(self) -> AggregateBalancesWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -87,7 +87,7 @@ class AsyncAggregateBalances(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAggregateBalancesWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers diff --git a/src/lithic/resources/auth_rules/auth_rules.py b/src/lithic/resources/auth_rules/auth_rules.py index 6ce45ef9..e7293a53 100644 --- a/src/lithic/resources/auth_rules/auth_rules.py +++ b/src/lithic/resources/auth_rules/auth_rules.py @@ -2,7 +2,7 @@ from __future__ import annotations -from .v2 import ( +from .v2.v2 import ( V2, AsyncV2, V2WithRawResponse, @@ -10,7 +10,6 @@ V2WithStreamingResponse, AsyncV2WithStreamingResponse, ) -from .v2.v2 import V2, AsyncV2 from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -25,7 +24,7 @@ def v2(self) -> V2: @cached_property def with_raw_response(self) -> AuthRulesWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -50,7 +49,7 @@ def v2(self) -> AsyncV2: @cached_property def with_raw_response(self) -> AsyncAuthRulesWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers diff --git a/src/lithic/resources/auth_rules/v2/backtests.py b/src/lithic/resources/auth_rules/v2/backtests.py index 86584912..8dd61a5f 100644 --- a/src/lithic/resources/auth_rules/v2/backtests.py +++ b/src/lithic/resources/auth_rules/v2/backtests.py @@ -28,7 +28,7 @@ class Backtests(SyncAPIResource): @cached_property def with_raw_response(self) -> BacktestsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -174,7 +174,7 @@ class AsyncBacktests(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncBacktestsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers diff --git a/src/lithic/resources/auth_rules/v2/v2.py b/src/lithic/resources/auth_rules/v2/v2.py index f0c1fd5e..c91af684 100644 --- a/src/lithic/resources/auth_rules/v2/v2.py +++ b/src/lithic/resources/auth_rules/v2/v2.py @@ -48,7 +48,7 @@ def backtests(self) -> Backtests: @cached_property def with_raw_response(self) -> V2WithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -69,6 +69,7 @@ def create( self, *, account_tokens: List[str], + name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN, type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -84,6 +85,8 @@ def create( Args: account_tokens: Account tokens to which the Auth Rule applies. + name: Auth Rule Name + parameters: Parameters for the current version of the Auth Rule type: The type of Auth Rule @@ -103,6 +106,7 @@ def create( self, *, card_tokens: List[str], + name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | NotGiven = NOT_GIVEN, type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -118,6 +122,8 @@ def create( Args: card_tokens: Card tokens to which the Auth Rule applies. + name: Auth Rule Name + parameters: Parameters for the current version of the Auth Rule type: The type of Auth Rule @@ -137,6 +143,8 @@ def create( self, *, program_level: bool, + excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | NotGiven = NOT_GIVEN, type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -152,6 +160,10 @@ def create( Args: program_level: Whether the Auth Rule applies to all authorizations on the card program. + excluded_card_tokens: Card tokens to which the Auth Rule does not apply. + + name: Auth Rule Name + parameters: Parameters for the current version of the Auth Rule type: The type of Auth Rule @@ -171,10 +183,12 @@ def create( self, *, account_tokens: List[str] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN, type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN, card_tokens: List[str] | NotGiven = NOT_GIVEN, program_level: bool | NotGiven = NOT_GIVEN, + excluded_card_tokens: List[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, @@ -187,10 +201,12 @@ def create( body=maybe_transform( { "account_tokens": account_tokens, + "name": name, "parameters": parameters, "type": type, "card_tokens": card_tokens, "program_level": program_level, + "excluded_card_tokens": excluded_card_tokens, }, v2_create_params.V2CreateParams, ), @@ -237,6 +253,7 @@ 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. @@ -249,6 +266,8 @@ def update( Updates an authorization rule's properties Args: + 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 @@ -267,7 +286,13 @@ def update( raise ValueError(f"Expected a non-empty value for `auth_rule_token` but received {auth_rule_token!r}") return self._patch( f"/v2/auth_rules/{auth_rule_token}", - body=maybe_transform({"state": state}, v2_update_params.V2UpdateParams), + body=maybe_transform( + { + "name": name, + "state": state, + }, + v2_update_params.V2UpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -407,6 +432,7 @@ def apply( auth_rule_token: str, *, program_level: bool, + excluded_card_tokens: List[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, @@ -424,6 +450,8 @@ def apply( Args: program_level: Whether the Auth Rule applies to all authorizations on the card program. + excluded_card_tokens: Card tokens to which the Auth Rule does not apply. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -442,6 +470,7 @@ def apply( account_tokens: List[str] | NotGiven = NOT_GIVEN, card_tokens: List[str] | NotGiven = NOT_GIVEN, program_level: bool | NotGiven = NOT_GIVEN, + excluded_card_tokens: List[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, @@ -458,6 +487,7 @@ def apply( "account_tokens": account_tokens, "card_tokens": card_tokens, "program_level": program_level, + "excluded_card_tokens": excluded_card_tokens, }, v2_apply_params.V2ApplyParams, ), @@ -634,7 +664,7 @@ def backtests(self) -> AsyncBacktests: @cached_property def with_raw_response(self) -> AsyncV2WithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -655,6 +685,7 @@ async def create( self, *, account_tokens: List[str], + name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN, type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -670,6 +701,8 @@ async def create( Args: account_tokens: Account tokens to which the Auth Rule applies. + name: Auth Rule Name + parameters: Parameters for the current version of the Auth Rule type: The type of Auth Rule @@ -689,6 +722,7 @@ async def create( self, *, card_tokens: List[str], + name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | NotGiven = NOT_GIVEN, type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -704,6 +738,8 @@ async def create( Args: card_tokens: Card tokens to which the Auth Rule applies. + name: Auth Rule Name + parameters: Parameters for the current version of the Auth Rule type: The type of Auth Rule @@ -723,6 +759,8 @@ async def create( self, *, program_level: bool, + excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | NotGiven = NOT_GIVEN, type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -738,6 +776,10 @@ async def create( Args: program_level: Whether the Auth Rule applies to all authorizations on the card program. + excluded_card_tokens: Card tokens to which the Auth Rule does not apply. + + name: Auth Rule Name + parameters: Parameters for the current version of the Auth Rule type: The type of Auth Rule @@ -757,10 +799,12 @@ async def create( self, *, account_tokens: List[str] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN, type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN, card_tokens: List[str] | NotGiven = NOT_GIVEN, program_level: bool | NotGiven = NOT_GIVEN, + excluded_card_tokens: List[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, @@ -773,10 +817,12 @@ async def create( body=await async_maybe_transform( { "account_tokens": account_tokens, + "name": name, "parameters": parameters, "type": type, "card_tokens": card_tokens, "program_level": program_level, + "excluded_card_tokens": excluded_card_tokens, }, v2_create_params.V2CreateParams, ), @@ -823,6 +869,7 @@ 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. @@ -835,6 +882,8 @@ async def update( Updates an authorization rule's properties Args: + 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 @@ -853,7 +902,13 @@ async def update( raise ValueError(f"Expected a non-empty value for `auth_rule_token` but received {auth_rule_token!r}") return await self._patch( f"/v2/auth_rules/{auth_rule_token}", - body=await async_maybe_transform({"state": state}, v2_update_params.V2UpdateParams), + body=await async_maybe_transform( + { + "name": name, + "state": state, + }, + v2_update_params.V2UpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -993,6 +1048,7 @@ async def apply( auth_rule_token: str, *, program_level: bool, + excluded_card_tokens: List[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, @@ -1010,6 +1066,8 @@ async def apply( Args: program_level: Whether the Auth Rule applies to all authorizations on the card program. + excluded_card_tokens: Card tokens to which the Auth Rule does not apply. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1028,6 +1086,7 @@ async def apply( account_tokens: List[str] | NotGiven = NOT_GIVEN, card_tokens: List[str] | NotGiven = NOT_GIVEN, program_level: bool | NotGiven = NOT_GIVEN, + excluded_card_tokens: List[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, @@ -1044,6 +1103,7 @@ async def apply( "account_tokens": account_tokens, "card_tokens": card_tokens, "program_level": program_level, + "excluded_card_tokens": excluded_card_tokens, }, v2_apply_params.V2ApplyParams, ), diff --git a/src/lithic/resources/auth_stream_enrollment.py b/src/lithic/resources/auth_stream_enrollment.py index 369144e1..330f8640 100644 --- a/src/lithic/resources/auth_stream_enrollment.py +++ b/src/lithic/resources/auth_stream_enrollment.py @@ -19,7 +19,7 @@ class AuthStreamEnrollment(SyncAPIResource): @cached_property def with_raw_response(self) -> AuthStreamEnrollmentWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -92,7 +92,7 @@ class AsyncAuthStreamEnrollment(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAuthStreamEnrollmentWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers diff --git a/src/lithic/resources/balances.py b/src/lithic/resources/balances.py index 1c41326d..e9bbc5c0 100644 --- a/src/lithic/resources/balances.py +++ b/src/lithic/resources/balances.py @@ -26,7 +26,7 @@ class Balances(SyncAPIResource): @cached_property def with_raw_response(self) -> BalancesWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -103,7 +103,7 @@ class AsyncBalances(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncBalancesWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers diff --git a/src/lithic/resources/book_transfers.py b/src/lithic/resources/book_transfers.py index f247ddd4..6a47e684 100644 --- a/src/lithic/resources/book_transfers.py +++ b/src/lithic/resources/book_transfers.py @@ -29,7 +29,7 @@ class BookTransfers(SyncAPIResource): @cached_property def with_raw_response(self) -> BookTransfersWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -315,7 +315,7 @@ class AsyncBookTransfers(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncBookTransfersWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers diff --git a/src/lithic/resources/card_programs.py b/src/lithic/resources/card_programs.py index 7ce7db44..46a28ad7 100644 --- a/src/lithic/resources/card_programs.py +++ b/src/lithic/resources/card_programs.py @@ -22,7 +22,7 @@ class CardPrograms(SyncAPIResource): @cached_property def with_raw_response(self) -> CardProgramsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -129,7 +129,7 @@ class AsyncCardPrograms(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncCardProgramsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers diff --git a/src/lithic/resources/cards/aggregate_balances.py b/src/lithic/resources/cards/aggregate_balances.py index 1580e0d1..07db0ecc 100644 --- a/src/lithic/resources/cards/aggregate_balances.py +++ b/src/lithic/resources/cards/aggregate_balances.py @@ -22,7 +22,7 @@ class AggregateBalances(SyncAPIResource): @cached_property def with_raw_response(self) -> AggregateBalancesWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -90,7 +90,7 @@ class AsyncAggregateBalances(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAggregateBalancesWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers diff --git a/src/lithic/resources/cards/balances.py b/src/lithic/resources/cards/balances.py index 0b272ccb..35fa6ff7 100644 --- a/src/lithic/resources/cards/balances.py +++ b/src/lithic/resources/cards/balances.py @@ -25,7 +25,7 @@ class Balances(SyncAPIResource): @cached_property def with_raw_response(self) -> BalancesWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -98,7 +98,7 @@ class AsyncBalances(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncBalancesWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers diff --git a/src/lithic/resources/cards/cards.py b/src/lithic/resources/cards/cards.py index 1139d633..71aeef8c 100644 --- a/src/lithic/resources/cards/cards.py +++ b/src/lithic/resources/cards/cards.py @@ -25,6 +25,7 @@ card_provision_params, card_get_embed_url_params, card_search_by_pan_params, + card_convert_physical_params, ) from ..._types import ( NOT_GIVEN, @@ -94,7 +95,7 @@ def financial_transactions(self) -> FinancialTransactions: @cached_property def with_raw_response(self) -> CardsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers @@ -140,7 +141,7 @@ def create( ) -> Card: """Create a new virtual or physical card. - Parameters `pin`, `shipping_address`, and + Parameters `shipping_address` and `product_id` only apply to physical cards. Args: @@ -187,7 +188,7 @@ def create( memo: Friendly name to identify the card. - pin: Encrypted PIN block (in base64). Only applies to cards of type `PHYSICAL` and + pin: Encrypted PIN block (in base64). Applies to cards of type `PHYSICAL` and `VIRTUAL`. See [Encrypted PIN Block](https://docs.lithic.com/docs/cards#encrypted-pin-block). @@ -201,8 +202,9 @@ def create( If `replacement_for` is specified and this field is omitted, the replacement card's account will be inferred from the card being replaced. - replacement_for: Only applicable to cards of type `PHYSICAL`. Globally unique identifier for the - card that this physical card will replace. + replacement_for: Globally unique identifier for the card that this card will replace. If the card + type is `PHYSICAL` it will be replaced by a `PHYSICAL` card. If the card type is + `VIRTUAL` it will be replaced by a `VIRTUAL` card. shipping_method: Shipping method for the card. Only applies to cards of type PHYSICAL. Use of options besides `STANDARD` require additional permissions. @@ -217,11 +219,11 @@ def create( - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking - spend_limit: Amount (in cents) to limit approved authorizations. Transaction requests above - the spend limit will be declined. Note that a spend limit of 0 is effectively no - limit, and should only be used to reset or remove a prior limit. Only a limit of - 1 or above will result in declined transactions due to checks against the card - limit. + spend_limit: Amount (in cents) to limit approved authorizations (e.g. 100000 would be a + $1,000 limit). Transaction requests above the spend limit will be declined. Note + that a spend limit of 0 is effectively no limit, and should only be used to + reset or remove a prior limit. Only a limit of 1 or above will result in + declined transactions due to checks against the card limit. spend_limit_duration: Spend limit duration values: @@ -337,7 +339,7 @@ def update( """Update the specified properties of the card. Unsupplied properties will remain - unchanged. `pin` parameter only applies to physical cards. + unchanged. _Note: setting a card to a `CLOSED` state is a final action that cannot be undone._ @@ -357,11 +359,11 @@ def update( pin_status: Indicates if a card is blocked due a PIN status issue (e.g. excessive incorrect attempts). Can only be set to `OK` to unblock a card. - spend_limit: Amount (in cents) to limit approved authorizations. Transaction requests above - the spend limit will be declined. Note that a spend limit of 0 is effectively no - limit, and should only be used to reset or remove a prior limit. Only a limit of - 1 or above will result in declined transactions due to checks against the card - limit. + spend_limit: Amount (in cents) to limit approved authorizations (e.g. 100000 would be a + $1,000 limit). Transaction requests above the spend limit will be declined. Note + that a spend limit of 0 is effectively no limit, and should only be used to + reset or remove a prior limit. Only a limit of 1 or above will result in + declined transactions due to checks against the card limit. spend_limit_duration: Spend limit duration values: @@ -488,6 +490,84 @@ def list( model=Card, ) + def convert_physical( + self, + card_token: str, + *, + shipping_address: ShippingAddress, + carrier: Carrier | NotGiven = NOT_GIVEN, + product_id: str | NotGiven = NOT_GIVEN, + shipping_method: Literal["2-DAY", "EXPEDITED", "EXPRESS", "PRIORITY", "STANDARD", "STANDARD_WITH_TRACKING"] + | 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, + ) -> Card: + """Convert a virtual card into a physical card and manufacture it. + + Customer must + supply relevant fields for physical card creation including `product_id`, + `carrier`, `shipping_method`, and `shipping_address`. The card token will be + unchanged. The card's type will be altered to `PHYSICAL`. The card will be set + to state `PENDING_FULFILLMENT` and fulfilled at next fulfillment cycle. Virtual + cards created on card programs which do not support physical cards cannot be + converted. The card program cannot be changed as part of the conversion. Cards + must be in an `OPEN` state to be converted. Only applies to cards of type + `VIRTUAL` (or existing cards with deprecated types of `DIGITAL_WALLET` and + `UNLOCKED`). + + Args: + shipping_address: The shipping address this card will be sent to. + + carrier: If omitted, the previous carrier will be used. + + product_id: Specifies the configuration (e.g. physical card art) that the card should be + manufactured with, and only applies to cards of type `PHYSICAL`. This must be + configured with Lithic before use. + + shipping_method: Shipping method for the card. Use of options besides `STANDARD` require + additional permissions. + + - `STANDARD` - USPS regular mail or similar international option, with no + tracking + - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, + with tracking + - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking + - `EXPRESS` - FedEx Express, 3-day shipping, with tracking + - `2_DAY` - FedEx 2-day shipping, with tracking + - `EXPEDITED` - FedEx Standard Overnight or similar international option, with + tracking + + 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 + """ + if not card_token: + raise ValueError(f"Expected a non-empty value for `card_token` but received {card_token!r}") + return self._post( + f"/v1/cards/{card_token}/convert_physical", + body=maybe_transform( + { + "shipping_address": shipping_address, + "carrier": carrier, + "product_id": product_id, + "shipping_method": shipping_method, + }, + card_convert_physical_params.CardConvertPhysicalParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Card, + ) + def embed( self, *, @@ -510,9 +590,10 @@ def embed( that we provide, optionally styled in the customer's branding using a specified css stylesheet. A user's browser makes the request directly to api.lithic.com, so card PANs and CVVs never touch the API customer's servers while full card - data is displayed to their end-users. The response contains an HTML document. - This means that the url for the request can be inserted straight into the `src` - attribute of an iframe. + data is displayed to their end-users. The response contains an HTML document + (see Embedded Card UI or Changelog for upcoming changes in January). This means + that the url for the request can be inserted straight into the `src` attribute + of an iframe. ```html